summaryrefslogtreecommitdiff
path: root/SOURCES
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2023-01-24 00:04:42 +0100
committerJan200101 <sentrycraft123@gmail.com>2023-01-24 00:04:42 +0100
commitb2e1729dfb566db3e0ce2a858f722bb6138bb5be (patch)
treeb0eacb3e3d6fddac62e31898ad873b6e557ae139 /SOURCES
parent98903b8328ad2ca695b84a1bcac1c88edf28aa61 (diff)
downloadkernel-fsync-b2e1729dfb566db3e0ce2a858f722bb6138bb5be.tar.gz
kernel-fsync-b2e1729dfb566db3e0ce2a858f722bb6138bb5be.zip
kernel 6.1.7
Diffstat (limited to 'SOURCES')
-rw-r--r--SOURCES/asus-linux.patch1328
-rw-r--r--SOURCES/linux-surface.patch102
-rw-r--r--SOURCES/patch-6.1-redhat.patch36
3 files changed, 55 insertions, 1411 deletions
diff --git a/SOURCES/asus-linux.patch b/SOURCES/asus-linux.patch
deleted file mode 100644
index 1276952..0000000
--- a/SOURCES/asus-linux.patch
+++ /dev/null
@@ -1,1328 +0,0 @@
-From 0afaa446a07db0ded4c032511b35485bd12ff80f Mon Sep 17 00:00:00 2001
-From: Jan200101 <sentrycraft123@gmail.com>
-Date: Sat, 17 Dec 2022 18:14:04 +0100
-Subject: [PATCH] asus-linux
-
-Signed-off-by: Jan200101 <sentrycraft123@gmail.com>
----
- .../ABI/testing/sysfs-platform-asus-wmi | 41 ++
- drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 4 +
- drivers/hid/amd-sfh-hid/amd_sfh_pcie.h | 1 +
- .../hid_descriptor/amd_sfh_hid_desc.c | 27 +
- .../hid_descriptor/amd_sfh_hid_desc.h | 8 +
- .../hid_descriptor/amd_sfh_hid_report_desc.h | 19 +
- drivers/platform/x86/asus-nb-wmi.c | 14 +-
- drivers/platform/x86/asus-wmi.c | 677 ++++++++++--------
- include/linux/platform_data/x86/asus-wmi.h | 10 +
- 9 files changed, 503 insertions(+), 298 deletions(-)
-
-diff --git a/Documentation/ABI/testing/sysfs-platform-asus-wmi b/Documentation/ABI/testing/sysfs-platform-asus-wmi
-index 04885738cf15..a77a004a1baa 100644
---- a/Documentation/ABI/testing/sysfs-platform-asus-wmi
-+++ b/Documentation/ABI/testing/sysfs-platform-asus-wmi
-@@ -57,3 +57,44 @@ Description:
- * 0 - default,
- * 1 - overboost,
- * 2 - silent
-+
-+What: /sys/devices/platform/<platform>/gpu_mux_mode
-+Date: Aug 2022
-+KernelVersion: 6.1
-+Contact: "Luke Jones" <luke@ljones.dev>
-+Description:
-+ Switch the GPU hardware MUX mode. Laptops with this feature can
-+ can be toggled to boot with only the dGPU (discrete mode) or in
-+ standard Optimus/Hybrid mode. On switch a reboot is required:
-+
-+ * 0 - Discrete GPU,
-+ * 1 - Optimus/Hybrid,
-+
-+What: /sys/devices/platform/<platform>/dgpu_disable
-+Date: Aug 2022
-+KernelVersion: 5.17
-+Contact: "Luke Jones" <luke@ljones.dev>
-+Description:
-+ Disable discrete GPU:
-+ * 0 - Enable dGPU,
-+ * 1 - Disable dGPU
-+
-+What: /sys/devices/platform/<platform>/egpu_enable
-+Date: Aug 2022
-+KernelVersion: 5.17
-+Contact: "Luke Jones" <luke@ljones.dev>
-+Description:
-+ Enable the external GPU paired with ROG X-Flow laptops.
-+ Toggling this setting will also trigger ACPI to disable the dGPU:
-+
-+ * 0 - Disable,
-+ * 1 - Enable
-+
-+What: /sys/devices/platform/<platform>/panel_od
-+Date: Aug 2022
-+KernelVersion: 5.17
-+Contact: "Luke Jones" <luke@ljones.dev>
-+Description:
-+ Enable an LCD response-time boost to reduce or remove ghosting:
-+ * 0 - Disable,
-+ * 1 - Enable
-diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
-index 47774b9ab3de..a03f0968e82f 100644
---- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
-+++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
-@@ -27,6 +27,7 @@
- #define ACEL_EN BIT(0)
- #define GYRO_EN BIT(1)
- #define MAGNO_EN BIT(2)
-+#define KBGUARD_EN BIT(15)
- #define HPD_EN BIT(16)
- #define ALS_EN BIT(19)
-
-@@ -233,6 +234,9 @@ int amd_mp2_get_sensor_num(struct amd_mp2_dev *privdata, u8 *sensor_id)
- if (HPD_EN & activestatus)
- sensor_id[num_of_sensors++] = HPD_IDX;
-
-+ if (KBGUARD_EN & activestatus)
-+ sensor_id[num_of_sensors++] = KBGUARD_IDX;
-+
- return num_of_sensors;
- }
-
-diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h
-index dfb7cabd82ef..5fa15eed43f3 100644
---- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h
-+++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h
-@@ -23,6 +23,7 @@
- #define V2_STATUS 0x2
-
- #define HPD_IDX 16
-+#define KBGUARD_IDX 15
-
- #define SENSOR_DISCOVERY_STATUS_MASK GENMASK(5, 3)
- #define SENSOR_DISCOVERY_STATUS_SHIFT 3
-diff --git a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c
-index f9a8c02d5a7b..06487eb75dc8 100644
---- a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c
-+++ b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c
-@@ -57,6 +57,11 @@ static int get_report_descriptor(int sensor_idx, u8 *rep_desc)
- memcpy(rep_desc, hpd_report_descriptor,
- sizeof(hpd_report_descriptor));
- break;
-+ case KBGUARD_IDX: /* kbguard ? */
-+ memset(rep_desc, 0, sizeof(kbguard_report_descriptor));
-+ memcpy(rep_desc, kbguard_report_descriptor,
-+ sizeof(kbguard_report_descriptor));
-+ break;
- default:
- break;
- }
-@@ -116,6 +121,16 @@ static u32 get_descr_sz(int sensor_idx, int descriptor_name)
- return sizeof(struct hpd_feature_report);
- }
- break;
-+ case KBGUARD_IDX:
-+ switch (descriptor_name) {
-+ case descr_size:
-+ return sizeof(kbguard_report_descriptor);
-+ case input_size:
-+ return sizeof(struct kbguard_input_report);
-+ case feature_size:
-+ return sizeof(struct kbguard_feature_report);
-+ }
-+ break;
-
- default:
- break;
-@@ -139,6 +154,7 @@ static u8 get_feature_report(int sensor_idx, int report_id, u8 *feature_report)
- struct gyro_feature_report gyro_feature;
- struct magno_feature_report magno_feature;
- struct hpd_feature_report hpd_feature;
-+ struct kbguard_feature_report kbguard_feature;
- struct als_feature_report als_feature;
- u8 report_size = 0;
-
-@@ -186,6 +202,11 @@ static u8 get_feature_report(int sensor_idx, int report_id, u8 *feature_report)
- memcpy(feature_report, &hpd_feature, sizeof(hpd_feature));
- report_size = sizeof(hpd_feature);
- break;
-+ case KBGUARD_IDX: /* auto disable keyboard when flip out */
-+ get_common_features(&kbguard_feature.common_property, report_id);
-+ memcpy(feature_report, &kbguard_feature, sizeof(kbguard_feature));
-+ report_size = sizeof(kbguard_feature);
-+ break;
-
- default:
- break;
-@@ -211,6 +232,7 @@ static u8 get_input_report(u8 current_index, int sensor_idx, int report_id,
- struct accel3_input_report acc_input;
- struct gyro_input_report gyro_input;
- struct hpd_input_report hpd_input;
-+ struct kbguard_input_report kbguard_input;
- struct als_input_report als_input;
- struct hpd_status hpdstatus;
- u8 report_size = 0;
-@@ -263,6 +285,11 @@ static u8 get_input_report(u8 current_index, int sensor_idx, int report_id,
- report_size = sizeof(hpd_input);
- memcpy(input_report, &hpd_input, sizeof(hpd_input));
- break;
-+ case KBGUARD_IDX: /* kb guard */
-+ get_common_inputs(&kbguard_input.common_property, report_id);
-+ report_size = sizeof(kbguard_input);
-+ memcpy(input_report, &kbguard_input, sizeof(kbguard_input));
-+break;
- default:
- break;
- }
-diff --git a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h
-index ebd55675eb62..2f2ba9a0cfbc 100644
---- a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h
-+++ b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h
-@@ -111,4 +111,12 @@ struct hpd_input_report {
- u8 human_presence;
- } __packed;
-
-+struct kbguard_feature_report {
-+ struct common_feature_property common_property;
-+} __packed;
-+
-+struct kbguard_input_report {
-+ struct common_input_property common_property;
-+} __packed;
-+
- #endif
-diff --git a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h
-index 697f2791ea9c..7a62fcec2c73 100644
---- a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h
-+++ b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h
-@@ -644,6 +644,25 @@ static const u8 als_report_descriptor[] = {
- 0xC0 /* HID end collection */
- };
-
-+
-+static const u8 kbguard_report_descriptor[] = {
-+0x06, 0x43, 0xFF, // Usage Page (Vendor Defined 0xFF43)
-+0x0A, 0x02, 0x02, // Usage (0x0202)
-+0xA1, 0x01, // Collection (Application)
-+0x85, 0x11, // Report ID (17)
-+0x15, 0x00, // Logical Minimum (0)
-+0x25, 0x01, // Logical Maximum (1)
-+0x35, 0x00, // Physical Minimum (0)
-+0x45, 0x01, // Physical Maximum (1)
-+0x65, 0x00, // Unit (None)
-+0x55, 0x00, // Unit Exponent (0)
-+0x75, 0x01, // Report Size (1)
-+0x95, 0x98, // Report Count (-104)
-+0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
-+0x91, 0x03, // Output (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
-+0xC1, 0x00, // End Collection
-+};
-+
- /* BIOMETRIC PRESENCE*/
- static const u8 hpd_report_descriptor[] = {
- 0x05, 0x20, /* Usage page */
-diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
-index d9e7cf6e4a0e..fcfe6dddd645 100644
---- a/drivers/platform/x86/asus-nb-wmi.c
-+++ b/drivers/platform/x86/asus-nb-wmi.c
-@@ -504,17 +504,8 @@ static void asus_nb_wmi_quirks(struct asus_wmi_driver *driver)
- else
- wapf = quirks->wapf;
-
-- switch (tablet_mode_sw) {
-- case 0:
-- quirks->tablet_switch_mode = asus_wmi_no_tablet_switch;
-- break;
-- case 1:
-- quirks->tablet_switch_mode = asus_wmi_kbd_dock_devid;
-- break;
-- case 2:
-- quirks->tablet_switch_mode = asus_wmi_lid_flip_devid;
-- break;
-- }
-+ if (tablet_mode_sw != -1)
-+ quirks->tablet_switch_mode = tablet_mode_sw;
-
- if (quirks->i8042_filter) {
- ret = i8042_install_filter(quirks->i8042_filter);
-@@ -586,6 +577,7 @@ static const struct key_entry asus_nb_wmi_keymap[] = {
- { KE_KEY, 0xA5, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + TV + HDMI */
- { KE_KEY, 0xA6, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT + TV + HDMI */
- { KE_KEY, 0xA7, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + CRT + TV + HDMI */
-+ { KE_KEY, 0xAE, { KEY_FN_F5 } }, /* Fn+F5 fan mode on 2020+ */
- { KE_KEY, 0xB3, { KEY_PROG4 } }, /* AURA */
- { KE_KEY, 0xB5, { KEY_CALC } },
- { KE_KEY, 0xC4, { KEY_KBDILLUMUP } },
-diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
-index dce93187e11f..40e911467037 100644
---- a/drivers/platform/x86/asus-wmi.c
-+++ b/drivers/platform/x86/asus-wmi.c
-@@ -72,6 +72,7 @@ module_param(fnlock_default, bool, 0444);
-
- #define ASUS_WMI_FNLOCK_BIOS_DISABLED BIT(0)
-
-+#define ASUS_GPU_FAN_DESC "gpu_fan"
- #define ASUS_FAN_DESC "cpu_fan"
- #define ASUS_FAN_MFUN 0x13
- #define ASUS_FAN_SFUN_READ 0x06
-@@ -222,19 +223,25 @@ struct asus_wmi {
- struct asus_rfkill gps;
- struct asus_rfkill uwb;
-
-+ int tablet_switch_event_code;
-+ u32 tablet_switch_dev_id;
-+
- enum fan_type fan_type;
-+ enum fan_type gpu_fan_type;
- int fan_pwm_mode;
-+ int gpu_fan_pwm_mode;
- int agfn_pwm;
-
- bool fan_boost_mode_available;
- u8 fan_boost_mode_mask;
- u8 fan_boost_mode;
-
-- bool egpu_enable_available; // 0 = enable
-- bool egpu_enable;
--
-+ bool egpu_enable_available;
- bool dgpu_disable_available;
-- bool dgpu_disable;
-+ bool gpu_mux_mode_available;
-+
-+ bool kbd_rgb_mode_available;
-+ bool kbd_rgb_state_available;
-
- bool throttle_thermal_policy_available;
- u8 throttle_thermal_policy_mode;
-@@ -250,7 +257,6 @@ struct asus_wmi {
- bool battery_rsoc_available;
-
- bool panel_overdrive_available;
-- bool panel_overdrive;
-
- struct hotplug_slot hotplug_slot;
- struct mutex hotplug_lock;
-@@ -487,13 +493,28 @@ static bool asus_wmi_dev_is_present(struct asus_wmi *asus, u32 dev_id)
- }
-
- /* Input **********************************************************************/
-+static void asus_wmi_tablet_sw_init(struct asus_wmi *asus, u32 dev_id, int event_code)
-+{
-+ struct device *dev = &asus->platform_device->dev;
-+ int result;
-+
-+ result = asus_wmi_get_devstate_simple(asus, dev_id);
-+ if (result >= 0) {
-+ input_set_capability(asus->inputdev, EV_SW, SW_TABLET_MODE);
-+ input_report_switch(asus->inputdev, SW_TABLET_MODE, result);
-+ asus->tablet_switch_dev_id = dev_id;
-+ asus->tablet_switch_event_code = event_code;
-+ } else if (result == -ENODEV) {
-+ dev_err(dev, "This device has tablet-mode-switch quirk but got ENODEV checking it. This is a bug.");
-+ } else {
-+ dev_err(dev, "Error checking for tablet-mode-switch: %d\n", result);
-+ }
-+}
-
- static int asus_wmi_input_init(struct asus_wmi *asus)
- {
-- struct device *dev;
-- int err, result;
--
-- dev = &asus->platform_device->dev;
-+ struct device *dev = &asus->platform_device->dev;
-+ int err;
-
- asus->inputdev = input_allocate_device();
- if (!asus->inputdev)
-@@ -513,39 +534,13 @@ static int asus_wmi_input_init(struct asus_wmi *asus)
- case asus_wmi_no_tablet_switch:
- break;
- case asus_wmi_kbd_dock_devid:
-- result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_KBD_DOCK);
-- if (result >= 0) {
-- input_set_capability(asus->inputdev, EV_SW, SW_TABLET_MODE);
-- input_report_switch(asus->inputdev, SW_TABLET_MODE, !result);
-- } else if (result != -ENODEV) {
-- dev_err(dev, "Error checking for keyboard-dock: %d\n", result);
-- }
-+ asus_wmi_tablet_sw_init(asus, ASUS_WMI_DEVID_KBD_DOCK, NOTIFY_KBD_DOCK_CHANGE);
- break;
- case asus_wmi_lid_flip_devid:
-- result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_LID_FLIP);
-- if (result < 0)
-- asus->driver->quirks->tablet_switch_mode = asus_wmi_no_tablet_switch;
-- if (result >= 0) {
-- input_set_capability(asus->inputdev, EV_SW, SW_TABLET_MODE);
-- input_report_switch(asus->inputdev, SW_TABLET_MODE, result);
-- } else if (result == -ENODEV) {
-- dev_err(dev, "This device has lid_flip quirk but got ENODEV checking it. This is a bug.");
-- } else {
-- dev_err(dev, "Error checking for lid-flip: %d\n", result);
-- }
-+ asus_wmi_tablet_sw_init(asus, ASUS_WMI_DEVID_LID_FLIP, NOTIFY_LID_FLIP);
- break;
- case asus_wmi_lid_flip_rog_devid:
-- result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_LID_FLIP_ROG);
-- if (result < 0)
-- asus->driver->quirks->tablet_switch_mode = asus_wmi_no_tablet_switch;
-- if (result >= 0) {
-- input_set_capability(asus->inputdev, EV_SW, SW_TABLET_MODE);
-- input_report_switch(asus->inputdev, SW_TABLET_MODE, result);
-- } else if (result == -ENODEV) {
-- dev_err(dev, "This device has lid-flip-rog quirk but got ENODEV checking it. This is a bug.");
-- } else {
-- dev_err(dev, "Error checking for lid-flip: %d\n", result);
-- }
-+ asus_wmi_tablet_sw_init(asus, ASUS_WMI_DEVID_LID_FLIP_ROG, NOTIFY_LID_FLIP_ROG);
- break;
- }
-
-@@ -570,22 +565,14 @@ static void asus_wmi_input_exit(struct asus_wmi *asus)
-
- /* Tablet mode ****************************************************************/
-
--static void lid_flip_tablet_mode_get_state(struct asus_wmi *asus)
-+static void asus_wmi_tablet_mode_get_state(struct asus_wmi *asus)
- {
- int result;
-
-- result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_LID_FLIP);
-- if (result >= 0) {
-- input_report_switch(asus->inputdev, SW_TABLET_MODE, result);
-- input_sync(asus->inputdev);
-- }
--}
--
--static void lid_flip_rog_tablet_mode_get_state(struct asus_wmi *asus)
--{
-- int result;
-+ if (!asus->tablet_switch_dev_id)
-+ return;
-
-- result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_LID_FLIP_ROG);
-+ result = asus_wmi_get_devstate_simple(asus, asus->tablet_switch_dev_id);
- if (result >= 0) {
- input_report_switch(asus->inputdev, SW_TABLET_MODE, result);
- input_sync(asus->inputdev);
-@@ -593,179 +580,267 @@ static void lid_flip_rog_tablet_mode_get_state(struct asus_wmi *asus)
- }
-
- /* dGPU ********************************************************************/
--static int dgpu_disable_check_present(struct asus_wmi *asus)
-+static ssize_t dgpu_disable_show(struct device *dev,
-+ struct device_attribute *attr, char *buf)
- {
-- u32 result;
-- int err;
--
-- asus->dgpu_disable_available = false;
--
-- err = asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_DGPU, &result);
-- if (err) {
-- if (err == -ENODEV)
-- return 0;
-- return err;
-- }
-+ struct asus_wmi *asus = dev_get_drvdata(dev);
-+ int result;
-
-- if (result & ASUS_WMI_DSTS_PRESENCE_BIT) {
-- asus->dgpu_disable_available = true;
-- asus->dgpu_disable = result & ASUS_WMI_DSTS_STATUS_BIT;
-- }
-+ result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_DGPU);
-+ if (result < 0)
-+ return result;
-
-- return 0;
-+ return sysfs_emit(buf, "%d\n", result);
- }
-
--static int dgpu_disable_write(struct asus_wmi *asus)
-+/*
-+ * A user may be required to store the value twice, typcial store first, then
-+ * rescan PCI bus to activate power, then store a second time to save correctly.
-+ * The reason for this is that an extra code path in the ACPI is enabled when
-+ * the device and bus are powered.
-+ */
-+static ssize_t dgpu_disable_store(struct device *dev,
-+ struct device_attribute *attr,
-+ const char *buf, size_t count)
- {
-- u32 retval;
-- u8 value;
-- int err;
-+ int result, err;
-+ u32 disable;
-
-- /* Don't rely on type conversion */
-- value = asus->dgpu_disable ? 1 : 0;
-+ struct asus_wmi *asus = dev_get_drvdata(dev);
-
-- err = asus_wmi_set_devstate(ASUS_WMI_DEVID_DGPU, value, &retval);
-+ result = kstrtou32(buf, 10, &disable);
-+ if (result)
-+ return result;
-+
-+ if (disable > 1)
-+ return -EINVAL;
-+
-+ err = asus_wmi_set_devstate(ASUS_WMI_DEVID_DGPU, disable, &result);
- if (err) {
- pr_warn("Failed to set dgpu disable: %d\n", err);
- return err;
- }
-
-- if (retval > 1) {
-- pr_warn("Failed to set dgpu disable (retval): 0x%x\n", retval);
-+ if (result > 1) {
-+ pr_warn("Failed to set dgpu disable (result): 0x%x\n", result);
- return -EIO;
- }
-
- sysfs_notify(&asus->platform_device->dev.kobj, NULL, "dgpu_disable");
-
-- return 0;
-+ return count;
- }
-+static DEVICE_ATTR_RW(dgpu_disable);
-
--static ssize_t dgpu_disable_show(struct device *dev,
-+/* eGPU ********************************************************************/
-+static ssize_t egpu_enable_show(struct device *dev,
- struct device_attribute *attr, char *buf)
- {
- struct asus_wmi *asus = dev_get_drvdata(dev);
-- u8 mode = asus->dgpu_disable;
-+ int result;
-
-- return sysfs_emit(buf, "%d\n", mode);
-+ result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_EGPU);
-+ if (result < 0)
-+ return result;
-+
-+ return sysfs_emit(buf, "%d\n", result);
- }
-
--/*
-- * A user may be required to store the value twice, typcial store first, then
-- * rescan PCI bus to activate power, then store a second time to save correctly.
-- * The reason for this is that an extra code path in the ACPI is enabled when
-- * the device and bus are powered.
-- */
--static ssize_t dgpu_disable_store(struct device *dev,
-+/* The ACPI call to enable the eGPU also disables the internal dGPU */
-+static ssize_t egpu_enable_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
- {
-- bool disable;
-- int result;
-+ int result, err;
-+ u32 enable;
-
- struct asus_wmi *asus = dev_get_drvdata(dev);
-
-- result = kstrtobool(buf, &disable);
-- if (result)
-- return result;
-+ err = kstrtou32(buf, 10, &enable);
-+ if (err)
-+ return err;
-
-- asus->dgpu_disable = disable;
-+ if (enable > 1)
-+ return -EINVAL;
-
-- result = dgpu_disable_write(asus);
-- if (result)
-- return result;
-+ err = asus_wmi_set_devstate(ASUS_WMI_DEVID_EGPU, enable, &result);
-+ if (err) {
-+ pr_warn("Failed to set egpu disable: %d\n", err);
-+ return err;
-+ }
-+
-+ if (result > 1) {
-+ pr_warn("Failed to set egpu disable (retval): 0x%x\n", result);
-+ return -EIO;
-+ }
-+
-+ sysfs_notify(&asus->platform_device->dev.kobj, NULL, "egpu_enable");
-
- return count;
- }
-+static DEVICE_ATTR_RW(egpu_enable);
-
--static DEVICE_ATTR_RW(dgpu_disable);
-+/* gpu mux switch *************************************************************/
-+static ssize_t gpu_mux_mode_show(struct device *dev,
-+ struct device_attribute *attr, char *buf)
-+{
-+ struct asus_wmi *asus = dev_get_drvdata(dev);
-+ int result;
-
--/* eGPU ********************************************************************/
--static int egpu_enable_check_present(struct asus_wmi *asus)
-+ result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_GPU_MUX);
-+ if (result < 0)
-+ return result;
-+
-+ return sysfs_emit(buf, "%d\n", result);
-+}
-+
-+static ssize_t gpu_mux_mode_store(struct device *dev,
-+ struct device_attribute *attr,
-+ const char *buf, size_t count)
- {
-- u32 result;
-- int err;
-+ struct asus_wmi *asus = dev_get_drvdata(dev);
-+ int result, err;
-+ u32 optimus;
-
-- asus->egpu_enable_available = false;
-+ err = kstrtou32(buf, 10, &optimus);
-+ if (err)
-+ return err;
-
-- err = asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_EGPU, &result);
-+ if (optimus > 1)
-+ return -EINVAL;
-+
-+ err = asus_wmi_set_devstate(ASUS_WMI_DEVID_GPU_MUX, optimus, &result);
- if (err) {
-- if (err == -ENODEV)
-- return 0;
-+ dev_err(dev, "Failed to set GPU MUX mode: %d\n", err);
- return err;
- }
--
-- if (result & ASUS_WMI_DSTS_PRESENCE_BIT) {
-- asus->egpu_enable_available = true;
-- asus->egpu_enable = result & ASUS_WMI_DSTS_STATUS_BIT;
-+ /* !1 is considered a fail by ASUS */
-+ if (result != 1) {
-+ dev_warn(dev, "Failed to set GPU MUX mode (result): 0x%x\n", result);
-+ return -EIO;
- }
-
-- return 0;
-+ sysfs_notify(&asus->platform_device->dev.kobj, NULL, "gpu_mux_mode");
-+
-+ return count;
- }
-+static DEVICE_ATTR_RW(gpu_mux_mode);
-
--static int egpu_enable_write(struct asus_wmi *asus)
-+/* TUF Laptop Keyboard RGB Modes **********************************************/
-+static ssize_t kbd_rgb_mode_store(struct device *dev,
-+ struct device_attribute *attr,
-+ const char *buf, size_t count)
- {
-- u32 retval;
-- u8 value;
-+ u32 cmd, mode, r, g, b, speed;
- int err;
-
-- /* Don't rely on type conversion */
-- value = asus->egpu_enable ? 1 : 0;
-+ if (sscanf(buf, "%d %d %d %d %d %d", &cmd, &mode, &r, &g, &b, &speed) != 6)
-+ return -EINVAL;
-
-- err = asus_wmi_set_devstate(ASUS_WMI_DEVID_EGPU, value, &retval);
-+ cmd = !!cmd;
-
-- if (err) {
-- pr_warn("Failed to set egpu disable: %d\n", err);
-- return err;
-- }
-+ /* These are the known usable modes across all TUF/ROG */
-+ if (mode >= 12 || mode == 9)
-+ mode = 10;
-
-- if (retval > 1) {
-- pr_warn("Failed to set egpu disable (retval): 0x%x\n", retval);
-- return -EIO;
-+ switch (speed) {
-+ case 0:
-+ speed = 0xe1;
-+ break;
-+ case 1:
-+ speed = 0xeb;
-+ break;
-+ case 2:
-+ speed = 0xf5;
-+ break;
-+ default:
-+ speed = 0xeb;
- }
-
-- sysfs_notify(&asus->platform_device->dev.kobj, NULL, "egpu_enable");
-+ err = asus_wmi_evaluate_method3(ASUS_WMI_METHODID_DEVS, ASUS_WMI_DEVID_TUF_RGB_MODE,
-+ cmd | (mode << 8) | (r << 16) | (g << 24), b | (speed << 8), NULL);
-+ if (err)
-+ return err;
-
-- return 0;
-+ return count;
- }
-+static DEVICE_ATTR_WO(kbd_rgb_mode);
-
--static ssize_t egpu_enable_show(struct device *dev,
-- struct device_attribute *attr, char *buf)
-+static ssize_t kbd_rgb_mode_index_show(struct device *device,
-+ struct device_attribute *attr,
-+ char *buf)
- {
-- struct asus_wmi *asus = dev_get_drvdata(dev);
-- bool mode = asus->egpu_enable;
--
-- return sysfs_emit(buf, "%d\n", mode);
-+ return sysfs_emit(buf, "%s\n", "cmd mode red green blue speed");
- }
-+static DEVICE_ATTR_RO(kbd_rgb_mode_index);
-
--/* The ACPI call to enable the eGPU also disables the internal dGPU */
--static ssize_t egpu_enable_store(struct device *dev,
-- struct device_attribute *attr,
-- const char *buf, size_t count)
--{
-- bool enable;
-- int result;
--
-- struct asus_wmi *asus = dev_get_drvdata(dev);
-+static struct attribute *kbd_rgb_mode_attrs[] = {
-+ &dev_attr_kbd_rgb_mode.attr,
-+ &dev_attr_kbd_rgb_mode_index.attr,
-+ NULL,
-+};
-
-- result = kstrtobool(buf, &enable);
-- if (result)
-- return result;
-+static const struct attribute_group kbd_rgb_mode_group = {
-+ .attrs = kbd_rgb_mode_attrs,
-+};
-
-- asus->egpu_enable = enable;
-+/* TUF Laptop Keyboard RGB State **********************************************/
-+static ssize_t kbd_rgb_state_store(struct device *dev,
-+ struct device_attribute *attr,
-+ const char *buf, size_t count)
-+{
-+ u32 flags, cmd, boot, awake, sleep, keyboard;
-+ int err;
-
-- result = egpu_enable_write(asus);
-- if (result)
-- return result;
-+ if (sscanf(buf, "%d %d %d %d %d", &cmd, &boot, &awake, &sleep, &keyboard) != 5)
-+ return -EINVAL;
-
-- /* Ensure that the kernel status of dgpu is updated */
-- result = dgpu_disable_check_present(asus);
-- if (result)
-- return result;
-+ if (cmd)
-+ cmd = BIT(2);
-+
-+ flags = 0;
-+ if (boot)
-+ flags |= BIT(1);
-+ if (awake)
-+ flags |= BIT(3);
-+ if (sleep)
-+ flags |= BIT(5);
-+ if (keyboard)
-+ flags |= BIT(7);
-+
-+ /* 0xbd is the required default arg0 for the method. Nothing happens otherwise */
-+ err = asus_wmi_evaluate_method3(ASUS_WMI_METHODID_DEVS,
-+ ASUS_WMI_DEVID_TUF_RGB_STATE, 0xbd | cmd << 8 | (flags << 16), 0, NULL);
-+ if (err)
-+ return err;
-
- return count;
- }
-+static DEVICE_ATTR_WO(kbd_rgb_state);
-
--static DEVICE_ATTR_RW(egpu_enable);
-+static ssize_t kbd_rgb_state_index_show(struct device *device,
-+ struct device_attribute *attr,
-+ char *buf)
-+{
-+ return sysfs_emit(buf, "%s\n", "cmd boot awake sleep keyboard");
-+}
-+static DEVICE_ATTR_RO(kbd_rgb_state_index);
-+
-+static struct attribute *kbd_rgb_state_attrs[] = {
-+ &dev_attr_kbd_rgb_state.attr,
-+ &dev_attr_kbd_rgb_state_index.attr,
-+ NULL,
-+};
-+
-+static const struct attribute_group kbd_rgb_state_group = {
-+ .attrs = kbd_rgb_state_attrs,
-+};
-+
-+const struct attribute_group *kbd_rgb_mode_groups[] = {
-+ NULL,
-+ NULL,
-+ NULL,
-+};
-
- /* Battery ********************************************************************/
-
-@@ -803,7 +878,7 @@ static ssize_t charge_control_end_threshold_show(struct device *device,
- struct device_attribute *attr,
- char *buf)
- {
-- return sprintf(buf, "%d\n", charge_end_threshold);
-+ return sysfs_emit(buf, "%d\n", charge_end_threshold);
- }
-
- static DEVICE_ATTR_RW(charge_control_end_threshold);
-@@ -1085,7 +1160,12 @@ static void asus_wmi_led_exit(struct asus_wmi *asus)
-
- static int asus_wmi_led_init(struct asus_wmi *asus)
- {
-- int rv = 0, led_val;
-+ int rv = 0, num_rgb_groups = 0, led_val;
-+
-+ if (asus->kbd_rgb_mode_available)
-+ kbd_rgb_mode_groups[num_rgb_groups++] = &kbd_rgb_mode_group;
-+ if (asus->kbd_rgb_state_available)
-+ kbd_rgb_mode_groups[num_rgb_groups++] = &kbd_rgb_state_group;
-
- asus->led_workqueue = create_singlethread_workqueue("led_workqueue");
- if (!asus->led_workqueue)
-@@ -1113,6 +1193,9 @@ static int asus_wmi_led_init(struct asus_wmi *asus)
- asus->kbd_led.brightness_get = kbd_led_get;
- asus->kbd_led.max_brightness = 3;
-
-+ if (num_rgb_groups != 0)
-+ asus->kbd_led.groups = kbd_rgb_mode_groups;
-+
- rv = led_classdev_register(&asus->platform_device->dev,
- &asus->kbd_led);
- if (rv)
-@@ -1587,84 +1670,51 @@ static int asus_wmi_rfkill_init(struct asus_wmi *asus)
- }
-
- /* Panel Overdrive ************************************************************/
--static int panel_od_check_present(struct asus_wmi *asus)
--{
-- u32 result;
-- int err;
--
-- asus->panel_overdrive_available = false;
--
-- err = asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_PANEL_OD, &result);
-- if (err) {
-- if (err == -ENODEV)
-- return 0;
-- return err;
-- }
--
-- if (result & ASUS_WMI_DSTS_PRESENCE_BIT) {
-- asus->panel_overdrive_available = true;
-- asus->panel_overdrive = result & ASUS_WMI_DSTS_STATUS_BIT;
-- }
--
-- return 0;
--}
--
--static int panel_od_write(struct asus_wmi *asus)
--{
-- u32 retval;
-- u8 value;
-- int err;
--
-- /* Don't rely on type conversion */
-- value = asus->panel_overdrive ? 1 : 0;
--
-- err = asus_wmi_set_devstate(ASUS_WMI_DEVID_PANEL_OD, value, &retval);
--
-- if (err) {
-- pr_warn("Failed to set panel overdrive: %d\n", err);
-- return err;
-- }
--
-- if (retval > 1) {
-- pr_warn("Failed to set panel overdrive (retval): 0x%x\n", retval);
-- return -EIO;
-- }
--
-- sysfs_notify(&asus->platform_device->dev.kobj, NULL, "panel_od");
--
-- return 0;
--}
--
- static ssize_t panel_od_show(struct device *dev,
- struct device_attribute *attr, char *buf)
- {
- struct asus_wmi *asus = dev_get_drvdata(dev);
-+ int result;
-
-- return sysfs_emit(buf, "%d\n", asus->panel_overdrive);
-+ result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_PANEL_OD);
-+ if (result < 0)
-+ return result;
-+
-+ return sysfs_emit(buf, "%d\n", result);
- }
-
- static ssize_t panel_od_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
- {
-- bool overdrive;
-- int result;
-+ int result, err;
-+ u32 overdrive;
-
- struct asus_wmi *asus = dev_get_drvdata(dev);
-
-- result = kstrtobool(buf, &overdrive);
-+ result = kstrtou32(buf, 10, &overdrive);
- if (result)
- return result;
-
-- asus->panel_overdrive = overdrive;
-- result = panel_od_write(asus);
-+ if (overdrive > 1)
-+ return -EINVAL;
-
-- if (result)
-- return result;
-+ err = asus_wmi_set_devstate(ASUS_WMI_DEVID_PANEL_OD, overdrive, &result);
-+
-+ if (err) {
-+ pr_warn("Failed to set panel overdrive: %d\n", err);
-+ return err;
-+ }
-+
-+ if (result > 1) {
-+ pr_warn("Failed to set panel overdrive (result): 0x%x\n", result);
-+ return -EIO;
-+ }
-+
-+ sysfs_notify(&asus->platform_device->dev.kobj, NULL, "panel_od");
-
- return count;
- }
--
- static DEVICE_ATTR_RW(panel_od);
-
- /* Quirks *********************************************************************/
-@@ -1816,6 +1866,18 @@ static int asus_fan_set_auto(struct asus_wmi *asus)
- return -ENXIO;
- }
-
-+ /*
-+ * Modern models like the G713 also have GPU fan control (this is not AGFN)
-+ */
-+ if (asus->gpu_fan_type == FAN_TYPE_SPEC83) {
-+ status = asus_wmi_set_devstate(ASUS_WMI_DEVID_GPU_FAN_CTRL,
-+ 0, &retval);
-+ if (status)
-+ return status;
-+
-+ if (retval != 1)
-+ return -EIO;
-+ }
-
- return 0;
- }
-@@ -1853,7 +1915,7 @@ static ssize_t pwm1_show(struct device *dev,
- value = -1;
- }
-
-- return sprintf(buf, "%d\n", value);
-+ return sysfs_emit(buf, "%d\n", value);
- }
-
- static ssize_t pwm1_store(struct device *dev,
-@@ -1913,7 +1975,7 @@ static ssize_t fan1_input_show(struct device *dev,
- return -ENXIO;
- }
-
-- return sprintf(buf, "%d\n", value < 0 ? -1 : value*100);
-+ return sysfs_emit(buf, "%d\n", value < 0 ? -1 : value * 100);
- }
-
- static ssize_t pwm1_enable_show(struct device *dev,
-@@ -1931,7 +1993,7 @@ static ssize_t pwm1_enable_show(struct device *dev,
- * in practice on X532FL at least (the bit is always 0) and there's
- * also nothing in the DSDT to indicate that this behaviour exists.
- */
-- return sprintf(buf, "%d\n", asus->fan_pwm_mode);
-+ return sysfs_emit(buf, "%d\n", asus->fan_pwm_mode);
- }
-
- static ssize_t pwm1_enable_store(struct device *dev,
-@@ -1999,7 +2061,7 @@ static ssize_t fan1_label_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
- {
-- return sprintf(buf, "%s\n", ASUS_FAN_DESC);
-+ return sysfs_emit(buf, "%s\n", ASUS_FAN_DESC);
- }
-
- static ssize_t asus_hwmon_temp1(struct device *dev,
-@@ -2018,11 +2080,86 @@ static ssize_t asus_hwmon_temp1(struct device *dev,
- deci_kelvin_to_millicelsius(value & 0xFFFF));
- }
-
-+/* GPU fan on modern ROG laptops */
-+static ssize_t fan2_input_show(struct device *dev,
-+ struct device_attribute *attr,
-+ char *buf)
-+{
-+ struct asus_wmi *asus = dev_get_drvdata(dev);
-+ int value;
-+ int ret;
-+
-+ ret = asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_GPU_FAN_CTRL, &value);
-+ if (ret < 0)
-+ return ret;
-+
-+ value &= 0xffff;
-+
-+ return sysfs_emit(buf, "%d\n", value < 0 ? -1 : value * 100);
-+}
-+
-+static ssize_t fan2_label_show(struct device *dev,
-+ struct device_attribute *attr,
-+ char *buf)
-+{
-+ return sprintf(buf, "%s\n", ASUS_GPU_FAN_DESC);
-+}
-+
-+static ssize_t pwm2_enable_show(struct device *dev,
-+ struct device_attribute *attr,
-+ char *buf)
-+{
-+ struct asus_wmi *asus = dev_get_drvdata(dev);
-+
-+ return sysfs_emit(buf, "%d\n", asus->gpu_fan_pwm_mode);
-+}
-+
-+static ssize_t pwm2_enable_store(struct device *dev,
-+ struct device_attribute *attr,
-+ const char *buf, size_t count)
-+{
-+ struct asus_wmi *asus = dev_get_drvdata(dev);
-+ int state;
-+ int value;
-+ int ret;
-+ u32 retval;
-+
-+ ret = kstrtouint(buf, 10, &state);
-+ if (ret)
-+ return ret;
-+
-+ switch (state) { /* standard documented hwmon values */
-+ case ASUS_FAN_CTRL_FULLSPEED:
-+ value = 1;
-+ break;
-+ case ASUS_FAN_CTRL_AUTO:
-+ value = 0;
-+ break;
-+ default:
-+ return -EINVAL;
-+ }
-+
-+ ret = asus_wmi_set_devstate(ASUS_WMI_DEVID_GPU_FAN_CTRL,
-+ value, &retval);
-+ if (ret)
-+ return ret;
-+
-+ if (retval != 1)
-+ return -EIO;
-+
-+ asus->gpu_fan_pwm_mode = state;
-+ return count;
-+}
-+
- /* Fan1 */
- static DEVICE_ATTR_RW(pwm1);
- static DEVICE_ATTR_RW(pwm1_enable);
- static DEVICE_ATTR_RO(fan1_input);
- static DEVICE_ATTR_RO(fan1_label);
-+/* Fan2 - GPU fan */
-+static DEVICE_ATTR_RW(pwm2_enable);
-+static DEVICE_ATTR_RO(fan2_input);
-+static DEVICE_ATTR_RO(fan2_label);
-
- /* Temperature */
- static DEVICE_ATTR(temp1_input, S_IRUGO, asus_hwmon_temp1, NULL);
-@@ -2030,8 +2167,11 @@ static DEVICE_ATTR(temp1_input, S_IRUGO, asus_hwmon_temp1, NULL);
- static struct attribute *hwmon_attributes[] = {
- &dev_attr_pwm1.attr,
- &dev_attr_pwm1_enable.attr,
-+ &dev_attr_pwm2_enable.attr,
- &dev_attr_fan1_input.attr,
- &dev_attr_fan1_label.attr,
-+ &dev_attr_fan2_input.attr,
-+ &dev_attr_fan2_label.attr,
-
- &dev_attr_temp1_input.attr,
- NULL
-@@ -2040,7 +2180,7 @@ static struct attribute *hwmon_attributes[] = {
- static umode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj,
- struct attribute *attr, int idx)
- {
-- struct device *dev = container_of(kobj, struct device, kobj);
-+ struct device *dev = kobj_to_dev(kobj);
- struct asus_wmi *asus = dev_get_drvdata(dev->parent);
- u32 value = ASUS_WMI_UNSUPPORTED_METHOD;
-
-@@ -2052,6 +2192,11 @@ static umode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj,
- || attr == &dev_attr_pwm1_enable.attr) {
- if (asus->fan_type == FAN_TYPE_NONE)
- return 0;
-+ } else if (attr == &dev_attr_fan2_input.attr
-+ || attr == &dev_attr_fan2_label.attr
-+ || attr == &dev_attr_pwm2_enable.attr) {
-+ if (asus->gpu_fan_type == FAN_TYPE_NONE)
-+ return 0;
- } else if (attr == &dev_attr_temp1_input.attr) {
- int err = asus_wmi_get_devstate(asus,
- ASUS_WMI_DEVID_THERMAL_CTRL,
-@@ -2094,6 +2239,7 @@ static int asus_wmi_hwmon_init(struct asus_wmi *asus)
-
- static int asus_wmi_fan_init(struct asus_wmi *asus)
- {
-+ asus->gpu_fan_type = FAN_TYPE_NONE;
- asus->fan_type = FAN_TYPE_NONE;
- asus->agfn_pwm = -1;
-
-@@ -2102,6 +2248,10 @@ static int asus_wmi_fan_init(struct asus_wmi *asus)
- else if (asus_wmi_has_agfn_fan(asus))
- asus->fan_type = FAN_TYPE_AGFN;
-
-+ /* Modern models like G713 also have GPU fan control */
-+ if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_GPU_FAN_CTRL))
-+ asus->gpu_fan_type = FAN_TYPE_SPEC83;
-+
- if (asus->fan_type == FAN_TYPE_NONE)
- return -ENODEV;
-
-@@ -2192,7 +2342,7 @@ static ssize_t fan_boost_mode_show(struct device *dev,
- {
- struct asus_wmi *asus = dev_get_drvdata(dev);
-
-- return scnprintf(buf, PAGE_SIZE, "%d\n", asus->fan_boost_mode);
-+ return sysfs_emit(buf, "%d\n", asus->fan_boost_mode);
- }
-
- static ssize_t fan_boost_mode_store(struct device *dev,
-@@ -2744,7 +2894,7 @@ static ssize_t throttle_thermal_policy_show(struct device *dev,
- struct asus_wmi *asus = dev_get_drvdata(dev);
- u8 mode = asus->throttle_thermal_policy_mode;
-
-- return scnprintf(buf, PAGE_SIZE, "%d\n", mode);
-+ return sysfs_emit(buf, "%d\n", mode);
- }
-
- static ssize_t throttle_thermal_policy_store(struct device *dev,
-@@ -3096,9 +3246,7 @@ static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus)
- {
- unsigned int key_value = 1;
- bool autorelease = 1;
-- int result, orig_code;
--
-- orig_code = code;
-+ int orig_code = code;
-
- if (asus->driver->key_filter) {
- asus->driver->key_filter(asus->driver, &code, &key_value,
-@@ -3141,38 +3289,18 @@ static void asus_wmi_handle_event_code(int code, struct asus_wmi *asus)
- return;
- }
-
-- if (asus->driver->quirks->tablet_switch_mode == asus_wmi_kbd_dock_devid &&
-- code == NOTIFY_KBD_DOCK_CHANGE) {
-- result = asus_wmi_get_devstate_simple(asus,
-- ASUS_WMI_DEVID_KBD_DOCK);
-- if (result >= 0) {
-- input_report_switch(asus->inputdev, SW_TABLET_MODE,
-- !result);
-- input_sync(asus->inputdev);
-- }
-- return;
-- }
--
-- if (asus->driver->quirks->tablet_switch_mode == asus_wmi_lid_flip_devid &&
-- code == NOTIFY_LID_FLIP) {
-- lid_flip_tablet_mode_get_state(asus);
-- return;
-- }
--
-- if (asus->driver->quirks->tablet_switch_mode == asus_wmi_lid_flip_rog_devid &&
-- code == NOTIFY_LID_FLIP_ROG) {
-- lid_flip_rog_tablet_mode_get_state(asus);
-+ if (code == asus->tablet_switch_event_code) {
-+ asus_wmi_tablet_mode_get_state(asus);
- return;
- }
-
-- if (asus->fan_boost_mode_available && code == NOTIFY_KBD_FBM) {
-- fan_boost_mode_switch_next(asus);
-+ if (code == NOTIFY_KBD_FBM || code == NOTIFY_KBD_TTP) {
-+ if (asus->fan_boost_mode_available)
-+ fan_boost_mode_switch_next(asus);
-+ if (asus->throttle_thermal_policy_available)
-+ throttle_thermal_policy_switch_next(asus);
- return;
-- }
-
-- if (asus->throttle_thermal_policy_available && code == NOTIFY_KBD_TTP) {
-- throttle_thermal_policy_switch_next(asus);
-- return;
- }
-
- if (is_display_toggle(code) && asus->driver->quirks->no_display_toggle)
-@@ -3324,6 +3452,7 @@ static struct attribute *platform_attributes[] = {
- &dev_attr_touchpad.attr,
- &dev_attr_egpu_enable.attr,
- &dev_attr_dgpu_disable.attr,
-+ &dev_attr_gpu_mux_mode.attr,
- &dev_attr_lid_resume.attr,
- &dev_attr_als_enable.attr,
- &dev_attr_fan_boost_mode.attr,
-@@ -3335,7 +3464,7 @@ static struct attribute *platform_attributes[] = {
- static umode_t asus_sysfs_is_visible(struct kobject *kobj,
- struct attribute *attr, int idx)
- {
-- struct device *dev = container_of(kobj, struct device, kobj);
-+ struct device *dev = kobj_to_dev(kobj);
- struct asus_wmi *asus = dev_get_drvdata(dev);
- bool ok = true;
- int devid = -1;
-@@ -3354,6 +3483,10 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj,
- ok = asus->egpu_enable_available;
- else if (attr == &dev_attr_dgpu_disable.attr)
- ok = asus->dgpu_disable_available;
-+ else if (attr == &dev_attr_dgpu_disable.attr)
-+ ok = asus->dgpu_disable_available;
-+ else if (attr == &dev_attr_gpu_mux_mode.attr)
-+ ok = asus->gpu_mux_mode_available;
- else if (attr == &dev_attr_fan_boost_mode.attr)
- ok = asus->fan_boost_mode_available;
- else if (attr == &dev_attr_throttle_thermal_policy.attr)
-@@ -3615,13 +3748,12 @@ static int asus_wmi_add(struct platform_device *pdev)
- if (err)
- goto fail_platform;
-
-- err = egpu_enable_check_present(asus);
-- if (err)
-- goto fail_egpu_enable;
--
-- err = dgpu_disable_check_present(asus);
-- if (err)
-- goto fail_dgpu_disable;
-+ 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->gpu_mux_mode_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_GPU_MUX);
-+ asus->kbd_rgb_mode_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_MODE);
-+ asus->kbd_rgb_state_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_STATE);
-+ asus->panel_overdrive_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PANEL_OD);
-
- err = fan_boost_mode_check_present(asus);
- if (err)
-@@ -3637,10 +3769,6 @@ static int asus_wmi_add(struct platform_device *pdev)
- if (err)
- goto fail_platform_profile_setup;
-
-- err = panel_od_check_present(asus);
-- if (err)
-- goto fail_panel_od;
--
- err = asus_wmi_sysfs_init(asus->platform_device);
- if (err)
- goto fail_sysfs;
-@@ -3735,10 +3863,7 @@ static int asus_wmi_add(struct platform_device *pdev)
- if (asus->platform_profile_support)
- platform_profile_remove();
- fail_fan_boost_mode:
--fail_egpu_enable:
--fail_dgpu_disable:
- fail_platform:
--fail_panel_od:
- kfree(asus);
- return err;
- }
-@@ -3797,18 +3922,7 @@ static int asus_hotk_resume(struct device *device)
- if (asus_wmi_has_fnlock_key(asus))
- asus_wmi_fnlock_update(asus);
-
-- switch (asus->driver->quirks->tablet_switch_mode) {
-- case asus_wmi_no_tablet_switch:
-- case asus_wmi_kbd_dock_devid:
-- break;
-- case asus_wmi_lid_flip_devid:
-- lid_flip_tablet_mode_get_state(asus);
-- break;
-- case asus_wmi_lid_flip_rog_devid:
-- lid_flip_rog_tablet_mode_get_state(asus);
-- break;
-- }
--
-+ asus_wmi_tablet_mode_get_state(asus);
- return 0;
- }
-
-@@ -3848,18 +3962,7 @@ static int asus_hotk_restore(struct device *device)
- if (asus_wmi_has_fnlock_key(asus))
- asus_wmi_fnlock_update(asus);
-
-- switch (asus->driver->quirks->tablet_switch_mode) {
-- case asus_wmi_no_tablet_switch:
-- case asus_wmi_kbd_dock_devid:
-- break;
-- case asus_wmi_lid_flip_devid:
-- lid_flip_tablet_mode_get_state(asus);
-- break;
-- case asus_wmi_lid_flip_rog_devid:
-- lid_flip_rog_tablet_mode_get_state(asus);
-- break;
-- }
--
-+ asus_wmi_tablet_mode_get_state(asus);
- return 0;
- }
-
-diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h
-index 7c96db7f3060..28234dc9fa6a 100644
---- a/include/linux/platform_data/x86/asus-wmi.h
-+++ b/include/linux/platform_data/x86/asus-wmi.h
-@@ -79,6 +79,7 @@
- #define ASUS_WMI_DEVID_THERMAL_CTRL 0x00110011
- #define ASUS_WMI_DEVID_FAN_CTRL 0x00110012 /* deprecated */
- #define ASUS_WMI_DEVID_CPU_FAN_CTRL 0x00110013
-+#define ASUS_WMI_DEVID_GPU_FAN_CTRL 0x00110014
- #define ASUS_WMI_DEVID_CPU_FAN_CURVE 0x00110024
- #define ASUS_WMI_DEVID_GPU_FAN_CURVE 0x00110025
-
-@@ -100,6 +101,15 @@
- /* dgpu on/off */
- #define ASUS_WMI_DEVID_DGPU 0x00090020
-
-+/* gpu mux switch, 0 = dGPU, 1 = Optimus */
-+#define ASUS_WMI_DEVID_GPU_MUX 0x00090016
-+
-+/* TUF laptop RGB modes/colours */
-+#define ASUS_WMI_DEVID_TUF_RGB_MODE 0x00100056
-+
-+/* TUF laptop RGB power/state */
-+#define ASUS_WMI_DEVID_TUF_RGB_STATE 0x00100057
-+
- /* DSTS masks */
- #define ASUS_WMI_DSTS_STATUS_BIT 0x00000001
- #define ASUS_WMI_DSTS_UNKNOWN_BIT 0x00000002
---
-2.38.1
-
diff --git a/SOURCES/linux-surface.patch b/SOURCES/linux-surface.patch
index 6f10208..a4606e6 100644
--- a/SOURCES/linux-surface.patch
+++ b/SOURCES/linux-surface.patch
@@ -1,4 +1,4 @@
-From b1ce7e2a0ea543867d0aa1dd7a5d23dad9336a73 Mon Sep 17 00:00:00 2001
+From 19b8ce192055bdeca49b476a88bd5d694c54bbf7 Mon Sep 17 00:00:00 2001
From: Tsuchiya Yuto <kitakar@gmail.com>
Date: Sun, 18 Oct 2020 16:42:44 +0900
Subject: [PATCH] (surface3-oemb) add DMI matches for Surface 3 with broken DMI
@@ -99,7 +99,7 @@ index 6beb00858c33..d82d77387a0a 100644
--
2.39.0
-From f68e13904fe89824383047ad407cdf2868c0c644 Mon Sep 17 00:00:00 2001
+From ab8029b679353ff413840f06959039119731599a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
Date: Tue, 3 Nov 2020 13:28:04 +0100
Subject: [PATCH] mwifiex: Add quirk resetting the PCI bridge on MS Surface
@@ -266,7 +266,7 @@ index d6ff964aec5b..5d30ae39d65e 100644
--
2.39.0
-From 14ecac240936e807dd2366c70cdf9d108a5b8f40 Mon Sep 17 00:00:00 2001
+From 38ad493a42fa7e93cee10d17640a39eea0ecba97 Mon Sep 17 00:00:00 2001
From: Tsuchiya Yuto <kitakar@gmail.com>
Date: Sun, 4 Oct 2020 00:11:49 +0900
Subject: [PATCH] mwifiex: pcie: disable bridge_d3 for Surface gen4+
@@ -421,7 +421,7 @@ index 5d30ae39d65e..c14eb56eb911 100644
--
2.39.0
-From 2aa594c47d5d32cba044b4b249c7b191d4c5c2e3 Mon Sep 17 00:00:00 2001
+From 73bd3c344cd15dad5095585d51d0f07a7ae0eaf5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
Date: Thu, 25 Mar 2021 11:33:02 +0100
Subject: [PATCH] Bluetooth: btusb: Lower passive lescan interval on Marvell
@@ -499,7 +499,7 @@ index 6beafd62d722..633f77fb4f96 100644
--
2.39.0
-From 272e87cedc1e0b5c51e54c99e36f667c731d0dbb Mon Sep 17 00:00:00 2001
+From 8516237f9b2afa49f7b8f1d9e5ffc5be4a83c512 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 27 Feb 2021 00:45:52 +0100
Subject: [PATCH] ath10k: Add module parameters to override board files
@@ -620,7 +620,7 @@ index 5eb131ab916f..67f074a126d1 100644
--
2.39.0
-From 6152dcef77a334b7844aa565275902111194a78f Mon Sep 17 00:00:00 2001
+From 42fabf8dcff992959f7e261a13779ba9eb757780 Mon Sep 17 00:00:00 2001
From: Dorian Stoll <dorian.stoll@tmsp.io>
Date: Thu, 30 Jul 2020 13:21:53 +0200
Subject: [PATCH] misc: mei: Add missing IPTS device IDs
@@ -658,7 +658,7 @@ index 704cd0caa172..b4dc3fddd20d 100644
--
2.39.0
-From 81499f96035b9144633c1dd0942610ad9f4b0dce Mon Sep 17 00:00:00 2001
+From 72fed1d44ac9a6ba0669e20fd617b6330af1634e Mon Sep 17 00:00:00 2001
From: Dorian Stoll <dorian.stoll@tmsp.io>
Date: Thu, 6 Aug 2020 11:20:41 +0200
Subject: [PATCH] misc: Add support for Intel Precise Touch & Stylus
@@ -2123,7 +2123,7 @@ index 000000000000..53fb86a88f97
--
2.39.0
-From 1b39126e5e54ffd417c985ca1e08736fca1a51ee Mon Sep 17 00:00:00 2001
+From e3eebbc271fccaa8579b04b340f4b4b01d54ec61 Mon Sep 17 00:00:00 2001
From: Liban Hannan <liban.p@gmail.com>
Date: Tue, 12 Apr 2022 23:31:12 +0100
Subject: [PATCH] iommu: ipts: use IOMMU passthrough mode for IPTS
@@ -2223,7 +2223,7 @@ index 644ca49e8cf8..408c321b929a 100644
--
2.39.0
-From cb437b5308cb73255a86b0a6f1f5e1178d8533f0 Mon Sep 17 00:00:00 2001
+From 9e44cdad03a46c1f08f3be86173c118c6db561c6 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 5 Nov 2022 21:23:53 +0100
Subject: [PATCH] platform/surface: aggregator: Improve documentation and
@@ -2486,7 +2486,7 @@ index 45501b6e54e8..5c4ae1a26183 100644
--
2.39.0
-From e925dfd94cac673e7327260fd876a96e6fbb50a0 Mon Sep 17 00:00:00 2001
+From 29ac02c869e3070532fa9f6a947dbde5125afe2d Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 5 Nov 2022 21:30:58 +0100
Subject: [PATCH] platform/surface: aggregator: Ignore command messages not
@@ -2534,32 +2534,28 @@ diff --git a/drivers/platform/surface/aggregator/ssh_request_layer.c b/drivers/p
index f5565570f16c..90634dcacabf 100644
--- a/drivers/platform/surface/aggregator/ssh_request_layer.c
+++ b/drivers/platform/surface/aggregator/ssh_request_layer.c
-@@ -916,6 +916,21 @@ static void ssh_rtl_rx_command(struct ssh_ptl *p, const struct ssam_span *data)
- if (sshp_parse_command(dev, data, &command, &command_data))
+@@ -920,13 +920,13 @@
+ * Check if the message was intended for us. If not, drop it.
+ *
+ * Note: We will need to change this to handle debug messages. On newer
+- * generation devices, these seem to be sent to tid_out=0x03. We as
++ * generation devices, these seem to be sent to SSAM_SSH_TID_DEBUG. We as
+ * host can still receive them as they can be forwarded via an override
+- * option on SAM, but doing so does not change tid_out=0x00.
++ * option on SAM, but doing so does not change the target ID to SSAM_SSH_TID_HOST.
+ */
+- if (command->tid_out != 0x00) {
++ if (command->tid != 0x00) {
+ rtl_warn(rtl, "rtl: dropping message not intended for us (tid = %#04x)\n",
+- command->tid_out);
++ command->tid);
return;
+ }
-+ /*
-+ * Check if the message was intended for us. If not, drop it.
-+ *
-+ * Note: We will need to change this to handle debug messages. On newer
-+ * generation devices, these seem to be sent to SSAM_SSH_TID_DEBUG. We
-+ * as host can still receive them as they can be forwarded via an
-+ * override option on SAM, but doing so does not change the target ID
-+ * to SSAM_SSH_TID_HOST.
-+ */
-+ if (command->tid != SSAM_SSH_TID_HOST) {
-+ rtl_warn(rtl, "rtl: dropping message not intended for us (tid = %#04x)\n",
-+ command->tid);
-+ return;
-+ }
-+
- if (ssh_rqid_is_event(get_unaligned_le16(&command->rqid)))
- ssh_rtl_rx_event(rtl, command, &command_data);
- else
--
2.39.0
-From ff41cec74dd5826fd4ea5b8f6627bfbe3743e1e6 Mon Sep 17 00:00:00 2001
+From 7b80425cbcee6aeac0cf312367c1f98df72f2093 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 5 Nov 2022 21:42:19 +0100
Subject: [PATCH] platform/surface: aggregator: Add target and source IDs to
@@ -2753,7 +2749,7 @@ index 2a2c17771d01..55cc61bba1da 100644
--
2.39.0
-From 698898dad24512d70a21ab78844e617486028a25 Mon Sep 17 00:00:00 2001
+From 28f119067bd5982c043f3822b01a864e60d6ec54 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 5 Nov 2022 21:32:16 +0100
Subject: [PATCH] platform/surface: aggregator_hub: Use target-ID enum instead
@@ -2793,7 +2789,7 @@ index 43061514be38..62f27cdb6ca8 100644
--
2.39.0
-From 3c5d1c4ef943afa97f68879843797aff93f62395 Mon Sep 17 00:00:00 2001
+From e9cc6b4179e0e913d5203273742b0ad40f9da048 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 5 Nov 2022 21:33:26 +0100
Subject: [PATCH] platform/surface: aggregator_tabletsw: Use target-ID enum
@@ -2842,7 +2838,7 @@ index 27d95a6a7851..bd8cd453c393 100644
--
2.39.0
-From cbe57259ff7b94af0ae62170a9814594fe1f6705 Mon Sep 17 00:00:00 2001
+From 118efac5894275e2910b1e6a7764da49ef78a017 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 5 Nov 2022 21:34:06 +0100
Subject: [PATCH] platform/surface: dtx: Use target-ID enum instead of
@@ -2937,7 +2933,7 @@ index ed36944467f9..0de76a784a35 100644
--
2.39.0
-From f79e434b9f3851364689210195aea86a1720c466 Mon Sep 17 00:00:00 2001
+From 1bf091f4db2f290dc82252ae0479f92e37dc87b0 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 5 Nov 2022 21:40:06 +0100
Subject: [PATCH] HID: surface-hid: Use target-ID enum instead of hard-coding
@@ -2968,7 +2964,7 @@ index 0635341bc517..42933bf3e925 100644
--
2.39.0
-From 495ca177f24e437bfd86c75057f120e4c836149c Mon Sep 17 00:00:00 2001
+From 9530d700f41edbddd880d2bec9e3b6547de811f3 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 5 Nov 2022 21:45:28 +0100
Subject: [PATCH] platform/surface: aggregator: Enforce use of target-ID enum
@@ -3200,7 +3196,7 @@ index 46c45d1b6368..4da20b7a0ee5 100644
--
2.39.0
-From edf30b3b5d55e5b3d8064d2edc60b594fe684a3b Mon Sep 17 00:00:00 2001
+From f905337cf4c31e3cc429b94ab9586b370b882c23 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 5 Nov 2022 21:46:37 +0100
Subject: [PATCH] platform/surface: aggregator_registry: Fix target-ID of
@@ -3247,7 +3243,7 @@ index 023f126121d7..296f72d52e6a 100644
--
2.39.0
-From 0d55229782727243733f867a6b8148276d63fdd3 Mon Sep 17 00:00:00 2001
+From e17056688f8040ace8f60ee7a5ebc4e196ae6b0d Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 25 Jul 2020 17:19:53 +0200
Subject: [PATCH] i2c: acpi: Implement RawBytes read access
@@ -3359,7 +3355,7 @@ index 4dd777cc0c89..b2338618163a 100644
--
2.39.0
-From f65d13f177fe2c309ad238254caaae4e4312cefd Mon Sep 17 00:00:00 2001
+From 725ce85d616e7b985208e32426c41a95a33c4005 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Sat, 13 Feb 2021 16:41:18 +0100
Subject: [PATCH] platform/surface: Add driver for Surface Book 1 dGPU switch
@@ -3582,7 +3578,7 @@ index 000000000000..8b816ed8f35c
--
2.39.0
-From 183996b2e1e626c5c40a986fa25084b11429daa5 Mon Sep 17 00:00:00 2001
+From 0f45b177ca4e7d9b62c0f7572e273104fe93f274 Mon Sep 17 00:00:00 2001
From: Sachi King <nakato@nakato.io>
Date: Tue, 5 Oct 2021 00:05:09 +1100
Subject: [PATCH] Input: soc_button_array - support AMD variant Surface devices
@@ -3659,7 +3655,7 @@ index 09489380afda..0f02411a60f1 100644
--
2.39.0
-From 87897dbc255aaac49a53478463e1f7d23f3e5622 Mon Sep 17 00:00:00 2001
+From bff73a6735c9eba68a048fa321c371714d5817f6 Mon Sep 17 00:00:00 2001
From: Sachi King <nakato@nakato.io>
Date: Tue, 5 Oct 2021 00:22:57 +1100
Subject: [PATCH] platform/surface: surfacepro3_button: don't load on amd
@@ -3731,7 +3727,7 @@ index 242fb690dcaf..30eea54dbb47 100644
--
2.39.0
-From 172e2d4a0907bdf22b8bc6d7468c96481a7f355a Mon Sep 17 00:00:00 2001
+From dc3a1664b024f9f8051f65ee84edf5391460dbc4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= <verdre@v0yd.nl>
Date: Thu, 5 Nov 2020 13:09:45 +0100
Subject: [PATCH] hid/multitouch: Turn off Type Cover keyboard backlight when
@@ -3964,7 +3960,7 @@ index 372cbdd223e0..fe849df6a948 100644
--
2.39.0
-From 0a6239b736a59c94c1039d2c1fc553e450b3f721 Mon Sep 17 00:00:00 2001
+From 88620b36eb8e96c20001aaeda03ad290cbabf43e Mon Sep 17 00:00:00 2001
From: PJungkamp <p.jungkamp@gmail.com>
Date: Fri, 25 Feb 2022 12:04:25 +0100
Subject: [PATCH] hid/multitouch: Add support for surface pro type cover tablet
@@ -4264,7 +4260,7 @@ index fe849df6a948..3a7a43eb9fbe 100644
--
2.39.0
-From dd4e87b9c7f4930a07b93c73b4d85de6282c9910 Mon Sep 17 00:00:00 2001
+From d7034b752abab1bc8bbeae6bec214434a59e9a43 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Sun, 10 Oct 2021 20:56:57 +0200
Subject: [PATCH] ACPI: delay enumeration of devices with a _DEP pointing to an
@@ -4340,7 +4336,7 @@ index b47e93a24a9a..22c921886cbe 100644
--
2.39.0
-From 04d727b390677c247ce35cd3c459a9706c92149b Mon Sep 17 00:00:00 2001
+From b7ae48c658abca801fb92cc6c734a3e3726ede8a Mon Sep 17 00:00:00 2001
From: zouxiaoh <xiaohong.zou@intel.com>
Date: Fri, 25 Jun 2021 08:52:59 +0800
Subject: [PATCH] iommu: intel-ipu: use IOMMU passthrough mode for Intel IPUs
@@ -4457,7 +4453,7 @@ index 408c321b929a..6e58effbe12b 100644
--
2.39.0
-From aab7172afbd549a758e01f936b9a6683ba59b474 Mon Sep 17 00:00:00 2001
+From b8246f77d572fe16b5cd53acf2473cb6eddcaddc Mon Sep 17 00:00:00 2001
From: Daniel Scally <djrscally@gmail.com>
Date: Sun, 10 Oct 2021 20:57:02 +0200
Subject: [PATCH] platform/x86: int3472: Enable I2c daisy chain
@@ -4494,7 +4490,7 @@ index 5b8d1a9620a5..6a0ff035cf20 100644
--
2.39.0
-From c429d67a19c8860fd3b7f7b0a4f95fa465028fe6 Mon Sep 17 00:00:00 2001
+From 75d54e3be5ceb01b46d74e3e9d3af3f88d7a2669 Mon Sep 17 00:00:00 2001
From: Daniel Scally <djrscally@gmail.com>
Date: Thu, 28 Oct 2021 21:55:16 +0100
Subject: [PATCH] media: i2c: Add driver for DW9719 VCM
@@ -4998,7 +4994,7 @@ index 000000000000..180b04d2a6b3
--
2.39.0
-From dec3b71065ccf948d1d4830e46adad41ac134195 Mon Sep 17 00:00:00 2001
+From 0611d5aa6bb68362b37dc6dc310050ed2d16bd64 Mon Sep 17 00:00:00 2001
From: Daniel Scally <djrscally@gmail.com>
Date: Wed, 4 May 2022 23:21:45 +0100
Subject: [PATCH] media: ipu3-cio2: Move functionality from .complete() to
@@ -5113,7 +5109,7 @@ index 390bd5ea3472..76339fb842bf 100644
--
2.39.0
-From 1020ddb552417b2af335b0ad73efafad56cdd039 Mon Sep 17 00:00:00 2001
+From 65a24c651f437949aaa6cd640bf8318d747a92ce Mon Sep 17 00:00:00 2001
From: Daniel Scally <djrscally@gmail.com>
Date: Thu, 2 Jun 2022 22:15:56 +0100
Subject: [PATCH] media: ipu3-cio2: Re-add .complete() to ipu3-cio2
@@ -5156,7 +5152,7 @@ index 76339fb842bf..eb7aa269ec2b 100644
--
2.39.0
-From f27e3ae91e4d86ceb751029090de793847022949 Mon Sep 17 00:00:00 2001
+From c07d00b78e9792663f36a8f57444fc9b4e66a0d8 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Fri, 15 Jul 2022 23:48:00 +0200
Subject: [PATCH] drivers/media/i2c: Fix DW9719 dependencies
@@ -5185,7 +5181,7 @@ index 98d081efeef7..c67966cafe10 100644
--
2.39.0
-From aaff0863024578f7f6fe91573c68778ad0aec98e Mon Sep 17 00:00:00 2001
+From 4e0cf6e05dd0de32045adcc2087f4ed7c9a184e7 Mon Sep 17 00:00:00 2001
From: Sachi King <nakato@nakato.io>
Date: Sat, 29 May 2021 17:47:38 +1000
Subject: [PATCH] ACPI: Add quirk for Surface Laptop 4 AMD missing irq 7
@@ -5252,7 +5248,7 @@ index 907cc98b1938..0116d27b29ea 100644
--
2.39.0
-From 9d4e2bb0f9856ce57029c89895b38ae5949502f5 Mon Sep 17 00:00:00 2001
+From 94f476cef8457ab5cba6109ee104608eba7e8072 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Thu, 3 Jun 2021 14:04:26 +0200
Subject: [PATCH] ACPI: Add AMD 13" Surface Laptop 4 model to irq 7 override
@@ -5294,7 +5290,7 @@ index 0116d27b29ea..af102c6f8e5b 100644
--
2.39.0
-From dcf0efd363e301c409bfccb2ea3119e5d3fa3e52 Mon Sep 17 00:00:00 2001
+From ad11ec823a7792d636492a9f99dfaf7bd7842f0d Mon Sep 17 00:00:00 2001
From: "Bart Groeneveld | GPX Solutions B.V" <bart@gpxbv.nl>
Date: Mon, 5 Dec 2022 16:08:46 +0100
Subject: [PATCH] acpi: allow usage of acpi_tad on HW-reduced platforms
diff --git a/SOURCES/patch-6.1-redhat.patch b/SOURCES/patch-6.1-redhat.patch
index 5909c32..761ae0d 100644
--- a/SOURCES/patch-6.1-redhat.patch
+++ b/SOURCES/patch-6.1-redhat.patch
@@ -21,7 +21,6 @@
drivers/hwtracing/coresight/coresight-etm4x-core.c | 19 ++++
drivers/input/rmi4/rmi_driver.c | 124 ++++++++++++---------
drivers/iommu/iommu.c | 22 ++++
- .../net/wireless/broadcom/brcm80211/brcmfmac/of.c | 5 +-
drivers/pci/quirks.c | 24 ++++
drivers/usb/core/hub.c | 7 ++
include/linux/efi.h | 22 ++--
@@ -37,10 +36,10 @@
security/lockdown/Kconfig | 13 +++
security/lockdown/lockdown.c | 1 +
security/security.c | 6 +
- 39 files changed, 487 insertions(+), 182 deletions(-)
+ 38 files changed, 484 insertions(+), 180 deletions(-)
diff --git a/Makefile b/Makefile
-index 19e8c6dec6e5..37b6bc722a3e 100644
+index 7eb6793ecfbf..c7e8be8b3a5f 100644
--- a/Makefile
+++ b/Makefile
@@ -18,6 +18,10 @@ $(if $(filter __%, $(MAKECMDGOALS)), \
@@ -287,10 +286,10 @@ index c2c786eb95ab..4e3aa80cd5cf 100644
return ctx.rc;
}
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
-index b47e93a24a9a..9d172e177a75 100644
+index dbfa58e799e2..69654a728e07 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
-@@ -1743,6 +1743,15 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device)
+@@ -1746,6 +1746,15 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device)
if (!acpi_match_device_ids(device, ignore_serial_bus_ids))
return false;
@@ -409,7 +408,7 @@ index 8d151e332584..bd29fe4ddbf3 100644
obj-$(CONFIG_EFI_RCI2_TABLE) += rci2-table.o
obj-$(CONFIG_EFI_EMBEDDED_FIRMWARE) += embedded-firmware.o
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
-index f12cc29bd4b8..ec530425a457 100644
+index 033aac6be7da..28f9bf73368b 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -32,6 +32,7 @@
@@ -420,7 +419,7 @@ index f12cc29bd4b8..ec530425a457 100644
#include <asm/early_ioremap.h>
-@@ -881,40 +882,101 @@ int efi_mem_type(unsigned long phys_addr)
+@@ -884,40 +885,101 @@ int efi_mem_type(unsigned long phys_addr)
}
#endif
@@ -1018,29 +1017,6 @@ index 959d895fc1df..ced88384a6ee 100644
/*
* Changes the default domain of an iommu group that has *only* one device
*
-diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
-index a83699de01ec..fdd0c9abc1a1 100644
---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
-+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
-@@ -79,7 +79,8 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
- /* Apple ARM64 platforms have their own idea of board type, passed in
- * via the device tree. They also have an antenna SKU parameter
- */
-- if (!of_property_read_string(np, "brcm,board-type", &prop))
-+ err = of_property_read_string(np, "brcm,board-type", &prop);
-+ if (!err)
- settings->board_type = prop;
-
- if (!of_property_read_string(np, "apple,antenna-sku", &prop))
-@@ -87,7 +88,7 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
-
- /* Set board-type to the first string of the machine compatible prop */
- root = of_find_node_by_path("/");
-- if (root && !settings->board_type) {
-+ if (root && err) {
- char *board_type;
- const char *tmp;
-
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 285acc4aaccc..a7056957e7dd 100644
--- a/drivers/pci/quirks.c