From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: "Limonciello, Mario" <mario.limonciello@amd.com>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Daniel Vetter" <daniel@ffwll.ch>,
linux-kernel@vger.kernel.org,
"Chris Bainbridge" <chris.bainbridge@gmail.com>,
hughsient@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH v2] drm/client: Detect when ACPI lid is closed during initialization
Date: Thu, 30 May 2024 13:44:07 -0700 [thread overview]
Message-ID: <ZljlF1fE5ypKWoGk@google.com> (raw)
In-Reply-To: <CAA8EJpqODpGX-RthQ8qu3oU80qXp8a-N1Chz-dcQXjKYoDfEgw@mail.gmail.com>
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
next prev parent reply other threads:[~2024-05-31 13:36 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-28 21:03 [PATCH v2] drm/client: Detect when ACPI lid is closed during initialization Mario Limonciello
2024-05-29 13:33 ` Alex Deucher
2024-05-29 13:51 ` Jani Nikula
2024-05-29 13:55 ` Alex Deucher
2024-05-29 14:34 ` Mario Limonciello
2024-05-29 14:14 ` Ville Syrjälä
2024-05-29 14:45 ` Mario Limonciello
2024-05-29 15:39 ` Ville Syrjälä
2024-05-29 16:26 ` Mario Limonciello
2024-05-29 17:55 ` Dmitry Baryshkov
2024-05-30 4:41 ` Limonciello, Mario
2024-05-30 8:07 ` Dmitry Baryshkov
2024-05-30 20:44 ` Dmitry Torokhov [this message]
2024-05-29 14:22 ` ✓ Fi.CI.BAT: success for drm/client: Detect when ACPI lid is closed during initialization (rev2) Patchwork
2024-05-29 14:32 ` ✓ CI.Patch_applied: success for drm/client: Detect when ACPI lid is closed during initialization Patchwork
2024-05-29 14:33 ` ✓ CI.checkpatch: " Patchwork
2024-05-29 14:34 ` ✓ CI.KUnit: " Patchwork
2024-05-29 14:46 ` ✓ CI.Build: " Patchwork
2024-05-29 14:46 ` ✗ CI.Hooks: failure " Patchwork
2024-05-29 14:47 ` ✗ CI.checksparse: warning " Patchwork
2024-05-29 15:11 ` ✓ CI.BAT: success " Patchwork
2024-05-29 16:04 ` ✓ CI.FULL: " Patchwork
2024-05-30 14:13 ` ✗ Fi.CI.IGT: failure for drm/client: Detect when ACPI lid is closed during initialization (rev2) Patchwork
2024-06-04 2:02 ` [PATCH v2] drm/client: Detect when ACPI lid is closed during initialization kernel test robot
2024-06-05 15:08 ` Chris Bainbridge
2024-06-06 7:21 ` Jani Nikula
2024-06-06 12:31 ` Ville Syrjälä
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZljlF1fE5ypKWoGk@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=airlied@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=chris.bainbridge@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=hughsient@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mario.limonciello@amd.com \
--cc=mripard@kernel.org \
--cc=tzimmermann@suse.de \
--cc=ville.syrjala@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.