Skip to content

Commit

Permalink
add overheat delay
Browse files Browse the repository at this point in the history
  • Loading branch information
antheas committed Jan 6, 2025
1 parent b708051 commit 93f0e03
Show file tree
Hide file tree
Showing 2 changed files with 153 additions and 51 deletions.
202 changes: 152 additions & 50 deletions handheld.patch
Original file line number Diff line number Diff line change
Expand Up @@ -31836,27 +31836,29 @@ Same as G1619-04, Strix Point lineup uses 05.

Signed-off-by: Antheas Kapenekakis <[email protected]>
---
drivers/gpio/gpiolib-acpi.c | 7 +++++++
1 file changed, 7 insertions(+)
drivers/gpio/gpiolib-acpi.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index 78ecd56123a3..cd45f89cd5b2 100644
index 78ecd56123a3..be3bd1bb29cd 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -1690,6 +1690,13 @@ static const struct dmi_system_id gpiolib_acpi_quirks[] __initconst = {
.driver_data = &(struct acpi_gpiolib_dmi_quirk) {
@@ -1691,6 +1691,15 @@ static const struct dmi_system_id gpiolib_acpi_quirks[] __initconst = {
.ignore_wake = "PNP0C50:00@8",
},
},
+ {
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "GPD"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "G1619-05"),
+ },
+ .driver_data = &(struct acpi_gpiolib_dmi_quirk) {
+ .ignore_wake = "PNP0C50:00@8",
+ },
},
+ },
{} /* Terminating entry */
};

--
2.47.1

Expand Down Expand Up @@ -35145,6 +35147,150 @@ index 6e07e1a7b08f..eb42bdd2c348 100644
2.47.1


From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Antheas Kapenekakis <[email protected]>
Date: Mon, 6 Jan 2025 02:00:56 +0100
Subject: acpi/x86: s2idle: add delays for OneXPlayer/GPD overheating

Signed-off-by: Antheas Kapenekakis <[email protected]>
---
drivers/acpi/x86/s2idle.c | 105 ++++++++++++++++++++++++++++++++++++++
1 file changed, 105 insertions(+)

diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
index eb42bdd2c348..f62bf2f42832 100644
--- a/drivers/acpi/x86/s2idle.c
+++ b/drivers/acpi/x86/s2idle.c
@@ -23,6 +23,7 @@

#include "../sleep.h"

+#define CONFIG_SUSPEND
#ifdef CONFIG_SUSPEND

static bool sleep_no_lps0 __read_mostly;
@@ -114,6 +115,41 @@ static const struct s2idle_delay_quirks rog_ally_quirks = {
.delay_sleep_entry = 150,
};

+/*
+ * Certain OneXPlayer and GPD devices past the AMD 8000 series use an
+ * overheating trick to get Windows to hibernate. This works by setting
+ * the primary thermal zone of the device (acpitz) to 105C, which is its
+ * _HOT temperature, under which windows should hibernate. If the device
+ * is suspended, the EC will wake it up, which registers under ACPI as
+ * pressing the power button.
+ *
+ * A variant of BIOSes in these devices is "smarter" where the EC triggers
+ * the wakeup for hibernation by pressing the power button but then ACPI
+ * guards the overheat warning with being in Modern Standby. If we exit
+ * Modern Standby too quickly, when the EC queries the overheat function
+ * the guard will be gone, so we lose the overheat warning and thereby
+ * the cause of the wakeup. If this happens in the user's bag, this leads
+ * to "hot bag" syndrome.
+ *
+ * Therefore, add a delay to sleep_exit, ensuring that the hibernation
+ * warning in those BIOSes is registered. Userspace can then use this
+ * warning to emergency hibernate or shutdown the device. Once this
+ * warning happens, the EC of the device is tainted and will cause
+ * repeated wake-ups and maintain the overheat temperature. As we can no
+ * longer distinguish between the user of the device trying to wake it up
+ * and the EC, the only solution is to power down the device (S4S5).
+ */
+static const struct s2idle_delay_quirks overheat_quirks = {
+ .delay_sleep_exit = 500,
+};
+
+static const struct s2idle_delay_quirks msi_claw_quirks = {
+ .delay_display_off = 500,
+ .delay_sleep_entry = 500,
+ .delay_sleep_exit = 200,
+ .delay_display_on = 200,
+};
+
static const struct dmi_system_id s2idle_delay_quirks[] = {
{
.matches = {
@@ -127,6 +163,75 @@ static const struct dmi_system_id s2idle_delay_quirks[] = {
},
.driver_data = (void *)&rog_ally_quirks
},
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_NAME, "MS-1T41"), // MSI CLAW
+ },
+ .driver_data = (void *)&msi_claw_quirks
+ },
+ { /* OneXPlayer X1 AMD */
+ .matches = {
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ONE-NETBOOK"),
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ONEXPLAYER X1 A"),
+ },
+ .driver_data = (void *)&overheat_quirks,
+ },
+ { /* OneXPlayer X1 Intel */
+ .matches = {
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ONE-NETBOOK"),
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ONEXPLAYER X1 i"),
+ },
+ .driver_data = (void *)&overheat_quirks,
+ },
+ { /* OneXPlayer X1 mini (AMD) */
+ .matches = {
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ONE-NETBOOK"),
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ONEXPLAYER X1 mini"),
+ },
+ .driver_data = (void *)&overheat_quirks,
+ },
+ { /* OneXPlayer OneXFly F1 Pro (OLED) */
+ .matches = {
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ONE-NETBOOK"),
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ONEXPLAYER F1Pro"),
+ },
+ .driver_data = (void *)&overheat_quirks,
+ },
+ { /* OneXPlayer OneXFly F1 Pro (OLED) LE Red variant */
+ .matches = {
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ONE-NETBOOK"),
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ONEXPLAYER F1 EVA-02"),
+ },
+ .driver_data = (void *)&overheat_quirks,
+ },
+ { /* GPD Win 4 */
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "GPD"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "G1618-04"),
+ },
+ .driver_data = (void *)&overheat_quirks,
+ },
+ { /* GPD Win Mini */
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "GPD"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "G1617-01"),
+ },
+ .driver_data = (void *)&overheat_quirks,
+ },
+ { /* GPD Win Max 7000-8000 */
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "GPD"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "G1619-04"),
+ },
+ .driver_data = (void *)&overheat_quirks,
+ },
+ { /* GPD Win Max Strix Point */
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "GPD"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "G1619-05"),
+ },
+ .driver_data = (void *)&overheat_quirks,
+ },
{}
};

--
2.47.1


From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Antheas Kapenekakis <[email protected]>
Date: Thu, 19 Sep 2024 00:29:59 +0200
Expand Down Expand Up @@ -35537,50 +35683,6 @@ index 1a1924d71006..411775fae4ac 100644
2.47.1


From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Antheas Kapenekakis <[email protected]>
Date: Fri, 15 Nov 2024 20:52:34 +0100
Subject: [TEMPORARY] Add s2idle delays for MSI Claw

---
drivers/acpi/x86/s2idle.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
index eb42bdd2c348..4bace84d2044 100644
--- a/drivers/acpi/x86/s2idle.c
+++ b/drivers/acpi/x86/s2idle.c
@@ -114,6 +114,13 @@ static const struct s2idle_delay_quirks rog_ally_quirks = {
.delay_sleep_entry = 150,
};

+static const struct s2idle_delay_quirks msi_claw_quirks = {
+ .delay_display_off = 500,
+ .delay_sleep_entry = 500,
+ .delay_sleep_exit = 200,
+ .delay_display_on = 200,
+};
+
static const struct dmi_system_id s2idle_delay_quirks[] = {
{
.matches = {
@@ -127,6 +134,12 @@ static const struct dmi_system_id s2idle_delay_quirks[] = {
},
.driver_data = (void *)&rog_ally_quirks
},
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_NAME, "MS-1T41"), // MSI CLAW
+ },
+ .driver_data = (void *)&msi_claw_quirks
+ },
{}
};

--
2.47.1


From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Antheas Kapenekakis <[email protected]>
Date: Sat, 2 Nov 2024 17:45:04 +0100
Expand Down
2 changes: 1 addition & 1 deletion kernel.spec
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ Summary: The Linux kernel
# This is needed to do merge window version magic
%define patchlevel 12
# This allows pkg_release to have configurable %%{?dist} tag
%define specrelease 204%{?buildid}%{?dist}
%define specrelease 205%{?buildid}%{?dist}
# This defines the kabi tarball version
%define kabiversion 6.12.8

Expand Down

0 comments on commit 93f0e03

Please sign in to comment.