aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2024-09-21 12:18:50 +0200
committerJan200101 <sentrycraft123@gmail.com>2024-09-21 12:18:50 +0200
commit56ac8fd6620275dbe70ded1f43088e6875803e68 (patch)
treec15ef46e28cca88279ba8f99e5472769de4fc11a
parent35efb79b87d60910b98c94f9be81f4269b8cd7fd (diff)
downloadkernel-fsync-56ac8fd6620275dbe70ded1f43088e6875803e68.tar.gz
kernel-fsync-56ac8fd6620275dbe70ded1f43088e6875803e68.zip
kernel 6.9.12 oxp-sensors update, asus screw driver
-rw-r--r--SOURCES/0001-add-ally-x-dmi-quirk-for-controller-suspend.patch28
-rw-r--r--SOURCES/v0-oxp-sensors.patch799
-rw-r--r--SOURCES/v14.8-0004-HID-asus-add-ROG-Ally-xpad-settings.patch22
-rw-r--r--SOURCES/v2-ally-suspend-fix.patch534
-rw-r--r--SPECS/kernel.spec13
5 files changed, 927 insertions, 469 deletions
diff --git a/SOURCES/0001-add-ally-x-dmi-quirk-for-controller-suspend.patch b/SOURCES/0001-add-ally-x-dmi-quirk-for-controller-suspend.patch
deleted file mode 100644
index bffa8c5..0000000
--- a/SOURCES/0001-add-ally-x-dmi-quirk-for-controller-suspend.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 79d958eccfa4a1cfbb552032e9542f03333005e7 Mon Sep 17 00:00:00 2001
-From: antheas <antheas@users.noreply.github.com>
-Date: Mon, 15 Jul 2024 00:00:45 +0300
-Subject: [PATCH] add ally x dmi quirk for controller suspend
-
----
- 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 3f9b6285c9a6..8e362726b703 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
diff --git a/SOURCES/v0-oxp-sensors.patch b/SOURCES/v0-oxp-sensors.patch
index 4b42d51..f912873 100644
--- a/SOURCES/v0-oxp-sensors.patch
+++ b/SOURCES/v0-oxp-sensors.patch
@@ -1,54 +1,152 @@
-From b75680974fe91faa5fcc1bbe39156b1e2e134238 Mon Sep 17 00:00:00 2001
-From: "Derek J. Clark" <derekjohn.clark@gmail.com>
-Date: Wed, 27 Mar 2024 18:47:00 -0700
-Subject: [PATCH 1/4] oxp-sensors: hwmon: Add OrangePi Neo PWM fan control
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jan200101 <sentrycraft123@gmail.com>
+Date: Sat, 21 Sep 2024 09:44:41 +0200
+Subject: [PATCH] backport oxp-sensors
-Add OrangePi NEO handheld device. The OrangePi Neo uses different registers
-for PWM manual mode, set PWM, and read fan speed than previous devices. Valid
-PWM input and duty cycle is 1-244, we scale this to 1-155 to maintain
-compatibility with existing userspace tools.
+Signed-off-by: Jan200101 <sentrycraft123@gmail.com>
---
- drivers/hwmon/oxp-sensors.c | 112 ++++++++++++++++++++++++++++++++----
- 1 file changed, 100 insertions(+), 12 deletions(-)
+ drivers/hwmon/oxp-sensors.c | 301 ++++++++++++++++++++++++++++++------
+ 1 file changed, 257 insertions(+), 44 deletions(-)
diff --git a/drivers/hwmon/oxp-sensors.c b/drivers/hwmon/oxp-sensors.c
-index 8d3b0f86c..ebca28b4a 100644
+index 8d3b0f86cc57..83730d931824 100644
--- a/drivers/hwmon/oxp-sensors.c
+++ b/drivers/hwmon/oxp-sensors.c
-@@ -46,6 +46,7 @@ enum oxp_board {
+@@ -1,18 +1,21 @@
+ // SPDX-License-Identifier: GPL-2.0+
+ /*
+- * Platform driver for OneXPlayer, AOK ZOE, and Aya Neo Handhelds that expose
+- * fan reading and control via hwmon sysfs.
++ * Platform driver for OneXPlayer, AOKZOE, AYANEO, and OrangePi Handhelds
++ * that expose fan reading and control via hwmon sysfs.
+ *
+ * Old OXP boards have the same DMI strings and they are told apart by
+- * the boot cpu vendor (Intel/AMD). Currently only AMD boards are
+- * supported but the code is made to be simple to add other handheld
+- * boards in the future.
++ * the boot cpu vendor (Intel/AMD). Of these older models only AMD is
++ * supported.
++ *
+ * Fan control is provided via pwm interface in the range [0-255].
+ * Old AMD boards use [0-100] as range in the EC, the written value is
+ * scaled to accommodate for that. Newer boards like the mini PRO and
+- * AOK ZOE are not scaled but have the same EC layout.
++ * AOKZOE are not scaled but have the same EC layout. Newer models
++ * like the 2 and X1 are [0-184] and are scaled to 0-255. OrangePi
++ * are [1-244] and scaled to 0-255.
+ *
+ * Copyright (C) 2022 Joaquín I. Aramendía <samsagax@gmail.com>
++ * Copyright (C) 2024 Derek J. Clark <derekjohn.clark@gmail.com>
+ */
+
+ #include <linux/acpi.h>
+@@ -43,32 +46,48 @@ enum oxp_board {
+ aok_zoe_a1 = 1,
+ aya_neo_2,
+ aya_neo_air,
++ aya_neo_air_1s,
aya_neo_air_plus_mendo,
aya_neo_air_pro,
++ aya_neo_flip,
aya_neo_geek,
++ aya_neo_kun,
+ orange_pi_neo,
++ oxp_2,
++ oxp_fly,
oxp_mini_amd,
oxp_mini_amd_a07,
oxp_mini_amd_pro,
-@@ -54,10 +55,16 @@ enum oxp_board {
++ oxp_x1,
+ };
+
static enum oxp_board board;
/* Fan reading and PWM */
-#define OXP_SENSOR_FAN_REG 0x76 /* Fan reading is 2 registers long */
-#define OXP_SENSOR_PWM_ENABLE_REG 0x4A /* PWM enable is 1 register long */
-#define OXP_SENSOR_PWM_REG 0x4B /* PWM reading is 1 register long */
-+#define OXP_SENSOR_FAN_REG 0x76 /* Fan reading is 2 registers long */
-+#define OXP_SENSOR_PWM_ENABLE_REG 0x4A /* PWM enable is 1 register long */
-+#define OXP_SENSOR_PWM_REG 0x4B /* PWM reading is 1 register long */
-
-+#define ORANGEPI_SENSOR_FAN_REG 0x78 /* Fan reading is 2 registers long */
-+#define ORANGEPI_SENSOR_PWM_ENABLE_REG 0x40 /* PWM enable is 1 register long */
-+#define ORANGEPI_SENSOR_PWM_REG 0x38 /* PWM reading is 1 register long */
++#define OXP_SENSOR_FAN_REG 0x76 /* Fan reading is 2 registers long */
++#define OXP_2_SENSOR_FAN_REG 0x58 /* Fan reading is 2 registers long */
++#define OXP_SENSOR_PWM_ENABLE_REG 0x4A /* PWM enable is 1 register long */
++#define OXP_SENSOR_PWM_REG 0x4B /* PWM reading is 1 register long */
++#define PWM_MODE_AUTO 0x00
++#define PWM_MODE_MANUAL 0x01
+
-+#define PWM_MODE_AUTO 0x00
-+#define PWM_MODE_MANUAL 0x01
++/* OrangePi fan reading and PWM */
++#define ORANGEPI_SENSOR_FAN_REG 0x78 /* Fan reading is 2 registers long */
++#define ORANGEPI_SENSOR_PWM_ENABLE_REG 0x40 /* PWM enable is 1 register long */
++#define ORANGEPI_SENSOR_PWM_REG 0x38 /* PWM reading is 1 register long */
+
/* Turbo button takeover function
- * Older boards have different values and EC registers
+- * Older boards have different values and EC registers
++ * Different boards have different values and EC registers
* for the same function
-@@ -120,6 +127,13 @@ static const struct dmi_system_id dmi_table[] = {
+ */
+-#define OXP_OLD_TURBO_SWITCH_REG 0x1E
+-#define OXP_OLD_TURBO_TAKE_VAL 0x01
+-#define OXP_OLD_TURBO_RETURN_VAL 0x00
++#define OXP_TURBO_SWITCH_REG 0xF1 /* Mini Pro, OneXFly, AOKZOE */
++#define OXP_2_TURBO_SWITCH_REG 0xEB /* OXP2 and X1 */
++#define OXP_MINI_TURBO_SWITCH_REG 0x1E /* Mini AO7 */
++
++#define OXP_MINI_TURBO_TAKE_VAL 0x01 /* Mini AO7 */
++#define OXP_TURBO_TAKE_VAL 0x40 /* All other models */
+
+-#define OXP_TURBO_SWITCH_REG 0xF1
+-#define OXP_TURBO_TAKE_VAL 0x40
+-#define OXP_TURBO_RETURN_VAL 0x00
++#define OXP_TURBO_RETURN_VAL 0x00 /* Common return val */
+
+ static const struct dmi_system_id dmi_table[] = {
+ {
+@@ -88,7 +107,7 @@ static const struct dmi_system_id dmi_table[] = {
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
+- DMI_EXACT_MATCH(DMI_BOARD_NAME, "AYANEO 2"),
++ DMI_MATCH(DMI_BOARD_NAME, "AYANEO 2"),
+ },
+ .driver_data = (void *)aya_neo_2,
+ },
+@@ -99,6 +118,13 @@ static const struct dmi_system_id dmi_table[] = {
+ },
+ .driver_data = (void *)aya_neo_air,
+ },
++ {
++ .matches = {
++ DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
++ DMI_EXACT_MATCH(DMI_BOARD_NAME, "AIR 1S"),
++ },
++ .driver_data = (void *)aya_neo_air_1s,
++ },
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
+@@ -116,10 +142,31 @@ static const struct dmi_system_id dmi_table[] = {
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
+- DMI_EXACT_MATCH(DMI_BOARD_NAME, "GEEK"),
++ DMI_MATCH(DMI_BOARD_NAME, "FLIP"),
++ },
++ .driver_data = (void *)aya_neo_flip,
++ },
++ {
++ .matches = {
++ DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
++ DMI_MATCH(DMI_BOARD_NAME, "GEEK"),
},
.driver_data = (void *)aya_neo_geek,
},
+ {
+ .matches = {
++ DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
++ DMI_EXACT_MATCH(DMI_BOARD_NAME, "KUN"),
++ },
++ .driver_data = (void *)aya_neo_kun,
++ },
++ {
++ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "OrangePi"),
+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "NEO-01"),
+ },
@@ -57,7 +155,122 @@ index 8d3b0f86c..ebca28b4a 100644
{
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
-@@ -295,12 +309,42 @@ static DEVICE_ATTR_RW(tt_toggle);
+@@ -127,6 +174,20 @@ static const struct dmi_system_id dmi_table[] = {
+ },
+ .driver_data = (void *)oxp_mini_amd,
+ },
++ {
++ .matches = {
++ DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
++ DMI_MATCH(DMI_BOARD_NAME, "ONEXPLAYER 2"),
++ },
++ .driver_data = (void *)oxp_2,
++ },
++ {
++ .matches = {
++ DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
++ DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONEXPLAYER F1"),
++ },
++ .driver_data = (void *)oxp_fly,
++ },
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
+@@ -141,6 +202,13 @@ static const struct dmi_system_id dmi_table[] = {
+ },
+ .driver_data = (void *)oxp_mini_amd_pro,
+ },
++ {
++ .matches = {
++ DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
++ DMI_MATCH(DMI_BOARD_NAME, "ONEXPLAYER X1"),
++ },
++ .driver_data = (void *)oxp_x1,
++ },
+ {},
+ };
+
+@@ -192,14 +260,20 @@ static int tt_toggle_enable(void)
+
+ switch (board) {
+ case oxp_mini_amd_a07:
+- reg = OXP_OLD_TURBO_SWITCH_REG;
+- val = OXP_OLD_TURBO_TAKE_VAL;
++ reg = OXP_MINI_TURBO_SWITCH_REG;
++ val = OXP_MINI_TURBO_TAKE_VAL;
+ break;
+- case oxp_mini_amd_pro:
+ case aok_zoe_a1:
++ case oxp_fly:
++ case oxp_mini_amd_pro:
+ reg = OXP_TURBO_SWITCH_REG;
+ val = OXP_TURBO_TAKE_VAL;
+ break;
++ case oxp_2:
++ case oxp_x1:
++ reg = OXP_2_TURBO_SWITCH_REG;
++ val = OXP_TURBO_TAKE_VAL;
++ break;
+ default:
+ return -EINVAL;
+ }
+@@ -213,14 +287,20 @@ static int tt_toggle_disable(void)
+
+ switch (board) {
+ case oxp_mini_amd_a07:
+- reg = OXP_OLD_TURBO_SWITCH_REG;
+- val = OXP_OLD_TURBO_RETURN_VAL;
++ reg = OXP_MINI_TURBO_SWITCH_REG;
++ val = OXP_TURBO_RETURN_VAL;
+ break;
+- case oxp_mini_amd_pro:
+ case aok_zoe_a1:
++ case oxp_fly:
++ case oxp_mini_amd_pro:
+ reg = OXP_TURBO_SWITCH_REG;
+ val = OXP_TURBO_RETURN_VAL;
+ break;
++ case oxp_2:
++ case oxp_x1:
++ reg = OXP_2_TURBO_SWITCH_REG;
++ val = OXP_TURBO_RETURN_VAL;
++ break;
+ default:
+ return -EINVAL;
+ }
+@@ -233,8 +313,11 @@ static umode_t tt_toggle_is_visible(struct kobject *kobj,
+ {
+ switch (board) {
+ case aok_zoe_a1:
++ case oxp_2:
++ case oxp_fly:
+ case oxp_mini_amd_a07:
+ case oxp_mini_amd_pro:
++ case oxp_x1:
+ return attr->mode;
+ default:
+ break;
+@@ -273,12 +356,17 @@ static ssize_t tt_toggle_show(struct device *dev,
+
+ switch (board) {
+ case oxp_mini_amd_a07:
+- reg = OXP_OLD_TURBO_SWITCH_REG;
++ reg = OXP_MINI_TURBO_SWITCH_REG;
+ break;
+- case oxp_mini_amd_pro:
+ case aok_zoe_a1:
++ case oxp_fly:
++ case oxp_mini_amd_pro:
+ reg = OXP_TURBO_SWITCH_REG;
+ break;
++ case oxp_2:
++ case oxp_x1:
++ reg = OXP_2_TURBO_SWITCH_REG;
++ break;
+ default:
+ return -EINVAL;
+ }
+@@ -295,12 +383,53 @@ static DEVICE_ATTR_RW(tt_toggle);
/* PWM enable/disable functions */
static int oxp_pwm_enable(void)
{
@@ -70,10 +283,15 @@ index 8d3b0f86c..ebca28b4a 100644
+ case aya_neo_air:
+ case aya_neo_air_plus_mendo:
+ case aya_neo_air_pro:
++ case aya_neo_flip:
+ case aya_neo_geek:
++ case aya_neo_kun:
++ case oxp_2:
++ case oxp_fly:
+ case oxp_mini_amd:
+ case oxp_mini_amd_a07:
+ case oxp_mini_amd_pro:
++ case oxp_x1:
+ return write_to_ec(OXP_SENSOR_PWM_ENABLE_REG, PWM_MODE_MANUAL);
+ default:
+ return -EINVAL;
@@ -89,12 +307,18 @@ index 8d3b0f86c..ebca28b4a 100644
+ case aok_zoe_a1:
+ case aya_neo_2:
+ case aya_neo_air:
++ case aya_neo_air_1s:
+ case aya_neo_air_plus_mendo:
+ case aya_neo_air_pro:
++ case aya_neo_flip:
+ case aya_neo_geek:
++ case aya_neo_kun:
++ case oxp_2:
++ case oxp_fly:
+ case oxp_mini_amd:
+ case oxp_mini_amd_a07:
+ case oxp_mini_amd_pro:
++ case oxp_x1:
+ return write_to_ec(OXP_SENSOR_PWM_ENABLE_REG, PWM_MODE_AUTO);
+ default:
+ return -EINVAL;
@@ -102,7 +326,7 @@ index 8d3b0f86c..ebca28b4a 100644
}
/* Callbacks for hwmon interface */
-@@ -326,7 +370,22 @@ static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type,
+@@ -326,7 +455,30 @@ static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type,
case hwmon_fan:
switch (attr) {
case hwmon_fan_input:
@@ -110,12 +334,19 @@ index 8d3b0f86c..ebca28b4a 100644
+ switch (board) {
+ case orange_pi_neo:
+ return read_from_ec(ORANGEPI_SENSOR_FAN_REG, 2, val);
++ case oxp_2:
++ case oxp_x1:
++ return read_from_ec(OXP_2_SENSOR_FAN_REG, 2, val);
+ case aok_zoe_a1:
+ case aya_neo_2:
+ case aya_neo_air:
++ case aya_neo_air_1s:
+ case aya_neo_air_plus_mendo:
+ case aya_neo_air_pro:
++ case aya_neo_flip:
+ case aya_neo_geek:
++ case aya_neo_kun:
++ case oxp_fly:
+ case oxp_mini_amd:
+ case oxp_mini_amd_a07:
+ case oxp_mini_amd_pro:
@@ -123,10 +354,11 @@ index 8d3b0f86c..ebca28b4a 100644
+ default:
+ break;
+ }
++ break;
default:
break;
}
-@@ -334,10 +393,14 @@ static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type,
+@@ -334,27 +486,72 @@ static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type,
case hwmon_pwm:
switch (attr) {
case hwmon_pwm_input:
@@ -141,20 +373,34 @@ index 8d3b0f86c..ebca28b4a 100644
+ /* scale from range [1-244] */
+ *val = ((*val - 1) * 254 / 243) + 1;
+ break;
++ case oxp_2:
++ case oxp_x1:
++ ret = read_from_ec(OXP_SENSOR_PWM_REG, 1, val);
++ if (ret)
++ return ret;
++ /* scale from range [0-184] */
++ *val = (*val * 255) / 184;
++ break;
case aya_neo_2:
case aya_neo_air:
++ case aya_neo_air_1s:
case aya_neo_air_plus_mendo:
-@@ -345,16 +408,37 @@ static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type,
+ case aya_neo_air_pro:
++ case aya_neo_flip:
case aya_neo_geek:
++ case aya_neo_kun:
case oxp_mini_amd:
case oxp_mini_amd_a07:
+ ret = read_from_ec(OXP_SENSOR_PWM_REG, 1, val);
+ if (ret)
+ return ret;
++ /* scale from range [0-100] */
*val = (*val * 255) / 100;
break;
- case oxp_mini_amd_pro:
+- case oxp_mini_amd_pro:
case aok_zoe_a1:
++ case oxp_fly:
++ case oxp_mini_amd_pro:
default:
+ ret = read_from_ec(OXP_SENSOR_PWM_REG, 1, val);
+ if (ret)
@@ -170,20 +416,27 @@ index 8d3b0f86c..ebca28b4a 100644
+ case aok_zoe_a1:
+ case aya_neo_2:
+ case aya_neo_air:
++ case aya_neo_air_1s:
+ case aya_neo_air_plus_mendo:
+ case aya_neo_air_pro:
++ case aya_neo_flip:
+ case aya_neo_geek:
++ case aya_neo_kun:
++ case oxp_2:
++ case oxp_fly:
+ case oxp_mini_amd:
+ case oxp_mini_amd_a07:
+ case oxp_mini_amd_pro:
++ case oxp_x1:
+ return read_from_ec(OXP_SENSOR_PWM_ENABLE_REG, 1, val);
+ default:
+ break;
+ }
++ break;
default:
break;
}
-@@ -381,6 +465,10 @@ static int oxp_platform_write(struct device *dev, enum hwmon_sensor_types type,
+@@ -381,21 +578,36 @@ static int oxp_platform_write(struct device *dev, enum hwmon_sensor_types type,
if (val < 0 || val > 255)
return -EINVAL;
switch (board) {
@@ -191,420 +444,98 @@ index 8d3b0f86c..ebca28b4a 100644
+ /* scale to range [1-244] */
+ val = ((val - 1) * 243 / 254) + 1;
+ return write_to_ec(ORANGEPI_SENSOR_PWM_REG, val);
++ case oxp_2:
++ case oxp_x1:
++ /* scale to range [0-184] */
++ val = (val * 184) / 255;
++ return write_to_ec(OXP_SENSOR_PWM_REG, val);
case aya_neo_2:
case aya_neo_air:
++ case aya_neo_air_1s:
case aya_neo_air_plus_mendo:
-@@ -389,13 +477,13 @@ static int oxp_platform_write(struct device *dev, enum hwmon_sensor_types type,
+ case aya_neo_air_pro:
++ case aya_neo_flip:
+ case aya_neo_geek:
++ case aya_neo_kun:
case oxp_mini_amd:
case oxp_mini_amd_a07:
++ /* scale to range [0-100] */
val = (val * 100) / 255;
- break;
+ return write_to_ec(OXP_SENSOR_PWM_REG, val);
case aok_zoe_a1:
++ case oxp_fly:
case oxp_mini_amd_pro:
+ return write_to_ec(OXP_SENSOR_PWM_REG, val);
default:
break;
}
- return write_to_ec(OXP_SENSOR_PWM_REG, val);
++ break;
default:
break;
}
---
-2.45.2
-
-
-From 78c8501d4c2dc4dcc2125dcf130723b1fbe72e1c Mon Sep 17 00:00:00 2001
-From: "Derek J. Clark" <derekjohn.clark@gmail.com>
-Date: Wed, 27 Mar 2024 18:50:22 -0700
-Subject: [PATCH 2/4] oxp-sensors: hwmon: Add OneXPlayer 2 and OneXFly
-
-Add OneXPlayer 2 series and OneXFly handhelds. The 2 series uses a new register
-for turbo button takeover. While at it, adjust formatting of some constants and
-reorder all cases alphabetically for consistency. Rename some constants for
-disambiguation.
----
- drivers/hwmon/oxp-sensors.c | 90 ++++++++++++++++++++++++++++++-------
- 1 file changed, 74 insertions(+), 16 deletions(-)
-
-diff --git a/drivers/hwmon/oxp-sensors.c b/drivers/hwmon/oxp-sensors.c
-index ebca28b4a..cf8ba1cc6 100644
---- a/drivers/hwmon/oxp-sensors.c
-+++ b/drivers/hwmon/oxp-sensors.c
-@@ -47,6 +47,8 @@ enum oxp_board {
- aya_neo_air_pro,
- aya_neo_geek,
- orange_pi_neo,
-+ oxp_2,
-+ oxp_fly,
- oxp_mini_amd,
- oxp_mini_amd_a07,
- oxp_mini_amd_pro,
-@@ -66,16 +68,16 @@ static enum oxp_board board;
- #define PWM_MODE_AUTO 0x00
- #define PWM_MODE_MANUAL 0x01
- /* Turbo button takeover function
-- * Older boards have different values and EC registers
-+ * Different boards have different values and EC registers
- * for the same function
- */
--#define OXP_OLD_TURBO_SWITCH_REG 0x1E
--#define OXP_OLD_TURBO_TAKE_VAL 0x01
--#define OXP_OLD_TURBO_RETURN_VAL 0x00
-+#define OXP_TURBO_SWITCH_REG 0xF1
-+#define OXP_TURBO_TAKE_VAL 0x40
-+#define OXP_TURBO_RETURN_VAL 0x00 /* Common return val */
-
--#define OXP_TURBO_SWITCH_REG 0xF1
--#define OXP_TURBO_TAKE_VAL 0x40
--#define OXP_TURBO_RETURN_VAL 0x00
-+#define OXP_2_TURBO_SWITCH_REG 0xEB /* OXP2 and OXP2 Pro */
-+#define OXP_MINI_TURBO_SWITCH_REG 0x1E /* Mini AO7 */
-+#define OXP_MINI_TURBO_TAKE_VAL 0x01
-
- static const struct dmi_system_id dmi_table[] = {
- {
-@@ -141,6 +143,34 @@ static const struct dmi_system_id dmi_table[] = {
- },
- .driver_data = (void *)oxp_mini_amd,
- },
-+ {
-+ .matches = {
-+ DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
-+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONEXPLAYER 2 ARP23"),
-+ },
-+ .driver_data = (void *)oxp_2,
-+ },
-+ {
-+ .matches = {
-+ DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
-+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONEXPLAYER 2 PRO ARP23P"),
-+ },
-+ .driver_data = (void *)oxp_2,
-+ },
-+ {
-+ .matches = {
-+ DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
-+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONEXPLAYER 2 PRO ARP23P EVA-01"),
-+ },
-+ .driver_data = (void *)oxp_2,
-+ },
-+ {
-+ .matches = {
-+ DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
-+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONEXPLAYER F1"),
-+ },
-+ .driver_data = (void *)oxp_fly,
-+ },
- {
- .matches = {
- DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
-@@ -206,14 +236,19 @@ static int tt_toggle_enable(void)
+@@ -467,19 +679,20 @@ static int __init oxp_platform_init(void)
+ {
+ const struct dmi_system_id *dmi_entry;
- switch (board) {
- case oxp_mini_amd_a07:
-- reg = OXP_OLD_TURBO_SWITCH_REG;
-- val = OXP_OLD_TURBO_TAKE_VAL;
-+ reg = OXP_MINI_TURBO_SWITCH_REG;
-+ val = OXP_MINI_TURBO_TAKE_VAL;
- break;
-- case oxp_mini_amd_pro:
- case aok_zoe_a1:
-+ case oxp_fly:
-+ case oxp_mini_amd_pro:
- reg = OXP_TURBO_SWITCH_REG;
- val = OXP_TURBO_TAKE_VAL;
- break;
-+ case oxp_2:
-+ reg = OXP_2_TURBO_SWITCH_REG;
-+ val = OXP_TURBO_TAKE_VAL;
-+ break;
- default:
- return -EINVAL;
- }
-@@ -227,14 +262,19 @@ static int tt_toggle_disable(void)
+- /*
+- * Have to check for AMD processor here because DMI strings are the
+- * same between Intel and AMD boards, the only way to tell them apart
+- * is the CPU.
+- * Intel boards seem to have different EC registers and values to
+- * read/write.
+- */
+ dmi_entry = dmi_first_match(dmi_table);
+- if (!dmi_entry || boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
++ if (!dmi_entry)
+ return -ENODEV;
- switch (board) {
- case oxp_mini_amd_a07:
-- reg = OXP_OLD_TURBO_SWITCH_REG;
-- val = OXP_OLD_TURBO_RETURN_VAL;
-+ reg = OXP_MINI_TURBO_SWITCH_REG;
-+ val = OXP_TURBO_RETURN_VAL;
- break;
-- case oxp_mini_amd_pro:
- case aok_zoe_a1:
-+ case oxp_fly:
-+ case oxp_mini_amd_pro:
- reg = OXP_TURBO_SWITCH_REG;
- val = OXP_TURBO_RETURN_VAL;
- break;
-+ case oxp_2:
-+ reg = OXP_2_TURBO_SWITCH_REG;
-+ val = OXP_TURBO_RETURN_VAL;
-+ break;
- default:
- return -EINVAL;
- }
-@@ -247,6 +287,8 @@ static umode_t tt_toggle_is_visible(struct kobject *kobj,
- {
- switch (board) {
- case aok_zoe_a1:
-+ case oxp_2:
-+ case oxp_fly:
- case oxp_mini_amd_a07:
- case oxp_mini_amd_pro:
- return attr->mode;
-@@ -287,12 +329,16 @@ static ssize_t tt_toggle_show(struct device *dev,
+ board = (enum oxp_board)(unsigned long)dmi_entry->driver_data;
- switch (board) {
- case oxp_mini_amd_a07:
-- reg = OXP_OLD_TURBO_SWITCH_REG;
-+ reg = OXP_MINI_TURBO_SWITCH_REG;
- break;
-- case oxp_mini_amd_pro:
- case aok_zoe_a1:
-+ case oxp_fly:
-+ case oxp_mini_amd_pro:
- reg = OXP_TURBO_SWITCH_REG;
- break;
-+ case oxp_2:
-+ reg = OXP_2_TURBO_SWITCH_REG;
-+ break;
- default:
- return -EINVAL;
- }
-@@ -320,6 +366,8 @@ static int oxp_pwm_enable(void)
- case aya_neo_geek:
- case oxp_mini_amd:
- case oxp_mini_amd_a07:
-+ case oxp_2:
-+ case oxp_fly:
- case oxp_mini_amd_pro:
- return write_to_ec(OXP_SENSOR_PWM_ENABLE_REG, PWM_MODE_MANUAL);
- default:
-@@ -340,6 +388,8 @@ static int oxp_pwm_disable(void)
- case aya_neo_geek:
- case oxp_mini_amd:
- case oxp_mini_amd_a07:
-+ case oxp_2:
-+ case oxp_fly:
- case oxp_mini_amd_pro:
- return write_to_ec(OXP_SENSOR_PWM_ENABLE_REG, PWM_MODE_AUTO);
- default:
-@@ -381,6 +431,8 @@ static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type,
- case aya_neo_geek:
- case oxp_mini_amd:
- case oxp_mini_amd_a07:
-+ case oxp_2:
-+ case oxp_fly:
- case oxp_mini_amd_pro:
- return read_from_ec(OXP_SENSOR_FAN_REG, 2, val);
- default:
-@@ -413,8 +465,10 @@ static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type,
- return ret;
- *val = (*val * 255) / 100;
- break;
-- case oxp_mini_amd_pro:
- case aok_zoe_a1:
-+ case oxp_2:
-+ case oxp_fly:
-+ case oxp_mini_amd_pro:
- default:
- ret = read_from_ec(OXP_SENSOR_PWM_REG, 1, val);
- if (ret)
-@@ -434,6 +488,8 @@ static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type,
- case aya_neo_geek:
- case oxp_mini_amd:
- case oxp_mini_amd_a07:
-+ case oxp_2:
-+ case oxp_fly:
- case oxp_mini_amd_pro:
- return read_from_ec(OXP_SENSOR_PWM_ENABLE_REG, 1, val);
- default:
-@@ -479,6 +535,8 @@ static int oxp_platform_write(struct device *dev, enum hwmon_sensor_types type,
- val = (val * 100) / 255;
- return write_to_ec(OXP_SENSOR_PWM_REG, val);
- case aok_zoe_a1:
-+ case oxp_2:
-+ case oxp_fly:
- case oxp_mini_amd_pro:
- return write_to_ec(OXP_SENSOR_PWM_REG, val);
- default:
---
-2.45.2
-
-
-From f12bdbb992c66b8f1320372892da116e95a7f104 Mon Sep 17 00:00:00 2001
-From: "Derek J. Clark" <derekjohn.clark@gmail.com>
-Date: Thu, 28 Mar 2024 19:50:40 +0100
-Subject: [PATCH 3/4] oxp-sensors: hwmon: Add support for AYANEO 2s, air 1s,
- geek 1s and kun models
-
----
- drivers/hwmon/oxp-sensors.c | 48 +++++++++++++++++++++++++++++++++++++
- 1 file changed, 48 insertions(+)
-
-diff --git a/drivers/hwmon/oxp-sensors.c b/drivers/hwmon/oxp-sensors.c
-index cf8ba1cc6..e8d9fea9d 100644
---- a/drivers/hwmon/oxp-sensors.c
-+++ b/drivers/hwmon/oxp-sensors.c
-@@ -42,10 +42,14 @@ static bool unlock_global_acpi_lock(void)
- enum oxp_board {
- aok_zoe_a1 = 1,
- aya_neo_2,
-+ aya_neo_2s,
- aya_neo_air,
-+ aya_neo_air_1s,
- aya_neo_air_plus_mendo,
- aya_neo_air_pro,
- aya_neo_geek,
-+ aya_neo_geek_1s,
-+ aya_neo_kun,
- orange_pi_neo,
- oxp_2,
- oxp_fly,
-@@ -101,6 +105,13 @@ static const struct dmi_system_id dmi_table[] = {
- },
- .driver_data = (void *)aya_neo_2,
- },
-+ {
-+ .matches = {
-+ DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
-+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "AYANEO 2S"),
-+ },
-+ .driver_data = (void *)aya_neo_2s,
-+ },
- {
- .matches = {
- DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
-@@ -115,6 +126,13 @@ static const struct dmi_system_id dmi_table[] = {
- },
- .driver_data = (void *)aya_neo_air_plus_mendo,
- },
-+ {
-+ .matches = {
-+ DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
-+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "AIR 1S"),
-+ },
-+ .driver_data = (void *)aya_neo_air_1s,
-+ },
- {
- .matches = {
- DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
-@@ -129,6 +147,20 @@ static const struct dmi_system_id dmi_table[] = {
- },
- .driver_data = (void *)aya_neo_geek,
- },
-+ {
-+ .matches = {
-+ DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
-+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "GEEK 1S"),
-+ },
-+ .driver_data = (void *)aya_neo_geek_1s,
-+ },
-+ {
-+ .matches = {
-+ DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
-+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "KUN"),
-+ },
-+ .driver_data = (void *)aya_neo_kun,
-+ },
- {
- .matches = {
- DMI_MATCH(DMI_BOARD_VENDOR, "OrangePi"),
-@@ -360,10 +392,14 @@ static int oxp_pwm_enable(void)
- return write_to_ec(ORANGEPI_SENSOR_PWM_ENABLE_REG, PWM_MODE_MANUAL);
- case aok_zoe_a1:
- case aya_neo_2:
-+ case aya_neo_2s:
- case aya_neo_air:
-+ case aya_neo_air_1s:
- case aya_neo_air_plus_mendo:
- case aya_neo_air_pro:
- case aya_neo_geek:
-+ case aya_neo_geek_1s:
-+ case aya_neo_kun:
- case oxp_mini_amd:
- case oxp_mini_amd_a07:
- case oxp_2:
-@@ -382,10 +418,14 @@ static int oxp_pwm_disable(void)
- return write_to_ec(ORANGEPI_SENSOR_PWM_ENABLE_REG, PWM_MODE_AUTO);
- case aok_zoe_a1:
- case aya_neo_2:
-+ case aya_neo_2s:
- case aya_neo_air:
-+ case aya_neo_air_1s:
- case aya_neo_air_plus_mendo:
- case aya_neo_air_pro:
- case aya_neo_geek:
-+ case aya_neo_geek_1s:
-+ case aya_neo_kun:
- case oxp_mini_amd:
- case oxp_mini_amd_a07:
- case oxp_2:
-@@ -425,10 +465,14 @@ static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type,
- return read_from_ec(ORANGEPI_SENSOR_FAN_REG, 2, val);
- case aok_zoe_a1:
- case aya_neo_2:
-+ case aya_neo_2s:
- case aya_neo_air:
-+ case aya_neo_air_1s:
- case aya_neo_air_plus_mendo:
- case aya_neo_air_pro:
- case aya_neo_geek:
-+ case aya_neo_geek_1s:
-+ case aya_neo_kun:
- case oxp_mini_amd:
- case oxp_mini_amd_a07:
- case oxp_2:
-@@ -482,10 +526,14 @@ static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type,
- return read_from_ec(ORANGEPI_SENSOR_PWM_ENABLE_REG, 1, val);
- case aok_zoe_a1:
- case aya_neo_2:
-+ case aya_neo_2s:
- case aya_neo_air:
-+ case aya_neo_air_1s:
- case aya_neo_air_plus_mendo:
- case aya_neo_air_pro:
- case aya_neo_geek:
-+ case aya_neo_geek_1s:
-+ case aya_neo_kun:
- case oxp_mini_amd:
- case oxp_mini_amd_a07:
- case oxp_2:
---
-2.45.2
-
++ /*
++ * Have to check for AMD processor here because DMI strings are the same
++ * between Intel and AMD boards on older OneXPlayer devices, the only way
++ * to tell them apart is the CPU. Old Intel boards have an unsupported EC.
++ */
++ if (board == oxp_mini_amd && boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
++ return -ENODEV;
++
+ oxp_platform_device =
+ platform_create_bundle(&oxp_platform_driver,
+ oxp_platform_probe, NULL, 0, NULL, 0);
-From 61740ea3d49721fa86f6a0085029f8f4f68ae916 Mon Sep 17 00:00:00 2001
-From: "Derek J. Clark" <derekjohn.clark@gmail.com>
-Date: Wed, 27 Mar 2024 18:58:59 -0700
-Subject: [PATCH 4/4] oxp-sensors: hwmon: Add GPD Win Mini
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jan200101 <sentrycraft123@gmail.com>
+Date: Sat, 21 Sep 2024 10:01:30 +0200
+Subject: [PATCH] oxp-sensors: hwmon: Add GPD Win Mini
Add GPD Win Mini. GPD devices don't have a separate enable register, the PWM
register is used for this purpose. A write value of 0 puts the PWM into auto
mode, writing anything 1-244 puts the PWM into manual mode, and 245-255 are
undefined. We scale to 1-255 and handle manual by writing a value to 70% as a
common sense default.
+
+Signed-off-by: Jan200101 <sentrycraft123@gmail.com>
---
- drivers/hwmon/oxp-sensors.c | 43 +++++++++++++++++++++++++++++++++++++
- 1 file changed, 43 insertions(+)
+ drivers/hwmon/oxp-sensors.c | 42 +++++++++++++++++++++++++++++++++++++
+ 1 file changed, 42 insertions(+)
diff --git a/drivers/hwmon/oxp-sensors.c b/drivers/hwmon/oxp-sensors.c
-index e8d9fea9d..11dec1b31 100644
+index 83730d931824..e6ae932c11c5 100644
--- a/drivers/hwmon/oxp-sensors.c
+++ b/drivers/hwmon/oxp-sensors.c
-@@ -50,6 +50,7 @@ enum oxp_board {
+@@ -52,6 +52,7 @@ enum oxp_board {
+ aya_neo_flip,
aya_neo_geek,
- aya_neo_geek_1s,
aya_neo_kun,
+ gpd_win_mini,
orange_pi_neo,
oxp_2,
oxp_fly,
-@@ -69,8 +70,19 @@ static enum oxp_board board;
- #define ORANGEPI_SENSOR_PWM_ENABLE_REG 0x40 /* PWM enable is 1 register long */
- #define ORANGEPI_SENSOR_PWM_REG 0x38 /* PWM reading is 1 register long */
+@@ -89,6 +90,16 @@ static enum oxp_board board;
+
+ #define OXP_TURBO_RETURN_VAL 0x00 /* Common return val */
+/* GPD devices don't have a separate enable register for the fan.
+ * For the PWM register, 0 is auto, 1+ is a manual value, up to 255
@@ -613,18 +544,15 @@ index e8d9fea9d..11dec1b31 100644
+ * The mini uses the same fan register as the OrangePi NEO.
+ */
+#define GPD_MINI_SENSOR_PWM_REG 0x7A /* PWM reading is 1 register long */
-+/* Values for fan auto mode */
- #define PWM_MODE_AUTO 0x00
-+
-+ /* Values for fan manual mode */
- #define PWM_MODE_MANUAL 0x01
++/* Common sense default for manual mode */
+#define GPD_MINI_PWM_MODE_MANUAL 0xAA /* 70% */
- /* Turbo button takeover function
- * Different boards have different values and EC registers
- * for the same function
-@@ -161,6 +173,13 @@ static const struct dmi_system_id dmi_table[] = {
++
+ static const struct dmi_system_id dmi_table[] = {
+ {
+ .matches = {
+@@ -153,6 +164,13 @@ static const struct dmi_system_id dmi_table[] = {
},
- .driver_data = (void *)aya_neo_kun,
+ .driver_data = (void *)aya_neo_geek,
},
+ {
+ .matches = {
@@ -635,8 +563,8 @@ index e8d9fea9d..11dec1b31 100644
+ },
{
.matches = {
- DMI_MATCH(DMI_BOARD_VENDOR, "OrangePi"),
-@@ -388,6 +407,11 @@ static DEVICE_ATTR_RW(tt_toggle);
+ DMI_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
+@@ -384,6 +402,11 @@ static DEVICE_ATTR_RW(tt_toggle);
static int oxp_pwm_enable(void)
{
switch (board) {
@@ -648,7 +576,7 @@ index e8d9fea9d..11dec1b31 100644
case orange_pi_neo:
return write_to_ec(ORANGEPI_SENSOR_PWM_ENABLE_REG, PWM_MODE_MANUAL);
case aok_zoe_a1:
-@@ -414,6 +438,8 @@ static int oxp_pwm_enable(void)
+@@ -409,6 +432,8 @@ static int oxp_pwm_enable(void)
static int oxp_pwm_disable(void)
{
switch (board) {
@@ -657,15 +585,15 @@ index e8d9fea9d..11dec1b31 100644
case orange_pi_neo:
return write_to_ec(ORANGEPI_SENSOR_PWM_ENABLE_REG, PWM_MODE_AUTO);
case aok_zoe_a1:
-@@ -461,6 +487,7 @@ static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type,
+@@ -456,6 +481,7 @@ static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type,
switch (attr) {
case hwmon_fan_input:
switch (board) {
+ case gpd_win_mini:
case orange_pi_neo:
return read_from_ec(ORANGEPI_SENSOR_FAN_REG, 2, val);
- case aok_zoe_a1:
-@@ -490,6 +517,14 @@ static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type,
+ case oxp_2:
+@@ -487,6 +513,14 @@ static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type,
switch (attr) {
case hwmon_pwm_input:
switch (board) {
@@ -680,7 +608,7 @@ index e8d9fea9d..11dec1b31 100644
case orange_pi_neo:
ret = read_from_ec(ORANGEPI_SENSOR_PWM_REG, 1, val);
if (ret)
-@@ -522,6 +557,10 @@ static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type,
+@@ -530,6 +564,10 @@ static int oxp_platform_read(struct device *dev, enum hwmon_sensor_types type,
return 0;
case hwmon_pwm_enable:
switch (board) {
@@ -691,7 +619,7 @@ index e8d9fea9d..11dec1b31 100644
case orange_pi_neo:
return read_from_ec(ORANGEPI_SENSOR_PWM_ENABLE_REG, 1, val);
case aok_zoe_a1:
-@@ -569,6 +608,10 @@ static int oxp_platform_write(struct device *dev, enum hwmon_sensor_types type,
+@@ -578,6 +616,10 @@ static int oxp_platform_write(struct device *dev, enum hwmon_sensor_types type,
if (val < 0 || val > 255)
return -EINVAL;
switch (board) {
@@ -702,6 +630,27 @@ index e8d9fea9d..11dec1b31 100644
case orange_pi_neo:
/* scale to range [1-244] */
val = ((val - 1) * 243 / 254) + 1;
---
-2.45.2
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jan200101 <sentrycraft123@gmail.com>
+Date: Sat, 21 Sep 2024 10:01:47 +0200
+Subject: [PATCH] oxp-sensors: hwmon: match all ONEXPLAYER F1 models
+
+Signed-off-by: Jan200101 <sentrycraft123@gmail.com>
+---
+ drivers/hwmon/oxp-sensors.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/hwmon/oxp-sensors.c b/drivers/hwmon/oxp-sensors.c
+index e6ae932c11c5..0e564dfc5a05 100644
+--- a/drivers/hwmon/oxp-sensors.c
++++ b/drivers/hwmon/oxp-sensors.c
+@@ -202,7 +202,7 @@ static const struct dmi_system_id dmi_table[] = {
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "ONE-NETBOOK"),
+- DMI_EXACT_MATCH(DMI_BOARD_NAME, "ONEXPLAYER F1"),
++ DMI_MATCH(DMI_BOARD_NAME, "ONEXPLAYER F1"),
+ },
+ .driver_data = (void *)oxp_fly,
+ },
diff --git a/SOURCES/v14.8-0004-HID-asus-add-ROG-Ally-xpad-settings.patch b/SOURCES/v14.8-0004-HID-asus-add-ROG-Ally-xpad-settings.patch
index 2a21e86..a1105ef 100644
--- a/SOURCES/v14.8-0004-HID-asus-add-ROG-Ally-xpad-settings.patch
+++ b/SOURCES/v14.8-0004-HID-asus-add-ROG-Ally-xpad-settings.patch
@@ -241,7 +241,7 @@ index 3a1a6024d299..026705c43ee1 100644
{
unsigned char *dmabuf;
int ret;
-@@ -386,6 +362,13 @@ static int asus_kbd_set_report(struct hid_device *hdev, const u8 *buf, size_t bu
+@@ -362,6 +362,13 @@
return ret;
}
@@ -252,20 +252,20 @@ index 3a1a6024d299..026705c43ee1 100644
+ HID_REQ_GET_REPORT);
+}
+
- static int asus_kbd_init(struct hid_device *hdev, u8 report_id)
+ static int asus_kbd_init(struct hid_device *hdev)
{
- const u8 buf[] = { report_id, 0x41, 0x53, 0x55, 0x53, 0x20, 0x54,
-@@ -846,8 +829,8 @@ static int asus_input_mapping(struct hid_device *hdev,
- case 0xb2: asus_map_key_clear(KEY_PROG2); break; /* Fn+Left previous aura */
+ const u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x41, 0x53, 0x55, 0x53, 0x20, 0x54,
+@@ -857,6 +865,10 @@
case 0xb3: asus_map_key_clear(KEY_PROG3); break; /* Fn+Left next aura */
case 0x6a: asus_map_key_clear(KEY_F13); break; /* Screenpad toggle */
-- case 0x4b: asus_map_key_clear(KEY_F14); break; /* Arrows/Pg-Up/Dn toggle */
-- case 0xa5: asus_map_key_clear(KEY_F15); break; /* ROG Ally left back */
-+ case 0x4b: asus_map_key_clear(KEY_F14); break; /* Arrows/Pg-Up/Dn toggle, Ally M1 */
+ case 0x4b: asus_map_key_clear(KEY_F14); break; /* Arrows/Pg-Up/Dn toggle */
+ case 0xa5: asus_map_key_clear(KEY_F15); break; /* ROG Ally M2 */
- case 0xa6: asus_map_key_clear(KEY_F16); break; /* ROG Ally QAM button */
- case 0xa7: asus_map_key_clear(KEY_F17); break; /* ROG Ally ROG long-press */
- case 0xa8: asus_map_key_clear(KEY_F18); break; /* ROG Ally ROG long-press-release */
++ case 0xa6: asus_map_key_clear(KEY_F16); break; /* ROG Ally QAM button */
++ case 0xa7: asus_map_key_clear(KEY_F17); break; /* ROG Ally ROG long-press */
++ case 0xa8: asus_map_key_clear(KEY_F18); break; /* ROG Ally ROG long-press-release */
+
+
+ default:
@@ -1063,6 +1046,10 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
}
}
diff --git a/SOURCES/v2-ally-suspend-fix.patch b/SOURCES/v2-ally-suspend-fix.patch
new file mode 100644
index 0000000..ef4716e
--- /dev/null
+++ b/SOURCES/v2-ally-suspend-fix.patch
@@ -0,0 +1,534 @@
+From 3153735388746f8033a08f1388f3ee31de8975a3 Mon Sep 17 00:00:00 2001
+From: Antheas Kapenekakis <lkml@antheas.dev>
+Date: Fri, 20 Sep 2024 08:32:52 +0200
+Subject: [PATCH v2 0/4] acpi/x86: s2idle: move Display off/on calls outside
+ suspend (fixes ROG Ally suspend)
+
+The following series moves the Display off/on calls outside of the suspend sequence,
+as they are performed in Windows. This fixes certain issues that appear
+in devices that use the calls and expect the kernel to be active during their
+call (especially in the case of the ROG Ally devices) and opens the possibility
+of implementing a "Screen Off" state in the future (which mirrors Windows).
+
+This series requires a bit of background on how modern standby works in Windows.
+Fundamentally, it is composed of two stages: "Screen Off" and "Sleep".
+Each stage consists of a series of steps, with the former focusing on software
+and the latter focusing on the kernel.
+
+The "Screen Off" stage is a software only stage, where the kernel and drivers
+are fully active. In this stage, software is supposed to minimize non-essential
+activity and to slowly coalesce into a state of non-activity over a period of
+minutes. This can last from 1 second to hours, depending on device state (e.g.,
+if it is plugged in). During research of this patch on Windows, most times it
+fluxuates between 5 seconds to 10 minutes. To aid in battery life and in how
+fast the system suspends, Microsoft provides the _DSM firmware notifications
+"Display On" and "Display Off" that can be used to deactivate unnecessary
+hardware (e.g., RGB).
+
+The "Sleep" stage mirrors the traditional suspend sequence, in which kernel
+components are succesively suspended to reach a low power state.
+
+Currently, the kernel calls the Display On/Off calls during a late part of the
+suspend sequence, where most drivers have already suspended. Since these calls
+are not often used (and if they are, they are mostly used for lid switches),
+this has not caused issues up to now (although a little birdie tells me those
+lid sensors might not be behaving correctly currently).
+
+That was until the release of ROG Ally, where Asus placed a callback that turns
+the controller on and off in those _DSM calls. The Display Off call disconnects
+(if powersave is off) or powers off (if powersave is on and on DC power) the MCU
+responsible for the controller and deactivates the RGB of the device. Display On
+powers on or reconnects the controller respectively.
+This controller, in the Ally X, is composed of 6 HID devices that register to
+the kernel. As can be inferred, the handling of the calls during the suspend
+sequence leads to a set of undesirable outcomes, such as the controller
+soft-locking or only half of the HID devices coming back after resume.
+
+After moving the calls outside of the suspend sequence, my ROG Ally X test unit
+can suspend more than 50 times without rebooting, both with powersave on or off,
+regardless of whether it is plugged/unplugged during suspend, and still have the
+controller work with full reliability.
+
+In addition, moving the calls outside of the suspend sequence (and the validation
+work it implies) opens the possibility of implementing a "Screen Off" state in
+the future. This state would make a great addition to something like logind or
+systemd, if it is exposed over a sysfs endpoint. The recommendation here would
+be to allow userspace to instruct the kernel to enter "Screen Off" state when
+the device becomes inactive. The kernel would then call "Display Off" and
+delegade the responsibility of exiting "Screen Off" (and calling Display On)
+to userspace, regardless of the number of the suspensions afterwards.
+If userspace does not make the kernel enter "Screen Off" prior to suspend, the
+kernel would call Display Off and On before suspending, in the same way it is
+done with this patch.
+
+This series is worth backing this up with sources, so as part of it I reference
+Microsoft's documentation on Modern standby [1-3] that explains the difference
+between "Screen Off" and "Sleep" and how to prepare for them and attach a
+repository of more than 15 device DSDT tables [4] from different manufacturers.
+This repository also contains instructions on how to decode the DSDT tables on
+a test laptop, to figure out what the _DSM calls will do on that device (in most
+cases it is a NOOP or a lid sensor).
+
+Moreover, I conduct a short behavioral test in Windows with the Ally X to showcase
+the documentation empirically. The Ally is great for such a test, as it contains
+visual indicators for all Microsoft suspend points: "Display Off/On" calls are
+indicated with the Controller RGB turning off/on, "Screen Off" is indicated with
+the suspend light and fan being on, and suspend is indicated with the suspend
+light blinking.
+
+Referencing Microsoft's documentation, "Screen Off" is entered either through
+inactivity or by pressing the power button, so I conduct two tests: one by pressing
+the powerbutton, and one for entering Screen Off due to inactivity.
+
+1) Powerbutton test:
+When pressing the powerbutton, the screen of the Ally turns off, and the RGB of
+the controller faints to off within 1s. Following, depending on whether the
+system is plugged in, the power light and fan stay on for 5 seconds to 10 minutes.
+After this point, the power light begins to blink and the fan turns off, showing
+that the system has entered the "Sleep" state.
+
+2) Inactivity test:
+I set the Windows power settings to turn off the screen after 1 minute and wait.
+After one minute, the display turns off, and after 5 seconds, the controller RGB
+turns off. This indicates to me that "Screen Off" is not defined by the screen
+being off, but is rather characterized by it. During those 5 seconds while the
+RGB is on, I can use the controller to wake up the device. Afterwards it cannot.
+
+Those tests validate Microsoft's documentation and show that "Screen Off"
+seems to more closely correlate to lockscreen behavior (button locks instantly,
+inactivity after 5 seconds) than the screen being off and as such it is
+not something that would be a great fit for tying into the DRM subsystem.
+If controlled by userspace and part of the screen turning off, it would also
+solve several behavioral issues that currently exist. For example, as I look
+at my Ally X dev right now, with its screen off, I notice the RGB is still on,
+which is kind of bothersome, now that I know what the expected behavior is in
+Windows.
+
+This patch series is co-developed with help from Mario Limonciello, and, to be
+bisection friendly, is structured based on a patch series he made connecting the
+callbacks to the drm subsystem suspend [5]. It also references (already)
+upstream work by Luke Jones on Asus-wmi for the Ally controller quirk that is
+removed on patch (4) and an issue on amd-drm in 2023 in preparation for the
+work in that quirk [6].
+
+Link: https://learn.microsoft.com/en-us/windows-hardware/design/device-experiences/prepare-hardware-for-modern-standby [1]
+Link: https://learn.microsoft.com/en-us/windows-hardware/design/device-experiences/prepare-software-for-modern-standby [2]
+Link: https://learn.microsoft.com/en-us/windows-hardware/design/device-experiences/modern-standby-firmware-notifications [3]
+Link: https://github.com/hhd-dev/hwinfo/tree/master/devices [4]
+Link: https://git.kernel.org/pub/scm/linux/kernel/git/superm1/linux.git/log/?h=superm1/dsm-screen-on-off [5]
+Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2719 [6]
+
+Changes in v2:
+ - Added attribution to Mario Limonciello and changed the text to reflect that
+ - Made the screen on/off callbacks warn and bail with -EINVAL if they are
+ called in the wrong order (currently impossible)
+ - Changed patch 2 to not bail the suspend sequence when receiving an error
+ (as these calls are not part of the suspend sequence and failing the
+ suspend sequence would cause a user visible fault)
+
+Antheas Kapenekakis (4):
+ acpi/x86: s2idle: add support for screen off and screen on callbacks
+ acpi/x86: s2idle: handle screen off/on calls outside of suspend
+ sequence
+ acpi/x86: s2idle: call screen on and off as part of callbacks
+ platform/x86: asus-wmi: remove Ally (1st gen) and Ally X suspend quirk
+
+ drivers/acpi/x86/s2idle.c | 65 +++++++++++++++++++++++++--------
+ drivers/platform/x86/asus-wmi.c | 54 ---------------------------
+ include/linux/suspend.h | 5 +++
+ kernel/power/suspend.c | 28 ++++++++++++++
+ 4 files changed, 83 insertions(+), 69 deletions(-)
+
+--
+2.46.1
+
+From f9867c795cd94123c7a401a3adf50e0a74081fd6 Mon Sep 17 00:00:00 2001
+From: Antheas Kapenekakis <lkml@antheas.dev>
+Date: Wed, 18 Sep 2024 23:53:53 +0200
+Subject: [PATCH v2 1/4] acpi/x86: s2idle: add support for screen off and
+ screen on callbacks
+
+The screen off and screen on firmware functions are meant to signify
+the system entering a state where the user is not actively interacting
+with it (i.e., in Windows this state is called "Screen Off" and the
+system enters it once it turns the screen off e.g., due to inactivity).
+
+In this state, the kernel and userspace are fully active, and the user
+might still be interacting with the system somehow (such as with
+listening to music or having a hotspot). Userspace is supposed to
+minimize non-essential activities, but this is not required.
+In addition, there is no requirement of suspending post the screen off
+call. If the user interacts with the system, the kernel should call
+screen on and resume normal operation.
+
+This patch adds a set of callbacks to allow calling the Display On/Off
+firmware calls outside of the suspend/resume path.
+
+Co-developed-by: Mario Limonciello <mario.limonciello@amd.com>
+Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
+---
+ include/linux/suspend.h | 5 +++++
+ kernel/power/suspend.c | 12 ++++++++++++
+ 2 files changed, 17 insertions(+)
+
+diff --git a/include/linux/suspend.h b/include/linux/suspend.h
+index da6ebca3ff77..96ceaad07839 100644
+--- a/include/linux/suspend.h
++++ b/include/linux/suspend.h
+@@ -132,6 +132,7 @@ struct platform_suspend_ops {
+ };
+
+ struct platform_s2idle_ops {
++ int (*screen_off)(void);
+ int (*begin)(void);
+ int (*prepare)(void);
+ int (*prepare_late)(void);
+@@ -140,6 +141,7 @@ struct platform_s2idle_ops {
+ void (*restore_early)(void);
+ void (*restore)(void);
+ void (*end)(void);
++ int (*screen_on)(void);
+ };
+
+ #ifdef CONFIG_SUSPEND
+@@ -160,6 +162,9 @@ extern unsigned int pm_suspend_global_flags;
+ #define PM_SUSPEND_FLAG_FW_RESUME BIT(1)
+ #define PM_SUSPEND_FLAG_NO_PLATFORM BIT(2)
+
++int platform_suspend_screen_off(void);
++int platform_suspend_screen_on(void);
++
+ static inline void pm_suspend_clear_flags(void)
+ {
+ pm_suspend_global_flags = 0;
+diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
+index 09f8397bae15..19734b297527 100644
+--- a/kernel/power/suspend.c
++++ b/kernel/power/suspend.c
+@@ -254,6 +254,18 @@ static bool sleep_state_supported(suspend_state_t state)
+ (valid_state(state) && !cxl_mem_active());
+ }
+
++int platform_suspend_screen_off(void)
++{
++ return s2idle_ops && s2idle_ops->screen_off ? s2idle_ops->screen_off() : 0;
++}
++EXPORT_SYMBOL_GPL(platform_suspend_screen_off);
++
++int platform_suspend_screen_on(void)
++{
++ return s2idle_ops && s2idle_ops->screen_on ? s2idle_ops->screen_on() : 0;
++}
++EXPORT_SYMBOL_GPL(platform_suspend_screen_on);
++
+ static int platform_suspend_prepare(suspend_state_t state)
+ {
+ return state != PM_SUSPEND_TO_IDLE && suspend_ops->prepare ?
+--
+2.46.1
+
+
+From 487bbe29975a115e7af69c07acc8888f10f77d93 Mon Sep 17 00:00:00 2001
+From: Antheas Kapenekakis <lkml@antheas.dev>
+Date: Thu, 19 Sep 2024 00:02:32 +0200
+Subject: [PATCH v2 2/4] acpi/x86: s2idle: handle screen off/on calls outside
+ of suspend sequence
+
+Currently, the screen off/on calls are handled within the suspend
+sequence, which is a deviation from Windows. This causes issues with
+certain devices, such as the ROG Ally, which expects this call to be
+executed with the kernel fully awake. The subsequent half-suspended
+state makes the controller of the device to fail to suspend properly.
+
+This patch calls the screen off/on callbacks before entering the suspend
+sequence, which fixes this issue. In addition, it opens the possibility
+of modelling a state such as "Screen Off" that mirrors Windows, as the
+callbacks will be accessible and validated to work outside of the
+suspend sequence.
+
+Suggested-by: Mario Limonciello <mario.limonciello@amd.com>
+Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
+---
+ kernel/power/suspend.c | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
+index 19734b297527..2e391c1b1d20 100644
+--- a/kernel/power/suspend.c
++++ b/kernel/power/suspend.c
+@@ -507,6 +507,20 @@ int suspend_devices_and_enter(suspend_state_t state)
+
+ pm_suspend_target_state = state;
+
++ /*
++ * Linux does not have the concept of a "Screen Off" state, so call
++ * the platform functions for screen off prior to beginning the suspend
++ * sequence, mirroring Windows which calls them outside of it as well.
++ *
++ * If Linux ever gains a "Screen Off" state, the following callbacks can
++ * be replaced with a call that checks if we are in "Screen Off", in which
++ * case they will NOOP and if not call them as a fallback.
++ *
++ * In case of an error, since these calls are not part of the suspend
++ * sequence, do not bail.
++ */
++ platform_suspend_screen_off();
++
+ if (state == PM_SUSPEND_TO_IDLE)
+ pm_set_suspend_no_platform();
+
+@@ -540,6 +554,8 @@ int suspend_devices_and_enter(suspend_state_t state)
+ Close:
+ platform_resume_end(state);
+ pm_suspend_target_state = PM_SUSPEND_ON;
++
++ platform_suspend_screen_on();
+ return error;
+
+ Recover_platform:
+--
+2.46.1
+
+
+From 7ea23d70a9d945ff1b80290a1dd65af313d21172 Mon Sep 17 00:00:00 2001
+From: Antheas Kapenekakis <lkml@antheas.dev>
+Date: Thu, 19 Sep 2024 00:22:03 +0200
+Subject: [PATCH v2 3/4] acpi/x86: s2idle: call screen on and off as part of
+ callbacks
+
+Move the screen on and off calls into dedicated callbacks that gate
+the ACPI mutex, so they can be called outside of the suspend path.
+This fixes issues on certain devices that expect kernel drivers to be
+fully active during the calls, and allows for the flexibility of calling
+them as part of a more elaborate userspace suspend sequence (such as
+with "Screen Off" in Windows Modern Standby).
+
+Co-developed-by: Mario Limonciello <mario.limonciello@amd.com>
+Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
+---
+ drivers/acpi/x86/s2idle.c | 65 ++++++++++++++++++++++++++++++---------
+ 1 file changed, 50 insertions(+), 15 deletions(-)
+
+diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
+index dd0b40b9bbe8..6b28d8b892d8 100644
+--- a/drivers/acpi/x86/s2idle.c
++++ b/drivers/acpi/x86/s2idle.c
+@@ -60,6 +60,7 @@ static int lps0_dsm_func_mask;
+ static guid_t lps0_dsm_guid_microsoft;
+ static int lps0_dsm_func_mask_microsoft;
+ static int lps0_dsm_state;
++static bool lsp0_dsm_in_screen_off;
+
+ /* Device constraint entry structure */
+ struct lpi_device_info {
+@@ -539,15 +540,16 @@ static struct acpi_scan_handler lps0_handler = {
+ .attach = lps0_device_attach,
+ };
+
+-int acpi_s2idle_prepare_late(void)
++static int acpi_s2idle_screen_off(void)
+ {
+- struct acpi_s2idle_dev_ops *handler;
+-
+ if (!lps0_device_handle || sleep_no_lps0)
+ return 0;
+
+- if (pm_debug_messages_on)
+- lpi_check_constraints();
++ if (unlikely(WARN_ON(lsp0_dsm_in_screen_off)))
++ return -EINVAL;
++
++ lsp0_dsm_in_screen_off = true;
++ acpi_scan_lock_acquire();
+
+ /* Screen off */
+ if (lps0_dsm_func_mask > 0)
+@@ -560,6 +562,47 @@ int acpi_s2idle_prepare_late(void)
+ acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_OFF,
+ lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
+
++ acpi_scan_lock_release();
++
++ return 0;
++}
++
++static int acpi_s2idle_screen_on(void)
++{
++ if (!lps0_device_handle || sleep_no_lps0)
++ return 0;
++
++ if (unlikely(WARN_ON(!lsp0_dsm_in_screen_off)))
++ return -EINVAL;
++
++ lsp0_dsm_in_screen_off = false;
++ acpi_scan_lock_acquire();
++
++ /* Screen on */
++ if (lps0_dsm_func_mask_microsoft > 0)
++ acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_ON,
++ lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
++ if (lps0_dsm_func_mask > 0)
++ acpi_sleep_run_lps0_dsm(acpi_s2idle_vendor_amd() ?
++ ACPI_LPS0_SCREEN_ON_AMD :
++ ACPI_LPS0_SCREEN_ON,
++ lps0_dsm_func_mask, lps0_dsm_guid);
++
++ acpi_scan_lock_release();
++
++ return 0;
++}
++
++int acpi_s2idle_prepare_late(void)
++{
++ struct acpi_s2idle_dev_ops *handler;
++
++ if (!lps0_device_handle || sleep_no_lps0)
++ return 0;
++
++ if (pm_debug_messages_on)
++ lpi_check_constraints();
++
+ /* LPS0 entry */
+ if (lps0_dsm_func_mask > 0 && acpi_s2idle_vendor_amd())
+ acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY_AMD,
+@@ -623,19 +666,10 @@ void acpi_s2idle_restore_early(void)
+ acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_EXIT,
+ lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
+ }
+-
+- /* Screen on */
+- if (lps0_dsm_func_mask_microsoft > 0)
+- acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_ON,
+- lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
+- if (lps0_dsm_func_mask > 0)
+- acpi_sleep_run_lps0_dsm(acpi_s2idle_vendor_amd() ?
+- ACPI_LPS0_SCREEN_ON_AMD :
+- ACPI_LPS0_SCREEN_ON,
+- lps0_dsm_func_mask, lps0_dsm_guid);
+ }
+
+ static const struct platform_s2idle_ops acpi_s2idle_ops_lps0 = {
++ .screen_off = acpi_s2idle_screen_off,
+ .begin = acpi_s2idle_begin,
+ .prepare = acpi_s2idle_prepare,
+ .prepare_late = acpi_s2idle_prepare_late,
+@@ -644,6 +678,7 @@ static const struct platform_s2idle_ops acpi_s2idle_ops_lps0 = {
+ .restore_early = acpi_s2idle_restore_early,
+ .restore = acpi_s2idle_restore,
+ .end = acpi_s2idle_end,
++ .screen_on = acpi_s2idle_screen_on,
+ };
+
+ void __init acpi_s2idle_setup(void)
+--
+2.46.1
+
+
+From 3153735388746f8033a08f1388f3ee31de8975a3 Mon Sep 17 00:00:00 2001
+From: Antheas Kapenekakis <lkml@antheas.dev>
+Date: Thu, 19 Sep 2024 00:29:59 +0200
+Subject: [PATCH v2 4/4] platform/x86: asus-wmi: remove Ally (1st gen) and Ally
+ X suspend quirk
+
+By moving the Display On/Off calls outside of the suspend sequence,
+the racing conditions that made the Ally controller suspend unreliable
+are completely fixed. This includes both when mcu_powersave is enabled
+and disabled. Therefore, remove the quirk that fixed them only when
+the mcu_powersave attribute was disabled.
+
+Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
+Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
+---
+ drivers/platform/x86/asus-wmi.c | 54 ---------------------------------
+ 1 file changed, 54 deletions(-)
+
+diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
+index 37636e5a38e3..2c9656e0afda 100644
+--- a/drivers/platform/x86/asus-wmi.c
++++ b/drivers/platform/x86/asus-wmi.c
+@@ -126,11 +126,6 @@
+ #define ASUS_SCREENPAD_BRIGHT_MAX 255
+ #define ASUS_SCREENPAD_BRIGHT_DEFAULT 60
+
+-/* 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 300
+-
+ static const char * const ashs_ids[] = { "ATK4001", "ATK4002", NULL };
+
+ static int throttle_thermal_policy_write(struct asus_wmi *);
+@@ -298,9 +298,6 @@
+
+ bool fnlock_locked;
+
+- /* The ROG Ally device requires the MCU USB device be disconnected before suspend */
+- bool ally_mcu_usb_switch;
+-
+ struct asus_wmi_debug debug;
+
+ struct asus_wmi_driver *driver;
+@@ -4445,8 +4445,6 @@
+ asus->nv_temp_tgt_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_NV_THERM_TARGET);
+ asus->panel_overdrive_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PANEL_OD);
+ asus->mini_led_mode_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_MINI_LED_MODE);
+- asus->ally_mcu_usb_switch = acpi_has_method(NULL, ASUS_USB0_PWR_EC0_CSEE)
+- && dmi_match(DMI_BOARD_NAME, "RC71L");
+
+ err = fan_boost_mode_check_present(asus);
+ if (err)
+@@ -4624,42 +4624,6 @@
+ return 0;
+ }
+
+-static int asus_hotk_resume_early(struct device *device)
+-{
+- struct asus_wmi *asus = dev_get_drvdata(device);
+-
+- if (asus->ally_mcu_usb_switch) {
+- 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);
+- }
+- return 0;
+-}
+-
+-static int asus_hotk_prepare(struct device *device)
+-{
+- struct asus_wmi *asus = dev_get_drvdata(device);
+- int result, err;
+-
+- if (asus->ally_mcu_usb_switch) {
+- /* When powersave is enabled it causes many issues with resume of USB hub */
+- result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_MCU_POWERSAVE);
+- if (result == 1) {
+- dev_warn(device, "MCU powersave enabled, disabling to prevent resume issues");
+- err = asus_wmi_set_devstate(ASUS_WMI_DEVID_MCU_POWERSAVE, 0, &result);
+- if (err || result != 1)
+- dev_err(device, "Failed to set MCU powersave mode: %d\n", err);
+- }
+- /* 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
+- msleep(ASUS_USB0_PWR_EC0_CSEE_WAIT);
+- }
+- return 0;
+-}
+-
+ static int asus_hotk_restore(struct device *device)
+ {
+ struct asus_wmi *asus = dev_get_drvdata(device);
+@@ -4912,8 +4872,6 @@
+ .thaw = asus_hotk_thaw,
+ .restore = asus_hotk_restore,
+ .resume = asus_hotk_resume,
+- .resume_early = asus_hotk_resume_early,
+- .prepare = asus_hotk_prepare,
+ };
+
+ /* Registration ***************************************************************/
+--
+2.46.1
+
diff --git a/SPECS/kernel.spec b/SPECS/kernel.spec
index d929021..a411f3b 100644
--- a/SPECS/kernel.spec
+++ b/SPECS/kernel.spec
@@ -169,7 +169,7 @@ Summary: The Linux kernel
# This is needed to do merge window version magic
%define patchlevel 9
# This allows pkg_release to have configurable %%{?dist} tag
-%define specrelease 205%{?buildid}%{?dist}
+%define specrelease 206%{?buildid}%{?dist}
# This defines the kabi tarball version
%define kabiversion 6.9.12
@@ -989,7 +989,7 @@ Patch216: cachy-fixes.patch
# device specific patches
Patch300: linux-surface.patch
-Patch302: asus-linux.patch
+#Patch302: asus-linux.patch
Patch303: lenovo-legion-laptop.patch
# workaround for i915 getting stuck during async page flips on Nvidia PRIME systems
Patch308: 0001-drm-i915-quirks-disable-async-flipping-on-specific-d.patch
@@ -1002,8 +1002,8 @@ Patch317: ROG-ALLY-NCT6775-PLATFORM.patch
Patch321: v14.8-0004-HID-asus-add-ROG-Ally-xpad-settings.patch
Patch322: rog-ally-gyro-fix.patch
Patch323: 0001-Revert-drm-i915-mtl-Add-fake-PCH-for-Meteor-Lake.patch
-Patch336: 0001-add-ally-x-dmi-quirk-for-controller-suspend.patch
Patch337: 0001-patch_realtek-Fix-ROG-ALLY-X-audio.patch
+Patch338: v2-ally-suspend-fix.patch
# hdr: https://github.com/CachyOS/kernel-patches
Patch208: 0001-ntsync.patch
@@ -1895,7 +1895,7 @@ ApplyOptionalPatch cachy-fixes.patch
# device specific patches
ApplyOptionalPatch linux-surface.patch
-ApplyOptionalPatch asus-linux.patch
+#ApplyOptionalPatch asus-linux.patch
ApplyOptionalPatch lenovo-legion-laptop.patch
# workaround for i915 getting stuck during async page flips on Nvidia PRIME systems
ApplyOptionalPatch 0001-drm-i915-quirks-disable-async-flipping-on-specific-d.patch
@@ -1908,8 +1908,8 @@ ApplyOptionalPatch ROG-ALLY-NCT6775-PLATFORM.patch
ApplyOptionalPatch v14.8-0004-HID-asus-add-ROG-Ally-xpad-settings.patch
ApplyOptionalPatch rog-ally-gyro-fix.patch
ApplyOptionalPatch 0001-Revert-drm-i915-mtl-Add-fake-PCH-for-Meteor-Lake.patch
-ApplyOptionalPatch 0001-add-ally-x-dmi-quirk-for-controller-suspend.patch
ApplyOptionalPatch 0001-patch_realtek-Fix-ROG-ALLY-X-audio.patch
+ApplyOptionalPatch v2-ally-suspend-fix.patch
# https://github.com/CachyOS/kernel-patches
ApplyOptionalPatch 0001-ntsync.patch
@@ -4137,6 +4137,9 @@ fi\
#
#
%changelog
+* Sat Sep 21 2024 Jan200101 <sentrycraft123@gmail.com> - 6.9.12-206.fsync
+- kernel-fsync v6.9.12 oxp-sensors update, asus screw driver
+
* Thu Aug 22 2024 Jan200101 <sentrycraft123@gmail.com> - 6.9.12-205.fsync
- kernel-fsync v6.9.12 selinux vma revert