aboutsummaryrefslogtreecommitdiff
path: root/SOURCES/0001-NOT-FOR-UPSTREAM-PM-suspend-Disable-s2idle-on-Steam-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'SOURCES/0001-NOT-FOR-UPSTREAM-PM-suspend-Disable-s2idle-on-Steam-.patch')
-rw-r--r--SOURCES/0001-NOT-FOR-UPSTREAM-PM-suspend-Disable-s2idle-on-Steam-.patch81
1 files changed, 81 insertions, 0 deletions
diff --git a/SOURCES/0001-NOT-FOR-UPSTREAM-PM-suspend-Disable-s2idle-on-Steam-.patch b/SOURCES/0001-NOT-FOR-UPSTREAM-PM-suspend-Disable-s2idle-on-Steam-.patch
new file mode 100644
index 0000000..349a6a6
--- /dev/null
+++ b/SOURCES/0001-NOT-FOR-UPSTREAM-PM-suspend-Disable-s2idle-on-Steam-.patch
@@ -0,0 +1,81 @@
+From d6935e6d62b35ec14d2187c2cfdc19934d66db6d Mon Sep 17 00:00:00 2001
+From: "Guilherme G. Piccoli" <gpiccoli@igalia.com>
+Date: Thu, 2 Nov 2023 16:28:35 -0300
+Subject: [PATCH] (NOT-FOR-UPSTREAM) PM: suspend: Disable s2idle on Steam Deck
+
+Jupiter platform doesn't support s2idle - system appears to
+sleep and never wakeup again. So, disable it based on DMI
+checking for platforms named "Valve Jupiter".
+
+Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
+(cherry picked from commit 3956de585667cfd9f91a3ee8af34f6c0d44f4381)
+Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
+Signed-off-by: Jan200101 <sentrycraft123@gmail.com>
+---
+ kernel/power/suspend.c | 22 ++++++++++++++++++++++
+ 1 file changed, 22 insertions(+)
+
+diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
+index fa3bf161d13f..e614b865a099 100644
+--- a/kernel/power/suspend.c
++++ b/kernel/power/suspend.c
+@@ -30,6 +30,7 @@
+ #include <trace/events/power.h>
+ #include <linux/compiler.h>
+ #include <linux/moduleparam.h>
++#include <linux/dmi.h>
+
+ #include "power.h"
+
+@@ -60,6 +61,7 @@ static DECLARE_SWAIT_QUEUE_HEAD(s2idle_wait_head);
+
+ enum s2idle_states __read_mostly s2idle_state;
+ static DEFINE_RAW_SPINLOCK(s2idle_lock);
++static bool s2idle_unsupported;
+
+ /**
+ * pm_suspend_default_s2idle - Check if suspend-to-idle is the default suspend.
+@@ -174,6 +176,8 @@ static bool valid_state(suspend_state_t state)
+
+ void __init pm_states_init(void)
+ {
++ const char *sys_vendor, *product_name;
++
+ /* "mem" and "freeze" are always present in /sys/power/state. */
+ pm_states[PM_SUSPEND_MEM] = pm_labels[PM_SUSPEND_MEM];
+ pm_states[PM_SUSPEND_TO_IDLE] = pm_labels[PM_SUSPEND_TO_IDLE];
+@@ -182,6 +186,20 @@ void __init pm_states_init(void)
+ * initialize mem_sleep_states[] accordingly here.
+ */
+ mem_sleep_states[PM_SUSPEND_TO_IDLE] = mem_sleep_labels[PM_SUSPEND_TO_IDLE];
++
++ /*
++ * Identify here if we're running on Steam Deck - if so, we shouldn't
++ * support s2idle mem_sleep mode, since this mode doesn't work on Deck.
++ */
++
++ sys_vendor = dmi_get_system_info(DMI_SYS_VENDOR);
++ product_name = dmi_get_system_info(DMI_PRODUCT_NAME);
++
++ if (sys_vendor && (!strncmp("Valve", sys_vendor, 5)) &&
++ product_name && (!strncmp("Jupiter", product_name, 7))) {
++ s2idle_unsupported = true;
++ pr_info("Steam Deck quirk - no s2idle allowed!\n");
++ }
+ }
+
+ static int __init mem_sleep_default_setup(char *str)
+@@ -562,6 +580,10 @@ static int enter_state(suspend_state_t state)
+ return -EAGAIN;
+ }
+ #endif
++ if (s2idle_unsupported) {
++ pr_info("s2idle sleep is not supported\n");
++ return -EINVAL;
++ }
+ } else if (!valid_state(state)) {
+ return -EINVAL;
+ }
+--
+2.43.0
+