* Re: [PATCH v2] drm/client: Detect when ACPI lid is closed during initialization [not found] ` <873b7a7b-139d-498e-89da-098cb3d7599d@amd.com> @ 2024-05-30 8:07 ` Dmitry Baryshkov 2024-05-30 20:44 ` Dmitry Torokhov 0 siblings, 1 reply; 2+ messages in thread From: Dmitry Baryshkov @ 2024-05-30 8:07 UTC (permalink / raw) To: Limonciello, Mario, Dmitry Torokhov Cc: Ville Syrjälä, dri-devel, amd-gfx, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter, linux-kernel, Chris Bainbridge, hughsient, linux-input On Thu, 30 May 2024 at 07:41, Limonciello, Mario <mario.limonciello@amd.com> wrote: > > > >> Also a direct acpi_lid_open() call seems a bit iffy. But I guess if > >> someone needs this to work on non-ACPI system they get to figure out > >> how to abstract it better. acpi_lid_open() does seem to return != 0 > >> when ACPI is not supported, so at least it would err on the side > >> of enabling everything. > > > > Thanks. I was going to comment, but you got it first. I think a proper > > implementation should check for SW_LID input device instead of simply > > using acpi_lid_open(). This will handle the issue for other, > > non-ACPI-based laptops. > > > > Can you suggest how this would actually work? AFAICT the only way to > discover if input devices support SW_LID would be to iterate all the > input devices in the kernel and look for whether ->swbit has SW_LID set. > > This then turns into a dependency problem of whether any myriad of > drivers have started to report SW_LID. It's also a state machine > problem because other drivers can be unloaded at will. > > And then what do you if more than one sets SW_LID? It might be easier to handle this in the input subsystem. For example by using a refcount-like variable which handles all the LIDs and counts if all of them are closed. Or if any of the LIDs is closed. > > IOW - a lot of complexity for a non-ACPI system. Does such a problem > exist in non-ACPI systems? There are non-ACPI laptops. For example Chromebooks. Or Lenovo X13s, Lenovo Yoga C630, Lenovo Flex5G, etc. We are expecting more to come in the next few months. And I don't see why they won't have the same problem. -- With best wishes Dmitry ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] drm/client: Detect when ACPI lid is closed during initialization 2024-05-30 8:07 ` [PATCH v2] drm/client: Detect when ACPI lid is closed during initialization Dmitry Baryshkov @ 2024-05-30 20:44 ` Dmitry Torokhov 0 siblings, 0 replies; 2+ messages in thread From: Dmitry Torokhov @ 2024-05-30 20:44 UTC (permalink / raw) To: Dmitry Baryshkov Cc: Limonciello, Mario, Ville Syrjälä, dri-devel, amd-gfx, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie, Daniel Vetter, linux-kernel, Chris Bainbridge, hughsient, linux-input On Thu, May 30, 2024 at 11:07:53AM +0300, Dmitry Baryshkov wrote: > On Thu, 30 May 2024 at 07:41, Limonciello, Mario > <mario.limonciello@amd.com> wrote: > > > > > > >> Also a direct acpi_lid_open() call seems a bit iffy. But I guess if > > >> someone needs this to work on non-ACPI system they get to figure out > > >> how to abstract it better. acpi_lid_open() does seem to return != 0 > > >> when ACPI is not supported, so at least it would err on the side > > >> of enabling everything. > > > > > > Thanks. I was going to comment, but you got it first. I think a proper > > > implementation should check for SW_LID input device instead of simply > > > using acpi_lid_open(). This will handle the issue for other, > > > non-ACPI-based laptops. > > > > > > > Can you suggest how this would actually work? AFAICT the only way to > > discover if input devices support SW_LID would be to iterate all the > > input devices in the kernel and look for whether ->swbit has SW_LID set. > > > > This then turns into a dependency problem of whether any myriad of > > drivers have started to report SW_LID. It's also a state machine > > problem because other drivers can be unloaded at will. > > > > And then what do you if more than one sets SW_LID? > > It might be easier to handle this in the input subsystem. For example > by using a refcount-like variable which handles all the LIDs and > counts if all of them are closed. Or if any of the LIDs is closed. Yes, install an input handler matching on EV_SW/SW_LID so you will get notified when input devices capable of reporting SW_LID appear and disappear and also when SW_LID event is being generated, and handle as you wish. Something like https://chromium.googlesource.com/chromiumos/third_party/kernel/+/40e9f6a991856ee7d504ac1ccd587e435775cfc4%5E%21/#F0 In practice I think it is pretty safe to assume only 1 lid for a laptop/device. Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-05-30 20:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20240528210319.1242-1-mario.limonciello@amd.com>
[not found] ` <Zlc4V1goFvU2antl@intel.com>
[not found] ` <197d195f-9206-41dd-8ff1-f4bb4988fb9b@amd.com>
[not found] ` <ZldMKZ1MzSDXOheJ@intel.com>
[not found] ` <g34f3sdk22grheq2vaaonkl543dtk7nb5sffqgmkl5ywtj5skk@p5ht5ug33q4z>
[not found] ` <873b7a7b-139d-498e-89da-098cb3d7599d@amd.com>
2024-05-30 8:07 ` [PATCH v2] drm/client: Detect when ACPI lid is closed during initialization Dmitry Baryshkov
2024-05-30 20:44 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox