diff options
21 files changed, 961 insertions, 875 deletions
@@ -1,6 +1,6 @@ pkgbase = linux-g14 pkgdesc = Linux - pkgver = 6.3.8.arch1 + pkgver = 6.3.9.arch1 pkgrel = 1 url = https://gitlab.com/dragonn/linux-g14.git arch = x86_64 @@ -16,7 +16,7 @@ pkgbase = linux-g14 makedepends = xz makedepends = python options = !strip - source = archlinux-linux::git+https://github.com/archlinux/linux?signed#tag=v6.3.8-arch1 + source = archlinux-linux::git+https://github.com/archlinux/linux?signed#tag=v6.3.9-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 @@ -26,7 +26,6 @@ pkgbase = linux-g14 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 = 0029-patch02_gu604v_wmi_keys.patch source = 0032-Bluetooth-btusb-Add-a-new-PID-VID-0489-e0f6-for-MT7922.patch source = 0035-Add_quirk_for_polling_the_KBD_port.patch source = 0036-Block_a_rogue_device_on_ASUS_TUF_A16.patch @@ -36,13 +35,20 @@ pkgbase = linux-g14 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 = 0001-ALSA-hda-realtek-Add-quirk-for-ASUS-ROG-GX650P.patch + source = 0002-ALSA-hda-realtek-Add-quirk-for-ASUS-ROG-GA402X.patch + source = v2-0001-platform-x86-asus-wmi-add-support-for-showing-cha.patch + source = v2-0002-platform-x86-asus-wmi-add-support-for-showing-mid.patch + source = v2-0003-platform-x86-asus-wmi-support-middle-fan-custom-c.patch + source = v2-0004-platform-x86-asus-wmi-add-WMI-method-to-show-if-e.patch + source = v2-0005-platform-x86-asus-wmi-don-t-allow-eGPU-switching-.patch + source = v2-0006-platform-x86-asus-wmi-add-safety-checks-to-gpu-sw.patch + source = v2-0007-platform-x86-asus-wmi-support-setting-mini-LED-mo.patch + source = v2-0008-platform-x86-asus-wmi-expose-dGPU-and-CPU-tunable.patch + source = v4-0001-platform-x86-asus-wmi-add-support-for-ASUS-screen.patch source = 0038-mediatek-pci-reset.patch + source = 0040-workaround_hardware_decoding_amdgpu.patch + source = 0041-flush_and_deleyed_gfxoff_on_suspend_amdgpu.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 @@ -51,7 +57,7 @@ pkgbase = linux-g14 validpgpkeys = A2FF3A36AAA56654109064AB19802F8B0D70FC30 validpgpkeys = C7E7849466FE2358343588377258734B41C31549 sha256sums = SKIP - sha256sums = 21b9a9e542f853cdc695648d6ab6219bd2e881a4954277f241e104723c373d42 + sha256sums = 6508516de94ed941ae755d89807610dc51fe1229dbfecdf8a82604a8d33242ce sha256sums = bc8b5f303e3507c01d8543fb4352ed7dcdb9ed4eb2854788d39510f88d67f454 sha256sums = 81ad663925a0aa5b5332a69bae7227393664bb81ee2e57a283e7f16e9ff75efe sha256sums = 0a7ea482fe20c403788d290826cec42fe395e5a6eab07b88845f8b9a9829998d @@ -60,7 +66,6 @@ pkgbase = linux-g14 sha256sums = 7b16fce20b03babc9e149030f43e283534835bbd8835ba0a794fd0205fea1708 sha256sums = efbf65b17fb48fd22f199b6fddd05f159f8ea31faad5543f2c07fddf45eb9f12 sha256sums = d4f8e606eaad9a1fe302f04b9023a3980eb2305108c0d8c90654d23e53ff8bef - sha256sums = cdbcec3031878cdb7ffab32034e4ee31bbd0ec214088f95dc446a13320985631 sha256sums = a8e1e11a4ab1995cc4975c9b134a43ddfe7054ef0c965e52a7d8f9223e15c3e0 sha256sums = 315d1839630b37894a626bbc2aea012618b2e1ccb6f9d8aa27c0a3ce5e90e99c sha256sums = 1740589bbf5eb2c292904e508270ed221e1382f78bcb7cf1c72f1dc12f767e69 @@ -70,13 +75,20 @@ pkgbase = linux-g14 sha256sums = 655a7650a21ce4f725caf6fa248295edefa25a248aeaecf3d65a058503ae2530 sha256sums = 7ce4b001a81b15b5b5275620fc0cee3d251d753698ae3db4593619a2121e1f2e sha256sums = c7d44e1eb82b4711b4cc86016a1886a573f1abc893dbdd201d4a6d0326859b85 - sha256sums = 66ee16ec4e39973905905d66eb043a55fdeaae470902be6adf893ce1a4ac4cbe - sha256sums = 2c6b2efef195cc54d641374cad669884dede99a8b934e2b2b168c6ae35554f2c - sha256sums = 73db9582e8d5fa41a1a7ed38bd0a012cd28573d1d2eda44152ce13477bdd7999 - sha256sums = c7430e0ad27f9a1cd1677da1a7471dcf63088cb21cd943427454889c69e7f829 - sha256sums = 976abe70d2a1604ce2335a7d7ce5d9722db93e389413a0b6a7f3ea72f795b65b - sha256sums = 8a0ee3fbb3c95cd4d5cedd62517384374462d5157f3104013e5cbe6d91317e95 - sha256sums = a768687d858b608c01e22664817a80602e8c17911487fac71430f70b0c52b9f9 + sha256sums = 58c46d5d5b3428bd3c9354cf66542ae91323b116dc52826ca5eed2e522b67b0a + sha256sums = 06fd2961548a7d3e31bcd388e67d07f9840c74a7811f70810a7ca1f946e59c9e + sha256sums = 454dc9b16fd2559843d78a93905a39b1668eaaecb0bf0a9dccf432199f9b96be + sha256sums = 5a82899580abaaab4cd818c96407b6be5b2d6b6d1004355eab12fedebdb968a0 + sha256sums = a75528877f5db652b4e0b5e68f2ec39557bcad9786c6f6419327d3e08d1fe9be + sha256sums = cbf0738ba984d0fa9ad396ec1e5b2a6ed1e2411dc81b17423fdceef423a484b2 + sha256sums = 9f98765b43f5f31b33ed05f3611508113b02518e680ee82b251de80dae2e141d + sha256sums = 5e58aa605c2ae00c0925e1fbb838a8041e7cf2eb78c0d6167e59dbe27b536565 + sha256sums = 137f16f59a63568b3546649346ef1bc2211c03da28178a94bf8cd104051f67b8 + sha256sums = 1983fbb75a4e8c76ffeca51b42dcb3cdcd4a6a5b4aafdb02b3dcbf3c5c9a94ad + sha256sums = 2e0274f6681d22f0350bb04cab4bbe796e97c9bb1bd297054eaf900046036d81 + sha256sums = d673d034fbcd80426fd8d9c6af56537c5fe5b55fe49d74e313474d7fc285ecc1 + sha256sums = e41198b29cee4de7a5132d8df606f48c2d0f9c9076fe4230b00a33c7e0b22c71 + sha256sums = e2c81fc2af08c175a7642d4f4f90e398702d9d903857cf0bba81db99f146a561 sha256sums = 15e912a66e4bbce1cf0450f1dc6610653df29df8dd6d5426f9c1b039490436c8 sha256sums = 444f2d86de8c2177655b01596f939f99c2e7abfa8efad8a509e0a334f42dfa85 sha256sums = 982a31e47d3d586789e1b3cdda25f75e3b71d810e7494202089b8f2cef7c0ef9 diff --git a/0001-ALSA-hda-realtek-Add-quirk-for-ASUS-ROG-GX650P.patch b/0001-ALSA-hda-realtek-Add-quirk-for-ASUS-ROG-GX650P.patch new file mode 100644 index 000000000000..93a449e490d1 --- /dev/null +++ b/0001-ALSA-hda-realtek-Add-quirk-for-ASUS-ROG-GX650P.patch @@ -0,0 +1,72 @@ +From 1e23a87b42549adfec03184f46dc3c744393196d Mon Sep 17 00:00:00 2001 +From: "Luke D. Jones" <luke@ljones.dev> +Date: Fri, 30 Jun 2023 16:24:05 +1200 +Subject: [PATCH 1/2] ALSA: hda/realtek: Add quirk for ASUS ROG GX650P + +Adds the required quirk to enable the Cirrus amp and correct pins +on the ASUS ROG GV601V series. + +While this works if the related _DSD properties are made available, these +aren't included in the ACPI of these laptops (yet). + +Signed-off-by: Luke D. Jones <luke@ljones.dev> +--- + sound/pci/hda/patch_realtek.c | 21 ++++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index dabfdecece26..1c26f24b1246 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -5883,7 +5883,7 @@ static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec, + struct alc_spec *spec = codec->spec; + spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; + alc255_set_default_jack_type(codec); +- } ++ } + else + alc_fixup_headset_mode(codec, fix, action); + } +@@ -7065,6 +7065,8 @@ enum { + ALC285_FIXUP_SPEAKER2_TO_DAC1, + ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1, + ALC285_FIXUP_ASUS_HEADSET_MIC, ++ ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1, ++ ALC285_FIXUP_ASUS_I2C_HEADSET_MIC, + ALC280_FIXUP_HP_HEADSET_MIC, + ALC221_FIXUP_HP_FRONT_MIC, + ALC292_FIXUP_TPT460, +@@ -8051,6 +8053,22 @@ static const struct hda_fixup alc269_fixups[] = { + .chained = true, + .chain_id = ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1 + }, ++ [ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1] = { ++ .type = HDA_FIXUP_FUNC, ++ .v.func = alc285_fixup_speaker2_to_dac1, ++ .chained = true, ++ .chain_id = ALC287_FIXUP_CS35L41_I2C_2 ++ }, ++ [ALC285_FIXUP_ASUS_I2C_HEADSET_MIC] = { ++ .type = HDA_FIXUP_PINS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x19, 0x03a11050 }, ++ { 0x1b, 0x03a11c30 }, ++ { } ++ }, ++ .chained = true, ++ .chain_id = ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1 ++ }, + [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl[]) { +@@ -9525,6 +9543,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK), ++ SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650P", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC), + SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604V", ALC285_FIXUP_ASUS_HEADSET_MIC), + SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603V", ALC285_FIXUP_ASUS_HEADSET_MIC), + SND_PCI_QUIRK(0x1043, 0x1493, "ASUS GV601V", ALC285_FIXUP_ASUS_HEADSET_MIC), +-- +2.41.0 + diff --git a/0001-HID-amd_sfh-Add-keyguard-for-ASUS-ROG-X13-tablet.patch b/0001-HID-amd_sfh-Add-keyguard-for-ASUS-ROG-X13-tablet.patch deleted file mode 100644 index defab6fb88d7..000000000000 --- a/0001-HID-amd_sfh-Add-keyguard-for-ASUS-ROG-X13-tablet.patch +++ /dev/null @@ -1,193 +0,0 @@ -From e6529e0ad6942bb0eadc5f5ad0590124153e0a8c Mon Sep 17 00:00:00 2001 -From: "Luke D. Jones" <luke@ljones.dev> -Date: Wed, 3 Aug 2022 11:02:05 +1200 -Subject: [PATCH 1/1] 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 | 7 ++++- - 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 | 9 +++++++ - .../hid_descriptor/amd_sfh_hid_report_desc.h | 19 +++++++++++++ - 5 files changed, 62 insertions(+), 1 deletion(-) - -diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c -index dadc491bbf6b..243541d426d8 100644 ---- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c -+++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c -@@ -26,6 +26,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) - -@@ -232,6 +233,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; - } - -@@ -373,7 +377,8 @@ static int __maybe_unused amd_mp2_pci_suspend(struct device *dev) - - for (i = 0; i < cl_data->num_hid_devices; i++) { - if (cl_data->sensor_idx[i] != HPD_IDX && -- cl_data->sensor_sts[i] == SENSOR_ENABLED) { -+ cl_data->sensor_idx[i] != KBGUARD_IDX && -+ cl_data->sensor_sts[i] == SENSOR_ENABLED) { - mp2->mp2_ops->stop(mp2, cl_data->sensor_idx[i]); - status = amd_sfh_wait_for_response - (mp2, cl_data->sensor_idx[i], SENSOR_DISABLED); -diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h -index 8c760526132a..4a86bc6038a2 100644 ---- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h -+++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h -@@ -36,6 +36,7 @@ - #define SENSOR_DISABLED 5 - - #define HPD_IDX 16 -+#define KBGUARD_IDX 15 - - #define AMD_SFH_IDLE_LOOP 200 - -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 76095bd53c65..f41d28ea7b93 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 @@ 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 @@ 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 @@ 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 @@ 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; -@@ -210,6 +231,7 @@ u8 get_input_report(u8 current_index, int sensor_idx, int report_id, struct amd_ - 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; -@@ -262,6 +284,11 @@ u8 get_input_report(u8 current_index, int sensor_idx, int report_id, struct amd_ - 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 70b1b7abe2c6..98571a8597b3 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 -@@ -105,12 +105,21 @@ struct hpd_feature_report { - struct common_feature_property common_property; - } __packed; - -+struct kbguard_feature_report { -+ struct common_feature_property common_property; -+} __packed; -+ - struct hpd_input_report { - struct common_input_property common_property; - /* values specific to human presence sensor */ - u8 human_presence; - } __packed; - -+struct kbguard_input_report { -+ struct common_input_property common_property; -+} __packed; -+ -+ - int get_report_descriptor(int sensor_idx, u8 rep_desc[]); - u32 get_descr_sz(int sensor_idx, int descriptor_name); - u8 get_feature_report(int sensor_idx, int report_id, u8 *feature_report); -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.1 - diff --git a/0001-linux6.0.y-bore1.7.5.patch b/0001-linux6.0.y-bore1.7.5.patch deleted file mode 100644 index 89281b292f78..000000000000 --- a/0001-linux6.0.y-bore1.7.5.patch +++ /dev/null @@ -1,461 +0,0 @@ -From 33d4c5a2808aeb991653f9c4cecd7320434f1ea1 Mon Sep 17 00:00:00 2001 -From: Masahito S <firelzrd@gmail.com> -Date: Sun, 18 Dec 2022 15:26:15 +0900 -Subject: [PATCH] linux6.0.y-bore1.7.5 - ---- - include/linux/sched.h | 5 ++ - init/Kconfig | 20 +++++ - kernel/sched/core.c | 29 +++++++ - kernel/sched/debug.c | 3 + - kernel/sched/fair.c | 166 ++++++++++++++++++++++++++++++++++++++-- - kernel/sched/features.h | 4 + - 6 files changed, 220 insertions(+), 7 deletions(-) - -diff --git a/include/linux/sched.h b/include/linux/sched.h -index 8d82d6d32..a53340011 100644 ---- a/include/linux/sched.h -+++ b/include/linux/sched.h -@@ -545,6 +545,11 @@ struct sched_entity { - u64 sum_exec_runtime; - u64 vruntime; - u64 prev_sum_exec_runtime; -+#ifdef CONFIG_SCHED_BORE -+ u64 prev_burst_time; -+ u64 burst_time; -+ u8 burst_score; -+#endif // CONFIG_SCHED_BORE - - u64 nr_migrations; - -diff --git a/init/Kconfig b/init/Kconfig -index d1d779d6b..04a0b6b20 100644 ---- a/init/Kconfig -+++ b/init/Kconfig -@@ -1272,6 +1272,26 @@ config CHECKPOINT_RESTORE - - If unsure, say N here. - -+config SCHED_BORE -+ bool "Burst-Oriented Response Enhancer" -+ default y -+ help -+ In Desktop and Mobile computing, one might prefer interactive -+ tasks to keep responsive no matter what they run in the background. -+ -+ Enabling this kernel feature modifies the scheduler to discriminate -+ tasks by their burst time (runtime since it last went sleeping or -+ yielding state) and prioritize those that run less bursty. -+ Such tasks usually include window compositor, widgets backend, -+ terminal emulator, video playback, games and so on. -+ With a little impact to scheduling fairness, it may improve -+ responsiveness especially under heavy background workload. -+ -+ You can turn it off by setting the sysctl kernel.sched_bore = 0. -+ Enabling this feature implies NO_GENTLE_FAIR_SLEEPERS by default. -+ -+ If unsure say Y here. -+ - config SCHED_AUTOGROUP - bool "Automatic process group scheduling" - select CGROUPS -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index ee28253c9..0a9d220fc 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -4320,6 +4320,22 @@ int wake_up_state(struct task_struct *p, unsigned int state) - return try_to_wake_up(p, state, 0); - } - -+#ifdef CONFIG_SCHED_BORE -+static inline void sched_on_fork_calc_prev_burst_from_siblings(struct task_struct *p) -+{ -+ struct task_struct *sib; -+ u64 sum = 0, avg = 0; -+ u32 cnt = 0; -+ list_for_each_entry(sib, &p->sibling, sibling) { -+ cnt++; -+ sum += sib->se.prev_burst_time; -+ } -+ if (cnt) avg = sum / cnt; -+ p->se.prev_burst_time = max(p->se.prev_burst_time, avg); -+ p->se.burst_time = 0; -+} -+#endif // CONFIG_SCHED_BORE -+ - /* - * Perform scheduler related setup for a newly forked process p. - * p is forked by current. -@@ -4336,6 +4352,9 @@ static void __sched_fork(unsigned long clone_flags, struct task_struct *p) - p->se.prev_sum_exec_runtime = 0; - p->se.nr_migrations = 0; - p->se.vruntime = 0; -+#ifdef CONFIG_SCHED_BORE -+ p->se.burst_time = 0; -+#endif // CONFIG_SCHED_BORE - INIT_LIST_HEAD(&p->se.group_node); - - #ifdef CONFIG_FAIR_GROUP_SCHED -@@ -4536,6 +4555,9 @@ late_initcall(sched_core_sysctl_init); - int sched_fork(unsigned long clone_flags, struct task_struct *p) - { - __sched_fork(clone_flags, p); -+#ifdef CONFIG_SCHED_BORE -+ sched_on_fork_calc_prev_burst_from_siblings(p); -+#endif // CONFIG_SCHED_BORE - /* - * We mark the process as NEW here. This guarantees that - * nobody will actually run it, and a signal or other external -@@ -8947,6 +8969,9 @@ void __init init_idle(struct task_struct *idle, int cpu) - - idle->__state = TASK_RUNNING; - idle->se.exec_start = sched_clock(); -+#ifdef CONFIG_SCHED_BORE -+ idle->se.prev_burst_time = 0; -+#endif //CONFIG_SCHED_BORE - /* - * PF_KTHREAD should already be set at this point; regardless, make it - * look like a proper per-CPU kthread. -@@ -9617,6 +9642,10 @@ void __init sched_init(void) - BUG_ON(&dl_sched_class != &stop_sched_class + 1); - #endif - -+#ifdef CONFIG_SCHED_BORE -+ printk(KERN_INFO "BORE (Burst-Oriented Response Enhancer) CPU Scheduler modification 1.7.5 by Masahito Suzuki"); -+#endif // CONFIG_SCHED_BORE -+ - wait_bit_init(); - - #ifdef CONFIG_FAIR_GROUP_SCHED -diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c -index 667876da8..e9f7a9cb0 100644 ---- a/kernel/sched/debug.c -+++ b/kernel/sched/debug.c -@@ -546,6 +546,9 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p) - SPLIT_NS(schedstat_val_or_zero(p->stats.sum_sleep_runtime)), - SPLIT_NS(schedstat_val_or_zero(p->stats.sum_block_runtime))); - -+#ifdef CONFIG_SCHED_BORE -+ SEQ_printf(m, " %2d", p->se.burst_score); -+#endif - #ifdef CONFIG_NUMA_BALANCING - SEQ_printf(m, " %d %d", task_node(p), task_numa_group_id(p)); - #endif -diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c -index 914096c5b..a37e26794 100644 ---- a/kernel/sched/fair.c -+++ b/kernel/sched/fair.c -@@ -19,6 +19,9 @@ - * - * Adaptive scheduling granularity, math enhancements by Peter Zijlstra - * Copyright (C) 2007 Red Hat, Inc., Peter Zijlstra -+ * -+ * Burst-Oriented Response Enhancer (BORE) CPU Scheduler -+ * Copyright (C) 2021 Masahito Suzuki <firelzrd@gmail.com> - */ - #include <linux/energy_model.h> - #include <linux/mmap_lock.h> -@@ -66,10 +69,16 @@ - * (to see the precise effective timeslice length of your workload, - * run vmstat and monitor the context-switches (cs) field) - * -- * (default: 6ms * (1 + ilog(ncpus)), units: nanoseconds) -+ * (BORE default: 12.8ms constant, units: nanoseconds) -+ * (CFS default: 6ms * (1 + ilog(ncpus)), units: nanoseconds) - */ -+#ifdef CONFIG_SCHED_BORE -+unsigned int sysctl_sched_latency = 12800000ULL; -+static unsigned int normalized_sysctl_sched_latency = 12800000ULL; -+#else // CONFIG_SCHED_BORE - unsigned int sysctl_sched_latency = 6000000ULL; - static unsigned int normalized_sysctl_sched_latency = 6000000ULL; -+#endif // CONFIG_SCHED_BORE - - /* - * The initial- and re-scaling of tunables is configurable -@@ -80,25 +89,41 @@ static unsigned int normalized_sysctl_sched_latency = 6000000ULL; - * SCHED_TUNABLESCALING_LOG - scaled logarithmical, *1+ilog(ncpus) - * SCHED_TUNABLESCALING_LINEAR - scaled linear, *ncpus - * -- * (default SCHED_TUNABLESCALING_LOG = *(1+ilog(ncpus)) -+ * (BORE default SCHED_TUNABLESCALING_NONE = *1 constant) -+ * (CFS default SCHED_TUNABLESCALING_LOG = *(1+ilog(ncpus)) - */ -+#ifdef CONFIG_SCHED_BORE -+unsigned int sysctl_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE; -+#else // CONFIG_SCHED_BORE - unsigned int sysctl_sched_tunable_scaling = SCHED_TUNABLESCALING_LOG; -+#endif // CONFIG_SCHED_BORE - - /* - * Minimal preemption granularity for CPU-bound tasks: - * -- * (default: 0.75 msec * (1 + ilog(ncpus)), units: nanoseconds) -+ * (BORE default: 1.6 msec constant, units: nanoseconds) -+ * (CFS default: 0.75 msec * (1 + ilog(ncpus)), units: nanoseconds) - */ -+#ifdef CONFIG_SCHED_BORE -+unsigned int sysctl_sched_min_granularity = 1600000ULL; -+static unsigned int normalized_sysctl_sched_min_granularity = 1600000ULL; -+#else // CONFIG_SCHED_BORE - unsigned int sysctl_sched_min_granularity = 750000ULL; - static unsigned int normalized_sysctl_sched_min_granularity = 750000ULL; -+#endif // CONFIG_SCHED_BORE - - /* - * Minimal preemption granularity for CPU-bound SCHED_IDLE tasks. - * Applies only when SCHED_IDLE tasks compete with normal tasks. - * -- * (default: 0.75 msec) -+ * (BORE default: 1.6 msec constant) -+ * (CFS default: 0.75 msec) - */ -+#ifdef CONFIG_SCHED_BORE -+unsigned int sysctl_sched_idle_min_granularity = 1600000ULL; -+#else // CONFIG_SCHED_BORE - unsigned int sysctl_sched_idle_min_granularity = 750000ULL; -+#endif // CONFIG_SCHED_BORE - - /* - * This value is kept at sysctl_sched_latency/sysctl_sched_min_granularity -@@ -118,13 +143,29 @@ unsigned int sysctl_sched_child_runs_first __read_mostly; - * and reduces their over-scheduling. Synchronous workloads will still - * have immediate wakeup/sleep latencies. - * -- * (default: 1 msec * (1 + ilog(ncpus)), units: nanoseconds) -+ * (BORE default: 4.8 msec constant, units: nanoseconds) -+ * (CFS default: 1 msec * (1 + ilog(ncpus)), units: nanoseconds) - */ -+#ifdef CONFIG_SCHED_BORE -+unsigned int sysctl_sched_wakeup_granularity = 4800000UL; -+static unsigned int normalized_sysctl_sched_wakeup_granularity = 4800000UL; -+#else // CONFIG_SCHED_BORE - unsigned int sysctl_sched_wakeup_granularity = 1000000UL; - static unsigned int normalized_sysctl_sched_wakeup_granularity = 1000000UL; -+#endif // CONFIG_SCHED_BORE - - const_debug unsigned int sysctl_sched_migration_cost = 500000UL; - -+#ifdef CONFIG_SCHED_BORE -+unsigned int __read_mostly sched_bore = 1; -+unsigned int __read_mostly sched_burst_penalty_scale = 1256; -+unsigned int __read_mostly sched_burst_granularity = 12; -+unsigned int __read_mostly sched_burst_smoothness = 1; -+static int three = 3; -+static int sixty_four = 64; -+static int maxval_12_bits = 4095; -+#endif // CONFIG_SCHED_BORE -+ - int sched_thermal_decay_shift; - static int __init setup_sched_thermal_decay_shift(char *str) - { -@@ -179,6 +220,44 @@ static unsigned int sysctl_sched_cfs_bandwidth_slice = 5000UL; - - #ifdef CONFIG_SYSCTL - static struct ctl_table sched_fair_sysctls[] = { -+#ifdef CONFIG_SCHED_BORE -+ { -+ .procname = "sched_bore", -+ .data = &sched_bore, -+ .maxlen = sizeof(unsigned int), -+ .mode = 0644, -+ .proc_handler = &proc_dointvec_minmax, -+ .extra1 = SYSCTL_ZERO, -+ .extra2 = &three, -+ }, -+ { -+ .procname = "sched_burst_penalty_scale", -+ .data = &sched_burst_penalty_scale, -+ .maxlen = sizeof(unsigned int), -+ .mode = 0644, -+ .proc_handler = &proc_dointvec_minmax, -+ .extra1 = SYSCTL_ZERO, -+ .extra2 = &maxval_12_bits, -+ }, -+ { -+ .procname = "sched_burst_granularity", -+ .data = &sched_burst_granularity, -+ .maxlen = sizeof(unsigned int), -+ .mode = 0644, -+ .proc_handler = &proc_dointvec_minmax, -+ .extra1 = SYSCTL_ZERO, -+ .extra2 = &sixty_four, -+ }, -+ { -+ .procname = "sched_burst_smoothness", -+ .data = &sched_burst_smoothness, -+ .maxlen = sizeof(unsigned int), -+ .mode = 0644, -+ .proc_handler = &proc_dointvec_minmax, -+ .extra1 = SYSCTL_ZERO, -+ .extra2 = &three, -+ }, -+#endif // CONFIG_SCHED_BORE - { - .procname = "sched_child_runs_first", - .data = &sysctl_sched_child_runs_first, -@@ -879,6 +958,36 @@ static void update_tg_load_avg(struct cfs_rq *cfs_rq) - } - #endif /* CONFIG_SMP */ - -+#ifdef CONFIG_SCHED_BORE -+static inline void update_burst_score(struct sched_entity *se) { -+ u64 burst_count; -+ u32 msb, bcnt_prec10; -+ -+ burst_count = max(se->burst_time, se->prev_burst_time) >> sched_burst_granularity; -+ msb = fls64(burst_count); -+ bcnt_prec10 = (msb << 10) | (burst_count << ((65 - msb) & 0x3F) >> 54); -+ se->burst_score = min(bcnt_prec10 * sched_burst_penalty_scale >> 20, (u32)39); -+} -+ -+static u64 burst_scale(u64 delta, struct sched_entity *se) { -+ return mul_u64_u32_shr(delta, sched_prio_to_wmult[se->burst_score], 22); -+} -+ -+static u64 calc_delta_fair_bscale(u64 delta, struct sched_entity *se) { -+ return burst_scale(calc_delta_fair(delta, se), se); -+} -+ -+static inline u64 binary_smooth(u64 old, u64 new, unsigned int smoothness) { -+ return (new + old * ((1 << smoothness) - 1)) >> smoothness; -+} -+ -+static inline void reset_burst(struct sched_entity *se) { -+ se->prev_burst_time = binary_smooth( -+ se->prev_burst_time, se->burst_time, sched_burst_smoothness); -+ se->burst_time = 0; -+} -+#endif // CONFIG_SCHED_BORE -+ - /* - * Update the current task's runtime statistics. - */ -@@ -908,6 +1017,13 @@ static void update_curr(struct cfs_rq *cfs_rq) - curr->sum_exec_runtime += delta_exec; - schedstat_add(cfs_rq->exec_clock, delta_exec); - -+#ifdef CONFIG_SCHED_BORE -+ curr->burst_time += delta_exec; -+ update_burst_score(curr); -+ if (sched_bore & 1) -+ curr->vruntime += calc_delta_fair_bscale(delta_exec, curr); -+ else -+#endif // CONFIG_SCHED_BORE - curr->vruntime += calc_delta_fair(delta_exec, curr); - update_min_vruntime(cfs_rq); - -@@ -4641,6 +4757,11 @@ set_next_entity(struct cfs_rq *cfs_rq, struct sched_entity *se) - se->prev_sum_exec_runtime = se->sum_exec_runtime; - } - -+#ifdef CONFIG_SCHED_BORE -+static int -+wakeup_preempt_entity_bscale(struct sched_entity *curr, -+ struct sched_entity *se, bool do_scale); -+#endif // CONFIG_SCHED_BORE - static int - wakeup_preempt_entity(struct sched_entity *curr, struct sched_entity *se); - -@@ -4685,7 +4806,13 @@ pick_next_entity(struct cfs_rq *cfs_rq, struct sched_entity *curr) - se = second; - } - -- if (cfs_rq->next && wakeup_preempt_entity(cfs_rq->next, left) < 1) { -+#ifdef CONFIG_SCHED_BORE -+ if (cfs_rq->next && wakeup_preempt_entity_bscale( -+ cfs_rq->next, left, sched_bore & 2) < 1) -+#else // CONFIG_SCHED_BORE -+ if (cfs_rq->next && wakeup_preempt_entity(cfs_rq->next, left) < 1) -+#endif // CONFIG_SCHED_BORE -+ { - /* - * Someone really wants this to run. If it's not unfair, run it. - */ -@@ -5831,6 +5958,9 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags) - util_est_dequeue(&rq->cfs, p); - - for_each_sched_entity(se) { -+#ifdef CONFIG_SCHED_BORE -+ if (task_sleep) reset_burst(se); -+#endif // CONFIG_SCHED_BORE - cfs_rq = cfs_rq_of(se); - dequeue_entity(cfs_rq, se, flags); - -@@ -7182,7 +7312,12 @@ static unsigned long wakeup_gran(struct sched_entity *se) - * - */ - static int -+#ifdef CONFIG_SCHED_BORE -+wakeup_preempt_entity_bscale(struct sched_entity *curr, -+ struct sched_entity *se, bool do_scale) -+#else // CONFIG_SCHED_BORE - wakeup_preempt_entity(struct sched_entity *curr, struct sched_entity *se) -+#endif // CONFIG_SCHED_BORE - { - s64 gran, vdiff = curr->vruntime - se->vruntime; - -@@ -7190,11 +7325,20 @@ wakeup_preempt_entity(struct sched_entity *curr, struct sched_entity *se) - return -1; - - gran = wakeup_gran(se); -+#ifdef CONFIG_SCHED_BORE -+ if (do_scale) gran = burst_scale(gran, se); -+#endif // CONFIG_SCHED_BORE - if (vdiff > gran) - return 1; - - return 0; - } -+#ifdef CONFIG_SCHED_BORE -+static int wakeup_preempt_entity(struct sched_entity *curr, struct sched_entity *se) -+{ -+ return wakeup_preempt_entity_bscale(curr, se, false); -+} -+#endif // CONFIG_SCHED_BORE - - static void set_last_buddy(struct sched_entity *se) - { -@@ -7294,7 +7438,12 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_ - return; - - update_curr(cfs_rq_of(se)); -- if (wakeup_preempt_entity(se, pse) == 1) { -+#ifdef CONFIG_SCHED_BORE -+ if (wakeup_preempt_entity_bscale(se, pse, sched_bore & 2) == 1) -+#else // CONFIG_SCHED_BORE -+ if (wakeup_preempt_entity(se, pse) == 1) -+#endif // CONFIG_SCHED_BORE -+ { - /* - * Bias pick_next to pick the sched entity that is - * triggering this preemption. -@@ -7530,6 +7679,9 @@ static void yield_task_fair(struct rq *rq) - struct task_struct *curr = rq->curr; - struct cfs_rq *cfs_rq = task_cfs_rq(curr); - struct sched_entity *se = &curr->se; -+#ifdef CONFIG_SCHED_BORE -+ reset_burst(se); -+#endif // CONFIG_SCHED_BORE - - /* - * Are we the only task in the tree? -diff --git a/kernel/sched/features.h b/kernel/sched/features.h -index ee7f23c76..0f2396e52 100644 ---- a/kernel/sched/features.h -+++ b/kernel/sched/features.h -@@ -4,7 +4,11 @@ - * them to run sooner, but does not allow tons of sleepers to - * rip the spread apart. - */ -+#ifdef CONFIG_SCHED_BORE -+SCHED_FEAT(GENTLE_FAIR_SLEEPERS, false) -+#else // CONFIG_SCHED_BORE - SCHED_FEAT(GENTLE_FAIR_SLEEPERS, true) -+#endif // CONFIG_SCHED_BORE - - /* - * Place new tasks ahead so that they do not starve already running --- -2.25.1 - diff --git a/0001-perf-urgent-2023-01-06_Intel-RAPL-updates-for-new-model-IDs.patch b/0001-perf-urgent-2023-01-06_Intel-RAPL-updates-for-new-model-IDs.patch deleted file mode 100644 index cfdd5df2262d..000000000000 --- a/0001-perf-urgent-2023-01-06_Intel-RAPL-updates-for-new-model-IDs.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 57512b57dcfaf63c52d8ad2fb35321328cde31b0 Mon Sep 17 00:00:00 2001 -From: Zhang Rui <rui.zhang@intel.com> -Date: Wed, 4 Jan 2023 22:58:31 +0800 -Subject: perf/x86/rapl: Add support for Intel Emerald Rapids - -Emerald Rapids RAPL support is the same as previous Sapphire Rapids. -Add Emerald Rapids model for RAPL. - -Signed-off-by: Zhang Rui <rui.zhang@intel.com> -Signed-off-by: Ingo Molnar <mingo@kernel.org> -Link: https://lore.kernel.org/r/20230104145831.25498-2-rui.zhang@intel.com ---- - arch/x86/events/rapl.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/arch/x86/events/rapl.c b/arch/x86/events/rapl.c -index 589c6885560d2..52e6e7ed4f78a 100644 ---- a/arch/x86/events/rapl.c -+++ b/arch/x86/events/rapl.c -@@ -806,6 +806,7 @@ static const struct x86_cpu_id rapl_model_match[] __initconst = { - X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_L, &model_skl), - X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_N, &model_skl), - X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, &model_spr), -+ X86_MATCH_INTEL_FAM6_MODEL(EMERALDRAPIDS_X, &model_spr), - X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE, &model_skl), - X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_P, &model_skl), - X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_S, &model_skl), --- -cgit - diff --git a/0002-ALSA-hda-realtek-Add-quirk-for-ASUS-ROG-GA402X.patch b/0002-ALSA-hda-realtek-Add-quirk-for-ASUS-ROG-GA402X.patch new file mode 100644 index 000000000000..7aa617ba4560 --- /dev/null +++ b/0002-ALSA-hda-realtek-Add-quirk-for-ASUS-ROG-GA402X.patch @@ -0,0 +1,31 @@ +From f323359939ae90f940a43fda3f2c2f72c8d7e16e Mon Sep 17 00:00:00 2001 +From: "Luke D. Jones" <luke@ljones.dev> +Date: Fri, 30 Jun 2023 16:25:02 +1200 +Subject: [PATCH 2/2] ALSA: hda/realtek: Add quirk for ASUS ROG GA402X + +Adds the required quirk to enable the Cirrus amp and correct pins +on the ASUS ROG GV601V series. + +While this works if the related _DSD properties are made available, these +aren't included in the ACPI of these laptops (yet). + +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 1c26f24b1246..5b7df324e8b4 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -9544,6 +9544,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK), + SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650P", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC), ++ SND_PCI_QUIRK(0x1043, 0x1463, "Asus GA402X", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC), + SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604V", ALC285_FIXUP_ASUS_HEADSET_MIC), + SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603V", ALC285_FIXUP_ASUS_HEADSET_MIC), + SND_PCI_QUIRK(0x1043, 0x1493, "ASUS GV601V", ALC285_FIXUP_ASUS_HEADSET_MIC), +-- +2.41.0 + diff --git a/0029-patch02_gu604v_wmi_keys.patch b/0029-patch02_gu604v_wmi_keys.patch deleted file mode 100644 index 1975c473406a..000000000000 --- a/0029-patch02_gu604v_wmi_keys.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/drivers/platform/x86/asus-nb-wmi.c 2023-04-26 21:54:26.327382038 +0300 -+++ b/drivers/platform/x86/asus-nb-wmi.c 2023-04-26 21:51:54.438703534 +0300 -@@ -585,6 +585,7 @@ - { KE_KEY, 0x71, { KEY_F13 } }, /* General-purpose button */ - { KE_IGNORE, 0x79, }, /* Charger type dectection notification */ - { KE_KEY, 0x7a, { KEY_ALS_TOGGLE } }, /* Ambient Light Sensor Toggle */ -+ { KE_IGNORE, 0x7B, }, /* Charger connect/disconnect notification */ - { KE_KEY, 0x7c, { KEY_MICMUTE } }, - { KE_KEY, 0x7D, { KEY_BLUETOOTH } }, /* Bluetooth Enable */ - { KE_KEY, 0x7E, { KEY_BLUETOOTH } }, /* Bluetooth Disable */ -@@ -614,6 +615,7 @@ - { KE_KEY, 0xAE, { KEY_FN_F5 } }, /* Fn+F5 fan mode on 2020+ */ - { KE_KEY, 0xB3, { KEY_PROG4 } }, /* AURA */ - { KE_KEY, 0xB5, { KEY_CALC } }, -+ { KE_IGNORE, 0xC0, }, /* Not sure, happens when usb-c display connects/disconnects */ - { KE_KEY, 0xC4, { KEY_KBDILLUMUP } }, - { KE_KEY, 0xC5, { KEY_KBDILLUMDOWN } }, - { KE_IGNORE, 0xC6, }, /* Ambient Light Sensor notification */ diff --git a/0038-mediatek-pci-reset.patch b/0038-mediatek-pci-reset.patch index 6661136d2b5c..5966c1143c02 100644 --- a/0038-mediatek-pci-reset.patch +++ b/0038-mediatek-pci-reset.patch @@ -108,3 +108,5 @@ index ddb1fa4ee01d..9671fbe35a8e 100644 return ret; -- 2.34.1 + + diff --git a/0040-workaround_hardware_decoding_amdgpu.patch b/0040-workaround_hardware_decoding_amdgpu.patch new file mode 100644 index 000000000000..9850a67b02c8 --- /dev/null +++ b/0040-workaround_hardware_decoding_amdgpu.patch @@ -0,0 +1,28 @@ +From 6ed6ec89ec57aa7049544b212f199bb4272eefb3 Mon Sep 17 00:00:00 2001 +From: Arglebargle <arglebargle@arglebargle.dev> +Date: Tue, 27 Jun 2023 02:00:23 -0700 +Subject: [PATCH] HACK: workaround hardware decoding lagging/hanging + +Workaround issues with hardware decoding lagging or hanging the gpu + +See this thread: https://gitlab.freedesktop.org/drm/amd/-/issues/2535 +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_ring_mux.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring_mux.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring_mux.c +index 73516abef662..f59eceb9589f 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring_mux.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring_mux.c +@@ -28,7 +28,7 @@ + #include "amdgpu.h" + + #define AMDGPU_MUX_RESUBMIT_JIFFIES_TIMEOUT (HZ / 2) +-#define AMDGPU_MAX_LAST_UNSIGNALED_THRESHOLD_US 10000 ++#define AMDGPU_MAX_LAST_UNSIGNALED_THRESHOLD_US 200000 + + static const struct ring_info { + unsigned int hw_pio; +-- +GitLab + diff --git a/0041-flush_and_deleyed_gfxoff_on_suspend_amdgpu.patch b/0041-flush_and_deleyed_gfxoff_on_suspend_amdgpu.patch new file mode 100644 index 000000000000..0fbbd454571c --- /dev/null +++ b/0041-flush_and_deleyed_gfxoff_on_suspend_amdgpu.patch @@ -0,0 +1,66 @@ +From 98688e56430307f8069c6a7ed4bc301a5d08b9b7 Mon Sep 17 00:00:00 2001 +From: Mario Limonciello <mario.limonciello@amd.com> +Date: Thu, 18 May 2023 11:52:51 -0500 +Subject: [PATCH] drm/amd: Flush any delayed gfxoff on suspend entry + +DCN 3.1.4 is reported to hang on s2idle entry if graphics activity +is happening during entry. This is because GFXOFF was scheduled as +delayed but RLC gets disabled in s2idle entry sequence which will +hang GFX IP if not already in GFXOFF. + +To help this problem, flush any delayed work for GFXOFF early in +s2idle entry sequence to ensure that it's off when RLC is changed. + +commit 3964b0c2e843 ("drm/amdgpu: complete gfxoff allow signal during +suspend without delay") modified power gating flow so that if called +in s0ix that it ensured that GFXOFF wasn't put in work queue but +instead processed immediately. + +This is dead code due to commit 5d70a549d00d ("drm/amdgpu: skip +CG/PG for gfx during S0ix") because GFXOFF will now not be explicitly +called as part of the suspend entry code. Remove that dead code. + +Cc: stable@vger.kernel.org # 6.1+ +Suggested-by: Tim Huang <tim.huang@amd.com> +Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 + + drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 9 +-------- + 2 files changed, 2 insertions(+), 8 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +index 5c7d40873ee2..7721fe892847 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +@@ -4205,6 +4205,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon) + drm_fb_helper_set_suspend_unlocked(adev_to_drm(adev)->fb_helper, true); + + cancel_delayed_work_sync(&adev->delayed_init_work); ++ flush_delayed_work(&adev->gfx.gfx_off_delay_work); + + amdgpu_ras_suspend(adev); + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +index f3f541ba0aca..bff5b6eac39b 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +@@ -589,15 +589,8 @@ void amdgpu_gfx_off_ctrl(struct amdgpu_device *adev, bool enable) + + if (adev->gfx.gfx_off_req_count == 0 && + !adev->gfx.gfx_off_state) { +- /* If going to s2idle, no need to wait */ +- if (adev->in_s0ix) { +- if (!amdgpu_dpm_set_powergating_by_smu(adev, +- AMD_IP_BLOCK_TYPE_GFX, true)) +- adev->gfx.gfx_off_state = true; +- } else { +- schedule_delayed_work(&adev->gfx.gfx_off_delay_work, ++ schedule_delayed_work(&adev->gfx.gfx_off_delay_work, + delay); +- } + } + } else { + if (adev->gfx.gfx_off_req_count == 0) { +-- +GitLab + @@ -3,7 +3,7 @@ # Contributor: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com> pkgbase=linux-g14 -pkgver=6.3.8.arch1 +pkgver=6.3.9.arch1 pkgrel=1 pkgdesc='Linux' _srctag=v${pkgver%.*}-${pkgver##*.} @@ -43,9 +43,7 @@ source=( 0001-Revert-PCI-Add-a-REBAR-size-quirk-for-Sapphire-RX-56.patch 0001-constgran-v2.patch 0001-linux6.1.y-bore2.2.1.patch - - 0029-patch02_gu604v_wmi_keys.patch - + 0032-Bluetooth-btusb-Add-a-new-PID-VID-0489-e0f6-for-MT7922.patch 0035-Add_quirk_for_polling_the_KBD_port.patch 0036-Block_a_rogue_device_on_ASUS_TUF_A16.patch @@ -56,14 +54,23 @@ source=( 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 - + + 0001-ALSA-hda-realtek-Add-quirk-for-ASUS-ROG-GX650P.patch + 0002-ALSA-hda-realtek-Add-quirk-for-ASUS-ROG-GA402X.patch + v2-0001-platform-x86-asus-wmi-add-support-for-showing-cha.patch + v2-0002-platform-x86-asus-wmi-add-support-for-showing-mid.patch + v2-0003-platform-x86-asus-wmi-support-middle-fan-custom-c.patch + v2-0004-platform-x86-asus-wmi-add-WMI-method-to-show-if-e.patch + v2-0005-platform-x86-asus-wmi-don-t-allow-eGPU-switching-.patch + v2-0006-platform-x86-asus-wmi-add-safety-checks-to-gpu-sw.patch + v2-0007-platform-x86-asus-wmi-support-setting-mini-LED-mo.patch + v2-0008-platform-x86-asus-wmi-expose-dGPU-and-CPU-tunable.patch + v4-0001-platform-x86-asus-wmi-add-support-for-ASUS-screen.patch + 0038-mediatek-pci-reset.patch + 0040-workaround_hardware_decoding_amdgpu.patch + 0041-flush_and_deleyed_gfxoff_on_suspend_amdgpu.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" @@ -78,7 +85,7 @@ validpgpkeys=( ) sha256sums=('SKIP' - '21b9a9e542f853cdc695648d6ab6219bd2e881a4954277f241e104723c373d42' + '6508516de94ed941ae755d89807610dc51fe1229dbfecdf8a82604a8d33242ce' 'bc8b5f303e3507c01d8543fb4352ed7dcdb9ed4eb2854788d39510f88d67f454' '81ad663925a0aa5b5332a69bae7227393664bb81ee2e57a283e7f16e9ff75efe' '0a7ea482fe20c403788d290826cec42fe395e5a6eab07b88845f8b9a9829998d' @@ -87,7 +94,6 @@ sha256sums=('SKIP' '7b16fce20b03babc9e149030f43e283534835bbd8835ba0a794fd0205fea1708' 'efbf65b17fb48fd22f199b6fddd05f159f8ea31faad5543f2c07fddf45eb9f12' 'd4f8e606eaad9a1fe302f04b9023a3980eb2305108c0d8c90654d23e53ff8bef' - 'cdbcec3031878cdb7ffab32034e4ee31bbd0ec214088f95dc446a13320985631' 'a8e1e11a4ab1995cc4975c9b134a43ddfe7054ef0c965e52a7d8f9223e15c3e0' '315d1839630b37894a626bbc2aea012618b2e1ccb6f9d8aa27c0a3ce5e90e99c' '1740589bbf5eb2c292904e508270ed221e1382f78bcb7cf1c72f1dc12f767e69' @@ -97,13 +103,20 @@ sha256sums=('SKIP' '655a7650a21ce4f725caf6fa248295edefa25a248aeaecf3d65a058503ae2530' '7ce4b001a81b15b5b5275620fc0cee3d251d753698ae3db4593619a2121e1f2e' 'c7d44e1eb82b4711b4cc86016a1886a573f1abc893dbdd201d4a6d0326859b85' - '66ee16ec4e39973905905d66eb043a55fdeaae470902be6adf893ce1a4ac4cbe' - '2c6b2efef195cc54d641374cad669884dede99a8b934e2b2b168c6ae35554f2c' - '73db9582e8d5fa41a1a7ed38bd0a012cd28573d1d2eda44152ce13477bdd7999' - 'c7430e0ad27f9a1cd1677da1a7471dcf63088cb21cd943427454889c69e7f829' - '976abe70d2a1604ce2335a7d7ce5d9722db93e389413a0b6a7f3ea72f795b65b' - '8a0ee3fbb3c95cd4d5cedd62517384374462d5157f3104013e5cbe6d91317e95' - 'a768687d858b608c01e22664817a80602e8c17911487fac71430f70b0c52b9f9' + '58c46d5d5b3428bd3c9354cf66542ae91323b116dc52826ca5eed2e522b67b0a' + '06fd2961548a7d3e31bcd388e67d07f9840c74a7811f70810a7ca1f946e59c9e' + '454dc9b16fd2559843d78a93905a39b1668eaaecb0bf0a9dccf432199f9b96be' + '5a82899580abaaab4cd818c96407b6be5b2d6b6d1004355eab12fedebdb968a0' + 'a75528877f5db652b4e0b5e68f2ec39557bcad9786c6f6419327d3e08d1fe9be' + 'cbf0738ba984d0fa9ad396ec1e5b2a6ed1e2411dc81b17423fdceef423a484b2' + '9f98765b43f5f31b33ed05f3611508113b02518e680ee82b251de80dae2e141d' + '5e58aa605c2ae00c0925e1fbb838a8041e7cf2eb78c0d6167e59dbe27b536565' + '137f16f59a63568b3546649346ef1bc2211c03da28178a94bf8cd104051f67b8' + '1983fbb75a4e8c76ffeca51b42dcb3cdcd4a6a5b4aafdb02b3dcbf3c5c9a94ad' + '2e0274f6681d22f0350bb04cab4bbe796e97c9bb1bd297054eaf900046036d81' + 'd673d034fbcd80426fd8d9c6af56537c5fe5b55fe49d74e313474d7fc285ecc1' + 'e41198b29cee4de7a5132d8df606f48c2d0f9c9076fe4230b00a33c7e0b22c71' + 'e2c81fc2af08c175a7642d4f4f90e398702d9d903857cf0bba81db99f146a561' '15e912a66e4bbce1cf0450f1dc6610653df29df8dd6d5426f9c1b039490436c8' '444f2d86de8c2177655b01596f939f99c2e7abfa8efad8a509e0a334f42dfa85' '982a31e47d3d586789e1b3cdda25f75e3b71d810e7494202089b8f2cef7c0ef9') @@ -281,7 +294,7 @@ _package() { echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase" echo "Installing modules..." - _make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \ + ZSTD_CLEVEL=19 _make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \ DEPMOD=/doesnt/exist modules_install # Suppress depmod # remove build and source links @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/x86 6.3.3-arch1 Kernel Configuration +# Linux/x86 6.3.8-arch1 Kernel Configuration # CONFIG_CC_VERSION_TEXT="gcc (GCC) 13.1.1 20230429" CONFIG_CC_IS_GCC=y @@ -6976,7 +6976,7 @@ CONFIG_SND_SERIAL_U16550=m CONFIG_SND_MPU401=m CONFIG_SND_PORTMAN2X4=m CONFIG_SND_AC97_POWER_SAVE=y -CONFIG_SND_AC97_POWER_SAVE_DEFAULT=0 +CONFIG_SND_AC97_POWER_SAVE_DEFAULT=10 CONFIG_SND_SB_COMMON=m CONFIG_SND_PCI=y CONFIG_SND_AD1889=m @@ -7081,7 +7081,7 @@ CONFIG_SND_HDA_CODEC_CA0132_DSP=y CONFIG_SND_HDA_CODEC_CMEDIA=m CONFIG_SND_HDA_CODEC_SI3054=m CONFIG_SND_HDA_GENERIC=m -CONFIG_SND_HDA_POWER_SAVE_DEFAULT=1 +CONFIG_SND_HDA_POWER_SAVE_DEFAULT=10 CONFIG_SND_HDA_INTEL_HDMI_SILENT_STREAM=y # CONFIG_SND_HDA_CTL_DEV_ID is not set # end of HD-Audio diff --git a/0007-platform-x86-asus-wmi-add-support-for-showing-charge.patch b/v2-0001-platform-x86-asus-wmi-add-support-for-showing-cha.patch index 3e4603029cf9..003bd82806c9 100644 --- a/0007-platform-x86-asus-wmi-add-support-for-showing-charge.patch +++ b/v2-0001-platform-x86-asus-wmi-add-support-for-showing-cha.patch @@ -1,18 +1,18 @@ -From 7fb84ee268c5f40219ae694845b7a956a68ca2d2 Mon Sep 17 00:00:00 2001 +From 5195a8ad57e5076ce520f725a49f595fe617b6d2 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 +Subject: [PATCH v2 1/8] 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. +Expose a WMI method in sysfs platform for showing which connected +charger 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 ++++++++++++++++--- + .../ABI/testing/sysfs-platform-asus-wmi | 10 +++++++++ + drivers/platform/x86/asus-wmi.c | 21 +++++++++++++++++++ include/linux/platform_data/x86/asus-wmi.h | 3 +++ - 3 files changed, 36 insertions(+), 4 deletions(-) + 3 files changed, 34 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-platform-asus-wmi b/Documentation/ABI/testing/sysfs-platform-asus-wmi index a77a004a1baa..eb29e3023c7b 100644 @@ -34,10 +34,10 @@ index a77a004a1baa..eb29e3023c7b 100644 + * 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 +index 1038dfdcdd32..f23375d5fb82 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c -@@ -239,6 +239,7 @@ struct asus_wmi { +@@ -237,6 +237,7 @@ struct asus_wmi { u8 fan_boost_mode_mask; u8 fan_boost_mode; @@ -45,7 +45,7 @@ index 5edf9ece51dc..fd1ce1650187 100644 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) +@@ -586,6 +587,22 @@ static void asus_wmi_tablet_mode_get_state(struct asus_wmi *asus) asus_wmi_tablet_sw_report(asus, result); } @@ -68,18 +68,7 @@ index 5edf9ece51dc..fd1ce1650187 100644 /* 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[] = { +@@ -3462,6 +3479,7 @@ static struct attribute *platform_attributes[] = { &dev_attr_camera.attr, &dev_attr_cardr.attr, &dev_attr_touchpad.attr, @@ -87,7 +76,7 @@ index 5edf9ece51dc..fd1ce1650187 100644 &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, +@@ -3491,6 +3509,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; @@ -96,7 +85,7 @@ index 5edf9ece51dc..fd1ce1650187 100644 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) +@@ -3757,6 +3777,7 @@ static int asus_wmi_add(struct platform_device *pdev) if (err) goto fail_platform; @@ -104,18 +93,11 @@ index 5edf9ece51dc..fd1ce1650187 100644 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 +index 28234dc9fa6a..f90cafe26af1 100644 --- a/include/linux/platform_data/x86/asus-wmi.h +++ b/include/linux/platform_data/x86/asus-wmi.h -@@ -99,6 +99,9 @@ +@@ -95,6 +95,9 @@ /* Keyboard dock */ #define ASUS_WMI_DEVID_KBD_DOCK 0x00120063 @@ -126,5 +108,5 @@ index a2d94adb5c80..b57f3591676a 100644 #define ASUS_WMI_DEVID_EGPU 0x00090019 -- -2.40.1 +2.41.0 diff --git a/0008-platform-x86-asus-wmi-add-support-for-showing-middle.patch b/v2-0002-platform-x86-asus-wmi-add-support-for-showing-mid.patch index dab1f4aa5439..1f1e3e8ccccf 100644 --- a/0008-platform-x86-asus-wmi-add-support-for-showing-middle.patch +++ b/v2-0002-platform-x86-asus-wmi-add-support-for-showing-mid.patch @@ -1,7 +1,7 @@ -From 7fc27f5a4d3f2f6f0f01c42470ad67342a8bf767 Mon Sep 17 00:00:00 2001 +From dcc493d84f202bbdf97eb48660179724f744c76d 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 +Subject: [PATCH v2 2/8] platform/x86: asus-wmi: add support for showing middle fan RPM Some newer ASUS ROG laptops now have a middle/center fan in addition @@ -17,10 +17,10 @@ Signed-off-by: Luke D. Jones <luke@ljones.dev> 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 +index f23375d5fb82..375d25ae0aca 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); +@@ -72,6 +72,7 @@ module_param(fnlock_default, bool, 0444); #define ASUS_WMI_FNLOCK_BIOS_DISABLED BIT(0) @@ -28,7 +28,7 @@ index fd1ce1650187..8cc532166559 100644 #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 { +@@ -229,8 +230,10 @@ struct asus_wmi { enum fan_type fan_type; enum fan_type gpu_fan_type; @@ -39,7 +39,7 @@ index fd1ce1650187..8cc532166559 100644 int agfn_pwm; bool fan_boost_mode_available; -@@ -2131,6 +2134,31 @@ static ssize_t fan2_label_show(struct device *dev, +@@ -2129,6 +2132,31 @@ static ssize_t fan2_label_show(struct device *dev, return sysfs_emit(buf, "%s\n", ASUS_GPU_FAN_DESC); } @@ -71,7 +71,7 @@ index fd1ce1650187..8cc532166559 100644 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, +@@ -2175,6 +2203,52 @@ static ssize_t pwm2_enable_store(struct device *dev, return count; } @@ -124,7 +124,7 @@ index fd1ce1650187..8cc532166559 100644 /* Fan1 */ static DEVICE_ATTR_RW(pwm1); static DEVICE_ATTR_RW(pwm1_enable); -@@ -2186,6 +2260,10 @@ static DEVICE_ATTR_RO(fan1_label); +@@ -2184,6 +2258,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); @@ -135,7 +135,7 @@ index fd1ce1650187..8cc532166559 100644 /* Temperature */ static DEVICE_ATTR(temp1_input, S_IRUGO, asus_hwmon_temp1, NULL); -@@ -2194,10 +2272,13 @@ static struct attribute *hwmon_attributes[] = { +@@ -2192,10 +2270,13 @@ static struct attribute *hwmon_attributes[] = { &dev_attr_pwm1.attr, &dev_attr_pwm1_enable.attr, &dev_attr_pwm2_enable.attr, @@ -149,7 +149,7 @@ index fd1ce1650187..8cc532166559 100644 &dev_attr_temp1_input.attr, NULL -@@ -2223,6 +2304,11 @@ static umode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj, +@@ -2221,6 +2302,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; @@ -161,7 +161,7 @@ index fd1ce1650187..8cc532166559 100644 } 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) +@@ -2264,6 +2350,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; @@ -169,7 +169,7 @@ index fd1ce1650187..8cc532166559 100644 asus->fan_type = FAN_TYPE_NONE; asus->agfn_pwm = -1; -@@ -2280,6 +2367,10 @@ static int asus_wmi_fan_init(struct asus_wmi *asus) +@@ -2278,6 +2365,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; @@ -181,10 +181,10 @@ index fd1ce1650187..8cc532166559 100644 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 +index f90cafe26af1..2c03bda7703f 100644 --- a/include/linux/platform_data/x86/asus-wmi.h +++ b/include/linux/platform_data/x86/asus-wmi.h -@@ -84,6 +84,7 @@ +@@ -80,6 +80,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 @@ -193,5 +193,5 @@ index b57f3591676a..94e3172b9c72 100644 #define ASUS_WMI_DEVID_GPU_FAN_CURVE 0x00110025 -- -2.40.1 +2.41.0 diff --git a/0009-platform-x86-asus-wmi-support-middle-fan-custom-curv.patch b/v2-0003-platform-x86-asus-wmi-support-middle-fan-custom-c.patch index d81dad9632ec..3afbc18e251e 100644 --- a/0009-platform-x86-asus-wmi-support-middle-fan-custom-curv.patch +++ b/v2-0003-platform-x86-asus-wmi-support-middle-fan-custom-c.patch @@ -1,7 +1,7 @@ -From 21a0a1c935b8dde224e24ca027ff49bee7bfed01 Mon Sep 17 00:00:00 2001 +From 3b638cb413bfa9f50433676fdc82bf63ef0fb3d9 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 +Subject: [PATCH v2 3/8] platform/x86: asus-wmi: support middle fan custom curves Adds support for fan curves defined for the middle fan which @@ -9,15 +9,15 @@ is available on some ASUS ROG laptops. Signed-off-by: Luke D. Jones <luke@ljones.dev> --- - drivers/platform/x86/asus-wmi.c | 75 +++++++++++++++++++++- + drivers/platform/x86/asus-wmi.c | 77 +++++++++++++++++++++- include/linux/platform_data/x86/asus-wmi.h | 1 + - 2 files changed, 74 insertions(+), 2 deletions(-) + 2 files changed, 76 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c -index 8cc532166559..d63d0111cb8b 100644 +index 375d25ae0aca..fb27218e51cf 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); +@@ -113,6 +113,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 @@ -25,7 +25,7 @@ index 8cc532166559..d63d0111cb8b 100644 /* Mask to determine if setting temperature or percentage */ #define FAN_CURVE_PWM_MASK 0x04 -@@ -255,7 +256,8 @@ struct asus_wmi { +@@ -253,7 +254,8 @@ struct asus_wmi { bool cpu_fan_curve_available; bool gpu_fan_curve_available; @@ -35,7 +35,7 @@ index 8cc532166559..d63d0111cb8b 100644 struct platform_profile_handler platform_profile_handler; bool platform_profile_support; -@@ -2082,6 +2084,8 @@ static ssize_t pwm1_enable_store(struct device *dev, +@@ -2080,6 +2082,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; @@ -44,7 +44,7 @@ index 8cc532166559..d63d0111cb8b 100644 return count; } -@@ -2533,6 +2537,9 @@ static int fan_curve_get_factory_default(struct asus_wmi *asus, u32 fan_dev) +@@ -2531,6 +2535,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; @@ -54,7 +54,7 @@ index 8cc532166559..d63d0111cb8b 100644 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, +@@ -2819,6 +2826,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); @@ -97,7 +97,7 @@ index 8cc532166559..d63d0111cb8b 100644 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[] = { +@@ -2856,6 +2899,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, @@ -122,7 +122,7 @@ index 8cc532166559..d63d0111cb8b 100644 NULL }; -@@ -2877,6 +2938,9 @@ static umode_t asus_fan_curve_is_visible(struct kobject *kobj, +@@ -2875,6 +2936,9 @@ static umode_t asus_fan_curve_is_visible(struct kobject *kobj, if (asus->gpu_fan_curve_available && attr->name[3] == '2') return 0644; @@ -132,7 +132,7 @@ index 8cc532166559..d63d0111cb8b 100644 return 0; } -@@ -2906,7 +2970,12 @@ static int asus_wmi_custom_fan_curve_init(struct asus_wmi *asus) +@@ -2904,7 +2968,14 @@ static int asus_wmi_custom_fan_curve_init(struct asus_wmi *asus) if (err) return err; @@ -142,11 +142,13 @@ index 8cc532166559..d63d0111cb8b 100644 + if (err) + return err; + -+ if (!asus->cpu_fan_curve_available && !asus->gpu_fan_curve_available && !asus->mid_fan_curve_available) ++ 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) +@@ -2973,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; @@ -156,10 +158,10 @@ index 8cc532166559..d63d0111cb8b 100644 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 +index 2c03bda7703f..329efc086993 100644 --- a/include/linux/platform_data/x86/asus-wmi.h +++ b/include/linux/platform_data/x86/asus-wmi.h -@@ -87,6 +87,7 @@ +@@ -83,6 +83,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 @@ -168,5 +170,5 @@ index 94e3172b9c72..dc5e8038d88b 100644 /* Power */ #define ASUS_WMI_DEVID_PROCESSOR_STATE 0x00120012 -- -2.40.1 +2.41.0 diff --git a/0010-platform-x86-asus-wmi-add-WMI-method-to-show-if-egpu.patch b/v2-0004-platform-x86-asus-wmi-add-WMI-method-to-show-if-e.patch index 9ea518e39041..ee987eed6cb3 100644 --- a/0010-platform-x86-asus-wmi-add-WMI-method-to-show-if-egpu.patch +++ b/v2-0004-platform-x86-asus-wmi-add-WMI-method-to-show-if-e.patch @@ -1,7 +1,7 @@ -From 2fb35e005be26d242d6a3e94db7fbcbaed9aa0e9 Mon Sep 17 00:00:00 2001 +From c43a477f701c2c97e13f1a2ee6e1304beeddbf56 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 +Subject: [PATCH v2 4/8] platform/x86: asus-wmi: add WMI method to show if egpu connected Exposes the WMI method which tells if the eGPU is properly connected @@ -35,18 +35,18 @@ index eb29e3023c7b..878daf7c2036 100644 + * 0 - False, + * 1 - True diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c -index d63d0111cb8b..26155bdc48da 100644 +index fb27218e51cf..0c8a4a46b121 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c -@@ -245,6 +245,7 @@ struct asus_wmi { +@@ -243,6 +243,7 @@ struct asus_wmi { bool charge_mode_available; bool egpu_enable_available; -+ bool egpu_connected_available; ++ bool egpu_connect_available; bool dgpu_disable_available; bool gpu_mux_mode_available; -@@ -711,6 +712,22 @@ static ssize_t egpu_enable_store(struct device *dev, +@@ -709,6 +710,22 @@ static ssize_t egpu_enable_store(struct device *dev, } static DEVICE_ATTR_RW(egpu_enable); @@ -69,7 +69,7 @@ index d63d0111cb8b..26155bdc48da 100644 /* 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[] = { +@@ -3645,6 +3662,7 @@ static struct attribute *platform_attributes[] = { &dev_attr_touchpad.attr, &dev_attr_charge_mode.attr, &dev_attr_egpu_enable.attr, @@ -77,28 +77,28 @@ index d63d0111cb8b..26155bdc48da 100644 &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, +@@ -3677,6 +3695,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; ++ ok = asus->egpu_connect_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) +@@ -3943,6 +3963,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->egpu_connect_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 +index 329efc086993..2034648f8cdf 100644 --- a/include/linux/platform_data/x86/asus-wmi.h +++ b/include/linux/platform_data/x86/asus-wmi.h -@@ -104,7 +104,9 @@ +@@ -100,7 +100,9 @@ /* Charging mode - 1=Barrel, 2=USB */ #define ASUS_WMI_DEVID_CHARGE_MODE 0x0012006C @@ -110,5 +110,5 @@ index dc5e8038d88b..bfc284fe4d68 100644 /* dgpu on/off */ -- -2.40.1 +2.41.0 diff --git a/v2-0005-platform-x86-asus-wmi-don-t-allow-eGPU-switching-.patch b/v2-0005-platform-x86-asus-wmi-don-t-allow-eGPU-switching-.patch new file mode 100644 index 000000000000..ed923d0a908d --- /dev/null +++ b/v2-0005-platform-x86-asus-wmi-don-t-allow-eGPU-switching-.patch @@ -0,0 +1,37 @@ +From ba1fcbaa4037e2523c40a7aaa0cab9d75bf75e10 Mon Sep 17 00:00:00 2001 +From: "Luke D. Jones" <luke@ljones.dev> +Date: Tue, 20 Jun 2023 12:26:51 +1200 +Subject: [PATCH v2 5/8] platform/x86: asus-wmi: don't allow eGPU switching if + eGPU not connected + +Check the ASUS_WMI_DEVID_EGPU_CONNECTED method for eGPU connection +before allowing the ASUS_WMI_DEVID_EGPU method to run. + +Signed-off-by: Luke D. Jones <luke@ljones.dev> +--- + drivers/platform/x86/asus-wmi.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c +index 0c8a4a46b121..821addb284d7 100644 +--- a/drivers/platform/x86/asus-wmi.c ++++ b/drivers/platform/x86/asus-wmi.c +@@ -693,6 +693,15 @@ static ssize_t egpu_enable_store(struct device *dev, + if (enable > 1) + return -EINVAL; + ++ err = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_EGPU_CONNECTED); ++ if (err < 0) ++ return err; ++ if (err < 1) { ++ err = -ENODEV; ++ pr_warn("Failed to set egpu disable: %d\n", err); ++ return err; ++ } ++ + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_EGPU, enable, &result); + if (err) { + pr_warn("Failed to set egpu disable: %d\n", err); +-- +2.41.0 + diff --git a/v2-0006-platform-x86-asus-wmi-add-safety-checks-to-gpu-sw.patch b/v2-0006-platform-x86-asus-wmi-add-safety-checks-to-gpu-sw.patch new file mode 100644 index 000000000000..124cfa02e5cd --- /dev/null +++ b/v2-0006-platform-x86-asus-wmi-add-safety-checks-to-gpu-sw.patch @@ -0,0 +1,104 @@ +From 391b0757f19890d67ec0ade558a255421588047e Mon Sep 17 00:00:00 2001 +From: "Luke D. Jones" <luke@ljones.dev> +Date: Tue, 20 Jun 2023 12:48:31 +1200 +Subject: [PATCH v2 6/8] platform/x86: asus-wmi: add safety checks to gpu + switching + +Add safety checking to dgpu_disable, egpu_enable, gpu_mux_mode. + +These checks prevent users from doing such things as: +- disabling the dGPU while is muxed to drive the internal screen +- enabling the eGPU which also disables the dGPU, while muxed to + the internal screen +- switching the MUX to dGPU while the dGPU is disabled + +Signed-off-by: Luke D. Jones <luke@ljones.dev> +--- + drivers/platform/x86/asus-wmi.c | 50 ++++++++++++++++++++++++++++++++- + 1 file changed, 49 insertions(+), 1 deletion(-) + +diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c +index 821addb284d7..602426a7fb41 100644 +--- a/drivers/platform/x86/asus-wmi.c ++++ b/drivers/platform/x86/asus-wmi.c +@@ -645,6 +645,18 @@ static ssize_t dgpu_disable_store(struct device *dev, + if (disable > 1) + return -EINVAL; + ++ if (asus->gpu_mux_mode_available) { ++ result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_GPU_MUX); ++ if (result < 0) ++ /* An error here may signal greater failure of GPU handling */ ++ return result; ++ if (!result && disable) { ++ err = -ENODEV; ++ pr_warn("Can not disable dGPU when the MUX is in dGPU mode: %d\n", err); ++ return err; ++ } ++ } ++ + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_DGPU, disable, &result); + if (err) { + pr_warn("Failed to set dgpu disable: %d\n", err); +@@ -693,7 +705,7 @@ static ssize_t egpu_enable_store(struct device *dev, + if (enable > 1) + return -EINVAL; + +- err = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_EGPU_CONNECTED); ++ result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_EGPU_CONNECTED); + if (err < 0) + return err; + if (err < 1) { +@@ -702,6 +714,18 @@ static ssize_t egpu_enable_store(struct device *dev, + return err; + } + ++ if (asus->gpu_mux_mode_available) { ++ result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_GPU_MUX); ++ if (result < 0) ++ /* An error here may signal greater failure of GPU handling */ ++ return result; ++ if (!result && enable) { ++ err = -ENODEV; ++ pr_warn("Can not enable eGPU when the MUX is in dGPU mode: %d\n", err); ++ return err; ++ } ++ } ++ + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_EGPU, enable, &result); + if (err) { + pr_warn("Failed to set egpu disable: %d\n", err); +@@ -764,6 +788,30 @@ static ssize_t gpu_mux_mode_store(struct device *dev, + if (optimus > 1) + return -EINVAL; + ++ if (asus->dgpu_disable_available) { ++ result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_DGPU); ++ if (result < 0) ++ /* An error here may signal greater failure of GPU handling */ ++ return result; ++ if (result && !optimus) { ++ err = -ENODEV; ++ pr_warn("Can not switch MUX to dGPU mode when dGPU is disabled: %d\n", err); ++ return err; ++ } ++ } ++ ++ if (asus->egpu_enable_available) { ++ result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_EGPU); ++ if (result < 0) ++ /* An error here may signal greater failure of GPU handling */ ++ return result; ++ if (result && !optimus) { ++ err = -ENODEV; ++ pr_warn("Can not switch MUX to dGPU mode when eGPU is enabled: %d\n", err); ++ return err; ++ } ++ } ++ + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_GPU_MUX, optimus, &result); + if (err) { + dev_err(dev, "Failed to set GPU MUX mode: %d\n", err); +-- +2.41.0 + diff --git a/0011-platform-x86-asus-wmi-support-setting-mini-LED-mode.patch b/v2-0007-platform-x86-asus-wmi-support-setting-mini-LED-mo.patch index c92dbc224ce5..8492f2904924 100644 --- a/0011-platform-x86-asus-wmi-support-setting-mini-LED-mode.patch +++ b/v2-0007-platform-x86-asus-wmi-support-setting-mini-LED-mo.patch @@ -1,7 +1,7 @@ -From f7ff4d0624e23015698b408b3e0721ad0241a3ed Mon Sep 17 00:00:00 2001 +From 7e181ab671dc4c63eb2b2df5cc50dd3218d9b37d 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 +Subject: [PATCH v2 7/8] platform/x86: asus-wmi: support setting mini-LED mode Support changing the mini-LED mode on some of the newer ASUS laptops. @@ -30,10 +30,10 @@ index 878daf7c2036..5624bdef49cb 100644 + * 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 +index 602426a7fb41..1fc9e8afc2f3 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c -@@ -267,6 +267,7 @@ struct asus_wmi { +@@ -265,6 +265,7 @@ struct asus_wmi { bool battery_rsoc_available; bool panel_overdrive_available; @@ -41,7 +41,7 @@ index 26155bdc48da..e86366353008 100644 struct hotplug_slot hotplug_slot; struct mutex hotplug_lock; -@@ -1765,6 +1766,54 @@ static ssize_t panel_od_store(struct device *dev, +@@ -1820,6 +1821,54 @@ static ssize_t panel_od_store(struct device *dev, } static DEVICE_ATTR_RW(panel_od); @@ -96,7 +96,7 @@ index 26155bdc48da..e86366353008 100644 /* Quirks *********************************************************************/ static void asus_wmi_set_xusb2pr(struct asus_wmi *asus) -@@ -3787,6 +3836,7 @@ static struct attribute *platform_attributes[] = { +@@ -3727,6 +3776,7 @@ static struct attribute *platform_attributes[] = { &dev_attr_fan_boost_mode.attr, &dev_attr_throttle_thermal_policy.attr, &dev_attr_panel_od.attr, @@ -104,7 +104,7 @@ index 26155bdc48da..e86366353008 100644 NULL }; -@@ -3824,6 +3874,8 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj, +@@ -3764,6 +3814,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; @@ -113,7 +113,7 @@ index 26155bdc48da..e86366353008 100644 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) +@@ -4026,6 +4078,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); @@ -122,10 +122,10 @@ index 26155bdc48da..e86366353008 100644 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 +index 2034648f8cdf..ea80361ac6c7 100644 --- a/include/linux/platform_data/x86/asus-wmi.h +++ b/include/linux/platform_data/x86/asus-wmi.h -@@ -70,6 +70,7 @@ +@@ -66,6 +66,7 @@ #define ASUS_WMI_DEVID_CAMERA 0x00060013 #define ASUS_WMI_DEVID_LID_FLIP 0x00060062 #define ASUS_WMI_DEVID_LID_FLIP_ROG 0x00060077 @@ -134,5 +134,5 @@ index bfc284fe4d68..193efdca4545 100644 /* Storage */ #define ASUS_WMI_DEVID_CARDREADER 0x00080013 -- -2.40.1 +2.41.0 diff --git a/v2-0008-platform-x86-asus-wmi-expose-dGPU-and-CPU-tunable.patch b/v2-0008-platform-x86-asus-wmi-expose-dGPU-and-CPU-tunable.patch new file mode 100644 index 000000000000..86f229993fcc --- /dev/null +++ b/v2-0008-platform-x86-asus-wmi-expose-dGPU-and-CPU-tunable.patch @@ -0,0 +1,443 @@ +From b297ff51a7a10ed07f176cc8ba8ea7a653c5b725 Mon Sep 17 00:00:00 2001 +From: "Luke D. Jones" <luke@ljones.dev> +Date: Tue, 6 Jun 2023 15:05:01 +1200 +Subject: [PATCH v2 8/8] platform/x86: asus-wmi: expose dGPU and CPU tunables + for ROG + +Expose various CPU and dGPU tunables that are available on many ASUS +ROG laptops. The tunables shown in sysfs will vary depending on the CPU +and dGPU vendor. + +All of these variables are write only and there is no easy way to find +what the defaults are. In general they seem to default to the max value +the vendor sets for the CPU and dGPU package - this is not the same as +the min/max writable value. Values written to these variables that are +beyond the capabilities of the CPU are ignored by the laptop. + +Signed-off-by: Luke D. Jones <luke@ljones.dev> +--- + .../ABI/testing/sysfs-platform-asus-wmi | 58 ++++ + drivers/platform/x86/asus-wmi.c | 285 ++++++++++++++++++ + include/linux/platform_data/x86/asus-wmi.h | 9 + + 3 files changed, 352 insertions(+) + +diff --git a/Documentation/ABI/testing/sysfs-platform-asus-wmi b/Documentation/ABI/testing/sysfs-platform-asus-wmi +index 5624bdef49cb..caaccd28fabf 100644 +--- a/Documentation/ABI/testing/sysfs-platform-asus-wmi ++++ b/Documentation/ABI/testing/sysfs-platform-asus-wmi +@@ -126,3 +126,61 @@ Description: + Change the mini-LED mode: + * 0 - Single-zone, + * 1 - Multi-zone ++ ++What: /sys/devices/platform/<platform>/ppt_pl1_spl ++Date: Jun 2023 ++KernelVersion: 6.5 ++Contact: "Luke Jones" <luke@ljones.dev> ++Description: ++ Set the Package Power Target total of CPU: PL1 on Intel, SPL on AMD. ++ Shown on Intel+Nvidia or AMD+Nvidia based systems. ++ * min=5, max=250 ++ ++What: /sys/devices/platform/<platform>/ppt_pl2_sppt ++Date: Jun 2023 ++KernelVersion: 6.5 ++Contact: "Luke Jones" <luke@ljones.dev> ++Description: ++ Set the Slow Package Power Tracking Limit of CPU: PL2 on Intel, SPPT, ++ on AMD. Shown on Intel+Nvidia or AMD+Nvidia based systems. ++ * min=5, max=250 ++ ++What: /sys/devices/platform/<platform>/ppt_fppt ++Date: Jun 2023 ++KernelVersion: 6.5 ++Contact: "Luke Jones" <luke@ljones.dev> ++Description: ++ Set the Fast Package Power Tracking Limit of CPU. AMD+Nvidia only. ++ * min=5, max=250 ++ ++What: /sys/devices/platform/<platform>/ppt_apu_sppt ++Date: Jun 2023 ++KernelVersion: 6.5 ++Contact: "Luke Jones" <luke@ljones.dev> ++Description: ++ Set the APU SPPT limit. Shown on full AMD systems only. ++ * min=5, max=130 ++ ++What: /sys/devices/platform/<platform>/ppt_platform_sppt ++Date: Jun 2023 ++KernelVersion: 6.5 ++Contact: "Luke Jones" <luke@ljones.dev> ++Description: ++ Set the platform SPPT limit. Shown on full AMD systems only. ++ * min=5, max=130 ++ ++What: /sys/devices/platform/<platform>/nv_dynamic_boost ++Date: Jun 2023 ++KernelVersion: 6.5 ++Contact: "Luke Jones" <luke@ljones.dev> ++Description: ++ Set the dynamic boost limit of the Nvidia dGPU: ++ * min=5, max=25 ++ ++What: /sys/devices/platform/<platform>/nv_temp_target ++Date: Jun 2023 ++KernelVersion: 6.5 ++Contact: "Luke Jones" <luke@ljones.dev> ++Description: ++ Set the target temperature limit of the Nvidia dGPU: ++ * min=75, max=87 +diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c +index 1fc9e8afc2f3..d9a353081f91 100644 +--- a/drivers/platform/x86/asus-wmi.c ++++ b/drivers/platform/x86/asus-wmi.c +@@ -117,6 +117,16 @@ module_param(fnlock_default, bool, 0444); + /* Mask to determine if setting temperature or percentage */ + #define FAN_CURVE_PWM_MASK 0x04 + ++/* Limits for tunables available on ASUS ROG laptops */ ++#define PPT_TOTAL_MIN 5 ++#define PPT_TOTAL_MAX 250 ++#define PPT_CPU_MIN 5 ++#define PPT_CPU_MAX 130 ++#define NVIDIA_BOOST_MIN 5 ++#define NVIDIA_BOOST_MAX 25 ++#define NVIDIA_TEMP_MIN 75 ++#define NVIDIA_TEMP_MAX 87 ++ + static const char * const ashs_ids[] = { "ATK4001", "ATK4002", NULL }; + + static int throttle_thermal_policy_write(struct asus_wmi *); +@@ -247,6 +257,15 @@ struct asus_wmi { + bool dgpu_disable_available; + bool gpu_mux_mode_available; + ++ /* Tunables provided by ASUS for gaming laptops */ ++ bool ppt_pl2_sppt_available; ++ bool ppt_pl1_spl_available; ++ bool ppt_apu_sppt_available; ++ bool ppt_plat_sppt_available; ++ bool ppt_fppt_available; ++ bool nv_dyn_boost_available; ++ bool nv_temp_tgt_available; ++ + bool kbd_rgb_mode_available; + bool kbd_rgb_state_available; + +@@ -946,6 +965,244 @@ static const struct attribute_group *kbd_rgb_mode_groups[] = { + NULL, + }; + ++/* Tunable: PPT: Intel=PL1, AMD=SPPT *****************************************/ ++static ssize_t ppt_pl2_sppt_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ int result, err; ++ u32 value; ++ ++ struct asus_wmi *asus = dev_get_drvdata(dev); ++ ++ result = kstrtou32(buf, 10, &value); ++ if (result) ++ return result; ++ ++ if (value < PPT_TOTAL_MIN || value > PPT_TOTAL_MAX) ++ return -EINVAL; ++ ++ err = asus_wmi_set_devstate(ASUS_WMI_DEVID_PPT_PL2_SPPT, value, &result); ++ if (err) { ++ pr_warn("Failed to set ppt_pl2_sppt: %d\n", err); ++ return err; ++ } ++ ++ if (result > 1) { ++ pr_warn("Failed to set ppt_pl2_sppt (result): 0x%x\n", result); ++ return -EIO; ++ } ++ ++ sysfs_notify(&asus->platform_device->dev.kobj, NULL, "ppt_pl2_sppt"); ++ ++ return count; ++} ++static DEVICE_ATTR_WO(ppt_pl2_sppt); ++ ++/* Tunable: PPT, Intel=PL1, AMD=SPL ******************************************/ ++static ssize_t ppt_pl1_spl_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ int result, err; ++ u32 value; ++ ++ struct asus_wmi *asus = dev_get_drvdata(dev); ++ ++ result = kstrtou32(buf, 10, &value); ++ if (result) ++ return result; ++ ++ if (value < PPT_TOTAL_MIN || value > PPT_TOTAL_MAX) ++ return -EINVAL; ++ ++ err = asus_wmi_set_devstate(ASUS_WMI_DEVID_PPT_PL1_SPL, value, &result); ++ if (err) { ++ pr_warn("Failed to set ppt_pl1_spl: %d\n", err); ++ return err; ++ } ++ ++ if (result > 1) { ++ pr_warn("Failed to set ppt_pl1_spl (result): 0x%x\n", result); ++ return -EIO; ++ } ++ ++ sysfs_notify(&asus->platform_device->dev.kobj, NULL, "ppt_pl1_spl"); ++ ++ return count; ++} ++static DEVICE_ATTR_WO(ppt_pl1_spl); ++ ++/* Tunable: PPT APU FPPT ******************************************************/ ++static ssize_t ppt_fppt_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ int result, err; ++ u32 value; ++ ++ struct asus_wmi *asus = dev_get_drvdata(dev); ++ ++ result = kstrtou32(buf, 10, &value); ++ if (result) ++ return result; ++ ++ if (value < PPT_TOTAL_MIN || value > PPT_TOTAL_MAX) ++ return -EINVAL; ++ ++ err = asus_wmi_set_devstate(ASUS_WMI_DEVID_PPT_FPPT, value, &result); ++ if (err) { ++ pr_warn("Failed to set ppt_fppt: %d\n", err); ++ return err; ++ } ++ ++ if (result > 1) { ++ pr_warn("Failed to set ppt_fppt (result): 0x%x\n", result); ++ return -EIO; ++ } ++ ++ sysfs_notify(&asus->platform_device->dev.kobj, NULL, "ppt_fpu_sppt"); ++ ++ return count; ++} ++static DEVICE_ATTR_WO(ppt_fppt); ++ ++/* Tunable: PPT APU SPPT *****************************************************/ ++static ssize_t ppt_apu_sppt_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ int result, err; ++ u32 value; ++ ++ struct asus_wmi *asus = dev_get_drvdata(dev); ++ ++ result = kstrtou32(buf, 10, &value); ++ if (result) ++ return result; ++ ++ if (value < PPT_CPU_MIN || value > PPT_CPU_MAX) ++ return -EINVAL; ++ ++ err = asus_wmi_set_devstate(ASUS_WMI_DEVID_PPT_APU_SPPT, value, &result); ++ if (err) { ++ pr_warn("Failed to set ppt_apu_sppt: %d\n", err); ++ return err; ++ } ++ ++ if (result > 1) { ++ pr_warn("Failed to set ppt_apu_sppt (result): 0x%x\n", result); ++ return -EIO; ++ } ++ ++ sysfs_notify(&asus->platform_device->dev.kobj, NULL, "ppt_apu_sppt"); ++ ++ return count; ++} ++static DEVICE_ATTR_WO(ppt_apu_sppt); ++ ++/* Tunable: PPT platform SPPT ************************************************/ ++static ssize_t ppt_platform_sppt_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ int result, err; ++ u32 value; ++ ++ struct asus_wmi *asus = dev_get_drvdata(dev); ++ ++ result = kstrtou32(buf, 10, &value); ++ if (result) ++ return result; ++ ++ if (value < PPT_CPU_MIN || value > PPT_CPU_MAX) ++ return -EINVAL; ++ ++ err = asus_wmi_set_devstate(ASUS_WMI_DEVID_PPT_PLAT_SPPT, value, &result); ++ if (err) { ++ pr_warn("Failed to set ppt_platform_sppt: %d\n", err); ++ return err; ++ } ++ ++ if (result > 1) { ++ pr_warn("Failed to set ppt_platform_sppt (result): 0x%x\n", result); ++ return -EIO; ++ } ++ ++ sysfs_notify(&asus->platform_device->dev.kobj, NULL, "ppt_platform_sppt"); ++ ++ return count; ++} ++static DEVICE_ATTR_WO(ppt_platform_sppt); ++ ++/* Tunable: NVIDIA dynamic boost *********************************************/ ++static ssize_t nv_dynamic_boost_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ int result, err; ++ u32 value; ++ ++ struct asus_wmi *asus = dev_get_drvdata(dev); ++ ++ result = kstrtou32(buf, 10, &value); ++ if (result) ++ return result; ++ ++ if (value < NVIDIA_BOOST_MIN || value > NVIDIA_BOOST_MAX) ++ return -EINVAL; ++ ++ err = asus_wmi_set_devstate(ASUS_WMI_DEVID_NV_DYN_BOOST, value, &result); ++ if (err) { ++ pr_warn("Failed to set nv_dynamic_boost: %d\n", err); ++ return err; ++ } ++ ++ if (result > 1) { ++ pr_warn("Failed to set nv_dynamic_boost (result): 0x%x\n", result); ++ return -EIO; ++ } ++ ++ sysfs_notify(&asus->platform_device->dev.kobj, NULL, "nv_dynamic_boost"); ++ ++ return count; ++} ++static DEVICE_ATTR_WO(nv_dynamic_boost); ++ ++/* Tunable: NVIDIA temperature target ****************************************/ ++static ssize_t nv_temp_target_store(struct device *dev, ++ struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ int result, err; ++ u32 value; ++ ++ struct asus_wmi *asus = dev_get_drvdata(dev); ++ ++ result = kstrtou32(buf, 10, &value); ++ if (result) ++ return result; ++ ++ if (value < NVIDIA_TEMP_MIN || value > NVIDIA_TEMP_MAX) ++ return -EINVAL; ++ ++ err = asus_wmi_set_devstate(ASUS_WMI_DEVID_NV_THERM_TARGET, value, &result); ++ if (err) { ++ pr_warn("Failed to set nv_temp_target: %d\n", err); ++ return err; ++ } ++ ++ if (result > 1) { ++ pr_warn("Failed to set nv_temp_target (result): 0x%x\n", result); ++ return -EIO; ++ } ++ ++ sysfs_notify(&asus->platform_device->dev.kobj, NULL, "nv_temp_target"); ++ ++ return count; ++} ++static DEVICE_ATTR_WO(nv_temp_target); ++ + /* Battery ********************************************************************/ + + /* The battery maximum charging percentage */ +@@ -3775,6 +4032,13 @@ static struct attribute *platform_attributes[] = { + &dev_attr_als_enable.attr, + &dev_attr_fan_boost_mode.attr, + &dev_attr_throttle_thermal_policy.attr, ++ &dev_attr_ppt_pl2_sppt.attr, ++ &dev_attr_ppt_pl1_spl.attr, ++ &dev_attr_ppt_fppt.attr, ++ &dev_attr_ppt_apu_sppt.attr, ++ &dev_attr_ppt_platform_sppt.attr, ++ &dev_attr_nv_dynamic_boost.attr, ++ &dev_attr_nv_temp_target.attr, + &dev_attr_panel_od.attr, + &dev_attr_mini_led_mode.attr, + NULL +@@ -3812,6 +4076,20 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj, + ok = asus->fan_boost_mode_available; + else if (attr == &dev_attr_throttle_thermal_policy.attr) + ok = asus->throttle_thermal_policy_available; ++ else if (attr == &dev_attr_ppt_pl2_sppt.attr) ++ ok = asus->ppt_pl2_sppt_available; ++ else if (attr == &dev_attr_ppt_pl1_spl.attr) ++ ok = asus->ppt_pl1_spl_available; ++ else if (attr == &dev_attr_ppt_fppt.attr) ++ ok = asus->ppt_fppt_available; ++ else if (attr == &dev_attr_ppt_apu_sppt.attr) ++ ok = asus->ppt_apu_sppt_available; ++ else if (attr == &dev_attr_ppt_platform_sppt.attr) ++ ok = asus->ppt_plat_sppt_available; ++ else if (attr == &dev_attr_nv_dynamic_boost.attr) ++ ok = asus->nv_dyn_boost_available; ++ else if (attr == &dev_attr_nv_temp_target.attr) ++ ok = asus->nv_temp_tgt_available; + else if (attr == &dev_attr_panel_od.attr) + ok = asus->panel_overdrive_available; + else if (attr == &dev_attr_mini_led_mode.attr) +@@ -4077,6 +4355,13 @@ static int asus_wmi_add(struct platform_device *pdev) + 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->ppt_pl2_sppt_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PPT_PL2_SPPT); ++ asus->ppt_pl1_spl_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PPT_PL1_SPL); ++ asus->ppt_fppt_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PPT_FPPT); ++ asus->ppt_apu_sppt_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PPT_APU_SPPT); ++ asus->ppt_plat_sppt_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PPT_PLAT_SPPT); ++ asus->nv_dyn_boost_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_NV_DYN_BOOST); ++ asus->nv_temp_tgt_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_NV_THERM_TARGET); + asus->panel_overdrive_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PANEL_OD); + asus->mini_led_mode_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_MINI_LED_MODE); + +diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h +index ea80361ac6c7..16e99a1c37fc 100644 +--- a/include/linux/platform_data/x86/asus-wmi.h ++++ b/include/linux/platform_data/x86/asus-wmi.h +@@ -86,6 +86,15 @@ + #define ASUS_WMI_DEVID_GPU_FAN_CURVE 0x00110025 + #define ASUS_WMI_DEVID_MID_FAN_CURVE 0x00110032 + ++/* Tunables for AUS ROG laptops */ ++#define ASUS_WMI_DEVID_PPT_PL2_SPPT 0x001200A0 ++#define ASUS_WMI_DEVID_PPT_PL1_SPL 0x001200A3 ++#define ASUS_WMI_DEVID_PPT_APU_SPPT 0x001200B0 ++#define ASUS_WMI_DEVID_PPT_PLAT_SPPT 0x001200B1 ++#define ASUS_WMI_DEVID_PPT_FPPT 0x001200C1 ++#define ASUS_WMI_DEVID_NV_DYN_BOOST 0x001200C0 ++#define ASUS_WMI_DEVID_NV_THERM_TARGET 0x001200C2 ++ + /* Power */ + #define ASUS_WMI_DEVID_PROCESSOR_STATE 0x00120012 + +-- +2.41.0 + diff --git a/0006-platform-x86-asus-wmi-add-support-for-ASUS-screenpad.patch b/v4-0001-platform-x86-asus-wmi-add-support-for-ASUS-screen.patch index b25f6d10463f..c8c4f74a2832 100644 --- a/0006-platform-x86-asus-wmi-add-support-for-ASUS-screenpad.patch +++ b/v4-0001-platform-x86-asus-wmi-add-support-for-ASUS-screen.patch @@ -1,24 +1,23 @@ -From af85785d35b6a5f9c73126224b4eb674980eb835 Mon Sep 17 00:00:00 2001 +From 43d8c3f0139b08cd3c0c31ed463d7ae57fcf552c 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 06/11] platform/x86: asus-wmi: add support for ASUS screenpad +Subject: [PATCH v4 1/1] 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 ASUS laptops like the GX650P series and others. -These methods are utilised in a new backlight device named: -- asus_screenpad +These methods are utilised in a new backlight device named asus_screenpad. Signed-off-by: Luke D. Jones <luke@ljones.dev> --- - drivers/platform/x86/asus-wmi.c | 131 +++++++++++++++++++++ + drivers/platform/x86/asus-wmi.c | 128 +++++++++++++++++++++ drivers/platform/x86/asus-wmi.h | 1 + include/linux/platform_data/x86/asus-wmi.h | 4 + - 3 files changed, 136 insertions(+) + 3 files changed, 133 insertions(+) diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c -index 1038dfdcdd32..5edf9ece51dc 100644 +index 62cee13f5576..967c92ceb041 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -25,6 +25,7 @@ @@ -29,7 +28,7 @@ index 1038dfdcdd32..5edf9ece51dc 100644 #include <linux/module.h> #include <linux/pci.h> #include <linux/pci_hotplug.h> -@@ -200,6 +201,7 @@ struct asus_wmi { +@@ -212,6 +213,7 @@ struct asus_wmi { struct input_dev *inputdev; struct backlight_device *backlight_device; @@ -37,7 +36,7 @@ index 1038dfdcdd32..5edf9ece51dc 100644 struct platform_device *platform_device; struct led_classdev wlan_led; -@@ -3208,6 +3210,125 @@ static int is_display_toggle(int code) +@@ -3839,6 +3841,123 @@ static int is_display_toggle(int code) return 0; } @@ -45,8 +44,9 @@ index 1038dfdcdd32..5edf9ece51dc 100644 + +static int read_screenpad_backlight_power(struct asus_wmi *asus) +{ -+ int ret = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_SCREENPAD_POWER); ++ int ret; + ++ ret = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_SCREENPAD_POWER); + if (ret < 0) + return ret; + /* 1 == powered */ @@ -114,14 +114,22 @@ index 1038dfdcdd32..5edf9ece51dc 100644 +{ + struct backlight_device *bd; + struct backlight_properties props; -+ int power, brightness; ++ int err, power; ++ int brightness = 0; + + power = read_screenpad_backlight_power(asus); -+ if (power == -ENODEV) -+ power = FB_BLANK_UNBLANK; -+ else if (power < 0) ++ if (power < 0) + return power; + ++ if (power != FB_BLANK_POWERDOWN) { ++ err = asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_SCREENPAD_LIGHT, &brightness); ++ if (err < 0) ++ return err; ++ } ++ /* default to an acceptable min brightness on boot if too low */ ++ if (brightness < 60) ++ brightness = 60; ++ + memset(&props, 0, sizeof(struct backlight_properties)); + props.type = BACKLIGHT_RAW; /* ensure this bd is last to be picked */ + props.max_brightness = 255; @@ -134,17 +142,6 @@ index 1038dfdcdd32..5edf9ece51dc 100644 + } + + asus->screenpad_backlight_device = bd; -+ -+ brightness = read_screenpad_brightness(bd); -+ if (brightness < 0) -+ return brightness; -+ /* -+ * Counter an odd behaviour where default is set to < 13 if it was 0 on boot. -+ * 60 is subjective, but accepted as a good compromise to retain visibility. -+ */ -+ if (brightness < 60) -+ brightness = 60; -+ + asus->driver->screenpad_brightness = brightness; + bd->props.brightness = brightness; + bd->props.power = power; @@ -163,7 +160,7 @@ index 1038dfdcdd32..5edf9ece51dc 100644 /* Fn-lock ********************************************************************/ static bool asus_wmi_has_fnlock_key(struct asus_wmi *asus) -@@ -3823,6 +3944,12 @@ static int asus_wmi_add(struct platform_device *pdev) +@@ -4504,6 +4623,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); @@ -176,17 +173,16 @@ index 1038dfdcdd32..5edf9ece51dc 100644 if (asus_wmi_has_fnlock_key(asus)) { asus->fnlock_locked = fnlock_default; asus_wmi_fnlock_update(asus); -@@ -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); +@@ -4527,6 +4652,8 @@ static int asus_wmi_add(struct platform_device *pdev) + asus_wmi_backlight_exit(asus); + fail_backlight: + asus_wmi_rfkill_exit(asus); +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_screenpad_exit(asus); + fail_rfkill: + asus_wmi_led_exit(asus); + fail_leds: +@@ -4553,6 +4680,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); @@ -207,7 +203,7 @@ index a478ebfd34df..5fbdd0eafa02 100644 const char *name; diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h -index 28234dc9fa6a..a2d94adb5c80 100644 +index d17ae2eb0f8d..61ba70b32846 100644 --- a/include/linux/platform_data/x86/asus-wmi.h +++ b/include/linux/platform_data/x86/asus-wmi.h @@ -58,6 +58,10 @@ @@ -222,5 +218,5 @@ index 28234dc9fa6a..a2d94adb5c80 100644 #define ASUS_WMI_DEVID_THROTTLE_THERMAL_POLICY 0x00120075 -- -2.40.1 +2.41.0 |