aboutsummaryrefslogtreecommitdiff
path: root/SOURCES/0001-add-ally-x-dmi-quirk-for-controller-suspend.patch
blob: e0f47aa96027a96d5398ef173ecbd2917712d933 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
From 650af3af1d5ebd5e5b759c503147f2fbc88ac3b7 Mon Sep 17 00:00:00 2001
From: antheas <git@antheas.dev>
Date: Sat, 20 Jul 2024 19:43:36 +0300
Subject: [PATCH v2 1/3] allyx: add quirk for suspending controllers

---
 drivers/platform/x86/asus-wmi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 3f9b6285c..8e362726b 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -4645,8 +4645,10 @@ static int asus_wmi_add(struct platform_device *pdev)
 	asus->egpu_enable_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_EGPU);
 	asus->dgpu_disable_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_DGPU);
 	asus->kbd_rgb_state_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_STATE);
-	asus->ally_mcu_usb_switch = acpi_has_method(NULL, ASUS_USB0_PWR_EC0_CSEE)
-						&& dmi_match(DMI_BOARD_NAME, "RC71L");
+	asus->ally_mcu_usb_switch =
+		acpi_has_method(NULL, ASUS_USB0_PWR_EC0_CSEE) &&
+		(dmi_match(DMI_BOARD_NAME, "RC71L") ||
+		 dmi_match(DMI_BOARD_NAME, "RC72LA"));
 
 	if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_MINI_LED_MODE))
 		asus->mini_led_dev_id = ASUS_WMI_DEVID_MINI_LED_MODE;
-- 
2.45.2


From 013f01137eab6cb7ebbc6e7345185bd44456cbf6 Mon Sep 17 00:00:00 2001
From: antheas <git@antheas.dev>
Date: Sat, 20 Jul 2024 19:57:34 +0300
Subject: [PATCH v2 2/3] allyx: tweak suspend and resume suspends

---
 drivers/platform/x86/asus-wmi.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 8e362726b..b51b0153e 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -139,8 +139,11 @@ module_param(fnlock_default, bool, 0444);
 
 /* Controls the power state of the USB0 hub on ROG Ally which input is on */
 #define ASUS_USB0_PWR_EC0_CSEE "\\_SB.PCI0.SBRG.EC0.CSEE"
-/* 300ms so far seems to produce a reliable result on AC and battery */
-#define ASUS_USB0_PWR_EC0_CSEE_WAIT 1500
+/* Use different delays for the ally depending on context. */
+#define ASUS_USB0_PWR_EC0_CSEE_PREPARE 1200
+#define ASUS_USB0_PWR_EC0_CSEE_RESUME_BEFORE 1000
+#define ASUS_USB0_PWR_EC0_CSEE_RESUME_AFTER 1500
+
 
 static const char * const ashs_ids[] = { "ATK4001", "ATK4002", NULL };
 
@@ -4847,10 +4850,11 @@ static int asus_hotk_resume_early(struct device *device)
 
 	if (asus->ally_mcu_usb_switch) {
 		/* sleep required to prevent USB0 being yanked then reappearing rapidly */
+		msleep(ASUS_USB0_PWR_EC0_CSEE_RESUME_BEFORE);
 		if (ACPI_FAILURE(acpi_execute_simple_method(NULL, ASUS_USB0_PWR_EC0_CSEE, 0xB8)))
 			dev_err(device, "ROG Ally MCU failed to connect USB dev\n");
 		else
-			msleep(ASUS_USB0_PWR_EC0_CSEE_WAIT);
+			msleep(ASUS_USB0_PWR_EC0_CSEE_RESUME_AFTER);
 	}
 	return 0;
 }
@@ -4864,7 +4868,7 @@ static int asus_hotk_prepare(struct device *device)
 		if (ACPI_FAILURE(acpi_execute_simple_method(NULL, ASUS_USB0_PWR_EC0_CSEE, 0xB7)))
 			dev_err(device, "ROG Ally MCU failed to disconnect USB dev\n");
 		else
-			msleep(ASUS_USB0_PWR_EC0_CSEE_WAIT);
+			msleep(ASUS_USB0_PWR_EC0_CSEE_PREPARE);
 	}
 	return 0;
 }
-- 
2.45.2


From f508c14d1ca1c8161088da37752b1e4c816cd6a9 Mon Sep 17 00:00:00 2001
From: antheas <git@antheas.dev>
Date: Sat, 20 Jul 2024 20:07:37 +0300
Subject: [PATCH v2 3/3] add logging to allyx suspend quirk

---
 drivers/platform/x86/asus-wmi.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index b51b0153e..3122d2c27 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -4853,8 +4853,11 @@ static int asus_hotk_resume_early(struct device *device)
 		msleep(ASUS_USB0_PWR_EC0_CSEE_RESUME_BEFORE);
 		if (ACPI_FAILURE(acpi_execute_simple_method(NULL, ASUS_USB0_PWR_EC0_CSEE, 0xB8)))
 			dev_err(device, "ROG Ally MCU failed to connect USB dev\n");
-		else
+		else {
+			dev_info(device,
+				 "ROG Ally MCU resume command sent after suspend\n");
 			msleep(ASUS_USB0_PWR_EC0_CSEE_RESUME_AFTER);
+		}
 	}
 	return 0;
 }
@@ -4867,8 +4870,11 @@ static int asus_hotk_prepare(struct device *device)
 		/* sleep required to ensure USB0 is disabled before sleep continues */
 		if (ACPI_FAILURE(acpi_execute_simple_method(NULL, ASUS_USB0_PWR_EC0_CSEE, 0xB7)))
 			dev_err(device, "ROG Ally MCU failed to disconnect USB dev\n");
-		else
+		else {
+			dev_info(device,
+				 "ROG Ally MCU disconnect command sent before suspend.\n");
 			msleep(ASUS_USB0_PWR_EC0_CSEE_PREPARE);
+		}
 	}
 	return 0;
 }
-- 
2.45.2