gsl-firmware icon indicating copy to clipboard operation
gsl-firmware copied to clipboard

Any workflow suggestion about porting firmware to mainline linux driver?

Open Split7fire opened this issue 7 years ago • 15 comments

I want to port Chuwi HiBook firmware to work with mainline kernel. I found this https://github.com/torvalds/linux/pull/428/commits/4ca4d58dbccd66baa575f504c67261fdf2900371 It is pretty self-explanatory, but I can't find any info about naming scheme of files. Is it just manufacturer-model or something more (in linux folder there are multiple schemes presented).

P.S. maybe there are some scripts which will auto convert all firmwares to new format?

Split7fire avatar Dec 09 '17 04:12 Split7fire

silead.ko uses firmware in "vanilla" format, so https://github.com/onitake/gsl-firmware/blob/master/firmware/chuwi/hibook/firmware.fw should work. If you need to convert Windows driver firmware instead, please use https://github.com/onitake/gsl-firmware/blob/master/tools/unscramble .

onitake avatar Dec 11 '17 08:12 onitake

ok, I managed to rename fw to gsl3680-chuwi-hibook.fw and place it in /lib/firmware/silead (and in /lib/firmware/ too). I managed to recompile kernel with

static const struct property_entry chuwi_hibook_props[] = {
	PROPERTY_ENTRY_U32("touchscreen-size-x", 1860),
	PROPERTY_ENTRY_U32("touchscreen-size-y", 1280),
	PROPERTY_ENTRY_STRING("firmware-name", "gsl3680-chuwi-hibook.fw"),
	PROPERTY_ENTRY_U32("silead,max-fingers", 10),
	PROPERTY_ENTRY_BOOL("silead,home-button"),
	{ }
};

static const struct silead_ts_dmi_data chuwi_hibook_data = {
	.acpi_name	= "MSSL1680:00",
	.properties	= chuwi_hibook_props,
};

{
 		/* CHUWI HiBook */
 		.driver_data = (void *)&chuwi_hibook_data,
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "svnDefaultstring"),
 			DMI_MATCH(DMI_PRODUCT_NAME, "pnDefaultstring"),
 		},
 	},

but that dont work. Even manually modprobe silead leads to nothing in dmesg. What I've done wrong?

Split7fire avatar Dec 22 '17 16:12 Split7fire

Have you tried unloading the module (modprobe -r silead) before re-insmoding it? You should also make sure that no other silead modules are loaded (i.e. gslx680-acpi, ...).

onitake avatar Dec 22 '17 17:12 onitake

Yep, I tried that with no success. Also it is standard Fedora kernel with patch I made (in silead file). Also this is my dmi info

dmi:bvnAmericanMegatrendsInc.:bvr5.11:bd05/07/2016:svnDefaultstring:pnDefaultstring:pvrDefaultstring:rvnHampoo:rnCherryTrailCR:rvrDefaultstring:cvnDefaultstring:ct3:cvrDefaultstring:

Split7fire avatar Dec 23 '17 03:12 Split7fire

Hmm... If you unload and reload the module, you should at least see that it's matching the device. If the DMI info is wrong, it will still try to initialise the device with default parameters.

I suspect something is hogging the device and silead.ko can't match it. Can you try blacklisting all related modules, reboot, then try to load the module manually?

onitake avatar Dec 23 '17 09:12 onitake

I can say that silead dont auto load on boot, so it is strange. What related modules can I blacklist?

Split7fire avatar Dec 23 '17 09:12 Split7fire

Well, there's gslx680-acpi, and possibly other competing drivers. I think there's a way to check which driver has claimed a device, but I don't remember how exactly. Possibly through sysfs? You should find the MSSL1680 entry there somewhere, with a symlink to the claiming driver AFAIK.

onitake avatar Dec 23 '17 10:12 onitake

Ok, I managed to build gslx680 acpi module and loaded it. So, it works as expected and shows in dmesg.

gsl_ts_probe: got a device named MSSL0017:00 at address 0x40, IRQ 176, flags 0x0

Maybe the patch I made was defective?

Split7fire avatar Dec 25 '17 15:12 Split7fire

Ok - this is very interesting! It looks like your machine has a touch screen device id that is different from others. Can you replace .acpi_name = "MSSL1680:00", with .acpi_name = "MSSL0017:00", and see if it works?

onitake avatar Dec 25 '17 23:12 onitake

Nope, it didn't work either. And again no log in dmesg.

Split7fire avatar Dec 27 '17 05:12 Split7fire

Then I'm at my wit's end... If you don't get any message at all, that means no driver has matched your hardware. If you can't get silead.ko to at least recognise (and try to initialise) the controller, then you either have different hardware or something is wrong with the ACPI match or your DSDT.

Sorry, it looks like you are on your own...

onitake avatar Jan 27 '18 15:01 onitake

silead_dmi.c isn't part of the silead.ko module. It has to be compiled into the kernel. You can't just recompile the silead module for your changes to show up, you have to recompile the whole kernel.

maximumsomething avatar May 06 '18 18:05 maximumsomething

Good point... Never thought of that. But it totally makes sense:

config SILEAD_DMI
        bool "Tablets with Silead touchscreens"
        depends on ACPI && DMI && I2C=y && TOUCHSCREEN_SILEAD

@Split7fire , have you tried rebuilding your kernel and rebooting the machine after you have made the changes to silead_dmi.c?

onitake avatar May 07 '18 10:05 onitake

@onitake quite a long time passed since that tests. As I remember I do recompile and reboot every time. But for now I can't test it.

Split7fire avatar May 07 '18 15:05 Split7fire

I just updated the readme with better instructions for adding support to silead_ts. Any corrections/improvements are welcome.

onitake avatar May 14 '18 19:05 onitake

No further feedback, closing the issue.

onitake avatar Sep 27 '22 06:09 onitake