public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Antheas Kapenekakis <lkml@antheas.dev>
To: dmitry.osipenko@collabora.com
Cc: bob.beckett@collabora.com, bookeldor@gmail.com,
	hadess@hadess.net, jaap@haitsma.org, kernel@collabora.com,
	lennart@poettering.net, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org, lkml@antheas.dev, mccann@jhu.edu,
	rafael@kernel.org, richard@hughsie.com,
	sebastian.reichel@collabora.com, superm1@kernel.org,
	systemd-devel@lists.freedesktop.org, xaver.hugl@gmail.com
Subject: [RFC v2 04/10] platform/x86: asus-wmi: add s2idle begin delay for Ally devices
Date: Sat, 25 Apr 2026 23:57:28 +0200	[thread overview]
Message-ID: <20260425215734.14116-5-lkml@antheas.dev> (raw)
In-Reply-To: <20260425215734.14116-1-lkml@antheas.dev>

Asus ROG Ally devices have a small fade animation during their suspend
sequence. This animation is triggered by the Display Off firmware
notification. After it, they power off, disconnect, and save their
state. Without a delay after that notification, if the device is placed
into D3, it causes it to reboot during resume, or particularly for
original Allies, also leave the xpad device connected, causing spurious
wakeups when a gamepad button is pressed and higher standby drain.

Therefore, introduce a small delay quirk and bind it to an s2idle dev
ops device. Place this quirk in the asus-wmi driver, as the USB gamepad
disconnects, making it hard to place in hid-asus, and to allow for
proper functionality when the hid-asus driver is blacklisted.

Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
---
 drivers/platform/x86/asus-nb-wmi.c | 40 ++++++++++++++++++++++++++++++
 drivers/platform/x86/asus-wmi.c    | 12 +++++++++
 drivers/platform/x86/asus-wmi.h    | 14 +++++++++++
 3 files changed, 66 insertions(+)

diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
index b4677c5bba5b..da963f3a17b1 100644
--- a/drivers/platform/x86/asus-nb-wmi.c
+++ b/drivers/platform/x86/asus-nb-wmi.c
@@ -155,6 +155,10 @@ static struct quirk_entry quirk_asus_z13 = {
 	.tablet_switch_mode = asus_wmi_kbd_dock_devid,
 };
 
+static struct quirk_entry quirk_ally = {
+	.lps0_begin_delay = 500,
+};
+
 static int dmi_matched(const struct dmi_system_id *dmi)
 {
 	pr_info("Identified laptop model '%s'\n", dmi->ident);
@@ -553,6 +557,42 @@ static const struct dmi_system_id asus_quirks[] = {
 		},
 		.driver_data = &quirk_asus_z13,
 	},
+	{
+		.callback = dmi_matched,
+		.ident = "ASUS ROG Ally",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_BOARD_NAME, "RC71L"),
+		},
+		.driver_data = (void *)&quirk_ally,
+	},
+	{
+		.callback = dmi_matched,
+		.ident = "ASUS ROG Ally X",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_BOARD_NAME, "RC72L"),
+		},
+		.driver_data = (void *)&quirk_ally,
+	},
+	{
+		.callback = dmi_matched,
+		.ident = "ASUS ROG Xbox Ally",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_BOARD_NAME, "RC73Y"),
+		},
+		.driver_data = (void *)&quirk_ally,
+	},
+	{
+		.callback = dmi_matched,
+		.ident = "ASUS ROG Xbox Ally X",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_BOARD_NAME, "RC73X"),
+		},
+		.driver_data = (void *)&quirk_ally,
+	},
 	{},
 };
 
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 7c0915e097ba..3316415abbdf 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -337,6 +337,8 @@ struct asus_wmi {
 	struct asus_wmi_debug debug;
 
 	struct asus_wmi_driver *driver;
+
+	struct acpi_s2idle_dev_ops s2idle_dev_ops;
 };
 
 /* Global to allow setting externally without requiring driver data */
@@ -5030,6 +5032,12 @@ static int asus_wmi_add(struct platform_device *pdev)
 	if (err)
 		goto fail_platform;
 
+	if (asus->driver->quirks->lps0_begin_delay) {
+		asus->s2idle_dev_ops.begin_delay =
+			asus->driver->quirks->lps0_begin_delay;
+		acpi_register_lps0_dev(&asus->s2idle_dev_ops);
+	}
+
 	if (use_ally_mcu_hack == ASUS_WMI_ALLY_MCU_HACK_INIT) {
 		if (acpi_has_method(NULL, ASUS_USB0_PWR_EC0_CSEE)
 					&& dmi_check_system(asus_rog_ally_device))
@@ -5184,6 +5192,8 @@ static int asus_wmi_add(struct platform_device *pdev)
 fail_custom_fan_curve:
 fail_platform_profile_setup:
 fail_fan_boost_mode:
+	if (asus->driver->quirks->lps0_begin_delay)
+		acpi_unregister_lps0_dev(&asus->s2idle_dev_ops);
 fail_platform:
 	kfree(asus);
 	return err;
@@ -5207,6 +5217,8 @@ static void asus_wmi_remove(struct platform_device *device)
 	asus_fan_set_auto(asus);
 	throttle_thermal_policy_set_default(asus);
 	asus_wmi_battery_exit(asus);
+	if (asus->driver->quirks->lps0_begin_delay)
+		acpi_unregister_lps0_dev(&asus->s2idle_dev_ops);
 
 	kfree(asus);
 }
diff --git a/drivers/platform/x86/asus-wmi.h b/drivers/platform/x86/asus-wmi.h
index 5cd4392b964e..2a8c51d39bf8 100644
--- a/drivers/platform/x86/asus-wmi.h
+++ b/drivers/platform/x86/asus-wmi.h
@@ -52,6 +52,20 @@ struct quirk_entry {
 	 */
 	int no_display_toggle;
 	u32 xusb2pr;
+	/*
+	 * Ally devices uninitialize after the display off DSM of modern
+	 * stanby, after a predetermined fade animation on their RGB.
+	 * If the USB subsystem puts the controller into D3 before that,
+	 * it loses its state and (i) for original allies, it leaves the
+	 * xpad device connected, causing spurious wake-ups and higher
+	 * power draw, (ii) for newer allies using the adaptive protocol
+	 * causes the controller to reboot on resume if mcu_powersave is
+	 * false. Therefore, allow adding a delay for the affected devices.
+	 * (if MCU powersave is true the controller always reboots, but
+	 * this also causes an unwelcome 5-7s delay on resume, this issue
+	 * is present on all firmwares)
+	 */
+	int lps0_begin_delay;
 };
 
 struct asus_wmi_driver {
-- 
2.53.0



  parent reply	other threads:[~2026-04-25 21:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-25 21:57 [RFC v2 00/10] acpi/x86: s2idle: Introduce and implement hint class ABI and idle hint for s2idle Antheas Kapenekakis
2026-04-25 21:57 ` [RFC v2 01/10] acpi/x86: s2idle: Rename LPS0 constants so they mirror their function Antheas Kapenekakis
2026-04-26 14:14   ` Rafael J. Wysocki
2026-04-26 16:54     ` Antheas Kapenekakis
2026-04-27 15:07       ` Rafael J. Wysocki
2026-04-25 21:57 ` [RFC v2 02/10] acpi/x86: s2idle: Move Modern Standby calls to s2idle begin/end Antheas Kapenekakis
2026-04-25 21:57 ` [RFC v2 03/10] acpi/x86: s2idle: Add support for adding a delay after begin MS calls Antheas Kapenekakis
2026-04-28  1:57   ` Mario Limonciello
2026-04-28  7:47     ` Antheas Kapenekakis
2026-04-25 21:57 ` Antheas Kapenekakis [this message]
2026-04-28  1:56   ` [RFC v2 04/10] platform/x86: asus-wmi: add s2idle begin delay for Ally devices Mario Limonciello
2026-04-28  6:34   ` [systemd-devel] " Paul Menzel
2026-04-28  8:18     ` Antheas Kapenekakis
2026-04-25 21:57 ` [RFC v2 05/10] HID: asus: remove quirk handling " Antheas Kapenekakis
2026-04-25 21:57 ` [RFC v2 06/10] platform/x86: asus-wmi: Remove Ally s2idle resume fixes Antheas Kapenekakis
2026-04-25 21:57 ` [RFC v2 07/10] Documentation: Add documentation for the new sysfs hints class Antheas Kapenekakis
2026-04-25 21:57 ` [RFC v2 08/10] hint: Add hint class ABI for devices to receive updates on host activity Antheas Kapenekakis
2026-04-25 21:57 ` [RFC v2 09/10] acpi/x86: s2idle: Listen to idle hints to perform MS transitions Antheas Kapenekakis
2026-04-25 21:57 ` [RFC v2 10/10] acpi/x86: s2idle: Subtract delay from last DSM fire in begin delay Antheas Kapenekakis

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=20260425215734.14116-5-lkml@antheas.dev \
    --to=lkml@antheas.dev \
    --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=mccann@jhu.edu \
    --cc=rafael@kernel.org \
    --cc=richard@hughsie.com \
    --cc=sebastian.reichel@collabora.com \
    --cc=superm1@kernel.org \
    --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