diff options
20 files changed, 1347 insertions, 342 deletions
@@ -1,6 +1,6 @@ pkgbase = linux-g14 pkgdesc = Linux - pkgver = 6.3.5.arch1 + pkgver = 6.3.6.arch1 pkgrel = 1 url = https://gitlab.com/dragonn/linux-g14.git arch = x86_64 @@ -16,27 +16,33 @@ pkgbase = linux-g14 makedepends = xz makedepends = python options = !strip - source = archlinux-linux::git+https://github.com/archlinux/linux?signed#tag=v6.3.5-arch1 + source = archlinux-linux::git+https://github.com/archlinux/linux?signed#tag=v6.3.6-arch1 source = config source = choose-gcc-optimization.sh source = sys-kernel_arch-sources-g14_files-0004-5.17+--more-uarches-for-kernel.patch::https://raw.githubusercontent.com/graysky2/kernel_compiler_patch/master/more-uarches-for-kernel-5.17+.patch source = 0001-acpi-proc-idle-skip-dummy-wait.patch - source = 0019-HID-amd_sfh-Add-keyguard-for-ASUS-ROG-X13-tablet.patch source = 0001-platform-x86-asus-wmi-Add-safety-checks-to-dgpu-egpu.patch source = 0027-mt76_-mt7921_-Disable-powersave-features-by-default.patch source = 0001-Revert-PCI-Add-a-REBAR-size-quirk-for-Sapphire-RX-56.patch source = 0001-constgran-v2.patch source = 0001-linux6.1.y-bore2.2.1.patch - source = 0028-patch01_gu604_alc285_fixes.patch source = 0029-patch02_gu604v_wmi_keys.patch - source = 0031-FX516PE-rgb-mode.patch source = 0032-Bluetooth-btusb-Add-a-new-PID-VID-0489-e0f6-for-MT7922.patch - source = 0001-HID-asus-Add-support-for-ASUS-ROG-Z13-keyboard.patch - source = 0002-HID-asus-add-keycodes-for-0x6a-0x4b-and-0xc7.patch - source = 0003-HID-asus-reformat-the-hotkey-mapping-block.patch - source = 0005-ACPI-resource-Skip-IRQ-override-on-ASUS-TUF-Gaming-A.patch - source = 0006-ACPI-resource-Skip-IRQ-override-on-ASUS-TUF-Gaming-A.patch - source = 0007-platform-x86-asus-wmi-add-support-for-ASUS-screenpad.patch + source = 0035-Add_quirk_for_polling_the_KBD_port.patch + source = 0036-Block_a_rogue_device_on_ASUS_TUF_A16.patch + source = 0001-ACPI-resource-Skip-IRQ-override-on-ASUS-TUF-Gaming-A.patch + source = 0001-ALSA-hda-realtek-gu604.patch + source = 0001-HID-amd_sfh-Add-support-for-tablet-mode-switch-senso.patch + source = 0002-ACPI-resource-Skip-IRQ-override-on-ASUS-TUF-Gaming-A.patch + source = 0003-HID-asus-Add-support-for-ASUS-ROG-Z13-keyboard.patch + source = 0004-HID-asus-add-keycodes-for-0x6a-0x4b-and-0xc7.patch + source = 0005-HID-asus-reformat-the-hotkey-mapping-block.patch + source = 0006-platform-x86-asus-wmi-add-support-for-ASUS-screenpad.patch + source = 0007-platform-x86-asus-wmi-add-support-for-showing-charge.patch + source = 0008-platform-x86-asus-wmi-add-support-for-showing-middle.patch + source = 0009-platform-x86-asus-wmi-support-middle-fan-custom-curv.patch + source = 0010-platform-x86-asus-wmi-add-WMI-method-to-show-if-egpu.patch + source = 0011-platform-x86-asus-wmi-support-setting-mini-LED-mode.patch source = sys-kernel_arch-sources-g14_files-0047-asus-nb-wmi-Add-tablet_mode_sw-lid-flip.patch source = sys-kernel_arch-sources-g14_files-0048-asus-nb-wmi-fix-tablet_mode_sw_int.patch source = sys-kernel_arch-sources-g14_files-0049-ALSA-hda-realtek-Add-quirk-for-ASUS-M16-GU603H.patch diff --git a/0005-ACPI-resource-Skip-IRQ-override-on-ASUS-TUF-Gaming-A.patch b/0001-ACPI-resource-Skip-IRQ-override-on-ASUS-TUF-Gaming-A.patch index 337a7362ee5d..545ffe92c530 100644 --- a/0005-ACPI-resource-Skip-IRQ-override-on-ASUS-TUF-Gaming-A.patch +++ b/0001-ACPI-resource-Skip-IRQ-override-on-ASUS-TUF-Gaming-A.patch @@ -1,7 +1,8 @@ -From 816e2a658a7714a7870b00923318fa064b466194 Mon Sep 17 00:00:00 2001 +From cfadb2992e771f8b5bdbdbfe6c2fdd2fd964de1d Mon Sep 17 00:00:00 2001 From: hqp1203 <hqp1203hqp@163.com> Date: Tue, 14 Mar 2023 22:30:57 +0800 -Subject: [PATCH 5/7] ACPI: resource: Skip IRQ override on ASUS TUF Gaming A15 +Subject: [PATCH 01/11] ACPI: resource: Skip IRQ override on ASUS TUF Gaming + A15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -23,7 +24,7 @@ Signed-off-by: hqp1203 <hqp1203hqp@163.com> 1 file changed, 7 insertions(+) diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c -index e8492b3a393a..77b638974273 100644 +index 0800a9d77558..cefc3b24a845 100644 --- a/drivers/acpi/resource.c +++ b/drivers/acpi/resource.c @@ -467,6 +467,13 @@ static const struct dmi_system_id asus_laptop[] = { @@ -41,5 +42,5 @@ index e8492b3a393a..77b638974273 100644 }; -- -2.40.0 +2.40.1 diff --git a/0028-patch01_gu604_alc285_fixes.patch b/0001-ALSA-hda-realtek-gu604.patch index e511e03b2a80..cee95e3b5eb0 100644 --- a/0028-patch01_gu604_alc285_fixes.patch +++ b/0001-ALSA-hda-realtek-gu604.patch @@ -1,6 +1,6 @@ ---- a/sound/pci/hda/patch_realtek.c 2023-05-07 14:52:12.296284206 +0300 -+++ b/sound/pci/hda/patch_realtek.c 2023-05-07 14:53:10.013967423 +0300 -@@ -7063,6 +7063,8 @@ +--- a/sound/pci/hda/patch_realtek.c 2023-04-20 20:40:17.786527496 +0300 ++++ b/sound/pci/hda/patch_realtek.c 2023-04-20 20:25:02.524458831 +0300 +@@ -7061,6 +7061,8 @@ ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, ALC295_FIXUP_DISABLE_DAC3, ALC285_FIXUP_SPEAKER2_TO_DAC1, @@ -9,7 +9,7 @@ ALC280_FIXUP_HP_HEADSET_MIC, ALC221_FIXUP_HP_FRONT_MIC, ALC292_FIXUP_TPT460, -@@ -8033,6 +8035,22 @@ +@@ -8008,6 +8010,22 @@ .chained = true, .chain_id = ALC269_FIXUP_THINKPAD_ACPI }, @@ -32,12 +32,11 @@ [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = { .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl[]) { -@@ -9539,6 +9557,8 @@ +@@ -9512,6 +9530,7 @@ SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101), -+ SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604V", ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1), -+ SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603V", ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1), ++ SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604", ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1), SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2), SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), - SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
\ No newline at end of file + SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), diff --git a/0001-HID-amd_sfh-Add-support-for-tablet-mode-switch-senso.patch b/0001-HID-amd_sfh-Add-support-for-tablet-mode-switch-senso.patch new file mode 100644 index 000000000000..eec9d426ba70 --- /dev/null +++ b/0001-HID-amd_sfh-Add-support-for-tablet-mode-switch-senso.patch @@ -0,0 +1,206 @@ +This patch adds support for the tablet mode switch sensors on +convertible devices where that sensor is managed by AMD SFH, like the +Asus Flow X13 and the Lenovo ThinkPad L13 Yoga Gen2 (AMD). + +Co-developed-by: Ivan Dovgal <iv.dovg@gmail.com> +Signed-off-by: Ivan Dovgal <iv.dovg@gmail.com> +Co-developed-by: Luke D. Jones <luke@ljones.dev> +Signed-off-by: Luke D. Jones <luke@ljones.dev> +Signed-off-by: Adrian Freund <adrian@freund.io> +--- +v2: +* Fixed build warning reported by kernel test robot <lkp@intel.com> + + drivers/hid/amd-sfh-hid/amd_sfh_client.c | 2 ++ + drivers/hid/amd-sfh-hid/amd_sfh_hid.h | 2 +- + 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 | 7 +++++ + .../hid_descriptor/amd_sfh_hid_report_desc.h | 21 +++++++++++++++ + 7 files changed, 63 insertions(+), 1 deletion(-) + +diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_client.c b/drivers/hid/amd-sfh-hid/amd_sfh_client.c +index 8275bba63611..83dd0402933c 100644 +--- a/drivers/hid/amd-sfh-hid/amd_sfh_client.c ++++ b/drivers/hid/amd-sfh-hid/amd_sfh_client.c +@@ -146,6 +146,8 @@ static const char *get_sensor_name(int idx) + return "gyroscope"; + case mag_idx: + return "magnetometer"; ++ case tms_idx: ++ return "tablet-mode-switch"; + case als_idx: + return "ALS"; + case HPD_IDX: +diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_hid.h b/drivers/hid/amd-sfh-hid/amd_sfh_hid.h +index 3754fb423e3a..f10ec16bb8aa 100644 +--- a/drivers/hid/amd-sfh-hid/amd_sfh_hid.h ++++ b/drivers/hid/amd-sfh-hid/amd_sfh_hid.h +@@ -11,7 +11,7 @@ + #ifndef AMDSFH_HID_H + #define AMDSFH_HID_H + +-#define MAX_HID_DEVICES 5 ++#define MAX_HID_DEVICES 6 + #define AMD_SFH_HID_VENDOR 0x1022 + #define AMD_SFH_HID_PRODUCT 0x0001 + +diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +index 47774b9ab3de..cfda797f0a62 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 TMS_EN BIT(15) + #define HPD_EN BIT(16) + #define ALS_EN BIT(19) + +@@ -227,6 +228,9 @@ int amd_mp2_get_sensor_num(struct amd_mp2_dev *privdata, u8 *sensor_id) + if (MAGNO_EN & activestatus) + sensor_id[num_of_sensors++] = mag_idx; + ++ if (TMS_EN & activestatus) ++ sensor_id[num_of_sensors++] = tms_idx; ++ + if (ALS_EN & activestatus) + sensor_id[num_of_sensors++] = als_idx; + +diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h +index dfb7cabd82ef..e18ceee9e5db 100644 +--- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h ++++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h +@@ -78,6 +78,7 @@ enum sensor_idx { + accel_idx = 0, + gyro_idx = 1, + mag_idx = 2, ++ tms_idx = 15, + als_idx = 19 + }; + +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..181973f35f05 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 +@@ -47,6 +47,11 @@ static int get_report_descriptor(int sensor_idx, u8 *rep_desc) + memcpy(rep_desc, comp3_report_descriptor, + sizeof(comp3_report_descriptor)); + break; ++ case tms_idx: /* tablet mode switch */ ++ memset(rep_desc, 0, sizeof(tms_report_descriptor)); ++ memcpy(rep_desc, tms_report_descriptor, ++ sizeof(tms_report_descriptor)); ++ break; + case als_idx: /* ambient light sensor */ + memset(rep_desc, 0, sizeof(als_report_descriptor)); + memcpy(rep_desc, als_report_descriptor, +@@ -96,6 +101,16 @@ static u32 get_descr_sz(int sensor_idx, int descriptor_name) + return sizeof(struct magno_feature_report); + } + break; ++ case tms_idx: ++ switch (descriptor_name) { ++ case descr_size: ++ return sizeof(tms_report_descriptor); ++ case input_size: ++ return sizeof(struct tms_input_report); ++ case feature_size: ++ return sizeof(struct tms_feature_report); ++ } ++ break; + case als_idx: + switch (descriptor_name) { + case descr_size: +@@ -138,6 +153,7 @@ static u8 get_feature_report(int sensor_idx, int report_id, u8 *feature_report) + struct accel3_feature_report acc_feature; + struct gyro_feature_report gyro_feature; + struct magno_feature_report magno_feature; ++ struct tms_feature_report tms_feature; + struct hpd_feature_report hpd_feature; + struct als_feature_report als_feature; + u8 report_size = 0; +@@ -173,6 +189,11 @@ static u8 get_feature_report(int sensor_idx, int report_id, u8 *feature_report) + memcpy(feature_report, &magno_feature, sizeof(magno_feature)); + report_size = sizeof(magno_feature); + break; ++ case tms_idx: /* tablet mode switch */ ++ get_common_features(&tms_feature.common_property, report_id); ++ memcpy(feature_report, &tms_feature, sizeof(tms_feature)); ++ report_size = sizeof(tms_feature); ++ break; + case als_idx: /* ambient light sensor */ + get_common_features(&als_feature.common_property, report_id); + als_feature.als_change_sesnitivity = HID_DEFAULT_SENSITIVITY; +@@ -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 tms_input_report tms_input; + struct als_input_report als_input; + struct hpd_status hpdstatus; + u8 report_size = 0; +@@ -244,6 +266,11 @@ static u8 get_input_report(u8 current_index, int sensor_idx, int report_id, + memcpy(input_report, &magno_input, sizeof(magno_input)); + report_size = sizeof(magno_input); + break; ++ case tms_idx: /* tablet mode switch */ ++ get_common_inputs(&tms_input.common_property, report_id); ++ report_size = sizeof(tms_input); ++ memcpy(input_report, &tms_input, sizeof(tms_input)); ++ break; + case als_idx: /* Als */ + get_common_inputs(&als_input.common_property, report_id); + /* For ALS ,V2 Platforms uses C2P_MSG5 register instead of DRAM access method */ +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..b22068a47429 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,11 @@ struct hpd_input_report { + u8 human_presence; + } __packed; + ++struct tms_feature_report { ++ struct common_feature_property common_property; ++} __packed; ++ ++struct tms_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..96cbc1e5b9a7 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,27 @@ static const u8 als_report_descriptor[] = { + 0xC0 /* HID end collection */ + }; + ++ ++/* TABLET MODE SWITCH */ ++__maybe_unused // Used by sfh1.0, but not yet implemented in sfh1.1 ++static const u8 tms_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 */ +-- +2.38.1 + diff --git a/0006-ACPI-resource-Skip-IRQ-override-on-ASUS-TUF-Gaming-A.patch b/0002-ACPI-resource-Skip-IRQ-override-on-ASUS-TUF-Gaming-A.patch index 77ce2c56619f..b008c2f1f805 100644 --- a/0006-ACPI-resource-Skip-IRQ-override-on-ASUS-TUF-Gaming-A.patch +++ b/0002-ACPI-resource-Skip-IRQ-override-on-ASUS-TUF-Gaming-A.patch @@ -1,7 +1,8 @@ -From d3d4883ebc340388933d829a53fd61c834dadcb1 Mon Sep 17 00:00:00 2001 +From b64b6dd97c6cdfbd858198fff9a9481f279c05ff Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" <luke@ljones.dev> Date: Sun, 30 Apr 2023 10:56:34 +1200 -Subject: [PATCH 6/7] ACPI: resource: Skip IRQ override on ASUS TUF Gaming A16 +Subject: [PATCH 02/11] ACPI: resource: Skip IRQ override on ASUS TUF Gaming + A16 The TUF Gaming A16 FA617NS requires an irq override for full keyboard functionality. @@ -12,7 +13,7 @@ Signed-off-by: Luke D. Jones <luke@ljones.dev> 1 file changed, 7 insertions(+) diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c -index 77b638974273..01a7befe9625 100644 +index cefc3b24a845..065e55eb78f5 100644 --- a/drivers/acpi/resource.c +++ b/drivers/acpi/resource.c @@ -474,6 +474,13 @@ static const struct dmi_system_id asus_laptop[] = { @@ -30,5 +31,5 @@ index 77b638974273..01a7befe9625 100644 }; -- -2.40.0 +2.40.1 diff --git a/0001-HID-asus-Add-support-for-ASUS-ROG-Z13-keyboard.patch b/0003-HID-asus-Add-support-for-ASUS-ROG-Z13-keyboard.patch index 7219c48c637e..06ce5d74e514 100644 --- a/0001-HID-asus-Add-support-for-ASUS-ROG-Z13-keyboard.patch +++ b/0003-HID-asus-Add-support-for-ASUS-ROG-Z13-keyboard.patch @@ -1,7 +1,7 @@ -From f92c356bbd162c710bd7ee8cbc81b8d0a7cc7bb0 Mon Sep 17 00:00:00 2001 +From a3457e1c57736904ea4a389d1beb852ef8d7169e Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" <luke@ljones.dev> Date: Mon, 24 Apr 2023 11:16:24 +1200 -Subject: [PATCH 1/7] HID: asus: Add support for ASUS ROG Z13 keyboard +Subject: [PATCH 03/11] HID: asus: Add support for ASUS ROG Z13 keyboard Add support for the ROG Z13 keyboard. This is a variant of the last few ASUS ROG keyboards and has much of the same functionality. @@ -13,10 +13,10 @@ Signed-off-by: Luke D. Jones <luke@ljones.dev> 2 files changed, 4 insertions(+) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c -index d1094bb1aa42..ac93f987d822 100644 +index 01a27579ec02..46ecc7dfb2b0 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c -@@ -1267,6 +1267,9 @@ static const struct hid_device_id asus_devices[] = { +@@ -1268,6 +1268,9 @@ static const struct hid_device_id asus_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD2), QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD }, @@ -27,7 +27,7 @@ index d1094bb1aa42..ac93f987d822 100644 USB_DEVICE_ID_ASUSTEK_ROG_CLAYMORE_II_KEYBOARD), QUIRK_ROG_CLAYMORE_II_KEYBOARD }, diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h -index c2e9b6d1fd7d..513290a2e91c 100644 +index d79e946acdcb..25f26375815b 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -207,6 +207,7 @@ @@ -39,5 +39,5 @@ index c2e9b6d1fd7d..513290a2e91c 100644 #define USB_DEVICE_ID_ASUSTEK_FX503VD_KEYBOARD 0x1869 -- -2.40.0 +2.40.1 diff --git a/0004-ALSA-hda-realtek-Add-quirk-for-2nd-ASUS-GU603.patch b/0004-ALSA-hda-realtek-Add-quirk-for-2nd-ASUS-GU603.patch deleted file mode 100644 index 79ab0da9dd08..000000000000 --- a/0004-ALSA-hda-realtek-Add-quirk-for-2nd-ASUS-GU603.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 3c40d470339e5a8cdabcc52169dfc11404c6182d Mon Sep 17 00:00:00 2001 -From: "Luke D. Jones" <luke@ljones.dev> -Date: Mon, 24 Apr 2023 18:39:51 +1200 -Subject: [PATCH 4/7] ALSA: hda/realtek: Add quirk for 2nd ASUS GU603 - -Add quirk for GU603 with 0x1c62 variant of codec. - -Signed-off-by: Luke D. Jones <luke@ljones.dev> ---- - sound/pci/hda/patch_realtek.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index 3b9f077a227f..87839bf77b5a 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -9519,6 +9519,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { - SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC), - SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE), - SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), -+ SND_PCI_QUIRK(0x1043, 0x1c62, "ASUS GU603", ALC289_FIXUP_ASUS_GA401), - SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS), - SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC), - SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401), --- -2.40.0 - diff --git a/0002-HID-asus-add-keycodes-for-0x6a-0x4b-and-0xc7.patch b/0004-HID-asus-add-keycodes-for-0x6a-0x4b-and-0xc7.patch index a6bba47de7b2..93696ec28393 100644 --- a/0002-HID-asus-add-keycodes-for-0x6a-0x4b-and-0xc7.patch +++ b/0004-HID-asus-add-keycodes-for-0x6a-0x4b-and-0xc7.patch @@ -1,7 +1,7 @@ -From 2aaecf9313acfb848ab3fbed6b7f8801e3ebac20 Mon Sep 17 00:00:00 2001 +From ca51c1ad22ab812ee2611f5a22c93688ffd9b5f3 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" <luke@ljones.dev> Date: Mon, 24 Apr 2023 16:26:33 +1200 -Subject: [PATCH 2/7] HID: asus: add keycodes for 0x6a, 0x4b, and 0xc7 +Subject: [PATCH 04/11] HID: asus: add keycodes for 0x6a, 0x4b, and 0xc7 These two keys are found on some models with dual display. - 0x6a is intended for controlling the secondary screen brightness. @@ -19,10 +19,10 @@ Signed-off-by: Luke D. Jones <luke@ljones.dev> 1 file changed, 7 insertions(+) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c -index ac93f987d822..918d0d05ca88 100644 +index 46ecc7dfb2b0..ddfd37e67c3c 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c -@@ -883,6 +883,7 @@ static int asus_input_mapping(struct hid_device *hdev, +@@ -884,6 +884,7 @@ static int asus_input_mapping(struct hid_device *hdev, case 0xb5: asus_map_key_clear(KEY_CALC); break; case 0xc4: asus_map_key_clear(KEY_KBDILLUMUP); break; case 0xc5: asus_map_key_clear(KEY_KBDILLUMDOWN); break; @@ -30,7 +30,7 @@ index ac93f987d822..918d0d05ca88 100644 /* ASUS touchpad toggle */ case 0x6b: asus_map_key_clear(KEY_F21); break; -@@ -911,6 +912,12 @@ static int asus_input_mapping(struct hid_device *hdev, +@@ -912,6 +913,12 @@ static int asus_input_mapping(struct hid_device *hdev, /* Fn+Right Aura mode next on N-Key keyboard */ case 0xb3: asus_map_key_clear(KEY_PROG3); break; @@ -44,5 +44,5 @@ index ac93f987d822..918d0d05ca88 100644 /* ASUS lazily declares 256 usages, ignore the rest, * as some make the keyboard appear as a pointer device. */ -- -2.40.0 +2.40.1 diff --git a/0003-HID-asus-reformat-the-hotkey-mapping-block.patch b/0005-HID-asus-reformat-the-hotkey-mapping-block.patch index f65625cb765b..86606db56262 100644 --- a/0003-HID-asus-reformat-the-hotkey-mapping-block.patch +++ b/0005-HID-asus-reformat-the-hotkey-mapping-block.patch @@ -1,7 +1,7 @@ -From 14ee963e3c58cccf21e3e9eb7b9b89e13f41009b Mon Sep 17 00:00:00 2001 +From e8f498b61017b18bb7229c63be13b4792f2ba8eb Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" <luke@ljones.dev> Date: Tue, 2 May 2023 11:20:27 +1200 -Subject: [PATCH 3/7] HID: asus: reformat the hotkey mapping block +Subject: [PATCH 05/11] HID: asus: reformat the hotkey mapping block Older formatting of this block was beginning to get somewhat cluttered. Condensing the block and putting comments to the side makes it easier @@ -13,10 +13,10 @@ Signed-off-by: Luke D. Jones <luke@ljones.dev> 1 file changed, 12 insertions(+), 32 deletions(-) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c -index 918d0d05ca88..2bc14e076739 100644 +index ddfd37e67c3c..fd61dba88233 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c -@@ -885,38 +885,18 @@ static int asus_input_mapping(struct hid_device *hdev, +@@ -886,38 +886,18 @@ static int asus_input_mapping(struct hid_device *hdev, case 0xc5: asus_map_key_clear(KEY_KBDILLUMDOWN); break; case 0xc7: asus_map_key_clear(KEY_KBDILLUMTOGGLE); break; @@ -66,7 +66,7 @@ index 918d0d05ca88..2bc14e076739 100644 default: /* ASUS lazily declares 256 usages, ignore the rest, -@@ -1319,4 +1299,4 @@ static struct hid_driver asus_driver = { +@@ -1320,4 +1300,4 @@ static struct hid_driver asus_driver = { }; module_hid_driver(asus_driver); @@ -74,5 +74,5 @@ index 918d0d05ca88..2bc14e076739 100644 +MODULE_LICENSE("GPL"); \ No newline at end of file -- -2.40.0 +2.40.1 diff --git a/0007-platform-x86-asus-wmi-add-support-for-ASUS-screenpad.patch b/0006-platform-x86-asus-wmi-add-support-for-ASUS-screenpad.patch index c0ea5d262470..b25f6d10463f 100644 --- a/0007-platform-x86-asus-wmi-add-support-for-ASUS-screenpad.patch +++ b/0006-platform-x86-asus-wmi-add-support-for-ASUS-screenpad.patch @@ -1,7 +1,7 @@ -From 6f144cb34020fd81006680c6221f0ae5e44237ab Mon Sep 17 00:00:00 2001 +From af85785d35b6a5f9c73126224b4eb674980eb835 Mon Sep 17 00:00:00 2001 From: "Luke D. Jones" <luke@ljones.dev> Date: Sun, 30 Apr 2023 10:56:34 +1200 -Subject: [PATCH 7/7] platform/x86: asus-wmi: add support for ASUS screenpad +Subject: [PATCH 06/11] platform/x86: asus-wmi: add support for ASUS screenpad Add support for the WMI methods used to turn off and adjust the brightness of the secondary "screenpad" device found on some high-end @@ -18,7 +18,7 @@ Signed-off-by: Luke D. Jones <luke@ljones.dev> 3 files changed, 136 insertions(+) diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c -index 1038dfdcdd32..14a32e08f900 100644 +index 1038dfdcdd32..5edf9ece51dc 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -25,6 +25,7 @@ @@ -37,7 +37,7 @@ index 1038dfdcdd32..14a32e08f900 100644 struct platform_device *platform_device; struct led_classdev wlan_led; -@@ -3208,6 +3210,127 @@ static int is_display_toggle(int code) +@@ -3208,6 +3210,125 @@ static int is_display_toggle(int code) return 0; } @@ -80,9 +80,7 @@ index 1038dfdcdd32..14a32e08f900 100644 + u32 ctrl_param; + + power = read_screenpad_backlight_power(asus); -+ if (power == -ENODEV) -+ return err; -+ else if (power < 0) ++ if (power < 0) + return power; + + if (bd->props.power != power) { @@ -165,28 +163,37 @@ index 1038dfdcdd32..14a32e08f900 100644 /* Fn-lock ********************************************************************/ static bool asus_wmi_has_fnlock_key(struct asus_wmi *asus) -@@ -3823,6 +3946,13 @@ static int asus_wmi_add(struct platform_device *pdev) +@@ -3823,6 +3944,12 @@ static int asus_wmi_add(struct platform_device *pdev) } else if (asus->driver->quirks->wmi_backlight_set_devstate) err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL); + if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_SCREENPAD_LIGHT)) { -+ pr_warn("Begin asus_screenpad_init"); + err = asus_screenpad_init(asus); + if (err && err != -ENODEV) -+ goto fail_backlight; ++ goto fail_screenpad; + } + if (asus_wmi_has_fnlock_key(asus)) { asus->fnlock_locked = fnlock_default; asus_wmi_fnlock_update(asus); -@@ -3844,6 +3974,7 @@ static int asus_wmi_add(struct platform_device *pdev) - - fail_wmi_handler: +@@ -3853,6 +3980,9 @@ static int asus_wmi_add(struct platform_device *pdev) + asus_wmi_input_exit(asus); + fail_input: + asus_wmi_sysfs_exit(asus->platform_device); ++fail_screenpad: ++ if (asus->screenpad_backlight_device) ++ asus_screenpad_exit(asus); + fail_sysfs: + fail_throttle_thermal_policy: + fail_custom_fan_curve: +@@ -3872,6 +4002,7 @@ static int asus_wmi_remove(struct platform_device *device) + asus = platform_get_drvdata(device); + wmi_remove_notify_handler(asus->driver->event_guid); asus_wmi_backlight_exit(asus); + asus_screenpad_exit(asus); - fail_backlight: + asus_wmi_input_exit(asus); + asus_wmi_led_exit(asus); asus_wmi_rfkill_exit(asus); - fail_rfkill: diff --git a/drivers/platform/x86/asus-wmi.h b/drivers/platform/x86/asus-wmi.h index a478ebfd34df..5fbdd0eafa02 100644 --- a/drivers/platform/x86/asus-wmi.h @@ -215,5 +222,5 @@ index 28234dc9fa6a..a2d94adb5c80 100644 #define ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY 0x00120075 -- -2.40.0 +2.40.1 diff --git a/0007-platform-x86-asus-wmi-add-support-for-showing-charge.patch b/0007-platform-x86-asus-wmi-add-support-for-showing-charge.patch new file mode 100644 index 000000000000..3e4603029cf9 --- /dev/null +++ b/0007-platform-x86-asus-wmi-add-support-for-showing-charge.patch @@ -0,0 +1,130 @@ +From 7fb84ee268c5f40219ae694845b7a956a68ca2d2 Mon Sep 17 00:00:00 2001 +From: "Luke D. Jones" <luke@ljones.dev> +Date: Sun, 4 Jun 2023 18:48:11 +1200 +Subject: [PATCH 07/11] platform/x86: asus-wmi: add support for showing charger + mode + +Expose another WMI method in sysfs platform for showing what charging +mode the laptop is currently using. + +Signed-off-by: Luke D. Jones <luke@ljones.dev> +--- + .../ABI/testing/sysfs-platform-asus-wmi | 10 +++++++ + drivers/platform/x86/asus-wmi.c | 27 ++++++++++++++++--- + include/linux/platform_data/x86/asus-wmi.h | 3 +++ + 3 files changed, 36 insertions(+), 4 deletions(-) + +diff --git a/Documentation/ABI/testing/sysfs-platform-asus-wmi b/Documentation/ABI/testing/sysfs-platform-asus-wmi +index a77a004a1baa..eb29e3023c7b 100644 +--- a/Documentation/ABI/testing/sysfs-platform-asus-wmi ++++ b/Documentation/ABI/testing/sysfs-platform-asus-wmi +@@ -98,3 +98,13 @@ Description: + Enable an LCD response-time boost to reduce or remove ghosting: + * 0 - Disable, + * 1 - Enable ++ ++What: /sys/devices/platform/<platform>/charge_mode ++Date: Jun 2023 ++KernelVersion: 6.5 ++Contact: "Luke Jones" <luke@ljones.dev> ++Description: ++ Get the current charging mode being used: ++ * 1 - Barrel connected charger, ++ * 2 - USB-C charging ++ * 3 - Both connected, barrel used for charging +\ No newline at end of file +diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c +index 5edf9ece51dc..fd1ce1650187 100644 +--- a/drivers/platform/x86/asus-wmi.c ++++ b/drivers/platform/x86/asus-wmi.c +@@ -239,6 +239,7 @@ struct asus_wmi { + u8 fan_boost_mode_mask; + u8 fan_boost_mode; + ++ bool charge_mode_available; + bool egpu_enable_available; + bool dgpu_disable_available; + bool gpu_mux_mode_available; +@@ -588,6 +589,22 @@ static void asus_wmi_tablet_mode_get_state(struct asus_wmi *asus) + asus_wmi_tablet_sw_report(asus, result); + } + ++/* Charging mode, 1=Barrel, 2=USB ******************************************/ ++static ssize_t charge_mode_show(struct device *dev, ++ struct device_attribute *attr, char *buf) ++{ ++ struct asus_wmi *asus = dev_get_drvdata(dev); ++ int result, value; ++ ++ result = asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_CHARGE_MODE, &value); ++ if (result < 0) ++ return result; ++ ++ return sysfs_emit(buf, "%d\n", value & 0xff); ++} ++ ++static DEVICE_ATTR_RO(charge_mode); ++ + /* dGPU ********************************************************************/ + static ssize_t dgpu_disable_show(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -3286,9 +3303,7 @@ static int asus_screenpad_init(struct asus_wmi *asus) + int power, brightness; + + power = read_screenpad_backlight_power(asus); +- if (power == -ENODEV) +- power = FB_BLANK_UNBLANK; +- else if (power < 0) ++ if (power < 0) + return power; + + memset(&props, 0, sizeof(struct backlight_properties)); +@@ -3583,6 +3598,7 @@ static struct attribute *platform_attributes[] = { + &dev_attr_camera.attr, + &dev_attr_cardr.attr, + &dev_attr_touchpad.attr, ++ &dev_attr_charge_mode.attr, + &dev_attr_egpu_enable.attr, + &dev_attr_dgpu_disable.attr, + &dev_attr_gpu_mux_mode.attr, +@@ -3612,6 +3628,8 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj, + devid = ASUS_WMI_DEVID_LID_RESUME; + else if (attr == &dev_attr_als_enable.attr) + devid = ASUS_WMI_DEVID_ALS_ENABLE; ++ else if (attr == &dev_attr_charge_mode.attr) ++ ok = asus->charge_mode_available; + else if (attr == &dev_attr_egpu_enable.attr) + ok = asus->egpu_enable_available; + else if (attr == &dev_attr_dgpu_disable.attr) +@@ -3878,6 +3896,7 @@ static int asus_wmi_add(struct platform_device *pdev) + if (err) + goto fail_platform; + ++ asus->charge_mode_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_CHARGE_MODE); + 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); +@@ -4174,4 +4193,4 @@ static void __exit asus_wmi_exit(void) + } + + module_init(asus_wmi_init); +-module_exit(asus_wmi_exit); ++module_exit(asus_wmi_exit); +\ No newline at end of file +diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h +index a2d94adb5c80..b57f3591676a 100644 +--- a/include/linux/platform_data/x86/asus-wmi.h ++++ b/include/linux/platform_data/x86/asus-wmi.h +@@ -99,6 +99,9 @@ + /* Keyboard dock */ + #define ASUS_WMI_DEVID_KBD_DOCK 0x00120063 + ++/* Charging mode - 1=Barrel, 2=USB */ ++#define ASUS_WMI_DEVID_CHARGE_MODE 0x0012006C ++ + /* dgpu on/off */ + #define ASUS_WMI_DEVID_EGPU 0x00090019 + +-- +2.40.1 + diff --git a/0008-platform-x86-asus-wmi-add-support-for-showing-middle.patch b/0008-platform-x86-asus-wmi-add-support-for-showing-middle.patch new file mode 100644 index 000000000000..dab1f4aa5439 --- /dev/null +++ b/0008-platform-x86-asus-wmi-add-support-for-showing-middle.patch @@ -0,0 +1,197 @@ +From 7fc27f5a4d3f2f6f0f01c42470ad67342a8bf767 Mon Sep 17 00:00:00 2001 +From: "Luke D. Jones" <luke@ljones.dev> +Date: Sun, 4 Jun 2023 19:07:31 +1200 +Subject: [PATCH 08/11] platform/x86: asus-wmi: add support for showing middle + fan RPM + +Some newer ASUS ROG laptops now have a middle/center fan in addition +to the CPU and GPU fans. This new fan typically blows across the +heatpipes and VRMs betweent eh CPU and GPU. + +This commit exposes that fan to PWM control plus showing RPM. + +Signed-off-by: Luke D. Jones <luke@ljones.dev> +--- + drivers/platform/x86/asus-wmi.c | 91 ++++++++++++++++++++++ + include/linux/platform_data/x86/asus-wmi.h | 1 + + 2 files changed, 92 insertions(+) + +diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c +index fd1ce1650187..8cc532166559 100644 +--- a/drivers/platform/x86/asus-wmi.c ++++ b/drivers/platform/x86/asus-wmi.c +@@ -73,6 +73,7 @@ module_param(fnlock_default, bool, 0444); + + #define ASUS_WMI_FNLOCK_BIOS_DISABLED BIT(0) + ++#define ASUS_MID_FAN_DESC "mid_fan" + #define ASUS_GPU_FAN_DESC "gpu_fan" + #define ASUS_FAN_DESC "cpu_fan" + #define ASUS_FAN_MFUN 0x13 +@@ -231,8 +232,10 @@ struct asus_wmi { + + enum fan_type fan_type; + enum fan_type gpu_fan_type; ++ enum fan_type mid_fan_type; + int fan_pwm_mode; + int gpu_fan_pwm_mode; ++ int mid_fan_pwm_mode; + int agfn_pwm; + + bool fan_boost_mode_available; +@@ -2131,6 +2134,31 @@ static ssize_t fan2_label_show(struct device *dev, + return sysfs_emit(buf, "%s\n", ASUS_GPU_FAN_DESC); + } + ++/* Middle/Center fan on modern ROG laptops */ ++static ssize_t fan3_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_MID_FAN_CTRL, &value); ++ if (ret < 0) ++ return ret; ++ ++ value &= 0xffff; ++ ++ return sysfs_emit(buf, "%d\n", value * 100); ++} ++ ++static ssize_t fan3_label_show(struct device *dev, ++ struct device_attribute *attr, ++ char *buf) ++{ ++ return sysfs_emit(buf, "%s\n", ASUS_MID_FAN_DESC); ++} ++ + static ssize_t pwm2_enable_show(struct device *dev, + struct device_attribute *attr, + char *buf) +@@ -2177,6 +2205,52 @@ static ssize_t pwm2_enable_store(struct device *dev, + return count; + } + ++static ssize_t pwm3_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->mid_fan_pwm_mode); ++} ++ ++static ssize_t pwm3_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_MID_FAN_CTRL, ++ value, &retval); ++ if (ret) ++ return ret; ++ ++ if (retval != 1) ++ return -EIO; ++ ++ asus->mid_fan_pwm_mode = state; ++ return count; ++} ++ + /* Fan1 */ + static DEVICE_ATTR_RW(pwm1); + static DEVICE_ATTR_RW(pwm1_enable); +@@ -2186,6 +2260,10 @@ static DEVICE_ATTR_RO(fan1_label); + static DEVICE_ATTR_RW(pwm2_enable); + static DEVICE_ATTR_RO(fan2_input); + static DEVICE_ATTR_RO(fan2_label); ++/* Fan3 - Middle/center fan */ ++static DEVICE_ATTR_RW(pwm3_enable); ++static DEVICE_ATTR_RO(fan3_input); ++static DEVICE_ATTR_RO(fan3_label); + + /* Temperature */ + static DEVICE_ATTR(temp1_input, S_IRUGO, asus_hwmon_temp1, NULL); +@@ -2194,10 +2272,13 @@ static struct attribute *hwmon_attributes[] = { + &dev_attr_pwm1.attr, + &dev_attr_pwm1_enable.attr, + &dev_attr_pwm2_enable.attr, ++ &dev_attr_pwm3_enable.attr, + &dev_attr_fan1_input.attr, + &dev_attr_fan1_label.attr, + &dev_attr_fan2_input.attr, + &dev_attr_fan2_label.attr, ++ &dev_attr_fan3_input.attr, ++ &dev_attr_fan3_label.attr, + + &dev_attr_temp1_input.attr, + NULL +@@ -2223,6 +2304,11 @@ static umode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj, + || attr == &dev_attr_pwm2_enable.attr) { + if (asus->gpu_fan_type == FAN_TYPE_NONE) + return 0; ++ } else if (attr == &dev_attr_fan3_input.attr ++ || attr == &dev_attr_fan3_label.attr ++ || attr == &dev_attr_pwm3_enable.attr) { ++ if (asus->mid_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, +@@ -2266,6 +2352,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->mid_fan_type = FAN_TYPE_NONE; + asus->fan_type = FAN_TYPE_NONE; + asus->agfn_pwm = -1; + +@@ -2280,6 +2367,10 @@ static int asus_wmi_fan_init(struct asus_wmi *asus) + if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_GPU_FAN_CTRL)) + asus->gpu_fan_type = FAN_TYPE_SPEC83; + ++ /* Some models also have a center/middle fan */ ++ if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_MID_FAN_CTRL)) ++ asus->mid_fan_type = FAN_TYPE_SPEC83; ++ + if (asus->fan_type == FAN_TYPE_NONE) + return -ENODEV; + +diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h +index b57f3591676a..94e3172b9c72 100644 +--- a/include/linux/platform_data/x86/asus-wmi.h ++++ b/include/linux/platform_data/x86/asus-wmi.h +@@ -84,6 +84,7 @@ + #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_MID_FAN_CTRL 0x00110031 + #define ASUS_WMI_DEVID_CPU_FAN_CURVE 0x00110024 + #define ASUS_WMI_DEVID_GPU_FAN_CURVE 0x00110025 + +-- +2.40.1 + diff --git a/0009-platform-x86-asus-wmi-support-middle-fan-custom-curv.patch b/0009-platform-x86-asus-wmi-support-middle-fan-custom-curv.patch new file mode 100644 index 000000000000..d81dad9632ec --- /dev/null +++ b/0009-platform-x86-asus-wmi-support-middle-fan-custom-curv.patch @@ -0,0 +1,172 @@ +From 21a0a1c935b8dde224e24ca027ff49bee7bfed01 Mon Sep 17 00:00:00 2001 +From: "Luke D. Jones" <luke@ljones.dev> +Date: Sun, 4 Jun 2023 19:37:34 +1200 +Subject: [PATCH 09/11] platform/x86: asus-wmi: support middle fan custom + curves + +Adds support for fan curves defined for the middle fan which +is available on some ASUS ROG laptops. + +Signed-off-by: Luke D. Jones <luke@ljones.dev> +--- + drivers/platform/x86/asus-wmi.c | 75 +++++++++++++++++++++- + include/linux/platform_data/x86/asus-wmi.h | 1 + + 2 files changed, 74 insertions(+), 2 deletions(-) + +diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c +index 8cc532166559..d63d0111cb8b 100644 +--- a/drivers/platform/x86/asus-wmi.c ++++ b/drivers/platform/x86/asus-wmi.c +@@ -114,6 +114,7 @@ module_param(fnlock_default, bool, 0444); + #define FAN_CURVE_BUF_LEN 32 + #define FAN_CURVE_DEV_CPU 0x00 + #define FAN_CURVE_DEV_GPU 0x01 ++#define FAN_CURVE_DEV_MID 0x02 + /* Mask to determine if setting temperature or percentage */ + #define FAN_CURVE_PWM_MASK 0x04 + +@@ -255,7 +256,8 @@ struct asus_wmi { + + bool cpu_fan_curve_available; + bool gpu_fan_curve_available; +- struct fan_curve_data custom_fan_curves[2]; ++ bool mid_fan_curve_available; ++ struct fan_curve_data custom_fan_curves[3]; + + struct platform_profile_handler platform_profile_handler; + bool platform_profile_support; +@@ -2082,6 +2084,8 @@ static ssize_t pwm1_enable_store(struct device *dev, + asus->custom_fan_curves[FAN_CURVE_DEV_CPU].enabled = false; + if (asus->gpu_fan_curve_available) + asus->custom_fan_curves[FAN_CURVE_DEV_GPU].enabled = false; ++ if (asus->mid_fan_curve_available) ++ asus->custom_fan_curves[FAN_CURVE_DEV_MID].enabled = false; + + return count; + } +@@ -2533,6 +2537,9 @@ static int fan_curve_get_factory_default(struct asus_wmi *asus, u32 fan_dev) + if (fan_dev == ASUS_WMI_DEVID_GPU_FAN_CURVE) + fan_idx = FAN_CURVE_DEV_GPU; + ++ if (fan_dev == ASUS_WMI_DEVID_MID_FAN_CURVE) ++ fan_idx = FAN_CURVE_DEV_MID; ++ + curves = &asus->custom_fan_curves[fan_idx]; + err = asus_wmi_evaluate_method_buf(asus->dsts_id, fan_dev, mode, buf, + FAN_CURVE_BUF_LEN); +@@ -2821,6 +2828,42 @@ static SENSOR_DEVICE_ATTR_2_RW(pwm2_auto_point7_pwm, fan_curve, + static SENSOR_DEVICE_ATTR_2_RW(pwm2_auto_point8_pwm, fan_curve, + FAN_CURVE_DEV_GPU | FAN_CURVE_PWM_MASK, 7); + ++/* MID */ ++static SENSOR_DEVICE_ATTR_RW(pwm3_enable, fan_curve_enable, FAN_CURVE_DEV_GPU); ++static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point1_temp, fan_curve, ++ FAN_CURVE_DEV_GPU, 0); ++static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point2_temp, fan_curve, ++ FAN_CURVE_DEV_GPU, 1); ++static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point3_temp, fan_curve, ++ FAN_CURVE_DEV_GPU, 2); ++static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point4_temp, fan_curve, ++ FAN_CURVE_DEV_GPU, 3); ++static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point5_temp, fan_curve, ++ FAN_CURVE_DEV_GPU, 4); ++static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point6_temp, fan_curve, ++ FAN_CURVE_DEV_GPU, 5); ++static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point7_temp, fan_curve, ++ FAN_CURVE_DEV_GPU, 6); ++static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point8_temp, fan_curve, ++ FAN_CURVE_DEV_GPU, 7); ++ ++static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point1_pwm, fan_curve, ++ FAN_CURVE_DEV_GPU | FAN_CURVE_PWM_MASK, 0); ++static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point2_pwm, fan_curve, ++ FAN_CURVE_DEV_GPU | FAN_CURVE_PWM_MASK, 1); ++static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point3_pwm, fan_curve, ++ FAN_CURVE_DEV_GPU | FAN_CURVE_PWM_MASK, 2); ++static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point4_pwm, fan_curve, ++ FAN_CURVE_DEV_GPU | FAN_CURVE_PWM_MASK, 3); ++static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point5_pwm, fan_curve, ++ FAN_CURVE_DEV_GPU | FAN_CURVE_PWM_MASK, 4); ++static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point6_pwm, fan_curve, ++ FAN_CURVE_DEV_GPU | FAN_CURVE_PWM_MASK, 5); ++static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point7_pwm, fan_curve, ++ FAN_CURVE_DEV_GPU | FAN_CURVE_PWM_MASK, 6); ++static SENSOR_DEVICE_ATTR_2_RW(pwm3_auto_point8_pwm, fan_curve, ++ FAN_CURVE_DEV_GPU | FAN_CURVE_PWM_MASK, 7); ++ + static struct attribute *asus_fan_curve_attr[] = { + /* CPU */ + &sensor_dev_attr_pwm1_enable.dev_attr.attr, +@@ -2858,6 +2901,24 @@ static struct attribute *asus_fan_curve_attr[] = { + &sensor_dev_attr_pwm2_auto_point6_pwm.dev_attr.attr, + &sensor_dev_attr_pwm2_auto_point7_pwm.dev_attr.attr, + &sensor_dev_attr_pwm2_auto_point8_pwm.dev_attr.attr, ++ /* MID */ ++ &sensor_dev_attr_pwm3_enable.dev_attr.attr, ++ &sensor_dev_attr_pwm3_auto_point1_temp.dev_attr.attr, ++ &sensor_dev_attr_pwm3_auto_point2_temp.dev_attr.attr, ++ &sensor_dev_attr_pwm3_auto_point3_temp.dev_attr.attr, ++ &sensor_dev_attr_pwm3_auto_point4_temp.dev_attr.attr, ++ &sensor_dev_attr_pwm3_auto_point5_temp.dev_attr.attr, ++ &sensor_dev_attr_pwm3_auto_point6_temp.dev_attr.attr, ++ &sensor_dev_attr_pwm3_auto_point7_temp.dev_attr.attr, ++ &sensor_dev_attr_pwm3_auto_point8_temp.dev_attr.attr, ++ &sensor_dev_attr_pwm3_auto_point1_pwm.dev_attr.attr, ++ &sensor_dev_attr_pwm3_auto_point2_pwm.dev_attr.attr, ++ &sensor_dev_attr_pwm3_auto_point3_pwm.dev_attr.attr, ++ &sensor_dev_attr_pwm3_auto_point4_pwm.dev_attr.attr, ++ &sensor_dev_attr_pwm3_auto_point5_pwm.dev_attr.attr, ++ &sensor_dev_attr_pwm3_auto_point6_pwm.dev_attr.attr, ++ &sensor_dev_attr_pwm3_auto_point7_pwm.dev_attr.attr, ++ &sensor_dev_attr_pwm3_auto_point8_pwm.dev_attr.attr, + NULL + }; + +@@ -2877,6 +2938,9 @@ static umode_t asus_fan_curve_is_visible(struct kobject *kobj, + if (asus->gpu_fan_curve_available && attr->name[3] == '2') + return 0644; + ++ if (asus->mid_fan_curve_available && attr->name[3] == '3') ++ return 0644; ++ + return 0; + } + +@@ -2906,7 +2970,12 @@ static int asus_wmi_custom_fan_curve_init(struct asus_wmi *asus) + if (err) + return err; + +- if (!asus->cpu_fan_curve_available && !asus->gpu_fan_curve_available) ++ err = fan_curve_check_present(asus, &asus->mid_fan_curve_available, ++ ASUS_WMI_DEVID_MID_FAN_CURVE); ++ if (err) ++ return err; ++ ++ if (!asus->cpu_fan_curve_available && !asus->gpu_fan_curve_available && !asus->mid_fan_curve_available) + return 0; + + hwmon = devm_hwmon_device_register_with_groups( +@@ -2975,6 +3044,8 @@ static int throttle_thermal_policy_write(struct asus_wmi *asus) + asus->custom_fan_curves[FAN_CURVE_DEV_CPU].enabled = false; + if (asus->gpu_fan_curve_available) + asus->custom_fan_curves[FAN_CURVE_DEV_GPU].enabled = false; ++ if (asus->mid_fan_curve_available) ++ asus->custom_fan_curves[FAN_CURVE_DEV_MID].enabled = false; + + return 0; + } +diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h +index 94e3172b9c72..dc5e8038d88b 100644 +--- a/include/linux/platform_data/x86/asus-wmi.h ++++ b/include/linux/platform_data/x86/asus-wmi.h +@@ -87,6 +87,7 @@ + #define ASUS_WMI_DEVID_MID_FAN_CTRL 0x00110031 + #define ASUS_WMI_DEVID_CPU_FAN_CURVE 0x00110024 + #define ASUS_WMI_DEVID_GPU_FAN_CURVE 0x00110025 ++#define ASUS_WMI_DEVID_MID_FAN_CURVE 0x00110032 + + /* Power */ + #define ASUS_WMI_DEVID_PROCESSOR_STATE 0x00120012 +-- +2.40.1 + diff --git a/0010-platform-x86-asus-wmi-add-WMI-method-to-show-if-egpu.patch b/0010-platform-x86-asus-wmi-add-WMI-method-to-show-if-egpu.patch new file mode 100644 index 000000000000..9ea518e39041 --- /dev/null +++ b/0010-platform-x86-asus-wmi-add-WMI-method-to-show-if-egpu.patch @@ -0,0 +1,114 @@ +From 2fb35e005be26d242d6a3e94db7fbcbaed9aa0e9 Mon Sep 17 00:00:00 2001 +From: "Luke D. Jones" <luke@ljones.dev> +Date: Sun, 4 Jun 2023 20:01:57 +1200 +Subject: [PATCH 10/11] platform/x86: asus-wmi: add WMI method to show if egpu + connected + +Exposes the WMI method which tells if the eGPU is properly connected +on the devices that support it. + +Signed-off-by: Luke D. Jones <luke@ljones.dev> +--- + .../ABI/testing/sysfs-platform-asus-wmi | 11 +++++++++- + drivers/platform/x86/asus-wmi.c | 21 +++++++++++++++++++ + include/linux/platform_data/x86/asus-wmi.h | 4 +++- + 3 files changed, 34 insertions(+), 2 deletions(-) + +diff --git a/Documentation/ABI/testing/sysfs-platform-asus-wmi b/Documentation/ABI/testing/sysfs-platform-asus-wmi +index eb29e3023c7b..878daf7c2036 100644 +--- a/Documentation/ABI/testing/sysfs-platform-asus-wmi ++++ b/Documentation/ABI/testing/sysfs-platform-asus-wmi +@@ -107,4 +107,13 @@ Description: + Get the current charging mode being used: + * 1 - Barrel connected charger, + * 2 - USB-C charging +- * 3 - Both connected, barrel used for charging +\ No newline at end of file ++ * 3 - Both connected, barrel used for charging ++ ++What: /sys/devices/platform/<platform>/egpu_connected ++Date: Jun 2023 ++KernelVersion: 6.5 ++Contact: "Luke Jones" <luke@ljones.dev> ++Description: ++ Show if the egpu (XG Mobile) is correctly connected: ++ * 0 - False, ++ * 1 - True +diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c +index d63d0111cb8b..26155bdc48da 100644 +--- a/drivers/platform/x86/asus-wmi.c ++++ b/drivers/platform/x86/asus-wmi.c +@@ -245,6 +245,7 @@ struct asus_wmi { + + bool charge_mode_available; + bool egpu_enable_available; ++ bool egpu_connected_available; + bool dgpu_disable_available; + bool gpu_mux_mode_available; + +@@ -711,6 +712,22 @@ static ssize_t egpu_enable_store(struct device *dev, + } + static DEVICE_ATTR_RW(egpu_enable); + ++/* Is eGPU connected? *********************************************************/ ++static ssize_t egpu_connected_show(struct device *dev, ++ struct device_attribute *attr, char *buf) ++{ ++ struct asus_wmi *asus = dev_get_drvdata(dev); ++ int result; ++ ++ result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_EGPU_CONNECTED); ++ if (result < 0) ++ return result; ++ ++ return sysfs_emit(buf, "%d\n", result); ++} ++ ++static DEVICE_ATTR_RO(egpu_connected); ++ + /* gpu mux switch *************************************************************/ + static ssize_t gpu_mux_mode_show(struct device *dev, + struct device_attribute *attr, char *buf) +@@ -3762,6 +3779,7 @@ static struct attribute *platform_attributes[] = { + &dev_attr_touchpad.attr, + &dev_attr_charge_mode.attr, + &dev_attr_egpu_enable.attr, ++ &dev_attr_egpu_connected.attr, + &dev_attr_dgpu_disable.attr, + &dev_attr_gpu_mux_mode.attr, + &dev_attr_lid_resume.attr, +@@ -3794,6 +3812,8 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj, + ok = asus->charge_mode_available; + else if (attr == &dev_attr_egpu_enable.attr) + ok = asus->egpu_enable_available; ++ else if (attr == &dev_attr_egpu_connected.attr) ++ ok = asus->egpu_connected_available; + else if (attr == &dev_attr_dgpu_disable.attr) + ok = asus->dgpu_disable_available; + else if (attr == &dev_attr_gpu_mux_mode.attr) +@@ -4060,6 +4080,7 @@ static int asus_wmi_add(struct platform_device *pdev) + + asus->charge_mode_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_CHARGE_MODE); + asus->egpu_enable_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_EGPU); ++ asus->egpu_connected_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_EGPU_CONNECTED); + 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); +diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h +index dc5e8038d88b..bfc284fe4d68 100644 +--- a/include/linux/platform_data/x86/asus-wmi.h ++++ b/include/linux/platform_data/x86/asus-wmi.h +@@ -104,7 +104,9 @@ + /* Charging mode - 1=Barrel, 2=USB */ + #define ASUS_WMI_DEVID_CHARGE_MODE 0x0012006C + +-/* dgpu on/off */ ++/* epu is connected? 1 == true */ ++#define ASUS_WMI_DEVID_EGPU_CONNECTED 0x00090018 ++/* egpu on/off */ + #define ASUS_WMI_DEVID_EGPU 0x00090019 + + /* dgpu on/off */ +-- +2.40.1 + diff --git a/0011-platform-x86-asus-wmi-support-setting-mini-LED-mode.patch b/0011-platform-x86-asus-wmi-support-setting-mini-LED-mode.patch new file mode 100644 index 000000000000..c92dbc224ce5 --- /dev/null +++ b/0011-platform-x86-asus-wmi-support-setting-mini-LED-mode.patch @@ -0,0 +1,138 @@ +From f7ff4d0624e23015698b408b3e0721ad0241a3ed Mon Sep 17 00:00:00 2001 +From: "Luke D. Jones" <luke@ljones.dev> +Date: Sun, 4 Jun 2023 20:21:10 +1200 +Subject: [PATCH 11/11] platform/x86: asus-wmi: support setting mini-LED mode + +Support changing the mini-LED mode on some of the newer ASUS laptops. + +Signed-off-by: Luke D. Jones <luke@ljones.dev> +--- + .../ABI/testing/sysfs-platform-asus-wmi | 9 ++++ + drivers/platform/x86/asus-wmi.c | 53 +++++++++++++++++++ + include/linux/platform_data/x86/asus-wmi.h | 1 + + 3 files changed, 63 insertions(+) + +diff --git a/Documentation/ABI/testing/sysfs-platform-asus-wmi b/Documentation/ABI/testing/sysfs-platform-asus-wmi +index 878daf7c2036..5624bdef49cb 100644 +--- a/Documentation/ABI/testing/sysfs-platform-asus-wmi ++++ b/Documentation/ABI/testing/sysfs-platform-asus-wmi +@@ -117,3 +117,12 @@ Description: + Show if the egpu (XG Mobile) is correctly connected: + * 0 - False, + * 1 - True ++ ++What: /sys/devices/platform/<platform>/mini_led_mode ++Date: Jun 2023 ++KernelVersion: 6.5 ++Contact: "Luke Jones" <luke@ljones.dev> ++Description: ++ Change the mini-LED mode: ++ * 0 - Single-zone, ++ * 1 - Multi-zone +diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c +index 26155bdc48da..e86366353008 100644 +--- a/drivers/platform/x86/asus-wmi.c ++++ b/drivers/platform/x86/asus-wmi.c +@@ -267,6 +267,7 @@ struct asus_wmi { + bool battery_rsoc_available; + + bool panel_overdrive_available; ++ bool mini_led_mode_available; + + struct hotplug_slot hotplug_slot; + struct mutex hotplug_lock; +@@ -1765,6 +1766,54 @@ static ssize_t panel_od_store(struct device *dev, + } + static DEVICE_ATTR_RW(panel_od); + ++/* Mini-LED mode **************************************************************/ ++static ssize_t mini_led_mode_show(struct device *dev, ++ struct device_attribute *attr, char *buf) ++{ ++ struct asus_wmi *asus = dev_get_drvdata(dev); ++ int result; ++ ++ result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_MINI_LED_MODE); ++ if (result < 0) ++ return result; ++ ++ return sysfs_emit(buf, "%d\n", result); ++} ++ ++static ssize_t mini_led_mode_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ int result, err; ++ u32 mode; ++ ++ struct asus_wmi *asus = dev_get_drvdata(dev); ++ ++ result = kstrtou32(buf, 10, &mode); ++ if (result) ++ return result; ++ ++ if (mode > 1) ++ return -EINVAL; ++ ++ err = asus_wmi_set_devstate(ASUS_WMI_DEVID_MINI_LED_MODE, mode, &result); ++ ++ if (err) { ++ pr_warn("Failed to set mini-LED: %d\n", err); ++ return err; ++ } ++ ++ if (result > 1) { ++ pr_warn("Failed to set mini-LED mode (result): 0x%x\n", result); ++ return -EIO; ++ } ++ ++ sysfs_notify(&asus->platform_device->dev.kobj, NULL, "mini_led_mode"); ++ ++ return count; ++} ++static DEVICE_ATTR_RW(mini_led_mode); ++ + /* Quirks *********************************************************************/ + + static void asus_wmi_set_xusb2pr(struct asus_wmi *asus) +@@ -3787,6 +3836,7 @@ static struct attribute *platform_attributes[] = { + &dev_attr_fan_boost_mode.attr, + &dev_attr_throttle_thermal_policy.attr, + &dev_attr_panel_od.attr, ++ &dev_attr_mini_led_mode.attr, + NULL + }; + +@@ -3824,6 +3874,8 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj, + ok = asus->throttle_thermal_policy_available; + else if (attr == &dev_attr_panel_od.attr) + ok = asus->panel_overdrive_available; ++ else if (attr == &dev_attr_mini_led_mode.attr) ++ ok = asus->mini_led_mode_available; + + if (devid != -1) + ok = !(asus_wmi_get_devstate_simple(asus, devid) < 0); +@@ -4086,6 +4138,7 @@ static int asus_wmi_add(struct platform_device *pdev) + 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); ++ asus->mini_led_mode_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_MINI_LED_MODE); + + err = fan_boost_mode_check_present(asus); + if (err) +diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h +index bfc284fe4d68..193efdca4545 100644 +--- a/include/linux/platform_data/x86/asus-wmi.h ++++ b/include/linux/platform_data/x86/asus-wmi.h +@@ -70,6 +70,7 @@ + #define ASUS_WMI_DEVID_CAMERA 0x00060013 + #define ASUS_WMI_DEVID_LID_FLIP 0x00060062 + #define ASUS_WMI_DEVID_LID_FLIP_ROG 0x00060077 ++#define ASUS_WMI_DEVID_MINI_LED_MODE 0x0005001E + + /* Storage */ + #define ASUS_WMI_DEVID_CARDREADER 0x00080013 +-- +2.40.1 + diff --git a/0019-HID-amd_sfh-Add-keyguard-for-ASUS-ROG-X13-tablet.patch b/0019-HID-amd_sfh-Add-keyguard-for-ASUS-ROG-X13-tablet.patch deleted file mode 100644 index 4e587a119b0e..000000000000 --- a/0019-HID-amd_sfh-Add-keyguard-for-ASUS-ROG-X13-tablet.patch +++ /dev/null @@ -1,174 +0,0 @@ -From 802dfc514194e5459397f513b202031228b3315a Mon Sep 17 00:00:00 2001 -From: "Luke D. Jones" <luke@ljones.dev> -Date: Fri, 26 Aug 2022 12:25:12 +1200 -Subject: [PATCH 19/19] HID: amd_sfh: Add keyguard for ASUS ROG X13 tablet - -Add support for ROG X13 Flow 2-in-1 to disable the keyboard when -the lid is flipped. - -Signed-off-by: Luke D. Jones <luke@ljones.dev> ---- - 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 +++++++++++++ - 5 files changed, 59 insertions(+) - -diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c -index 4b90c86ee5f8..0f4db2ce076e 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 */ --- -2.37.2 - diff --git a/0031-FX516PE-rgb-mode.patch b/0031-FX516PE-rgb-mode.patch deleted file mode 100644 index c025fcbea3f6..000000000000 --- a/0031-FX516PE-rgb-mode.patch +++ /dev/null @@ -1,68 +0,0 @@ -diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c -index 1038dfdcdd32..7180d425a28f 100644 ---- a/drivers/platform/x86/asus-wmi.c -+++ b/drivers/platform/x86/asus-wmi.c -@@ -241,7 +241,7 @@ struct asus_wmi { - bool dgpu_disable_available; - bool gpu_mux_mode_available; - -- bool kbd_rgb_mode_available; -+ u32 kbd_rgb_mode_available; - bool kbd_rgb_state_available; - - bool throttle_thermal_policy_available; -@@ -738,6 +738,7 @@ static ssize_t kbd_rgb_mode_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) - { -+ struct asus_wmi *asus = dev_get_drvdata(dev); - u32 cmd, mode, r, g, b, speed; - int err; - -@@ -764,8 +765,14 @@ static ssize_t kbd_rgb_mode_store(struct device *dev, - speed = 0xeb; - } - -- err = asus_wmi_evaluate_method3(ASUS_WMI_METHODID_DEVS, ASUS_WMI_DEVID_TUF_RGB_MODE, -+ if (asus->kbd_rgb_mode_available == 1) { -+ 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); -+ } else if (asus->kbd_rgb_mode_available == 2) { -+ err = asus_wmi_evaluate_method3(ASUS_WMI_METHODID_DEVS, ASUS_WMI_DEVID_TUF_RGB_MODE_2, - cmd | (mode << 8) | (r << 16) | (g << 24), b | (speed << 8), NULL); -+ } -+ - if (err) - return err; - -@@ -3760,9 +3767,15 @@ 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->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); -+ if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_MODE)) { -+ asus->kbd_rgb_mode_available = 1; -+ } else if (asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_MODE_2)) { -+ asus->kbd_rgb_mode_available = 2; -+ } else { -+ asus->kbd_rgb_mode_available = 0; -+ } -+ asus->kbd_rgb_state_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_STATE); - - err = fan_boost_mode_check_present(asus); - if (err) -diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h -index 28234dc9fa6a..b299fd3ff914 100644 ---- a/include/linux/platform_data/x86/asus-wmi.h -+++ b/include/linux/platform_data/x86/asus-wmi.h -@@ -106,6 +106,8 @@ - - /* TUF laptop RGB modes/colours */ - #define ASUS_WMI_DEVID_TUF_RGB_MODE 0x00100056 -+/* TUF laptop RGB modes/colours, new method on FX516P series */ -+#define ASUS_WMI_DEVID_TUF_RGB_MODE_2 0x0010005A - - /* TUF laptop RGB power/state */ - #define ASUS_WMI_DEVID_TUF_RGB_STATE 0x00100057 diff --git a/0035-Add_quirk_for_polling_the_KBD_port.patch b/0035-Add_quirk_for_polling_the_KBD_port.patch new file mode 100644 index 000000000000..1c2ab65238cf --- /dev/null +++ b/0035-Add_quirk_for_polling_the_KBD_port.patch @@ -0,0 +1,177 @@ + + +It seems like there are some devices in the ASUS TUF A16 laptops that +just don't send any keyboard interrupts until you read from the KBD port. + +Signed-off-by: Friedrich Vock <friedrich.vock@gmx.de> +--- + drivers/input/serio/i8042-acpipnpio.h | 30 +++++++++++++++-- + drivers/input/serio/i8042.c | 47 ++++++++++++++++++++++----- + drivers/input/serio/i8042.h | 2 +- + 3 files changed, 67 insertions(+), 12 deletions(-) + +diff --git a/drivers/input/serio/i8042-acpipnpio.h b/drivers/input/serio/i8042-acpipnpio.h +index 028e45bd050b..be2e72aaa658 100644 +--- a/drivers/input/serio/i8042-acpipnpio.h ++++ b/drivers/input/serio/i8042-acpipnpio.h +@@ -83,6 +83,7 @@ static inline void i8042_write_command(int val) + #define SERIO_QUIRK_KBDRESET BIT(12) + #define SERIO_QUIRK_DRITEK BIT(13) + #define SERIO_QUIRK_NOPNP BIT(14) ++#define SERIO_QUIRK_POLL_KBD BIT(15) + + /* Quirk table for different mainboards. Options similar or identical to i8042 + * module parameters. +@@ -99,6 +100,26 @@ static const struct dmi_system_id i8042_dmi_quirk_table[] __initconst = { + }, + .driver_data = (void *)(SERIO_QUIRK_NOMUX) + }, ++ /* Some laptops seem to not trigger any keyboard interrupts at all, ++ * even when there is data available. On these devices, manually ++ * polling the keyboard port is required. ++ */ ++ { ++ /* ASUS TUF Gaming A16 with Ryzen 7 7735HS */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "FA617NS"), ++ }, ++ .driver_data = (void *)(SERIO_QUIRK_POLL_KBD) ++ }, ++ { ++ /* ASUS TUF Gaming A16 with Ryzen 9 7940HS */ ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "FA617XS"), ++ }, ++ .driver_data = (void *)(SERIO_QUIRK_POLL_KBD) ++ }, + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), +@@ -1634,6 +1655,8 @@ static void __init i8042_check_quirks(void) + if (quirks & SERIO_QUIRK_NOPNP) + i8042_nopnp = true; + #endif ++ if (quirks & SERIO_QUIRK_POLL_KBD) ++ i8042_poll_kbd = true; + } + #else + static inline void i8042_check_quirks(void) {} +@@ -1667,7 +1690,7 @@ static int __init i8042_platform_init(void) + + i8042_check_quirks(); + +- pr_debug("Active quirks (empty means none):%s%s%s%s%s%s%s%s%s%s%s%s%s\n", ++ pr_debug("Active quirks (empty means none):%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", + i8042_nokbd ? " nokbd" : "", + i8042_noaux ? " noaux" : "", + i8042_nomux ? " nomux" : "", +@@ -1687,10 +1710,11 @@ static int __init i8042_platform_init(void) + "", + #endif + #ifdef CONFIG_PNP +- i8042_nopnp ? " nopnp" : ""); ++ i8042_nopnp ? " nopnp" : "", + #else +- ""); ++ "", + #endif ++ i8042_poll_kbd ? "poll_kbd" : ""); + + retval = i8042_pnp_init(); + if (retval) +diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c +index 6dac7c1853a5..7212263d3a41 100644 +--- a/drivers/input/serio/i8042.c ++++ b/drivers/input/serio/i8042.c +@@ -115,6 +115,10 @@ module_param_named(nopnp, i8042_nopnp, bool, 0); + MODULE_PARM_DESC(nopnp, "Do not use PNP to detect controller settings"); + #endif + ++static bool i8042_poll_kbd; ++module_param_named(poll_kbd, i8042_poll_kbd, bool, 0); ++MODULE_PARM_DESC(poll_kbd, "Continuously poll the KBD port instead of relying on interrupts"); ++ + #define DEBUG + #ifdef DEBUG + static bool i8042_debug; +@@ -178,6 +182,24 @@ static irqreturn_t i8042_interrupt(int irq, void *dev_id); + static bool (*i8042_platform_filter)(unsigned char data, unsigned char str, + struct serio *serio); + ++#define POLL_TIME 1 ++static void i8042_poll_func(struct timer_list *timer) ++{ ++ unsigned char status; ++ unsigned long flags; ++ ++ do { ++ spin_lock_irqsave(&i8042_lock, flags); ++ status = i8042_read_status(); ++ spin_unlock_irqrestore(&i8042_lock, flags); ++ if (status & I8042_STR_OBF) ++ i8042_interrupt(0, NULL); ++ } while (status & I8042_STR_OBF); ++ mod_timer(timer, jiffies + msecs_to_jiffies(POLL_TIME)); ++} ++ ++DEFINE_TIMER(poll_timer, i8042_poll_func); ++ + void i8042_lock_chip(void) + { + mutex_lock(&i8042_mutex); +@@ -1437,13 +1459,15 @@ static void i8042_unregister_ports(void) + } + } + ++ + static void i8042_free_irqs(void) + { + if (i8042_aux_irq_registered) + free_irq(I8042_AUX_IRQ, i8042_platform_device); +- if (i8042_kbd_irq_registered) ++ if (i8042_poll_kbd) ++ del_timer(&poll_timer); ++ else if (i8042_kbd_irq_registered) + free_irq(I8042_KBD_IRQ, i8042_platform_device); +- + i8042_aux_irq_registered = i8042_kbd_irq_registered = false; + } + +@@ -1497,10 +1521,14 @@ static int i8042_setup_kbd(void) + if (error) + return error; + +- error = request_irq(I8042_KBD_IRQ, i8042_interrupt, IRQF_SHARED, +- "i8042", i8042_platform_device); +- if (error) +- goto err_free_port; ++ if (i8042_poll_kbd) ++ mod_timer(&poll_timer, msecs_to_jiffies(POLL_TIME)); ++ else { ++ error = request_irq(I8042_KBD_IRQ, i8042_interrupt, IRQF_SHARED, ++ "i8042", i8042_platform_device); ++ if (error) ++ goto err_free_port; ++ } + + error = i8042_enable_kbd_port(); + if (error) +@@ -1510,8 +1538,11 @@ static int i8042_setup_kbd(void) + return 0; + + err_free_irq: +- free_irq(I8042_KBD_IRQ, i8042_platform_device); +- err_free_port: ++ if (i8042_poll_kbd) ++ del_timer(&poll_timer); ++ else ++ free_irq(I8042_KBD_IRQ, i8042_platform_device); ++err_free_port: + i8042_free_kbd_port(); + return error; + } +-- +2.40.1 + diff --git a/0036-Block_a_rogue_device_on_ASUS_TUF_A16.patch b/0036-Block_a_rogue_device_on_ASUS_TUF_A16.patch new file mode 100644 index 000000000000..a97e2aa5ec2c --- /dev/null +++ b/0036-Block_a_rogue_device_on_ASUS_TUF_A16.patch @@ -0,0 +1,121 @@ + + +On these laptops, there seems to be a device that, when probed by +i2c-hid, constantly sends bogus interrupts and interferes with the +keyboard controller. When the device is enabled, it takes the keyboard +around 8 seconds to register that keys are being pressed or released. + +Nothing I tried seemed to make the device work, and preventing the +device from being probed doesn't seem to break any functionality of +the laptop. + +Signed-off-by: Friedrich Vock <friedrich.vock@gmx.de> +--- + drivers/hid/i2c-hid/i2c-hid-core.c | 5 +++ + drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c | 48 ++++++++++++++++++++++++ + drivers/hid/i2c-hid/i2c-hid.h | 3 ++ + 3 files changed, 56 insertions(+) + +diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c +index efbba0465eef..5f0686d058df 100644 +--- a/drivers/hid/i2c-hid/i2c-hid-core.c ++++ b/drivers/hid/i2c-hid/i2c-hid-core.c +@@ -1035,6 +1035,11 @@ int i2c_hid_core_probe(struct i2c_client *client, struct i2chid_ops *ops, + + ihid->quirks = i2c_hid_lookup_quirk(hid->vendor, hid->product); + ++ if (i2c_hid_device_blocked(hid->vendor, hid->product)) { ++ ret = -ENODEV; ++ goto err_irq; ++ } ++ + ret = hid_add_device(hid); + if (ret) { + if (ret != -ENODEV) +diff --git a/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c b/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c +index 210f17c3a0be..d2c2806b64b4 100644 +--- a/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c ++++ b/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c +@@ -440,6 +440,38 @@ static const struct dmi_system_id i2c_hid_dmi_quirk_table[] = { + { } /* Terminate list */ + }; + ++static const struct hid_device_id i2c_hid_blocked_ite_device = { ++ HID_DEVICE(BUS_I2C, HID_GROUP_GENERIC, USB_VENDOR_ID_ITE, 0x8051) ++}; ++ ++/* ++ * This list contains devices that can't be activated at all, for example ++ * because activating them breaks other important parts of the system. ++ */ ++static const struct dmi_system_id i2c_hid_dmi_block_table[] = { ++ /* ++ * On ASUS TUF Gaming A16 laptops, there is a device that will make the ++ * keyboard controller stop working correctly and flood the CPU with bogus ++ * interrupts. ++ */ ++ { ++ .ident = "ASUS TUF Gaming A16 (Ryzen 7 7735HS)", ++ .matches = { ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "FA617NS"), ++ }, ++ .driver_data = (void *)&i2c_hid_blocked_ite_device, ++ }, ++ { ++ .ident = "ASUS TUF Gaming A16 (Ryzen 9 7940HS)", ++ .matches = { ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), ++ DMI_MATCH(DMI_PRODUCT_NAME, "FA617XS"), ++ }, ++ .driver_data = (void *)&i2c_hid_blocked_ite_device, ++ }, ++ { } /* Terminate list */ ++}; + + struct i2c_hid_desc *i2c_hid_get_dmi_i2c_hid_desc_override(uint8_t *i2c_name) + { +@@ -492,3 +524,19 @@ u32 i2c_hid_get_dmi_quirks(const u16 vendor, const u16 product) + + return quirks; + } ++ ++bool i2c_hid_device_blocked(const u16 vendor, const u16 product) ++{ ++ const struct dmi_system_id *system_id = ++ dmi_first_match(i2c_hid_dmi_block_table); ++ ++ if (system_id) { ++ const struct hid_device_id *device_id = ++ (struct hid_device_id *)(system_id->driver_data); ++ ++ if (device_id && device_id->vendor == vendor && ++ device_id->product == product) ++ return true; ++ } ++ return false; ++} +diff --git a/drivers/hid/i2c-hid/i2c-hid.h b/drivers/hid/i2c-hid/i2c-hid.h +index 2c7b66d5caa0..e17bdd758f39 100644 +--- a/drivers/hid/i2c-hid/i2c-hid.h ++++ b/drivers/hid/i2c-hid/i2c-hid.h +@@ -10,6 +10,7 @@ struct i2c_hid_desc *i2c_hid_get_dmi_i2c_hid_desc_override(uint8_t *i2c_name); + char *i2c_hid_get_dmi_hid_report_desc_override(uint8_t *i2c_name, + unsigned int *size); + u32 i2c_hid_get_dmi_quirks(const u16 vendor, const u16 product); ++bool i2c_hid_device_blocked(const u16 vendor, const u16 product); + #else + static inline struct i2c_hid_desc + *i2c_hid_get_dmi_i2c_hid_desc_override(uint8_t *i2c_name) +@@ -19,6 +20,8 @@ static inline char *i2c_hid_get_dmi_hid_report_desc_override(uint8_t *i2c_name, + { return NULL; } + static inline u32 i2c_hid_get_dmi_quirks(const u16 vendor, const u16 product) + { return 0; } ++static inline bool i2c_hid_device_blocked(const u16 vendor, const u16 product) ++{ return false; } + #endif + + /** +-- +2.40.1 + @@ -3,7 +3,7 @@ # Contributor: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com> pkgbase=linux-g14 -pkgver=6.3.5.arch1 +pkgver=6.3.6.arch1 pkgrel=1 pkgdesc='Linux' _srctag=v${pkgver%.*}-${pkgver##*.} @@ -36,7 +36,6 @@ source=( 0001-acpi-proc-idle-skip-dummy-wait.patch - 0019-HID-amd_sfh-Add-keyguard-for-ASUS-ROG-X13-tablet.patch 0001-platform-x86-asus-wmi-Add-safety-checks-to-dgpu-egpu.patch 0027-mt76_-mt7921_-Disable-powersave-features-by-default.patch @@ -45,19 +44,25 @@ source=( 0001-constgran-v2.patch 0001-linux6.1.y-bore2.2.1.patch - 0028-patch01_gu604_alc285_fixes.patch 0029-patch02_gu604v_wmi_keys.patch - 0031-FX516PE-rgb-mode.patch 0032-Bluetooth-btusb-Add-a-new-PID-VID-0489-e0f6-for-MT7922.patch - - 0001-HID-asus-Add-support-for-ASUS-ROG-Z13-keyboard.patch - 0002-HID-asus-add-keycodes-for-0x6a-0x4b-and-0xc7.patch - 0003-HID-asus-reformat-the-hotkey-mapping-block.patch -# 0004-ALSA-hda-realtek-Add-quirk-for-2nd-ASUS-GU603.patch - 0005-ACPI-resource-Skip-IRQ-override-on-ASUS-TUF-Gaming-A.patch - 0006-ACPI-resource-Skip-IRQ-override-on-ASUS-TUF-Gaming-A.patch - 0007-platform-x86-asus-wmi-add-support-for-ASUS-screenpad.patch + 0035-Add_quirk_for_polling_the_KBD_port.patch + 0036-Block_a_rogue_device_on_ASUS_TUF_A16.patch + + 0001-ACPI-resource-Skip-IRQ-override-on-ASUS-TUF-Gaming-A.patch + 0001-ALSA-hda-realtek-gu604.patch + 0001-HID-amd_sfh-Add-support-for-tablet-mode-switch-senso.patch + 0002-ACPI-resource-Skip-IRQ-override-on-ASUS-TUF-Gaming-A.patch + 0003-HID-asus-Add-support-for-ASUS-ROG-Z13-keyboard.patch + 0004-HID-asus-add-keycodes-for-0x6a-0x4b-and-0xc7.patch + 0005-HID-asus-reformat-the-hotkey-mapping-block.patch + 0006-platform-x86-asus-wmi-add-support-for-ASUS-screenpad.patch + 0007-platform-x86-asus-wmi-add-support-for-showing-charge.patch + 0008-platform-x86-asus-wmi-add-support-for-showing-middle.patch + 0009-platform-x86-asus-wmi-support-middle-fan-custom-curv.patch + 0010-platform-x86-asus-wmi-add-WMI-method-to-show-if-egpu.patch + 0011-platform-x86-asus-wmi-support-setting-mini-LED-mode.patch "sys-kernel_arch-sources-g14_files-0047-asus-nb-wmi-Add-tablet_mode_sw-lid-flip.patch" "sys-kernel_arch-sources-g14_files-0048-asus-nb-wmi-fix-tablet_mode_sw_int.patch" |