Am 15.10.22 um 00:12 schrieb Lorenz Brun:
Hi x86 platform list, I'm considering contributing support for the usage mode/tablet mode switch for some Lenovo laptops (including the popular IdeaPad Flex series). There is already an out-of-tree driver at https://github.com/lukas-w/yoga-usage-mode which works well, but I'd like to get this support upstream. I have a few questions regarding the best approach: 1. There is the ideapad-laptop module already which deals with a bunch of functionality related to these laptops, but not the mode switch. Do you prefer a separate driver or should the functionality be added to ideapad-laptop? 2. The existing out-of-tree driver uses a WMI interface to access mode information. Should I work on the WMI layer or should I figure out which EC registers to use to get the functionality independently? If yes, how do we want to identify support for this type of mode switch? Regards, Lorenz
Hi, 1) In my opinion, the ideapad-laptop driver uses a totally different interface than the out of tree driver, so it would make sense to create a separate driver. 2) You should stick to the WMI interface. The vendor could change the internal EC registers at any time, which would drastically limit the portability and reliability of the driver in question. Also, there exists a whole WMI subsystem inside the linux kernel, which for example supports automatic discovery of WMI devices, etc. Looking at the out-of-tree driver in question, it seems that it does not fully utilize the WMI subsystem. If you want to upstream it, i suggest a rewrite to fix this. Since the driver is quite small, it should be relatively easy. Optionally, you could also add support for LENOVO_GSENSOR_DATA, since it also has some interesting methods. However, the scope of the driver is completely up to you. There are already some WMI-based drivers inside the kernel, maybe they can serve as an inspiration? Armin Wolf