public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mario Limonciello <superm1@kernel.org>
To: Antheas Kapenekakis <lkml@antheas.dev>,
	Dmitry Osipenko <dmitry.osipenko@collabora.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Robert Beckett <bob.beckett@collabora.com>,
	linux-acpi@vger.kernel.org, kernel@collabora.com,
	linux-kernel@vger.kernel.org,
	Sebastian Reichel <sebastian.reichel@collabora.com>,
	Xaver Hugl <xaver.hugl@gmail.com>,
	Richard Hughes <richard@hughsie.com>,
	William Jon McCann <mccann@jhu.edu>,
	"Jaap A . Haitsma" <jaap@haitsma.org>,
	Benjamin Canou <bookeldor@gmail.com>,
	Bastien Nocera <hadess@hadess.net>,
	systemd-devel@lists.freedesktop.org,
	Lennart Poettering <lennart@poettering.net>
Subject: Re: [RFC PATCH v1 1/1] ACPI: PM: s2idle: Add lps0_screen_off sysfs interface
Date: Tue, 2 Dec 2025 08:23:12 -0600	[thread overview]
Message-ID: <c7760b2d-c8cb-40fa-b1b1-8715e97e5cf0@kernel.org> (raw)
In-Reply-To: <CAGwozwG=F1BC8UF6Xkest5pwZG6iRjNjk5zpjmSV8Yh-0S2tGA@mail.gmail.com>

On 12/2/25 3:32 AM, Antheas Kapenekakis wrote:
> On Tue, 2 Dec 2025 at 05:36, Dmitry Osipenko
> <dmitry.osipenko@collabora.com> wrote:
>>
>> Add `/sys/power/lps0_screen_off` interface to allow userspace to control
>> Display OFF/ON DSM notifications at runtime. Writing "1" to this file
>> triggers the OFF notification, and "0" triggers the ON notification.
>>
>> Userspace should write "1" after turning off all physical and remote
>> displays. It should write "0" before turning on any of displays.
>>
>> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
>> ---
>>   Documentation/ABI/testing/sysfs-power |  13 +++
>>   drivers/acpi/x86/s2idle.c             | 149 +++++++++++++++++++++++---
>>   2 files changed, 145 insertions(+), 17 deletions(-)
>>
>> diff --git a/Documentation/ABI/testing/sysfs-power b/Documentation/ABI/testing/sysfs-power
>> index d38da077905a..af7c81ae517c 100644
>> --- a/Documentation/ABI/testing/sysfs-power
>> +++ b/Documentation/ABI/testing/sysfs-power
>> @@ -470,3 +470,16 @@ Description:
>>
>>                   Minimum value: 1
>>                   Default value: 3
>> +
>> +What:          /sys/power/lps0_screen_off
> 
> Hi,
> thanks for having a second stab at this. My initial series for this
> was kind of complicated, I would need to rewrite it anyway [1].
> 
> I will second Mario on the integer values. The main.c file provides
> the capabilities used in other power sysfs values and an ABI for doing
> string options.
> 
> For me, I have a bit of a problem with the ABI. I kind of prefer the
> one in [1]. There are three sleep states in Modern Standby: Screen
> Off, Sleep, and LPS0/DRIPS (and a fake resume one I added). The only
> one the kernel is suspended in is LPS0.
> 
> So the ABI should ideally be able to cover all three, even if at first
> you only do screen off. This means the name kind of becomes a problem.
> lps0_screen_off implies lps0 (is not the state, is also an ACPI x86
> specific term) and is limited to screen_off (cannot add sleep).
> 
> I used /sys/power/standby in my series, which I think was fine because
> you'd be able to add hooks to it for general drivers in the future.
> This way, it would not be limited to ACPI devices and the name implies
> that.

Why would you want to expose all those states to userspace?  I feel like 
it is going to be risky to have userspace changing the state machine for 
suspend like that.

Since the _DSM call that is interesting here is focusing specifically on 
screen off I have a slightly different proposal on how this could work.

What about if instead of an explicit userspace calling interface it's an 
inhibition/voting interface:

While in screen on:
* By default no inhibitions are set.
* If no inhibitions are set and all physical displays go into DPMS then 
DRM can do an call (using an exported symbol) to enter screen off.
* If userspace is using a remote display it could set an inhibition.
* When the inhibition is cleared (IE userspace indicates that a remote 
display is no longer in use) then:
   * if all physical displays are already off call screen off.
   * if at least one physical display is on do nothing (turning off 
physical displays would call screen off)

While in screen off
* When a physical display is turned DRM would use exported symbol to 
call screen on.
  * When  an inhibitor is added call screen ON.

By doing it this way userspace still has control, but it's not 
*mandatory* for userspace to be changed.


  reply	other threads:[~2025-12-02 14:23 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-02  4:34 [RFC PATCH v1 0/1] ACPI: s2idle: Add /sys/power/lps0_screen_off Dmitry Osipenko
2025-12-02  4:34 ` [RFC PATCH v1 1/1] ACPI: PM: s2idle: Add lps0_screen_off sysfs interface Dmitry Osipenko
2025-12-02  4:43   ` Mario Limonciello (AMD) (kernel.org)
2025-12-02  5:26     ` Dmitry Osipenko
2025-12-02  9:32   ` Antheas Kapenekakis
2025-12-02 14:23     ` Mario Limonciello [this message]
2025-12-02 15:17       ` Antheas Kapenekakis
2025-12-02 21:25         ` Mario Limonciello (AMD) (kernel.org)
2025-12-02 22:35           ` Dmitry Osipenko
2025-12-03  2:12             ` Mario Limonciello (AMD) (kernel.org)
2025-12-03  6:46               ` Dmitry Osipenko
2025-12-03 10:12                 ` Antheas Kapenekakis
2025-12-03 14:34                   ` Mario Limonciello
2025-12-03 14:46                     ` Antheas Kapenekakis
2025-12-02 21:59     ` Dmitry Osipenko
2025-12-03 14:58   ` Rafael J. Wysocki
2025-12-04 15:03     ` Dmitry Osipenko
2025-12-04 16:41       ` Rafael J. Wysocki
2025-12-04 18:31         ` Antheas Kapenekakis
2025-12-05 16:32           ` Rafael J. Wysocki
2025-12-05 16:46             ` Mario Limonciello (AMD) (kernel.org)
2025-12-05 17:22               ` Rafael J. Wysocki
2025-12-05 18:07                 ` Mario Limonciello
2025-12-05 19:37                   ` Rafael J. Wysocki
2025-12-05 19:42                     ` Mario Limonciello
2025-12-05 20:06                       ` Rafael J. Wysocki
2025-12-05 21:52                         ` Antheas Kapenekakis
2025-12-06 14:34                           ` Rafael J. Wysocki
2025-12-06 20:50                             ` Mario Limonciello
2025-12-06 23:35                               ` Antheas Kapenekakis
2025-12-07  0:31                                 ` Mario Limonciello
2025-12-07 10:34                                   ` Antheas Kapenekakis
2025-12-05 22:51             ` Antheas Kapenekakis
2025-12-07 11:06               ` Rafael J. Wysocki
2025-12-07 11:19                 ` Rafael J. Wysocki
2025-12-07 11:50                   ` Antheas Kapenekakis
2025-12-09 22:13                     ` Dmitry Osipenko
2025-12-09 22:22                       ` Antheas Kapenekakis
2025-12-09 22:23                       ` Rafael J. Wysocki
2025-12-07 11:42                 ` Antheas Kapenekakis
2025-12-05 13:34 ` [RFC PATCH v1 0/1] ACPI: s2idle: Add /sys/power/lps0_screen_off Pavel Machek

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=c7760b2d-c8cb-40fa-b1b1-8715e97e5cf0@kernel.org \
    --to=superm1@kernel.org \
    --cc=bob.beckett@collabora.com \
    --cc=bookeldor@gmail.com \
    --cc=dmitry.osipenko@collabora.com \
    --cc=hadess@hadess.net \
    --cc=jaap@haitsma.org \
    --cc=kernel@collabora.com \
    --cc=lennart@poettering.net \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkml@antheas.dev \
    --cc=mccann@jhu.edu \
    --cc=rafael@kernel.org \
    --cc=richard@hughsie.com \
    --cc=sebastian.reichel@collabora.com \
    --cc=systemd-devel@lists.freedesktop.org \
    --cc=xaver.hugl@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox