* Upstreaming Lenovo tablet switch driver @ 2022-10-14 22:12 Lorenz Brun 2022-10-15 1:26 ` Armin Wolf 0 siblings, 1 reply; 3+ messages in thread From: Lorenz Brun @ 2022-10-14 22:12 UTC (permalink / raw) To: platform-driver-x86 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Upstreaming Lenovo tablet switch driver 2022-10-14 22:12 Upstreaming Lenovo tablet switch driver Lorenz Brun @ 2022-10-15 1:26 ` Armin Wolf 2022-10-15 22:25 ` Lorenz Brun 0 siblings, 1 reply; 3+ messages in thread From: Armin Wolf @ 2022-10-15 1:26 UTC (permalink / raw) To: Lorenz Brun, platform-driver-x86 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Upstreaming Lenovo tablet switch driver 2022-10-15 1:26 ` Armin Wolf @ 2022-10-15 22:25 ` Lorenz Brun 0 siblings, 0 replies; 3+ messages in thread From: Lorenz Brun @ 2022-10-15 22:25 UTC (permalink / raw) To: Armin Wolf, platform-driver-x86 Hi Armin, Thanks for your input. While looking at new WMI drivers which I could use as a reference, I stumbled upon https://patchwork.kernel.org/project/platform-driver-x86/patch/20221004214332.35934-1-soyer@irl.hu/ which was sent last week and implements a driver for the same WMI interface. So I guess there is not much left for me to implement here, I'll just follow that patch. Regards, Lorenz On Sat, Oct 15 2022 at 03:26:50 +02:00:00, Armin Wolf <W_Armin@gmx.de> wrote: > 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 > ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-10-15 22:26 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-10-14 22:12 Upstreaming Lenovo tablet switch driver Lorenz Brun 2022-10-15 1:26 ` Armin Wolf 2022-10-15 22:25 ` Lorenz Brun
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox