summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeka2023-12-11 18:22:16 +0300
committerJeka2023-12-11 18:22:16 +0300
commit139ff035492c400023b1b7f0e6603c33cd9f04d2 (patch)
treed9f8b6e2ee29b9a91a862c4d87843c07e99f85fa
parent41ebcbdba1e39e7fe2bc46e727e8a88ed9fb7be0 (diff)
downloadaur-139ff035492c400023b1b7f0e6603c33cd9f04d2.tar.gz
kernel release 6.6.6
-rw-r--r--.SRCINFO82
-rw-r--r--0000-hid-asus-add-const-to-read-only-outgoing-usb-buffer.patch57
-rw-r--r--0001-ALSA-cs35l41-Use-mbox-command-to-enable-speaker-outp.patch238
-rw-r--r--0001-ALSA-hda-cs35l41-Improve-support-for-ASUS-ROG-Ally.patch64
-rw-r--r--0001-ALSA-hda-cs35l41-Support-ASUS-2023-laptops-with-miss.patch92
-rw-r--r--0001-Cirrus-no-dsdt.patch266
-rw-r--r--0001-GPU-reset.patch257
-rw-r--r--0001-HID.patch201
-rw-r--r--0001-hid-asus-reset-the-backlight-brightness-level-on-resume.patch59
-rw-r--r--0002-ALSA-cs35l41-Poll-for-Power-Up-Down-rather-than-wait.patch141
-rw-r--r--0002-drivers-firmware-skip-simpledrm-if-nvidia-drm.modese.patch89
-rw-r--r--0003-ALSA-hda-cs35l41-Check-mailbox-status-of-pause-comma.patch36
-rw-r--r--0003-sphinx-kfigure.py-Convert-outdir-to-str-before-using.patch33
-rw-r--r--0004-ALSA-hda-cs35l41-Ensure-we-correctly-re-sync-regmap-.patch74
-rw-r--r--0004-ASoC-Intel-soc-acpi-fix-Dell-SKU-0B34.patch51
-rw-r--r--0005-ALSA-hda-cs35l41-Ensure-we-pass-up-any-errors-during.patch63
-rw-r--r--0005-Revert-ASoC-Intel-soc-acpi-add-tables-for-Dell-SKU-0.patch79
-rw-r--r--0005-btrfs-wait-on-uncached-block-groups-on-every-allocat.patch255
-rw-r--r--0006-ALSA-hda-cs35l41-Move-Play-and-Pause-into-separate-f.patch193
-rw-r--r--0006-btrfs-set-last-dir-index-to-the-current-last-index-w.patch86
-rw-r--r--0006-platform-x86-asus-wmi-disable-USB0-hub-on-ROG-Ally-b.patch141
-rw-r--r--0007-ALSA-hda-hda_component-Add-pre-and-post-playback-hoo.patch56
-rw-r--r--0007-btrfs-refresh-dir-last-index-during-a-rewinddir-3-ca.patch102
-rw-r--r--0007-mt7921e_Perform_FLR_to_recovery_the_device.patch (renamed from 0202-mt7921e_Perform_FLR_to_recovery_the_device.patch)0
-rw-r--r--0008-ALSA-hda-cs35l41-Use-pre-and-post-playback-hooks.patch122
-rw-r--r--0008-btrfs-fix-race-between-reading-a-directory-and-addin.patch143
-rw-r--r--0009-ALSA-hda-cs35l41-Rework-System-Suspend-to-ensure-cor.patch114
-rw-r--r--0010-ALSA-hda-cs35l41-Add-device_link-between-HDA-and-cs3.patch60
-rw-r--r--0011-ALSA-hda-cs35l41-Ensure-amp-is-only-unmuted-during-p.patch73
-rw-r--r--0103-ASoC-Intel-soc-acpi-fix-Dell-SKU-0B34.patch51
-rw-r--r--0104-btrfs-wait-on-uncached-block-groups-on-every-allocat.patch255
-rw-r--r--0105-net_wwan_t7xx_add-AP-CLDMA.patch504
-rw-r--r--0301-drm-Add_GPU_reset_sysfs_event.patch108
-rw-r--r--0302-drm-amdgpu-add_work_function_for_GPU_reset_event.patch97
-rw-r--r--0303-drm-amdgpu-schedule_GPU_reset_event_work_function.patch41
-rw-r--r--0999-patch_realtek.patch (renamed from 0998-patch_realtek.patch)0
-rw-r--r--PKGBUILD91
-rw-r--r--ROG-ALLY-LED-fix.patch32
-rw-r--r--ROG_ALLY_OLDER_BIOS_AUDIO.patch18
-rw-r--r--config223
-rw-r--r--v14.1-0001-HID-asus-fix-more-n-key-report-descriptors-if-.patch89
-rw-r--r--v14.1-0002-HID-asus-make-asus_kbd_init-generic-remove-rog.patch130
-rw-r--r--v14.1-0003-HID-asus-add-ROG-Ally-N-Key-ID-and-keycodes.patch (renamed from 0201-asus-ally-asus-hid-6.5.patch)35
-rw-r--r--v14.1-0004-HID-asus-add-ROG-Ally-xpad-settings.patch2317
-rw-r--r--v14.1-fix-defaults1.patch63
-rw-r--r--wifi-nl80211-fix-deadlock-in-nl80211_set_cqm_rssi-(6.6.x).patch61
46 files changed, 3544 insertions, 3798 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 26349d694517..a09931beafa1 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = linux-jcore
pkgdesc = Kernel for Manjaro/EndeavourOS/Arch (ACS override patch include)
- pkgver = 6.5.7
+ pkgver = 6.6.6
pkgrel = 1
url = https://www.kernel.org/
arch = x86_64
@@ -21,65 +21,51 @@ pkgbase = linux-jcore
replaces = linux-acs-manjaro
replaces = linux-acs-manjaro-headers
options = !strip
- source = https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.5.7.tar.xz
+ source = https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.6.6.tar.xz
source = config
source = 0101-ZEN_Add_sysctl_and_CONFIG_to_disallow_unprivileged_CLONE_NEWUSER.patch
source = 0102-drivers-firmware-skip-simpledrm-if-nvidia-drm.modese.patch
- source = 0103-ASoC-Intel-soc-acpi-fix-Dell-SKU-0B34.patch
- source = 0104-btrfs-wait-on-uncached-block-groups-on-every-allocat.patch
- source = 0105-net_wwan_t7xx_add-AP-CLDMA.patch
- source = 0201-asus-ally-asus-hid-6.5.patch
- source = 0202-mt7921e_Perform_FLR_to_recovery_the_device.patch
- source = 0001-GPU-reset.patch
- source = 0001-Cirrus-no-dsdt.patch
+ source = 0999-patch_realtek.patch
+ source = 0000-hid-asus-add-const-to-read-only-outgoing-usb-buffer.patch
+ source = 0001-hid-asus-reset-the-backlight-brightness-level-on-resume.patch
+ source = v14.1-0001-HID-asus-fix-more-n-key-report-descriptors-if-.patch
+ source = v14.1-0002-HID-asus-make-asus_kbd_init-generic-remove-rog.patch
+ source = v14.1-0003-HID-asus-add-ROG-Ally-N-Key-ID-and-keycodes.patch
+ source = v14.1-0004-HID-asus-add-ROG-Ally-xpad-settings.patch
+ source = v14.1-fix-defaults1.patch
+ source = 0006-platform-x86-asus-wmi-disable-USB0-hub-on-ROG-Ally-b.patch
+ source = 0007-mt7921e_Perform_FLR_to_recovery_the_device.patch
+ source = 0301-drm-Add_GPU_reset_sysfs_event.patch
+ source = 0302-drm-amdgpu-add_work_function_for_GPU_reset_event.patch
+ source = 0303-drm-amdgpu-schedule_GPU_reset_event_work_function.patch
source = 0001-ALSA-hda-cs35l41-Support-ASUS-2023-laptops-with-miss.patch
- source = 0001-ALSA-cs35l41-Use-mbox-command-to-enable-speaker-outp.patch
- source = 0002-ALSA-cs35l41-Poll-for-Power-Up-Down-rather-than-wait.patch
- source = 0003-ALSA-hda-cs35l41-Check-mailbox-status-of-pause-comma.patch
- source = 0004-ALSA-hda-cs35l41-Ensure-we-correctly-re-sync-regmap-.patch
- source = 0005-ALSA-hda-cs35l41-Ensure-we-pass-up-any-errors-during.patch
- source = 0006-ALSA-hda-cs35l41-Move-Play-and-Pause-into-separate-f.patch
- source = 0007-ALSA-hda-hda_component-Add-pre-and-post-playback-hoo.patch
- source = 0008-ALSA-hda-cs35l41-Use-pre-and-post-playback-hooks.patch
- source = 0009-ALSA-hda-cs35l41-Rework-System-Suspend-to-ensure-cor.patch
- source = 0010-ALSA-hda-cs35l41-Add-device_link-between-HDA-and-cs3.patch
- source = 0011-ALSA-hda-cs35l41-Ensure-amp-is-only-unmuted-during-p.patch
- source = 0998-patch_realtek.patch
- source = 0001-HID.patch
- source = ROG-ALLY-LED-fix.patch
+ source = 0001-ALSA-hda-cs35l41-Improve-support-for-ASUS-ROG-Ally.patch
source = ROG-ALLY-NCT6775-PLATFORM.patch
- source = ROG_ALLY_OLDER_BIOS_AUDIO.patch
source = 0001-ROG-ALLY-bmi323-device.patch
+ source = 0001-HID.patch
source = 0999-acs.gitpatch
- sha256sums = 0d09ea448005c9cfe5383e4c72a872b39188b928f8c44e146b03b1b7851fbb8c
- sha256sums = 68c8f0aecfabb6f6eac76daed2985e9255ab62f98669d341d02aa66070ce17ce
+ sha256sums = ebf70a917934b13169e1be5b95c3b6c2fea5bc14e6dc144f1efb8a0016b224c8
+ sha256sums = 043ada1688a42e652bb0b339d2f9732c323c22da96bb2ca2bcf144a731c5e981
sha256sums = 05f04019d4a2ee072238c32860fa80d673687d84d78ef436ae9332b6fb788467
sha256sums = e1d17690dd21e8d5482b63ca66bfe6b478d39e8e8b59eedd53adb0a55ebc308d
- sha256sums = 6a8e31d9e0b9dfb13c1fb96cea1dc17929920038c50db7d731e1af63fd0b26b9
- sha256sums = 997e873b5fa0fb94ebc7ab88474edc15f7e94340643a1305fd2eab2917f39df6
- sha256sums = 6a5d3cff6d9887b9f2e6fe8121cadf7b22cafcfabe3bd0d3e80d9174ede7204d
- sha256sums = 6541760a7b0513ce52c7b2d67810135b1bd172849f52765e74a5ec0c7584dd56
- sha256sums = d673d034fbcd80426fd8d9c6af56537c5fe5b55fe49d74e313474d7fc285ecc1
- sha256sums = 11ff8e0119e1bd33a572e18a10dfb94f521b4e38ee5948d3c0508faf07835a78
- sha256sums = ec6f9f062e94a62ecbec3a9e30bb6fc7ffd33e279eeb621674bfe4e4c398836a
- sha256sums = 6536e2f6bcb881d412f99d6bf940487c0a79cc432a0ef7e6e60a24e6a445a8f2
- sha256sums = 27aaf7e14c7f5e127f5b658352ca5c3650477a92462139557aefb73bcea2b418
- sha256sums = 74da118887929f06afb57eaee716ff433ee5972c9dc91166fc08e66f44edb8e8
- sha256sums = c5ac510677e58ac6b189939ac853e64bf9ad026a614a47f4cb535ad62bf41163
- sha256sums = 88f0d69dad01ccfef899b6b08abe162fc7743d40571232dff9a7d9093890d0a8
- sha256sums = 826bfa21b613d9c198d375d902958c90bb30171aee602c1806aaf99212abbb40
- sha256sums = 0dae5e24249b712f1501ead600c8ef4a5df21484e39e06a1dbafb57929c4999f
- sha256sums = 8dddf5537e3feedbf9f9c67f3c19fa7412d9e01b4f78023262b8fa340d3f47b2
- sha256sums = 3774b4eba753eb5f3768a28a68eb1a17557c0347275c19b8133f9f74d64a80df
- sha256sums = a5daf210a6f72dde5b477d4b6d38a162b2698cac6c5fcfd4e4fd606274f34cec
- sha256sums = b9298bde48a9f6c5d028150d627c05c71880e2693933ef2fe070f090e80876a5
- sha256sums = 4d53a6853b63c0f01b60b408bee61fa729656f925e50fa55ae3cba309668242a
sha256sums = 3aa9f1ca47bb078f3c9a52fe61897cf4fe989068cd7e66bfa6644fd605fa40d2
- sha256sums = ed7f4ba3b47c92b5102c9eef81f41e57216e9357d4a638199035a93f080eeb1a
- sha256sums = 68a9b80e0b8d75880fbf3d8486bfe522cb19b4042554786b23bead9320165fa5
+ sha256sums = fb2cd8a3ea9d47bd78c99b8ece1f3959c20b4de97a7959a12650f989f5c724da
+ sha256sums = 7f3194f1a7c5ebc27bbfa4559cfd9a2ccffddbbd2d259c0d9c68631cb66c5855
+ sha256sums = 176adde8fc3069bd28393bf0c9d788f1b0f9a186678aec4dc17b0b081c57f97b
+ sha256sums = 493fa177cf602f087e981e95fad3764e305f4c486d4c2ef78255388b913be9cf
+ sha256sums = 50ea381758fb8a8566f38a509fe7cf0448c77eaec5103066cafc2ecf02db1e9f
+ sha256sums = 970687b811034e722befde62bcf6d51c7442a217074ed0fb71460bb1803f4c64
+ sha256sums = c00b23162fdbf50de375d8e444b6d59e2e3630cfac55ec1d06114b9dad00e542
+ sha256sums = 836e88044263f7bc474ca466b3d0d98c39e265db94925c300d0b138492946a13
+ sha256sums = d673d034fbcd80426fd8d9c6af56537c5fe5b55fe49d74e313474d7fc285ecc1
+ sha256sums = 1f62542a889a6c2eafd43acd0699f54720ed891eeda66a4a9261d75b92f28b7f
+ sha256sums = 6bc2c1b9a485c852b45e4064e8b9b559b9b26113fdc80bf9653af44c0886fde2
+ sha256sums = 559f01074cda3c161996617f1b7bc6cbbce0efc50e2cf9e843d60922ff2e8063
+ sha256sums = 79970a4729572cb25fd4644d66f38ecd5b3e1610a42ea4bbe436b501f3469fa2
+ sha256sums = 430a7f971d78d0873708e0ad38fba602ceafefd4da8ebbf9d9c591bc4799acb5
sha256sums = cfcd5c177423df8b7b98b0500fe7ab0757f895ed945c33e205963f0069c7a3be
- sha256sums = 2d8246d2ff6312cd8ff832c50f4176201e43fe9d55e9b758bec9f0cad75bd0ba
sha256sums = 5574a68b1c7733769835bb856a8c32e54398dfde59f264708672b87b73b3c6ea
+ sha256sums = 7c948773d758418d8a436067265d678c444827562c46b9fced2ff31ced108481
sha256sums = 458d7e024d33d4965b14b9b987f01a2884ff28761cff5da7c6a54132a95e9f36
pkgname = linux-jcore
diff --git a/0000-hid-asus-add-const-to-read-only-outgoing-usb-buffer.patch b/0000-hid-asus-add-const-to-read-only-outgoing-usb-buffer.patch
new file mode 100644
index 000000000000..3bf969bb1709
--- /dev/null
+++ b/0000-hid-asus-add-const-to-read-only-outgoing-usb-buffer.patch
@@ -0,0 +1,57 @@
+From 06ae5afce8cc1f7621cc5c7751e449ce20d68af7 Mon Sep 17 00:00:00 2001
+From: Denis Benato <benato.denis96@gmail.com>
+Date: Fri, 17 Nov 2023 14:15:55 +1300
+Subject: [PATCH] HID: hid-asus: add const to read-only outgoing usb buffer
+
+In the function asus_kbd_set_report the parameter buf is read-only
+as it gets copied in a memory portion suitable for USB transfer,
+but the parameter is not marked as const: add the missing const and mark
+const immutable buffers passed to that function.
+
+Signed-off-by: Denis Benato <benato.denis96@gmail.com>
+Signed-off-by: Luke D. Jones <luke@ljones.dev>
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+---
+ drivers/hid/hid-asus.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
+index fd61dba882338e..b70673a929a1ed 100644
+--- a/drivers/hid/hid-asus.c
++++ b/drivers/hid/hid-asus.c
+@@ -381,7 +381,7 @@ static int asus_raw_event(struct hid_device *hdev,
+ return 0;
+ }
+
+-static int asus_kbd_set_report(struct hid_device *hdev, u8 *buf, size_t buf_size)
++static int asus_kbd_set_report(struct hid_device *hdev, const u8 *buf, size_t buf_size)
+ {
+ unsigned char *dmabuf;
+ int ret;
+@@ -404,7 +404,7 @@ static int asus_kbd_set_report(struct hid_device *hdev, u8 *buf, size_t buf_size
+
+ static int asus_kbd_init(struct hid_device *hdev)
+ {
+- u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x41, 0x53, 0x55, 0x53, 0x20, 0x54,
++ const u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x41, 0x53, 0x55, 0x53, 0x20, 0x54,
+ 0x65, 0x63, 0x68, 0x2e, 0x49, 0x6e, 0x63, 0x2e, 0x00 };
+ int ret;
+
+@@ -418,7 +418,7 @@ static int asus_kbd_init(struct hid_device *hdev)
+ static int asus_kbd_get_functions(struct hid_device *hdev,
+ unsigned char *kbd_func)
+ {
+- u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x05, 0x20, 0x31, 0x00, 0x08 };
++ const u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x05, 0x20, 0x31, 0x00, 0x08 };
+ u8 *readbuf;
+ int ret;
+
+@@ -449,7 +449,7 @@ static int asus_kbd_get_functions(struct hid_device *hdev,
+
+ static int rog_nkey_led_init(struct hid_device *hdev)
+ {
+- u8 buf_init_start[] = { FEATURE_KBD_LED_REPORT_ID1, 0xB9 };
++ const u8 buf_init_start[] = { FEATURE_KBD_LED_REPORT_ID1, 0xB9 };
+ u8 buf_init2[] = { FEATURE_KBD_LED_REPORT_ID1, 0x41, 0x53, 0x55, 0x53, 0x20,
+ 0x54, 0x65, 0x63, 0x68, 0x2e, 0x49, 0x6e, 0x63, 0x2e, 0x00 };
+ u8 buf_init3[] = { FEATURE_KBD_LED_REPORT_ID1,
diff --git a/0001-ALSA-cs35l41-Use-mbox-command-to-enable-speaker-outp.patch b/0001-ALSA-cs35l41-Use-mbox-command-to-enable-speaker-outp.patch
deleted file mode 100644
index 57823933eba4..000000000000
--- a/0001-ALSA-cs35l41-Use-mbox-command-to-enable-speaker-outp.patch
+++ /dev/null
@@ -1,238 +0,0 @@
-From c21139c6470a5b08c7463e451f2ff404e55f652f Mon Sep 17 00:00:00 2001
-From: Stefan Binding <sbinding@opensource.cirrus.com>
-Date: Fri, 21 Jul 2023 16:18:06 +0100
-Subject: [PATCH 01/11] ALSA: cs35l41: Use mbox command to enable speaker
- output for external boost
-
-To enable the speaker output in external boost mode, 2 registers must
-be set, one after another. The longer the time between the writes of
-the two registers, the more likely, and more loudly a pop may occur.
-To minimize this, an mbox command can be used to allow the firmware
-to perform this action, minimizing any delay between write, thus
-minimizing any pop or click as a result. The old method will remain
-when running without firmware.
-
-Acked-by: Mark Brown <broonie@kernel.org>
-Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
----
- include/sound/cs35l41.h | 5 ++-
- sound/pci/hda/cs35l41_hda.c | 9 ++--
- sound/soc/codecs/cs35l41-lib.c | 76 +++++++++++++++++++++++++++-------
- sound/soc/codecs/cs35l41.c | 8 ++--
- 4 files changed, 74 insertions(+), 24 deletions(-)
-
-diff --git a/include/sound/cs35l41.h b/include/sound/cs35l41.h
-index 7239d943942c..1bf757901d02 100644
---- a/include/sound/cs35l41.h
-+++ b/include/sound/cs35l41.h
-@@ -829,6 +829,7 @@ enum cs35l41_cspl_mbox_cmd {
- CSPL_MBOX_CMD_STOP_PRE_REINIT = 4,
- CSPL_MBOX_CMD_HIBERNATE = 5,
- CSPL_MBOX_CMD_OUT_OF_HIBERNATE = 6,
-+ CSPL_MBOX_CMD_SPK_OUT_ENABLE = 7,
- CSPL_MBOX_CMD_UNKNOWN_CMD = -1,
- CSPL_MBOX_CMD_INVALID_SEQUENCE = -2,
- };
-@@ -901,7 +902,7 @@ int cs35l41_exit_hibernate(struct device *dev, struct regmap *regmap);
- int cs35l41_init_boost(struct device *dev, struct regmap *regmap,
- struct cs35l41_hw_cfg *hw_cfg);
- bool cs35l41_safe_reset(struct regmap *regmap, enum cs35l41_boost_type b_type);
--int cs35l41_global_enable(struct regmap *regmap, enum cs35l41_boost_type b_type, int enable,
-- struct completion *pll_lock);
-+int cs35l41_global_enable(struct device *dev, struct regmap *regmap, enum cs35l41_boost_type b_type,
-+ int enable, struct completion *pll_lock, bool firmware_running);
-
- #endif /* __CS35L41_H */
-diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
-index ce5faa620517..f9c97270db6f 100644
---- a/sound/pci/hda/cs35l41_hda.c
-+++ b/sound/pci/hda/cs35l41_hda.c
-@@ -514,13 +514,15 @@ static void cs35l41_hda_playback_hook(struct device *dev, int action)
- break;
- case HDA_GEN_PCM_ACT_PREPARE:
- mutex_lock(&cs35l41->fw_mutex);
-- ret = cs35l41_global_enable(reg, cs35l41->hw_cfg.bst_type, 1, NULL);
-+ ret = cs35l41_global_enable(dev, reg, cs35l41->hw_cfg.bst_type, 1, NULL,
-+ cs35l41->firmware_running);
- mutex_unlock(&cs35l41->fw_mutex);
- break;
- case HDA_GEN_PCM_ACT_CLEANUP:
- mutex_lock(&cs35l41->fw_mutex);
- regmap_multi_reg_write(reg, cs35l41_hda_mute, ARRAY_SIZE(cs35l41_hda_mute));
-- ret = cs35l41_global_enable(reg, cs35l41->hw_cfg.bst_type, 0, NULL);
-+ ret = cs35l41_global_enable(dev, reg, cs35l41->hw_cfg.bst_type, 0, NULL,
-+ cs35l41->firmware_running);
- mutex_unlock(&cs35l41->fw_mutex);
- break;
- case HDA_GEN_PCM_ACT_CLOSE:
-@@ -672,7 +674,8 @@ static int cs35l41_runtime_suspend(struct device *dev)
- if (cs35l41->playback_started) {
- regmap_multi_reg_write(cs35l41->regmap, cs35l41_hda_mute,
- ARRAY_SIZE(cs35l41_hda_mute));
-- cs35l41_global_enable(cs35l41->regmap, cs35l41->hw_cfg.bst_type, 0, NULL);
-+ cs35l41_global_enable(cs35l41->dev, cs35l41->regmap, cs35l41->hw_cfg.bst_type, 0,
-+ NULL, cs35l41->firmware_running);
- regmap_update_bits(cs35l41->regmap, CS35L41_PWR_CTRL2,
- CS35L41_AMP_EN_MASK, 0 << CS35L41_AMP_EN_SHIFT);
- if (cs35l41->hw_cfg.bst_type == CS35L41_EXT_BOOST)
-diff --git a/sound/soc/codecs/cs35l41-lib.c b/sound/soc/codecs/cs35l41-lib.c
-index 1e4205295a0d..a7556fa33cdd 100644
---- a/sound/soc/codecs/cs35l41-lib.c
-+++ b/sound/soc/codecs/cs35l41-lib.c
-@@ -1080,28 +1080,32 @@ static const struct reg_sequence cs35l41_safe_to_reset[] = {
- { 0x00000040, 0x00000033 },
- };
-
--static const struct reg_sequence cs35l41_active_to_safe[] = {
-+static const struct reg_sequence cs35l41_active_to_safe_start[] = {
- { 0x00000040, 0x00000055 },
- { 0x00000040, 0x000000AA },
- { 0x00007438, 0x00585941 },
- { CS35L41_PWR_CTRL1, 0x00000000 },
-- { 0x0000742C, 0x00000009, 3000 },
-+ { 0x0000742C, 0x00000009 },
-+};
-+
-+static const struct reg_sequence cs35l41_active_to_safe_end[] = {
- { 0x00007438, 0x00580941 },
- { 0x00000040, 0x000000CC },
- { 0x00000040, 0x00000033 },
- };
-
--static const struct reg_sequence cs35l41_safe_to_active[] = {
-+static const struct reg_sequence cs35l41_safe_to_active_start[] = {
- { 0x00000040, 0x00000055 },
- { 0x00000040, 0x000000AA },
- { 0x0000742C, 0x0000000F },
- { 0x0000742C, 0x00000079 },
- { 0x00007438, 0x00585941 },
-- { CS35L41_PWR_CTRL1, 0x00000001, 3000 }, // GLOBAL_EN = 1
-+ { CS35L41_PWR_CTRL1, 0x00000001 }, // GLOBAL_EN = 1
-+};
-+
-+static const struct reg_sequence cs35l41_safe_to_active_en_spk[] = {
- { 0x0000742C, 0x000000F9 },
- { 0x00007438, 0x00580941 },
-- { 0x00000040, 0x000000CC },
-- { 0x00000040, 0x00000033 },
- };
-
- static const struct reg_sequence cs35l41_reset_to_safe[] = {
-@@ -1188,11 +1192,11 @@ bool cs35l41_safe_reset(struct regmap *regmap, enum cs35l41_boost_type b_type)
- }
- EXPORT_SYMBOL_GPL(cs35l41_safe_reset);
-
--int cs35l41_global_enable(struct regmap *regmap, enum cs35l41_boost_type b_type, int enable,
-- struct completion *pll_lock)
-+int cs35l41_global_enable(struct device *dev, struct regmap *regmap, enum cs35l41_boost_type b_type,
-+ int enable, struct completion *pll_lock, bool firmware_running)
- {
- int ret;
-- unsigned int gpio1_func, pad_control, pwr_ctrl1, pwr_ctrl3;
-+ unsigned int gpio1_func, pad_control, pwr_ctrl1, pwr_ctrl3, int_status;
- struct reg_sequence cs35l41_mdsync_down_seq[] = {
- {CS35L41_PWR_CTRL3, 0},
- {CS35L41_GPIO_PAD_CONTROL, 0},
-@@ -1204,6 +1208,14 @@ int cs35l41_global_enable(struct regmap *regmap, enum cs35l41_boost_type b_type,
- {CS35L41_PWR_CTRL1, 0x00000001, 3000},
- };
-
-+ if ((pwr_ctl1_val & CS35L41_GLOBAL_EN_MASK) && enable) {
-+ dev_dbg(dev, "Cannot set Global Enable - already set.\n");
-+ return 0;
-+ } else if (!(pwr_ctl1_val & CS35L41_GLOBAL_EN_MASK) && !enable) {
-+ dev_dbg(dev, "Cannot unset Global Enable - not set.\n");
-+ return 0;
-+ }
-+
- switch (b_type) {
- case CS35L41_SHD_BOOST_ACTV:
- case CS35L41_SHD_BOOST_PASS:
-@@ -1244,16 +1256,48 @@ int cs35l41_global_enable(struct regmap *regmap, enum cs35l41_boost_type b_type,
- case CS35L41_INT_BOOST:
- ret = regmap_update_bits(regmap, CS35L41_PWR_CTRL1, CS35L41_GLOBAL_EN_MASK,
- enable << CS35L41_GLOBAL_EN_SHIFT);
-+ if (ret) {
-+ dev_err(dev, "CS35L41_PWR_CTRL1 set failed: %d\n", ret);
-+ return ret;
-+ }
- usleep_range(3000, 3100);
- break;
- case CS35L41_EXT_BOOST:
- case CS35L41_EXT_BOOST_NO_VSPK_SWITCH:
-- if (enable)
-- ret = regmap_multi_reg_write(regmap, cs35l41_safe_to_active,
-- ARRAY_SIZE(cs35l41_safe_to_active));
-- else
-- ret = regmap_multi_reg_write(regmap, cs35l41_active_to_safe,
-- ARRAY_SIZE(cs35l41_active_to_safe));
-+ if (enable) {
-+ /* Test Key is unlocked here */
-+ ret = regmap_multi_reg_write(regmap, cs35l41_safe_to_active_start,
-+ ARRAY_SIZE(cs35l41_safe_to_active_start));
-+ if (ret)
-+ return ret;
-+
-+ usleep_range(3000, 3100);
-+
-+ if (firmware_running)
-+ ret = cs35l41_set_cspl_mbox_cmd(dev, regmap,
-+ CSPL_MBOX_CMD_SPK_OUT_ENABLE);
-+ else
-+ ret = regmap_multi_reg_write(regmap, cs35l41_safe_to_active_en_spk,
-+ ARRAY_SIZE(cs35l41_safe_to_active_en_spk));
-+
-+ /* Lock the test key, it was unlocked during the multi_reg_write */
-+ cs35l41_test_key_lock(dev, regmap);
-+ } else {
-+ /* Test Key is unlocked here */
-+ ret = regmap_multi_reg_write(regmap, cs35l41_active_to_safe_start,
-+ ARRAY_SIZE(cs35l41_active_to_safe_start));
-+ if (ret) {
-+ /* Lock the test key, it was unlocked during the multi_reg_write */
-+ cs35l41_test_key_lock(dev, regmap);
-+ return ret;
-+ }
-+
-+ usleep_range(3000, 3100);
-+
-+ /* Test Key is locked here */
-+ ret = regmap_multi_reg_write(regmap, cs35l41_active_to_safe_end,
-+ ARRAY_SIZE(cs35l41_active_to_safe_end));
-+ }
- break;
- default:
- ret = -EINVAL;
-@@ -1344,6 +1388,8 @@ static bool cs35l41_check_cspl_mbox_sts(enum cs35l41_cspl_mbox_cmd cmd,
- return (sts == CSPL_MBOX_STS_RUNNING);
- case CSPL_MBOX_CMD_STOP_PRE_REINIT:
- return (sts == CSPL_MBOX_STS_RDY_FOR_REINIT);
-+ case CSPL_MBOX_CMD_SPK_OUT_ENABLE:
-+ return (sts == CSPL_MBOX_STS_RUNNING);
- default:
- return false;
- }
-diff --git a/sound/soc/codecs/cs35l41.c b/sound/soc/codecs/cs35l41.c
-index 6ac501f008ec..d4e9c9d9b50a 100644
---- a/sound/soc/codecs/cs35l41.c
-+++ b/sound/soc/codecs/cs35l41.c
-@@ -500,12 +500,12 @@ static int cs35l41_main_amp_event(struct snd_soc_dapm_widget *w,
- cs35l41_pup_patch,
- ARRAY_SIZE(cs35l41_pup_patch));
-
-- cs35l41_global_enable(cs35l41->regmap, cs35l41->hw_cfg.bst_type, 1,
-- &cs35l41->pll_lock);
-+ ret = cs35l41_global_enable(cs35l41->dev, cs35l41->regmap, cs35l41->hw_cfg.bst_type,
-+ 1, &cs35l41->pll_lock, cs35l41->dsp.cs_dsp.running);
- break;
- case SND_SOC_DAPM_POST_PMD:
-- cs35l41_global_enable(cs35l41->regmap, cs35l41->hw_cfg.bst_type, 0,
-- &cs35l41->pll_lock);
-+ ret = cs35l41_global_enable(cs35l41->dev, cs35l41->regmap, cs35l41->hw_cfg.bst_type,
-+ 0, &cs35l41->pll_lock, cs35l41->dsp.cs_dsp.running);
-
- ret = regmap_read_poll_timeout(cs35l41->regmap, CS35L41_IRQ1_STATUS1,
- val, val & CS35L41_PDN_DONE_MASK,
---
-2.41.0
-
diff --git a/0001-ALSA-hda-cs35l41-Improve-support-for-ASUS-ROG-Ally.patch b/0001-ALSA-hda-cs35l41-Improve-support-for-ASUS-ROG-Ally.patch
new file mode 100644
index 000000000000..d97fc7c444b9
--- /dev/null
+++ b/0001-ALSA-hda-cs35l41-Improve-support-for-ASUS-ROG-Ally.patch
@@ -0,0 +1,64 @@
+diff --git a/sound/pci/hda/cs35l41_hda_property.c b/sound/pci/hda/cs35l41_hda_property.c
+index b39f944..b67c636 100644
+--- a/sound/pci/hda/cs35l41_hda_property.c
++++ b/sound/pci/hda/cs35l41_hda_property.c
+@@ -6,7 +6,9 @@
+ //
+ // Author: Stefan Binding <sbinding@opensource.cirrus.com>
+
++#include <linux/dmi.h>
+ #include <linux/gpio/consumer.h>
++#include <linux/kernel.h>
+ #include <linux/string.h>
+ #include "cs35l41_hda_property.h"
+
+@@ -78,6 +80,40 @@ static int asus_rog_2023_spkr_id2(struct cs35l41_hda *cs35l41, struct device *ph
+ return 0;
+ }
+
++static int asus_rog_2023_ally_fix(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
++ const char *hid)
++{
++ const char *rog_ally_bios_ver = dmi_get_system_info(DMI_BIOS_VERSION);
++ const char *rog_ally_bios_num = rog_ally_bios_ver + 6; // Dropping the RC71L. part before the number
++ int rog_ally_bios_int;
++ kstrtoint(rog_ally_bios_num, 10, &rog_ally_bios_int);
++ if(rog_ally_bios_int >= 330){
++ printk(KERN_INFO "DSD properties exist in the %d BIOS\n", rog_ally_bios_int);
++ return -ENOENT; //Patch not applicable. Exiting...
++ }
++
++ struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg;
++
++ dev_info(cs35l41->dev, "Adding DSD properties for %s\n", cs35l41->acpi_subsystem_id);
++
++ cs35l41->index = id == 0x40 ? 0 : 1;
++ cs35l41->channel_index = 0;
++ cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH);
++ cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, 0, 0, 2);
++ hw_cfg->spk_pos = cs35l41->index;
++ hw_cfg->gpio1.func = CS35L41_NOT_USED;
++ hw_cfg->gpio1.valid = true;
++ hw_cfg->gpio2.func = CS35L41_INTERRUPT;
++ hw_cfg->gpio2.valid = true;
++ hw_cfg->bst_type = CS35L41_INT_BOOST;
++ hw_cfg->bst_ind = 1000; /* 1,000nH Inductance value */
++ hw_cfg->bst_ipk = 4500; /* 4,500mA peak current */
++ hw_cfg->bst_cap = 24; /* 24 microFarad cap value */
++ hw_cfg->valid = true;
++
++ return 0;
++}
++
+ struct cs35l41_prop_model {
+ const char *hid;
+ const char *ssid;
+@@ -94,7 +130,7 @@ const struct cs35l41_prop_model cs35l41_prop_model_table[] = {
+ { "CSC3551", "10431483", asus_rog_2023_spkr_id2 }, // ASUS GU603V - spi, reset gpio 1
+ { "CSC3551", "10431493", asus_rog_2023_spkr_id2 }, // ASUS GV601V - spi, reset gpio 1
+ { "CSC3551", "10431573", asus_rog_2023_spkr_id2 }, // ASUS GZ301V - spi, reset gpio 0
+- { "CSC3551", "104317F3", asus_rog_2023_spkr_id2 }, // ASUS ROG ALLY - i2c
++ { "CSC3551", "104317F3", asus_rog_2023_ally_fix }, // ASUS ROG ALLY - i2c
+ { "CSC3551", "10431B93", asus_rog_2023_spkr_id2 }, // ASUS G614J - spi, reset gpio 0
+ { "CSC3551", "10431CAF", asus_rog_2023_spkr_id2 }, // ASUS G634J - spi, reset gpio 0
+ { "CSC3551", "10431C9F", asus_rog_2023_spkr_id2 }, // ASUS G614JI -spi, reset gpio 0
diff --git a/0001-ALSA-hda-cs35l41-Support-ASUS-2023-laptops-with-miss.patch b/0001-ALSA-hda-cs35l41-Support-ASUS-2023-laptops-with-miss.patch
index 3ab4b163498b..aaafe28c8ab7 100644
--- a/0001-ALSA-hda-cs35l41-Support-ASUS-2023-laptops-with-miss.patch
+++ b/0001-ALSA-hda-cs35l41-Support-ASUS-2023-laptops-with-miss.patch
@@ -1,8 +1,8 @@
-From d99738ad5dd159028f354c1ece9eddabd16a0ed9 Mon Sep 17 00:00:00 2001
+From 34713cb8d4e13bf9e3b1403cdea9551e0532ec5c Mon Sep 17 00:00:00 2001
From: "Luke D. Jones" <luke@ljones.dev>
Date: Wed, 23 Aug 2023 11:05:59 +1200
-Subject: [PATCH] ALSA: hda: cs35l41: Support ASUS 2023 laptops with missing
- DSD
+Subject: [PATCH v2 2/2] ALSA: hda: cs35l41: Support ASUS 2023 laptops with
+ missing DSD
Support adding the missing DSD properties required for ASUS ROG 2023
laptops and other ASUS laptops to properly utilise the cs35l41.
@@ -19,6 +19,7 @@ The currently added laptops are:
- ASUS G634J, spi
- ASUS G614JI, spi
- ASUS G713P, i2c
+- ASUS H7604JV, spi
The SPI connected amps may be required to use an external DSD patch
to fix or add the "cs-gpios" property.
@@ -28,55 +29,55 @@ Signed-off-by: Jonathan LoBue <jlobue10@gmail.com>
Co-developed-by: Luke D. Jones <luke@ljones.dev>
Signed-off-by: Luke D. Jones <luke@ljones.dev>
---
- sound/pci/hda/cs35l41_hda_property.c | 54 ++++++++++++++++++++++++++++
- 1 file changed, 54 insertions(+)
+ sound/pci/hda/cs35l41_hda_property.c | 53 ++++++++++++++++++++++++++++
+ 1 file changed, 53 insertions(+)
diff --git a/sound/pci/hda/cs35l41_hda_property.c b/sound/pci/hda/cs35l41_hda_property.c
-index 673f23257a09..2bf2365cef50 100644
+index 673f23257a09..b06e8ca5f4b4 100644
--- a/sound/pci/hda/cs35l41_hda_property.c
+++ b/sound/pci/hda/cs35l41_hda_property.c
-@@ -43,6 +43,49 @@ static int lenovo_legion_no_acpi(struct cs35l41_hda *cs35l41, struct device *phy
+--- cs35l41_hda_property.c.orig 2023-10-23 05:11:21.000000000 +0700
++++ cs35l41_hda_property.c 2023-10-25 10:09:57.694887542 +0700
+@@ -74,6 +74,47 @@ static int hp_vision_acpi_fix(struct cs3
return 0;
}
-+static int asus_rog_2023_i2c_no_acpi(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
-+ const char *hid)
-+{
-+ struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg;
-+
-+ /* check I2C address to assign the index */
-+ cs35l41->index = id == 0x40 ? 0 : 1;
-+ cs35l41->channel_index = 0;
-+ cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH);
-+ cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, 0, 0, 2);
-+ hw_cfg->spk_pos = cs35l41->index;
-+ hw_cfg->gpio2.func = CS35L41_INTERRUPT;
-+ hw_cfg->gpio2.valid = true;
-+ hw_cfg->bst_type = CS35L41_EXT_BOOST_NO_VSPK_SWITCH;
-+ hw_cfg->valid = true;
-+
-+ return 0;
-+}
-+
+/*
-+ * Some SPI connected versions may be missing a chip select GPIO and require a DSD table patch.
++ * The CSC3551 is used in almost the entire ASUS ROG laptop range in 2023, this is likely to
++ * also include many non ROG labelled laptops. It is also used with either I2C connection or
++ * SPI connection. The SPI connected versions may be missing a chip select GPIO and require
++ * an DSD table patch.
+ */
-+static int asus_rog_2023_spi_no_acpi(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
++static int asus_rog_2023_spkr_id2(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
+ const char *hid)
+{
+ struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg;
++ int reset_gpio = 0;
++ int spkr_gpio = 2;
+
-+ /* check SPI address to assign the index */
-+ cs35l41->index = id == 0 ? 0 : 1;
++ /* check SPI or I2C address to assign the index */
++ cs35l41->index = (id == 0 || id == 0x40) ? 0 : 1;
+ cs35l41->channel_index = 0;
-+ cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH);
-+ cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, 0, 0, 2);
+ hw_cfg->spk_pos = cs35l41->index;
+ hw_cfg->bst_type = CS35L41_EXT_BOOST;
+ hw_cfg->gpio1.func = CS35l41_VSPK_SWITCH;
+ hw_cfg->gpio1.valid = true;
+ hw_cfg->gpio2.func = CS35L41_INTERRUPT;
+ hw_cfg->gpio2.valid = true;
++
++ if (strcmp(cs35l41->acpi_subsystem_id, "10431483") == 0)
++ spkr_gpio = 1;
++ cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, 0, 0, spkr_gpio);
++
++ if (strcmp(cs35l41->acpi_subsystem_id, "10431463") == 0)
++ reset_gpio = 0;
++ else if (strcmp(cs35l41->acpi_subsystem_id, "10431473") == 0
++ || strcmp(cs35l41->acpi_subsystem_id, "10431483") == 0
++ || strcmp(cs35l41->acpi_subsystem_id, "10431493") == 0) {
++ reset_gpio = 1;
++ }
++ cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, reset_gpio, GPIOD_OUT_HIGH);
++
+ hw_cfg->valid = true;
+
+ return 0;
@@ -85,21 +86,22 @@ index 673f23257a09..2bf2365cef50 100644
struct cs35l41_prop_model {
const char *hid;
const char *ssid;
-@@ -53,6 +96,17 @@ struct cs35l41_prop_model {
- const struct cs35l41_prop_model cs35l41_prop_model_table[] = {
+@@ -85,6 +126,18 @@ static const struct cs35l41_prop_model c
{ "CLSA0100", NULL, lenovo_legion_no_acpi },
{ "CLSA0101", NULL, lenovo_legion_no_acpi },
-+ { "CSC3551", "10431433", asus_rog_2023_i2c_no_acpi }, // ASUS GS650P
-+ { "CSC3551", "10431463", asus_rog_2023_i2c_no_acpi }, // ASUS GA402X
-+ { "CSC3551", "10431473", asus_rog_2023_spi_no_acpi }, // ASUS GU604V
-+ { "CSC3551", "10431483", asus_rog_2023_spi_no_acpi }, // ASUS GU603V
-+ { "CSC3551", "10431493", asus_rog_2023_spi_no_acpi }, // ASUS GV601V
-+ { "CSC3551", "10431573", asus_rog_2023_spi_no_acpi }, // ASUS GZ301V
-+ { "CSC3551", "104317F3", asus_rog_2023_i2c_no_acpi }, // ASUS ROG ALLY
-+ { "CSC3551", "10431B93", asus_rog_2023_spi_no_acpi }, // ASUS G614J
-+ { "CSC3551", "10431CAF", asus_rog_2023_spi_no_acpi }, // ASUS G634J
-+ { "CSC3551", "10431C9F", asus_rog_2023_spi_no_acpi }, // ASUS G614JI
-+ { "CSC3551", "10431D1F", asus_rog_2023_i2c_no_acpi }, // ASUS G713P
+ { "CSC3551", "103C89C6", hp_vision_acpi_fix },
++ { "CSC3551", "10431433", asus_rog_2023_spkr_id2 }, // ASUS GS650P - i2c
++ { "CSC3551", "10431463", asus_rog_2023_spkr_id2 }, // ASUS GA402X/N - i2c, reset gpio 0
++ { "CSC3551", "10431473", asus_rog_2023_spkr_id2 }, // ASUS GU604V - spi, reset gpio 1
++ { "CSC3551", "10431483", asus_rog_2023_spkr_id2 }, // ASUS GU603V - spi, reset 1, spkr 1
++ { "CSC3551", "10431493", asus_rog_2023_spkr_id2 }, // ASUS GV601V - spi, reset gpio 1
++ { "CSC3551", "10431573", asus_rog_2023_spkr_id2 }, // ASUS GZ301V - spi, reset gpio 0
++ { "CSC3551", "104317F3", asus_rog_2023_spkr_id2 }, // ASUS ROG ALLY - i2c
++ { "CSC3551", "10431B93", asus_rog_2023_spkr_id2 }, // ASUS G614J - spi, reset gpio 0
++ { "CSC3551", "10431CAF", asus_rog_2023_spkr_id2 }, // ASUS G634J - spi, reset gpio 0
++ { "CSC3551", "10431C9F", asus_rog_2023_spkr_id2 }, // ASUS G614JI -spi, reset gpio 0
++ { "CSC3551", "10431D1F", asus_rog_2023_spkr_id2 }, // ASUS G713P - i2c
++ { "CSC3551", "10431F1F", asus_rog_2023_spkr_id2 }, // ASUS H7604JV - spi, reset gpio 0
{}
};
diff --git a/0001-Cirrus-no-dsdt.patch b/0001-Cirrus-no-dsdt.patch
deleted file mode 100644
index 8de56f9d3a69..000000000000
--- a/0001-Cirrus-no-dsdt.patch
+++ /dev/null
@@ -1,266 +0,0 @@
-From git@z Thu Jan 1 00:00:00 1970
-Subject: [PATCH v1] ALSA: hda: cs35l41: Support systems with missing _DSD
- properties
-From: Stefan Binding <sbinding@opensource.cirrus.com>
-Date: Tue, 15 Aug 2023 17:10:33 +0100
-Message-Id: <20230815161033.3519-1-sbinding@opensource.cirrus.com>
-MIME-Version: 1.0
-Content-Type: text/plain; charset="utf-8"
-Content-Transfer-Encoding: 7bit
-
-Some systems using CS35L41 with HDA were released without some
-required _DSD properties in ACPI. To support these special cases,
-add an api to configure the correct properties for systems with
-this issue.
-
-This initial commit moves the no _DSD support for Lenovo
-Legion Laptops (CLSA0100, CLSA0101) into a new framework which
-can be extended to support additional laptops in the future.
-
-Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
----
- sound/pci/hda/Makefile | 2 +-
- sound/pci/hda/cs35l41_hda.c | 65 ++++++-------------------
- sound/pci/hda/cs35l41_hda.h | 1 +
- sound/pci/hda/cs35l41_hda_property.c | 73 ++++++++++++++++++++++++++++
- sound/pci/hda/cs35l41_hda_property.h | 18 +++++++
- 5 files changed, 108 insertions(+), 51 deletions(-)
- create mode 100644 sound/pci/hda/cs35l41_hda_property.c
- create mode 100644 sound/pci/hda/cs35l41_hda_property.h
-
-diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile
-index c6e6509e7b8e..5506255be895 100644
---- a/sound/pci/hda/Makefile
-+++ b/sound/pci/hda/Makefile
-@@ -28,7 +28,7 @@ snd-hda-codec-via-objs := patch_via.o
- snd-hda-codec-hdmi-objs := patch_hdmi.o hda_eld.o
-
- # side codecs
--snd-hda-scodec-cs35l41-objs := cs35l41_hda.o
-+snd-hda-scodec-cs35l41-objs := cs35l41_hda.o cs35l41_hda_property.o
- snd-hda-scodec-cs35l41-i2c-objs := cs35l41_hda_i2c.o
- snd-hda-scodec-cs35l41-spi-objs := cs35l41_hda_spi.o
- snd-hda-scodec-cs35l56-objs := cs35l56_hda.o
-diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
-index 825e551be9bb..f9b77353c266 100644
---- a/sound/pci/hda/cs35l41_hda.c
-+++ b/sound/pci/hda/cs35l41_hda.c
-@@ -19,6 +19,7 @@
- #include "hda_component.h"
- #include "cs35l41_hda.h"
- #include "hda_cs_dsp_ctl.h"
-+#include "cs35l41_hda_property.h"
-
- #define CS35L41_FIRMWARE_ROOT "cirrus/"
- #define CS35L41_PART "cs35l41"
-@@ -1315,8 +1316,7 @@ static int cs35l41_hda_apply_properties(struct cs35l41_hda *cs35l41)
- return cs35l41_hda_channel_map(cs35l41->dev, 0, NULL, 1, &hw_cfg->spk_pos);
- }
-
--static int cs35l41_get_speaker_id(struct device *dev, int amp_index,
-- int num_amps, int fixed_gpio_id)
-+int cs35l41_get_speaker_id(struct device *dev, int amp_index, int num_amps, int fixed_gpio_id)
- {
- struct gpio_desc *speaker_id_desc;
- int speaker_id = -ENODEV;
-@@ -1370,49 +1370,6 @@ static int cs35l41_get_speaker_id(struct device *dev, int amp_index,
- return speaker_id;
- }
-
--/*
-- * Device CLSA010(0/1) doesn't have _DSD so a gpiod_get by the label reset won't work.
-- * And devices created by serial-multi-instantiate don't have their device struct
-- * pointing to the correct fwnode, so acpi_dev must be used here.
-- * And devm functions expect that the device requesting the resource has the correct
-- * fwnode.
-- */
--static int cs35l41_no_acpi_dsd(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
-- const char *hid)
--{
-- struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg;
--
-- /* check I2C address to assign the index */
-- cs35l41->index = id == 0x40 ? 0 : 1;
-- cs35l41->channel_index = 0;
-- cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH);
-- cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, 0, 0, 2);
-- hw_cfg->spk_pos = cs35l41->index;
-- hw_cfg->gpio2.func = CS35L41_INTERRUPT;
-- hw_cfg->gpio2.valid = true;
-- hw_cfg->valid = true;
--
-- if (strncmp(hid, "CLSA0100", 8) == 0) {
-- hw_cfg->bst_type = CS35L41_EXT_BOOST_NO_VSPK_SWITCH;
-- } else if (strncmp(hid, "CLSA0101", 8) == 0) {
-- hw_cfg->bst_type = CS35L41_EXT_BOOST;
-- hw_cfg->gpio1.func = CS35l41_VSPK_SWITCH;
-- hw_cfg->gpio1.valid = true;
-- } else {
-- /*
-- * Note: CLSA010(0/1) are special cases which use a slightly different design.
-- * All other HIDs e.g. CSC3551 require valid ACPI _DSD properties to be supported.
-- */
-- dev_err(cs35l41->dev, "Error: ACPI _DSD Properties are missing for HID %s.\n", hid);
-- hw_cfg->valid = false;
-- hw_cfg->gpio1.valid = false;
-- hw_cfg->gpio2.valid = false;
-- return -EINVAL;
-- }
--
-- return 0;
--}
--
- static int cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41, const char *hid, int id)
- {
- struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg;
-@@ -1438,12 +1395,17 @@ static int cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41, const char *hid, i
- sub = NULL;
- cs35l41->acpi_subsystem_id = sub;
-
-+ ret = cs35l41_add_dsd_properties(cs35l41, physdev, id, hid);
-+ if (!ret) {
-+ dev_info(cs35l41->dev, "Using extra _DSD properties, bypassing _DSD in ACPI\n");
-+ goto put_physdev;
-+ }
-+
- property = "cirrus,dev-index";
- ret = device_property_count_u32(physdev, property);
-- if (ret <= 0) {
-- ret = cs35l41_no_acpi_dsd(cs35l41, physdev, id, hid);
-- goto err_put_physdev;
-- }
-+ if (ret <= 0)
-+ goto err;
-+
- if (ret > ARRAY_SIZE(values)) {
- ret = -EINVAL;
- goto err;
-@@ -1533,7 +1495,10 @@ static int cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41, const char *hid, i
-
- err:
- dev_err(cs35l41->dev, "Failed property %s: %d\n", property, ret);
--err_put_physdev:
-+ hw_cfg->valid = false;
-+ hw_cfg->gpio1.valid = false;
-+ hw_cfg->gpio2.valid = false;
-+put_physdev:
- put_device(physdev);
-
- return ret;
-diff --git a/sound/pci/hda/cs35l41_hda.h b/sound/pci/hda/cs35l41_hda.h
-index bdb35f3be68a..b93bf762976e 100644
---- a/sound/pci/hda/cs35l41_hda.h
-+++ b/sound/pci/hda/cs35l41_hda.h
-@@ -83,5 +83,6 @@ extern const struct dev_pm_ops cs35l41_hda_pm_ops;
- int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int irq,
- struct regmap *regmap);
- void cs35l41_hda_remove(struct device *dev);
-+int cs35l41_get_speaker_id(struct device *dev, int amp_index, int num_amps, int fixed_gpio_id);
-
- #endif /*__CS35L41_HDA_H__*/
-diff --git a/sound/pci/hda/cs35l41_hda_property.c b/sound/pci/hda/cs35l41_hda_property.c
-new file mode 100644
-index 000000000000..673f23257a09
---- /dev/null
-+++ b/sound/pci/hda/cs35l41_hda_property.c
-@@ -0,0 +1,73 @@
-+// SPDX-License-Identifier: GPL-2.0
-+//
-+// CS35L41 ALSA HDA Property driver
-+//
-+// Copyright 2023 Cirrus Logic, Inc.
-+//
-+// Author: Stefan Binding <sbinding@opensource.cirrus.com>
-+
-+#include <linux/gpio/consumer.h>
-+#include <linux/string.h>
-+#include "cs35l41_hda_property.h"
-+
-+/*
-+ * Device CLSA010(0/1) doesn't have _DSD so a gpiod_get by the label reset won't work.
-+ * And devices created by serial-multi-instantiate don't have their device struct
-+ * pointing to the correct fwnode, so acpi_dev must be used here.
-+ * And devm functions expect that the device requesting the resource has the correct
-+ * fwnode.
-+ */
-+static int lenovo_legion_no_acpi(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
-+ const char *hid)
-+{
-+ struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg;
-+
-+ /* check I2C address to assign the index */
-+ cs35l41->index = id == 0x40 ? 0 : 1;
-+ cs35l41->channel_index = 0;
-+ cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH);
-+ cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, 0, 0, 2);
-+ hw_cfg->spk_pos = cs35l41->index;
-+ hw_cfg->gpio2.func = CS35L41_INTERRUPT;
-+ hw_cfg->gpio2.valid = true;
-+ hw_cfg->valid = true;
-+
-+ if (strcmp(hid, "CLSA0100") == 0) {
-+ hw_cfg->bst_type = CS35L41_EXT_BOOST_NO_VSPK_SWITCH;
-+ } else if (strcmp(hid, "CLSA0101") == 0) {
-+ hw_cfg->bst_type = CS35L41_EXT_BOOST;
-+ hw_cfg->gpio1.func = CS35l41_VSPK_SWITCH;
-+ hw_cfg->gpio1.valid = true;
-+ }
-+
-+ return 0;
-+}
-+
-+struct cs35l41_prop_model {
-+ const char *hid;
-+ const char *ssid;
-+ int (*add_prop)(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
-+ const char *hid);
-+};
-+
-+const struct cs35l41_prop_model cs35l41_prop_model_table[] = {
-+ { "CLSA0100", NULL, lenovo_legion_no_acpi },
-+ { "CLSA0101", NULL, lenovo_legion_no_acpi },
-+ {}
-+};
-+
-+int cs35l41_add_dsd_properties(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
-+ const char *hid)
-+{
-+ const struct cs35l41_prop_model *model;
-+
-+ for (model = cs35l41_prop_model_table; model->hid > 0; model++) {
-+ if (!strcmp(model->hid, hid) &&
-+ (!model->ssid ||
-+ (cs35l41->acpi_subsystem_id &&
-+ !strcmp(model->ssid, cs35l41->acpi_subsystem_id))))
-+ return model->add_prop(cs35l41, physdev, id, hid);
-+ }
-+
-+ return -ENOENT;
-+}
-diff --git a/sound/pci/hda/cs35l41_hda_property.h b/sound/pci/hda/cs35l41_hda_property.h
-new file mode 100644
-index 000000000000..fd834042e2fd
---- /dev/null
-+++ b/sound/pci/hda/cs35l41_hda_property.h
-@@ -0,0 +1,18 @@
-+/* SPDX-License-Identifier: GPL-2.0
-+ *
-+ * CS35L41 ALSA HDA Property driver
-+ *
-+ * Copyright 2023 Cirrus Logic, Inc.
-+ *
-+ * Author: Stefan Binding <sbinding@opensource.cirrus.com>
-+ */
-+
-+#ifndef CS35L41_HDA_PROP_H
-+#define CS35L41_HDA_PROP_H
-+
-+#include <linux/device.h>
-+#include "cs35l41_hda.h"
-+
-+int cs35l41_add_dsd_properties(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
-+ const char *hid);
-+#endif /* CS35L41_HDA_PROP_H */
---
-2.34.1
-
diff --git a/0001-GPU-reset.patch b/0001-GPU-reset.patch
deleted file mode 100644
index 32651f44f5e2..000000000000
--- a/0001-GPU-reset.patch
+++ /dev/null
@@ -1,257 +0,0 @@
-From 69dfc1d574d2faddf770a40cf5d1f9715da33fd2 Mon Sep 17 00:00:00 2001
-From: Shashank Sharma <shashank.sharma@amd.com>
-Date: Mon, 7 Mar 2022 12:32:49 +0100
-Subject: [PATCH 1/3] drm: Add GPU reset sysfs event
-
-This patch adds a new sysfs event, which will indicate
-the userland about a GPU reset, and can also provide
-some information like:
-- process ID of the process involved with the GPU reset
-- process name of the involved process
-- the GPU status info (using flags)
-
-This patch also introduces the first flag of the flags
-bitmap, which can be appended as and when required.
-
-V2: Addressed review comments from Christian and Amar
- - move the reset information structure to DRM layer
- - drop _ctx from struct name
- - make pid 32 bit(than 64)
- - set flag when VRAM invalid (than valid)
- - add process name as well (Amar)
-
-Cc: Alexandar Deucher <alexander.deucher@amd.com>
-Cc: Christian Koenig <christian.koenig@amd.com>
-Cc: Amaranath Somalapuram <amaranath.somalapuram@amd.com>
-Signed-off-by: Shashank Sharma <shashank.sharma@amd.com>
-(cherry picked from commit 90230bd9d9c7d979038547460c9a2cbbeff8d6b9)
-[Forward port to 6.0]
-Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
----
- drivers/gpu/drm/drm_sysfs.c | 31 +++++++++++++++++++++++++++++++
- include/drm/drm_sysfs.h | 10 ++++++++++
- 2 files changed, 41 insertions(+)
-
-diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
-index 430e00b16eeca..4cf1b9b40e707 100644
---- a/drivers/gpu/drm/drm_sysfs.c
-+++ b/drivers/gpu/drm/drm_sysfs.c
-@@ -434,6 +434,37 @@ void drm_sysfs_connector_hotplug_event(struct drm_connector *connector)
- }
- EXPORT_SYMBOL(drm_sysfs_connector_hotplug_event);
-
-+/**
-+ * drm_sysfs_reset_event - generate a DRM uevent to indicate GPU reset
-+ * @dev: DRM device
-+ * @reset_info: The contextual information about the reset (like PID, flags)
-+ *
-+ * Send a uevent for the DRM device specified by @dev. This informs
-+ * user that a GPU reset has occurred, so that an interested client
-+ * can take any recovery or profiling measure.
-+ */
-+void drm_sysfs_reset_event(struct drm_device *dev, struct drm_reset_event *reset_info)
-+{
-+ unsigned char pid_str[13];
-+ unsigned char flags_str[15];
-+ unsigned char pname_str[TASK_COMM_LEN + 6];
-+ unsigned char reset_str[] = "RESET=1";
-+ char *envp[] = { reset_str, pid_str, pname_str, flags_str, NULL };
-+
-+ if (!reset_info) {
-+ DRM_WARN("No reset info, not sending the event\n");
-+ return;
-+ }
-+
-+ DRM_DEBUG("generating reset event\n");
-+
-+ snprintf(pid_str, ARRAY_SIZE(pid_str), "PID=%u", reset_info->pid);
-+ snprintf(pname_str, ARRAY_SIZE(pname_str), "NAME=%s", reset_info->pname);
-+ snprintf(flags_str, ARRAY_SIZE(flags_str), "FLAGS=%u", reset_info->flags);
-+ kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp);
-+}
-+EXPORT_SYMBOL(drm_sysfs_reset_event);
-+
- /**
- * drm_sysfs_connector_status_event - generate a DRM uevent for connector
- * property status change
-diff --git a/include/drm/drm_sysfs.h b/include/drm/drm_sysfs.h
-index 6273cac44e479..8c37d6a529328 100644
---- a/include/drm/drm_sysfs.h
-+++ b/include/drm/drm_sysfs.h
-@@ -1,17 +1,27 @@
- /* SPDX-License-Identifier: GPL-2.0 */
- #ifndef _DRM_SYSFS_H_
- #define _DRM_SYSFS_H_
-+#include <linux/sched.h>
-+
-+#define DRM_GPU_RESET_FLAG_VRAM_INVALID (1 << 0)
-
- struct drm_device;
- struct device;
- struct drm_connector;
- struct drm_property;
-
-+struct drm_reset_event {
-+ uint32_t pid;
-+ uint32_t flags;
-+ char pname[TASK_COMM_LEN];
-+};
-+
- int drm_class_device_register(struct device *dev);
- void drm_class_device_unregister(struct device *dev);
-
- void drm_sysfs_hotplug_event(struct drm_device *dev);
- void drm_sysfs_connector_hotplug_event(struct drm_connector *connector);
-+void drm_sysfs_reset_event(struct drm_device *dev, struct drm_reset_event *reset_info);
- void drm_sysfs_connector_status_event(struct drm_connector *connector,
- struct drm_property *property);
- #endif
---
-2.41.0
-
-
-From b717d62ae484fe8fc2f87478960e95cad838f574 Mon Sep 17 00:00:00 2001
-From: Shashank Sharma <shashank.sharma@amd.com>
-Date: Mon, 7 Mar 2022 15:33:00 +0100
-Subject: [PATCH 2/3] drm/amdgpu: add work function for GPU reset event
-
-This patch adds a work function, which sends a GPU reset
-uevent and some contextual infomration, like the PID and
-some status flags. This work should be scheduled during
-a GPU reset.
-
-The userspace can do some recovery and post-processing work
-based on this event and information.
-
-V2: Addressed review comments from Christian
-- Changed the name of the work to gpu_reset_event_work
-- Added a structure to accommodate some additional information
- (like a PID and some flags)
-- Do not add new structure in amdgpu.h
-
-Cc: Alexander Deucher <alexander.deucher@amd.com>
-Cc: Christian Koenig <christian.koenig@amd.com>
-Cc: Amaranath Somalapuram <amaranath.somalapuram@amd.com>
-Signed-off-by: Shashank Sharma <shashank.sharma@amd.com>
-(cherry picked from commit f63b09e78126f7da67b69409e2cce1d3ab2d7f46)
-[Forward port to 6.0]
-Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
----
- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 +++
- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 13 +++++++++++++
- 2 files changed, 16 insertions(+)
-
-diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
-index 2eca58220550e..5c376f7f51f4f 100644
---- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
-+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
-@@ -60,6 +60,7 @@
- #include <drm/amdgpu_drm.h>
- #include <drm/drm_gem.h>
- #include <drm/drm_ioctl.h>
-+#include <drm/drm_sysfs.h>
-
- #include <kgd_kfd_interface.h>
- #include "dm_pp_interface.h"
-@@ -1002,6 +1003,7 @@ struct amdgpu_device {
-
- int asic_reset_res;
- struct work_struct xgmi_reset_work;
-+ struct work_struct gpu_reset_event_work;
- struct list_head reset_list;
-
- long gfx_timeout;
-@@ -1035,6 +1037,7 @@ struct amdgpu_device {
- pci_channel_state_t pci_channel_state;
-
- struct amdgpu_reset_control *reset_cntl;
-+ struct drm_reset_event reset_event_info;
- uint32_t ip_versions[MAX_HWIP][HWIP_MAX_INSTANCE];
-
- bool ram_is_direct_mapped;
-diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
-index f1e9663b40510..08aa72743dfce 100644
---- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
-+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
-@@ -76,6 +76,7 @@
- #include <linux/pm_runtime.h>
-
- #include <drm/drm_drv.h>
-+#include <drm/drm_sysfs.h>
-
- MODULE_FIRMWARE("amdgpu/vega10_gpu_info.bin");
- MODULE_FIRMWARE("amdgpu/vega12_gpu_info.bin");
-@@ -3355,6 +3356,17 @@ bool amdgpu_device_has_dc_support(struct amdgpu_device *adev)
- return amdgpu_device_asic_has_dc_support(adev->asic_type);
- }
-
-+static void amdgpu_device_reset_event_func(struct work_struct *__work)
-+{
-+ struct amdgpu_device *adev = container_of(__work, struct amdgpu_device,
-+ gpu_reset_event_work);
-+ /*
-+ * A GPU reset has happened, inform the userspace and pass the
-+ * reset related information.
-+ */
-+ drm_sysfs_reset_event(&adev->ddev, &adev->reset_event_info);
-+}
-+
- static void amdgpu_device_xgmi_reset_func(struct work_struct *__work)
- {
- struct amdgpu_device *adev =
-@@ -3606,6 +3618,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
- amdgpu_device_delay_enable_gfx_off);
-
- INIT_WORK(&adev->xgmi_reset_work, amdgpu_device_xgmi_reset_func);
-+ INIT_WORK(&adev->gpu_reset_event_work, amdgpu_device_reset_event_func);
-
- adev->gfx.gfx_off_req_count = 1;
- adev->gfx.gfx_off_residency = 0;
---
-2.41.0
-
-
-From b65228799e5ac96211b0e4c342d0a4478a1b6410 Mon Sep 17 00:00:00 2001
-From: Somalapuram Amaranath <Amaranath.Somalapuram@amd.com>
-Date: Thu, 10 Mar 2022 11:31:44 +0530
-Subject: [PATCH 3/3] drm/amdgpu: schedule GPU reset event work function
-
-Schedule work function with valid PID, process name,
-and vram lost status during a GPU reset/ recovery.
-
-Signed-off-by: Somalapuram Amaranath <Amaranath.Somalapuram@amd.com>
-(cherry picked from commit 293c019a84c6402b08db9579819b555b01cd613b)
-[Forward ported to 6.0]
-Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
----
- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 14 ++++++++++++++
- 1 file changed, 14 insertions(+)
-
-diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
-index 08aa72743dfce..47ff7a56c6848 100644
---- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
-+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
-@@ -4924,6 +4924,20 @@ int amdgpu_do_asic_reset(struct list_head *device_list_handle,
- reset_context->job->vm->task_info;
- amdgpu_reset_capture_coredumpm(tmp_adev);
- #endif
-+ if (reset_context->job && reset_context->job->vm) {
-+ tmp_adev->reset_event_info.pid =
-+ reset_context->job->vm->task_info.pid;
-+ memset(tmp_adev->reset_event_info.pname, 0, TASK_COMM_LEN);
-+ strcpy(tmp_adev->reset_event_info.pname,
-+ reset_context->job->vm->task_info.process_name);
-+ } else {
-+ tmp_adev->reset_event_info.pid = 0;
-+ memset(tmp_adev->reset_event_info.pname, 0, TASK_COMM_LEN);
-+ }
-+
-+ tmp_adev->reset_event_info.flags = vram_lost;
-+ schedule_work(&tmp_adev->gpu_reset_event_work);
-+
- if (vram_lost) {
- DRM_INFO("VRAM is lost due to GPU reset!\n");
- amdgpu_inc_vram_lost(tmp_adev);
---
-2.41.0
-
diff --git a/0001-HID.patch b/0001-HID.patch
index eab0dd5e61b8..e2efea6d660e 100644
--- a/0001-HID.patch
+++ b/0001-HID.patch
@@ -1,7 +1,7 @@
-From b899859fe49cccda9e8739d29d883dbd6dd057f3 Mon Sep 17 00:00:00 2001
+From a9ccf84a04fc85556161640c5031735dce06c661 Mon Sep 17 00:00:00 2001
From: Vicki Pfau <vi@endrift.com>
Date: Thu, 30 Jun 2022 18:42:10 -0700
-Subject: [PATCH 01/10] USB: gadget: f_hid: Add Get-Feature report
+Subject: [PATCH 1/7] USB: gadget: f_hid: Add Get-Feature report
While the HID gadget implementation has been sufficient for devices that only
use INTERRUPT transfers, the USB HID standard includes provisions for Set- and
@@ -25,7 +25,7 @@ Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
create mode 100644 include/uapi/linux/usb/g_hid.h
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
-index ea85e2c701a15..6fec92b5a0bd9 100644
+index ea85e2c701a15f..6fec92b5a0bd99 100644
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -16,6 +16,7 @@
@@ -239,7 +239,7 @@ index ea85e2c701a15..6fec92b5a0bd9 100644
diff --git a/include/uapi/linux/usb/g_hid.h b/include/uapi/linux/usb/g_hid.h
new file mode 100644
-index 0000000000000..c6068b4863543
+index 00000000000000..c6068b4863543f
--- /dev/null
+++ b/include/uapi/linux/usb/g_hid.h
@@ -0,0 +1,38 @@
@@ -282,7 +282,7 @@ index 0000000000000..c6068b4863543
+
+#endif /* __UAPI_LINUX_USB_G_HID_H */
diff --git a/include/uapi/linux/usb/gadgetfs.h b/include/uapi/linux/usb/gadgetfs.h
-index 835473910a498..9754822b2a409 100644
+index 835473910a4980..9754822b2a409e 100644
--- a/include/uapi/linux/usb/gadgetfs.h
+++ b/include/uapi/linux/usb/gadgetfs.h
@@ -62,7 +62,7 @@ struct usb_gadgetfs_event {
@@ -294,14 +294,11 @@ index 835473910a498..9754822b2a409 100644
* Don't add any colliding codes to either driver, and keep
* them in unique ranges (size 0x20 for now).
*/
---
-2.41.0
-
-From 20ebaf7b44ff03078cf53e43306d6c5a3d0613e6 Mon Sep 17 00:00:00 2001
+From d53013c39bab99518664ac507f01423606eac4e7 Mon Sep 17 00:00:00 2001
From: Vicki Pfau <vi@endrift.com>
Date: Thu, 30 Jun 2022 18:43:10 -0700
-Subject: [PATCH 02/10] USB: gadget: f_hid: Add Set-Feature report
+Subject: [PATCH 2/7] USB: gadget: f_hid: Add Set-Feature report
While the HID gadget implementation has been sufficient for devices that only
use INTERRUPT transfers, the USB HID standard includes provisions for Set- and
@@ -323,7 +320,7 @@ Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
2 files changed, 106 insertions(+), 28 deletions(-)
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
-index 6fec92b5a0bd9..172cba91aded1 100644
+index 6fec92b5a0bd99..172cba91aded11 100644
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -76,6 +76,11 @@ struct f_hidg {
@@ -514,7 +511,7 @@ index 6fec92b5a0bd9..172cba91aded1 100644
/* create char device */
cdev_init(&hidg->cdev, &f_hidg_fops);
diff --git a/include/uapi/linux/usb/g_hid.h b/include/uapi/linux/usb/g_hid.h
-index c6068b4863543..54814c2c68d60 100644
+index c6068b4863543f..54814c2c68d608 100644
--- a/include/uapi/linux/usb/g_hid.h
+++ b/include/uapi/linux/usb/g_hid.h
@@ -1,38 +1,22 @@
@@ -560,14 +557,11 @@ index c6068b4863543..54814c2c68d60 100644
#define GADGET_HID_WRITE_GET_REPORT _IOW('g', 0x42, struct usb_hidg_report)
#endif /* __UAPI_LINUX_USB_G_HID_H */
---
-2.41.0
-
-From 146e98d6f595e3a4e6c09a00ee9ec2d48a6703cb Mon Sep 17 00:00:00 2001
+From 4265c89f5f389b39d229c5e849d8bdba3aa5a044 Mon Sep 17 00:00:00 2001
From: Vicki Pfau <vi@endrift.com>
Date: Tue, 29 Nov 2022 18:32:58 -0800
-Subject: [PATCH 03/10] HID: hid-steam: Update list of identifiers from SDL
+Subject: [PATCH 3/7] HID: hid-steam: Update list of identifiers from SDL
SDL includes a list of settings (registers), reports (cmds), and various other
identifiers that were provided by Valve. This commit imports a significant
@@ -581,7 +575,7 @@ Signed-off-by: Vicki Pfau <vi@endrift.com>
1 file changed, 121 insertions(+), 35 deletions(-)
diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c
-index b110818fc9458..39a9bf3b7f77d 100644
+index b110818fc94586..39a9bf3b7f77d8 100644
--- a/drivers/hid/hid-steam.c
+++ b/drivers/hid/hid-steam.c
@@ -71,7 +71,7 @@ static LIST_HEAD(steam_devices);
@@ -827,14 +821,11 @@ index b110818fc9458..39a9bf3b7f77d 100644
0);
schedule_delayed_work(&steam->heartbeat, 5 * HZ);
}
---
-2.41.0
-
-From 4b1dd1ebfd2d3f123212e1296d304909e5b3a406 Mon Sep 17 00:00:00 2001
+From 7b2d90f93687de4bbc49fd9dc0d002308ad35fd3 Mon Sep 17 00:00:00 2001
From: Vicki Pfau <vi@endrift.com>
Date: Wed, 16 Nov 2022 19:54:26 -0800
-Subject: [PATCH 04/10] HID: hid-steam: Add gamepad-only mode switched to by
+Subject: [PATCH 4/7] HID: hid-steam: Add gamepad-only mode switched to by
holding options
Signed-off-by: Vicki Pfau <vi@endrift.com>
@@ -843,7 +834,7 @@ Signed-off-by: Vicki Pfau <vi@endrift.com>
1 file changed, 72 insertions(+)
diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c
-index 39a9bf3b7f77d..0620046b142ef 100644
+index 39a9bf3b7f77d8..0620046b142ef5 100644
--- a/drivers/hid/hid-steam.c
+++ b/drivers/hid/hid-steam.c
@@ -202,6 +202,11 @@ static LIST_HEAD(steam_devices);
@@ -981,14 +972,11 @@ index 39a9bf3b7f77d..0620046b142ef 100644
}
/*
---
-2.41.0
-
-From 187582492c359d56865759f120214cfe6fa4ed50 Mon Sep 17 00:00:00 2001
+From 295c78a31c4ef285272fe5f00a88b8c5c3e0fd91 Mon Sep 17 00:00:00 2001
From: Vicki Pfau <vi@endrift.com>
Date: Mon, 8 May 2023 20:24:56 -0700
-Subject: [PATCH 05/10] HID: hid-steam: Clean up locking
+Subject: [PATCH 5/7] HID: hid-steam: Clean up locking
This cleans up the locking logic so that the spinlock is consistently used for
access to a small handful of struct variables, and the mutex is exclusively and
@@ -1003,7 +991,7 @@ Signed-off-by: Vicki Pfau <vi@endrift.com>
1 file changed, 90 insertions(+), 58 deletions(-)
diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c
-index 0620046b142ef..845ca71b8bd3a 100644
+index 0620046b142ef5..845ca71b8bd3ab 100644
--- a/drivers/hid/hid-steam.c
+++ b/drivers/hid/hid-steam.c
@@ -214,7 +214,7 @@ struct steam_device {
@@ -1388,14 +1376,11 @@ index 0620046b142ef..845ca71b8bd3a 100644
}
mutex_unlock(&steam_devices_lock);
return 0;
---
-2.41.0
-
-From d4490c88bed06b4c18af4a6029d67374df5218e1 Mon Sep 17 00:00:00 2001
+From 2112ff750681f512405c95b0fb111fb1421b8d5b Mon Sep 17 00:00:00 2001
From: Vicki Pfau <vi@endrift.com>
Date: Wed, 10 May 2023 17:27:12 -0700
-Subject: [PATCH 06/10] HID: hid-steam: Make client_opened a counter
+Subject: [PATCH 6/7] HID: hid-steam: Make client_opened a counter
The client_opened variable was used to track if the hidraw was opened by any
clients to silence keyboard/mouse events while opened. However, there was no
@@ -1409,7 +1394,7 @@ Signed-off-by: Vicki Pfau <vi@endrift.com>
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c
-index 845ca71b8bd3a..0c2fe51b29bc1 100644
+index 845ca71b8bd3ab..0c2fe51b29bc10 100644
--- a/drivers/hid/hid-steam.c
+++ b/drivers/hid/hid-steam.c
@@ -215,7 +215,7 @@ struct steam_device {
@@ -1457,14 +1442,11 @@ index 845ca71b8bd3a..0c2fe51b29bc1 100644
if (steam->quirks & STEAM_QUIRK_WIRELESS) {
hid_info(hdev, "Steam wireless receiver disconnected");
}
---
-2.41.0
-
-From 58a8667b251984ecc85a503c5dec3fc8f98028ff Mon Sep 17 00:00:00 2001
+From 5ebbce0dd01a1682a64b211f00f1b82c5535eca2 Mon Sep 17 00:00:00 2001
From: Vicki Pfau <vi@endrift.com>
Date: Thu, 18 May 2023 18:00:35 -0700
-Subject: [PATCH 07/10] HID: hid-steam: Better handling of serial number length
+Subject: [PATCH 7/7] HID: hid-steam: Better handling of serial number length
The second byte of the GET_STRING_ATTRIB report is a length, so we should set
the size of the buffer to be the size we're actually requesting, and only
@@ -1476,7 +1458,7 @@ Signed-off-by: Vicki Pfau <vi@endrift.com>
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c
-index 0c2fe51b29bc1..92e3e1052fa42 100644
+index 0c2fe51b29bc10..92e3e1052fa423 100644
--- a/drivers/hid/hid-steam.c
+++ b/drivers/hid/hid-steam.c
@@ -208,7 +208,7 @@ static LIST_HEAD(steam_devices);
@@ -1516,138 +1498,3 @@ index 0c2fe51b29bc1..92e3e1052fa42 100644
out:
mutex_unlock(&steam->report_mutex);
return ret;
---
-2.41.0
-
-
-From 7460867bd78651a6187ac44c73d1be653c09973b Mon Sep 17 00:00:00 2001
-From: Vicki Pfau <vi@endrift.com>
-Date: Fri, 24 Mar 2023 10:42:27 -0700
-Subject: [PATCH 08/10] Input: xpad - fix support for some third-party
- controllers
-
-Some third-party controllers, such as the HORPIAD FPS for Nintendo Switch and
-Gamesir-G3w, require a specific packet that the first-party XInput driver sends
-before it will start sending reports. It's not currently known what this packet
-does, but since the first-party driver always sends it's unlikely that this
-could cause issues with existing controllers.
-
-Co-authored-by: Andrey Smirnov <andrew.smirnov@gmail.com>
-Signed-off-by: Vicki Pfau <vi@endrift.com>
-Link: https://lore.kernel.org/r/20230324040446.3487725-3-vi@endrift.com
-Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
----
- drivers/input/joystick/xpad.c | 22 ++++++++++++++++++++++
- 1 file changed, 22 insertions(+)
-
-diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
-index cdb193317c3b6..fc680b45f936e 100644
---- a/drivers/input/joystick/xpad.c
-+++ b/drivers/input/joystick/xpad.c
-@@ -264,6 +264,7 @@ static const struct xpad_device {
- { 0x0f0d, 0x0067, "HORIPAD ONE", 0, XTYPE_XBOXONE },
- { 0x0f0d, 0x0078, "Hori Real Arcade Pro V Kai Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
- { 0x0f0d, 0x00c5, "Hori Fighting Commander ONE", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
-+ { 0x0f0d, 0x00dc, "HORIPAD FPS for Nintendo Switch", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
- { 0x0f30, 0x010b, "Philips Recoil", 0, XTYPE_XBOX },
- { 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX },
- { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX },
-@@ -1720,6 +1721,27 @@ static int xpad_start_input(struct usb_xpad *xpad)
- return error;
- }
- }
-+ if (xpad->xtype == XTYPE_XBOX360) {
-+ /*
-+ * Some third-party controllers Xbox 360-style controllers
-+ * require this message to finish initialization.
-+ */
-+ u8 dummy[20];
-+
-+ error = usb_control_msg_recv(xpad->udev, 0,
-+ /* bRequest */ 0x01,
-+ /* bmRequestType */
-+ USB_TYPE_VENDOR | USB_DIR_IN |
-+ USB_RECIP_INTERFACE,
-+ /* wValue */ 0x100,
-+ /* wIndex */ 0x00,
-+ dummy, sizeof(dummy),
-+ 25, GFP_KERNEL);
-+ if (error)
-+ dev_warn(&xpad->dev->dev,
-+ "unable to receive magic message: %d\n",
-+ error);
-+ }
-
- return 0;
- }
---
-2.41.0
-
-
-From 469ab7efd0383f60e83c086347526273ed1d1a33 Mon Sep 17 00:00:00 2001
-From: Timothee Besset <ttimo@valvesoftware.com>
-Date: Mon, 22 May 2023 20:25:57 -0500
-Subject: [PATCH 09/10] Input: xpad - Add GameSir VID for Xbox One controllers
-
-Co-authored-by: Sam Lantinga <saml@valvesoftware.com>
-Signed-off-by: Sam Lantinga <slouken@libsdl.org>
-Signed-off-by: Vicki Pfau <vi@endrift.com>
----
- drivers/input/joystick/xpad.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
-index fc680b45f936e..bb2f69faa2a81 100644
---- a/drivers/input/joystick/xpad.c
-+++ b/drivers/input/joystick/xpad.c
-@@ -500,6 +500,7 @@ static const struct usb_device_id xpad_table[] = {
- XPAD_XBOX360_VENDOR(0x2f24), /* GameSir controllers */
- XPAD_XBOX360_VENDOR(0x31e3), /* Wooting Keyboards */
- XPAD_XBOX360_VENDOR(0x3285), /* Nacon GC-100 */
-+ XPAD_XBOXONE_VENDOR(0x3537), /* GameSir Controllers */
- { }
- };
-
---
-2.41.0
-
-
-From 4fd74c574f8554056facabd4e36e5e397f2e6b98 Mon Sep 17 00:00:00 2001
-From: Jonathan Frederick <doublej472@gmail.com>
-Date: Fri, 7 Jul 2023 15:11:33 -0700
-Subject: [PATCH 10/10] Input: xpad - add GameSir T4 Kaleid Controller support
-
-Add VID and PID to the xpad_device table to allow driver
-to use the GameSir T4 Kaleid Controller, which is
-XTYPE_XBOX360 compatible in xinput mode.
-
-Signed-off-by: Jonathan Frederick <doublej472@gmail.com>
-Link: https://lore.kernel.org/r/ZKeKSbP3faIPv5jB@dbj-hp-flip
-Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
----
- drivers/input/joystick/xpad.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
-index bb2f69faa2a81..ede380551e55c 100644
---- a/drivers/input/joystick/xpad.c
-+++ b/drivers/input/joystick/xpad.c
-@@ -366,6 +366,7 @@ static const struct xpad_device {
- { 0x31e3, 0x1300, "Wooting 60HE (AVR)", 0, XTYPE_XBOX360 },
- { 0x31e3, 0x1310, "Wooting 60HE (ARM)", 0, XTYPE_XBOX360 },
- { 0x3285, 0x0607, "Nacon GC-100", 0, XTYPE_XBOX360 },
-+ { 0x3537, 0x1004, "GameSir T4 Kaleid", 0, XTYPE_XBOX360 },
- { 0x3767, 0x0101, "Fanatec Speedster 3 Forceshock Wheel", 0, XTYPE_XBOX },
- { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX },
- { 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN }
-@@ -500,6 +501,7 @@ static const struct usb_device_id xpad_table[] = {
- XPAD_XBOX360_VENDOR(0x2f24), /* GameSir controllers */
- XPAD_XBOX360_VENDOR(0x31e3), /* Wooting Keyboards */
- XPAD_XBOX360_VENDOR(0x3285), /* Nacon GC-100 */
-+ XPAD_XBOX360_VENDOR(0x3537), /* GameSir Controllers */
- XPAD_XBOXONE_VENDOR(0x3537), /* GameSir Controllers */
- { }
- };
---
-2.41.0
-
diff --git a/0001-hid-asus-reset-the-backlight-brightness-level-on-resume.patch b/0001-hid-asus-reset-the-backlight-brightness-level-on-resume.patch
new file mode 100644
index 000000000000..59698ca0f7cc
--- /dev/null
+++ b/0001-hid-asus-reset-the-backlight-brightness-level-on-resume.patch
@@ -0,0 +1,59 @@
+From ca054bb924b349c586d783e4473c4cab404c40a1 Mon Sep 17 00:00:00 2001
+From: Denis Benato <benato.denis96@gmail.com>
+Date: Fri, 17 Nov 2023 14:15:56 +1300
+Subject: [PATCH] HID: hid-asus: reset the backlight brightness level on resume
+
+Some devices managed by this driver automatically set brightness to 0
+before entering a suspended state and reset it back to a default
+brightness level after the resume:
+this has the effect of having the kernel report wrong brightness
+status after a sleep, and on some devices (like the Asus RC71L) that
+brightness is the intensity of LEDs directly facing the user.
+
+Fix the above issue by setting back brightness to the level it had
+before entering a sleep state.
+
+Signed-off-by: Denis Benato <benato.denis96@gmail.com>
+Signed-off-by: Luke D. Jones <luke@ljones.dev>
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+---
+ drivers/hid/hid-asus.c | 19 +++++++++++++++++++
+ 1 file changed, 19 insertions(+)
+
+diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
+index b70673a929a1ed..78cdfb8b9a7aeb 100644
+--- a/drivers/hid/hid-asus.c
++++ b/drivers/hid/hid-asus.c
+@@ -1000,6 +1000,24 @@ static int asus_start_multitouch(struct hid_device *hdev)
+ return 0;
+ }
+
++static int __maybe_unused asus_resume(struct hid_device *hdev) {
++ struct asus_drvdata *drvdata = hid_get_drvdata(hdev);
++ int ret = 0;
++
++ if (drvdata->kbd_backlight) {
++ const u8 buf[] = { FEATURE_KBD_REPORT_ID, 0xba, 0xc5, 0xc4,
++ drvdata->kbd_backlight->cdev.brightness };
++ ret = asus_kbd_set_report(hdev, buf, sizeof(buf));
++ if (ret < 0) {
++ hid_err(hdev, "Asus failed to set keyboard backlight: %d\n", ret);
++ goto asus_resume_err;
++ }
++ }
++
++asus_resume_err:
++ return ret;
++}
++
+ static int __maybe_unused asus_reset_resume(struct hid_device *hdev)
+ {
+ struct asus_drvdata *drvdata = hid_get_drvdata(hdev);
+@@ -1294,6 +1312,7 @@ static struct hid_driver asus_driver = {
+ .input_configured = asus_input_configured,
+ #ifdef CONFIG_PM
+ .reset_resume = asus_reset_resume,
++ .resume = asus_resume,
+ #endif
+ .event = asus_event,
+ .raw_event = asus_raw_event
diff --git a/0002-ALSA-cs35l41-Poll-for-Power-Up-Down-rather-than-wait.patch b/0002-ALSA-cs35l41-Poll-for-Power-Up-Down-rather-than-wait.patch
deleted file mode 100644
index 396384f9a457..000000000000
--- a/0002-ALSA-cs35l41-Poll-for-Power-Up-Down-rather-than-wait.patch
+++ /dev/null
@@ -1,141 +0,0 @@
-From 437f5415c5ac8e49b0675f74132b6e1308b6e5c7 Mon Sep 17 00:00:00 2001
-From: Stefan Binding <sbinding@opensource.cirrus.com>
-Date: Fri, 21 Jul 2023 16:18:07 +0100
-Subject: [PATCH 02/11] ALSA: cs35l41: Poll for Power Up/Down rather than
- waiting a fixed delay
-
-To ensure the chip has correctly powered up or down before continuing,
-the driver will now poll a register, rather than wait a fixed delay.
-
-Acked-by: Mark Brown <broonie@kernel.org>
-Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
----
- sound/soc/codecs/cs35l41-lib.c | 48 +++++++++++++++++++++++++++++++---
- sound/soc/codecs/cs35l41.c | 10 -------
- 2 files changed, 44 insertions(+), 14 deletions(-)
-
-diff --git a/sound/soc/codecs/cs35l41-lib.c b/sound/soc/codecs/cs35l41-lib.c
-index a7556fa33cdd..a9c559a676e7 100644
---- a/sound/soc/codecs/cs35l41-lib.c
-+++ b/sound/soc/codecs/cs35l41-lib.c
-@@ -1196,7 +1196,8 @@ int cs35l41_global_enable(struct device *dev, struct regmap *regmap, enum cs35l4
- int enable, struct completion *pll_lock, bool firmware_running)
- {
- int ret;
-- unsigned int gpio1_func, pad_control, pwr_ctrl1, pwr_ctrl3, int_status;
-+ unsigned int gpio1_func, pad_control, pwr_ctrl1, pwr_ctrl3, int_status, pup_pdn_mask;
-+ unsigned int pwr_ctl1_val;
- struct reg_sequence cs35l41_mdsync_down_seq[] = {
- {CS35L41_PWR_CTRL3, 0},
- {CS35L41_GPIO_PAD_CONTROL, 0},
-@@ -1208,6 +1209,12 @@ int cs35l41_global_enable(struct device *dev, struct regmap *regmap, enum cs35l4
- {CS35L41_PWR_CTRL1, 0x00000001, 3000},
- };
-
-+ pup_pdn_mask = enable ? CS35L41_PUP_DONE_MASK : CS35L41_PDN_DONE_MASK;
-+
-+ ret = regmap_read(regmap, CS35L41_PWR_CTRL1, &pwr_ctl1_val);
-+ if (ret)
-+ return ret;
-+
- if ((pwr_ctl1_val & CS35L41_GLOBAL_EN_MASK) && enable) {
- dev_dbg(dev, "Cannot set Global Enable - already set.\n");
- return 0;
-@@ -1252,6 +1259,15 @@ int cs35l41_global_enable(struct device *dev, struct regmap *regmap, enum cs35l4
- ret = regmap_multi_reg_write(regmap, cs35l41_mdsync_up_seq,
- ARRAY_SIZE(cs35l41_mdsync_up_seq));
- }
-+
-+ ret = regmap_read_poll_timeout(regmap, CS35L41_IRQ1_STATUS1,
-+ int_status, int_status & pup_pdn_mask,
-+ 1000, 100000);
-+ if (ret)
-+ dev_err(dev, "Enable(%d) failed: %d\n", enable, ret);
-+
-+ // Clear PUP/PDN status
-+ regmap_write(regmap, CS35L41_IRQ1_STATUS1, pup_pdn_mask);
- break;
- case CS35L41_INT_BOOST:
- ret = regmap_update_bits(regmap, CS35L41_PWR_CTRL1, CS35L41_GLOBAL_EN_MASK,
-@@ -1260,7 +1276,15 @@ int cs35l41_global_enable(struct device *dev, struct regmap *regmap, enum cs35l4
- dev_err(dev, "CS35L41_PWR_CTRL1 set failed: %d\n", ret);
- return ret;
- }
-- usleep_range(3000, 3100);
-+
-+ ret = regmap_read_poll_timeout(regmap, CS35L41_IRQ1_STATUS1,
-+ int_status, int_status & pup_pdn_mask,
-+ 1000, 100000);
-+ if (ret)
-+ dev_err(dev, "Enable(%d) failed: %d\n", enable, ret);
-+
-+ /* Clear PUP/PDN status */
-+ regmap_write(regmap, CS35L41_IRQ1_STATUS1, pup_pdn_mask);
- break;
- case CS35L41_EXT_BOOST:
- case CS35L41_EXT_BOOST_NO_VSPK_SWITCH:
-@@ -1271,7 +1295,15 @@ int cs35l41_global_enable(struct device *dev, struct regmap *regmap, enum cs35l4
- if (ret)
- return ret;
-
-- usleep_range(3000, 3100);
-+ ret = regmap_read_poll_timeout(regmap, CS35L41_IRQ1_STATUS1, int_status,
-+ int_status & CS35L41_PUP_DONE_MASK, 1000, 100000);
-+ if (ret) {
-+ dev_err(dev, "Failed waiting for CS35L41_PUP_DONE_MASK: %d\n", ret);
-+ /* Lock the test key, it was unlocked during the multi_reg_write */
-+ cs35l41_test_key_lock(dev, regmap);
-+ return ret;
-+ }
-+ regmap_write(regmap, CS35L41_IRQ1_STATUS1, CS35L41_PUP_DONE_MASK);
-
- if (firmware_running)
- ret = cs35l41_set_cspl_mbox_cmd(dev, regmap,
-@@ -1292,7 +1324,15 @@ int cs35l41_global_enable(struct device *dev, struct regmap *regmap, enum cs35l4
- return ret;
- }
-
-- usleep_range(3000, 3100);
-+ ret = regmap_read_poll_timeout(regmap, CS35L41_IRQ1_STATUS1, int_status,
-+ int_status & CS35L41_PDN_DONE_MASK, 1000, 100000);
-+ if (ret) {
-+ dev_err(dev, "Failed waiting for CS35L41_PDN_DONE_MASK: %d\n", ret);
-+ /* Lock the test key, it was unlocked during the multi_reg_write */
-+ cs35l41_test_key_lock(dev, regmap);
-+ return ret;
-+ }
-+ regmap_write(regmap, CS35L41_IRQ1_STATUS1, CS35L41_PDN_DONE_MASK);
-
- /* Test Key is locked here */
- ret = regmap_multi_reg_write(regmap, cs35l41_active_to_safe_end,
-diff --git a/sound/soc/codecs/cs35l41.c b/sound/soc/codecs/cs35l41.c
-index d4e9c9d9b50a..2b3c36f02edb 100644
---- a/sound/soc/codecs/cs35l41.c
-+++ b/sound/soc/codecs/cs35l41.c
-@@ -491,7 +491,6 @@ static int cs35l41_main_amp_event(struct snd_soc_dapm_widget *w,
- {
- struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
- struct cs35l41_private *cs35l41 = snd_soc_component_get_drvdata(component);
-- unsigned int val;
- int ret = 0;
-
- switch (event) {
-@@ -507,15 +506,6 @@ static int cs35l41_main_amp_event(struct snd_soc_dapm_widget *w,
- ret = cs35l41_global_enable(cs35l41->dev, cs35l41->regmap, cs35l41->hw_cfg.bst_type,
- 0, &cs35l41->pll_lock, cs35l41->dsp.cs_dsp.running);
-
-- ret = regmap_read_poll_timeout(cs35l41->regmap, CS35L41_IRQ1_STATUS1,
-- val, val & CS35L41_PDN_DONE_MASK,
-- 1000, 100000);
-- if (ret)
-- dev_warn(cs35l41->dev, "PDN failed: %d\n", ret);
--
-- regmap_write(cs35l41->regmap, CS35L41_IRQ1_STATUS1,
-- CS35L41_PDN_DONE_MASK);
--
- regmap_multi_reg_write_bypassed(cs35l41->regmap,
- cs35l41_pdn_patch,
- ARRAY_SIZE(cs35l41_pdn_patch));
---
-2.41.0
-
diff --git a/0002-drivers-firmware-skip-simpledrm-if-nvidia-drm.modese.patch b/0002-drivers-firmware-skip-simpledrm-if-nvidia-drm.modese.patch
deleted file mode 100644
index 1f518e6bb744..000000000000
--- a/0002-drivers-firmware-skip-simpledrm-if-nvidia-drm.modese.patch
+++ /dev/null
@@ -1,89 +0,0 @@
-From 5e9d8dd3971972048485610161c2556a7608849e Mon Sep 17 00:00:00 2001
-From: Javier Martinez Canillas <javierm@redhat.com>
-Date: Thu, 19 May 2022 14:40:07 +0200
-Subject: [PATCH 2/8] drivers/firmware: skip simpledrm if nvidia-drm.modeset=1
- is set
-
-The Nvidia proprietary driver has some bugs that leads to issues if used
-with the simpledrm driver. The most noticeable is that does not register
-an emulated fbdev device.
-
-It just relies on a fbdev to be registered by another driver, that could
-be that could be attached to the framebuffer console. On UEFI machines,
-this is the efifb driver.
-
-This means that disabling the efifb driver will cause virtual consoles to
-not be present in the system when using the Nvidia driver. Legacy BIOS is
-not affected just because fbcon is not used there, but instead vgacon.
-
-Unless a VGA mode is specified using the vga= kernel command line option,
-in that case the vesafb driver is used instead and its fbdev attached to
-the fbcon.
-
-This is a problem because with CONFIG_SYSFB_SIMPLEFB=y, the sysfb platform
-code attempts to register a "simple-framebuffer" platform device (that is
-matched against simpledrm) and only registers either an "efi-framebuffer"
-or "vesa-framebuffer" if this fails to be registered due the video modes
-not being compatible.
-
-The Nvidia driver relying on another driver to register the fbdev is quite
-fragile, since it can't really assume those will stick around. For example
-there are patches posted to remove the EFI and VESA platform devices once
-a real DRM or fbdev driver probes.
-
-But in any case, moving to a simpledrm + emulated fbdev only breaks this
-assumption and causes users to not have VT if the Nvidia driver is used.
-
-So to prevent this, let's add a workaround and make the sysfb to skip the
-"simple-framebuffer" registration when nvidia-drm.modeset=1 option is set.
-
-This is quite horrible, but honestly I can't think of any other approach.
-
-For this to work, the CONFIG_FB_EFI and CONFIG_FB_VESA config options must
-be enabled besides CONFIG_DRM_SIMPLEDRM.
-
-Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
-Cherry-picked-for: https://bugs.archlinux.org/task/73720
----
- drivers/firmware/sysfb.c | 18 +++++++++++++++++-
- 1 file changed, 17 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c
-index 82fcfd29bc4d2..17b7e096b6828 100644
---- a/drivers/firmware/sysfb.c
-+++ b/drivers/firmware/sysfb.c
-@@ -34,6 +34,22 @@
- #include <linux/screen_info.h>
- #include <linux/sysfb.h>
-
-+static int skip_simpledrm;
-+
-+static int __init simpledrm_disable(char *opt)
-+{
-+ if (!opt)
-+ return -EINVAL;
-+
-+ get_option(&opt, &skip_simpledrm);
-+
-+ if (skip_simpledrm)
-+ pr_info("The simpledrm driver will not be probed\n");
-+
-+ return 0;
-+}
-+early_param("nvidia-drm.modeset", simpledrm_disable);
-+
- static struct platform_device *pd;
- static DEFINE_MUTEX(disable_lock);
- static bool disabled;
-@@ -85,7 +101,7 @@ static __init int sysfb_init(void)
-
- /* try to create a simple-framebuffer device */
- compatible = sysfb_parse_mode(si, &mode);
-- if (compatible) {
-+ if (compatible && !skip_simpledrm) {
- pd = sysfb_create_simplefb(si, &mode);
- if (!IS_ERR(pd))
- goto unlock_mutex;
---
-2.41.0
-
diff --git a/0003-ALSA-hda-cs35l41-Check-mailbox-status-of-pause-comma.patch b/0003-ALSA-hda-cs35l41-Check-mailbox-status-of-pause-comma.patch
deleted file mode 100644
index 6eb272a81b13..000000000000
--- a/0003-ALSA-hda-cs35l41-Check-mailbox-status-of-pause-comma.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 796af5ec6c6bb2eadf78a96f629e2c7fba11123b Mon Sep 17 00:00:00 2001
-From: Stefan Binding <sbinding@opensource.cirrus.com>
-Date: Fri, 21 Jul 2023 16:18:08 +0100
-Subject: [PATCH 03/11] ALSA: hda: cs35l41: Check mailbox status of pause
- command after firmware load
-
-Currently, we do not check the return status of the pause command,
-immediately after we load firmware. If the pause has failed,
-the firmware is not running.
-
-Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
----
- sound/pci/hda/cs35l41_hda.c | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
-diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
-index f9c97270db6f..29f1dce45f1d 100644
---- a/sound/pci/hda/cs35l41_hda.c
-+++ b/sound/pci/hda/cs35l41_hda.c
-@@ -781,7 +781,12 @@ static int cs35l41_smart_amp(struct cs35l41_hda *cs35l41)
- goto clean_dsp;
- }
-
-- cs35l41_set_cspl_mbox_cmd(cs35l41->dev, cs35l41->regmap, CSPL_MBOX_CMD_PAUSE);
-+ ret = cs35l41_set_cspl_mbox_cmd(cs35l41->dev, cs35l41->regmap, CSPL_MBOX_CMD_PAUSE);
-+ if (ret) {
-+ dev_err(cs35l41->dev, "Error waiting for DSP to pause: %u\n", ret);
-+ goto clean_dsp;
-+ }
-+
- cs35l41->firmware_running = true;
-
- return 0;
---
-2.41.0
-
diff --git a/0003-sphinx-kfigure.py-Convert-outdir-to-str-before-using.patch b/0003-sphinx-kfigure.py-Convert-outdir-to-str-before-using.patch
deleted file mode 100644
index 3ec7388d12b1..000000000000
--- a/0003-sphinx-kfigure.py-Convert-outdir-to-str-before-using.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 37d1bd4999f06c7c4b3094cb74b7614c552ecc1d Mon Sep 17 00:00:00 2001
-From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
-Date: Thu, 24 Aug 2023 01:28:17 +0200
-Subject: [PATCH 3/8] sphinx: kfigure.py: Convert outdir to str before using
- len
-
-Sphinx 7.2 replaced several uses of str with pathlib Paths, causing the
-build to fail with a TypeError when attempting to use len on one.
-
-Patch by @loqs; thanks.
-
-Fixes: https://bugs.archlinux.org/task/79446
-Signed-off-by: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
----
- Documentation/sphinx/kfigure.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/Documentation/sphinx/kfigure.py b/Documentation/sphinx/kfigure.py
-index cefdbb7e75230..13e885bbd499c 100644
---- a/Documentation/sphinx/kfigure.py
-+++ b/Documentation/sphinx/kfigure.py
-@@ -309,7 +309,7 @@ def convert_image(img_node, translator, src_fname=None):
- if dst_fname:
- # the builder needs not to copy one more time, so pop it if exists.
- translator.builder.images.pop(img_node['uri'], None)
-- _name = dst_fname[len(translator.builder.outdir) + 1:]
-+ _name = dst_fname[len(str(translator.builder.outdir)) + 1:]
-
- if isNewer(dst_fname, src_fname):
- kernellog.verbose(app,
---
-2.41.0
-
diff --git a/0004-ALSA-hda-cs35l41-Ensure-we-correctly-re-sync-regmap-.patch b/0004-ALSA-hda-cs35l41-Ensure-we-correctly-re-sync-regmap-.patch
deleted file mode 100644
index d7cce6083559..000000000000
--- a/0004-ALSA-hda-cs35l41-Ensure-we-correctly-re-sync-regmap-.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-From 9684d3a1fbe55573eccd6c7e5f72dd519a4e406b Mon Sep 17 00:00:00 2001
-From: Stefan Binding <sbinding@opensource.cirrus.com>
-Date: Fri, 21 Jul 2023 16:18:09 +0100
-Subject: [PATCH 04/11] ALSA: hda: cs35l41: Ensure we correctly re-sync regmap
- before system suspending.
-
-In order to properly system suspend, it is necessary to unload the firmware
-and ensure the chip is ready for shutdown (if necessary). If the system
-is currently in runtime suspend, it is necessary to wake up the device,
-and then make it ready. Currently, the wake does not correctly resync
-the device, which may mean it cannot suspend correctly. Fix this by
-performaing a resync.
-
-Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
----
- sound/pci/hda/cs35l41_hda.c | 32 +++++++++++++++++++++++++++-----
- 1 file changed, 27 insertions(+), 5 deletions(-)
-
-diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
-index 29f1dce45f1d..f42457147ce4 100644
---- a/sound/pci/hda/cs35l41_hda.c
-+++ b/sound/pci/hda/cs35l41_hda.c
-@@ -574,21 +574,43 @@ static int cs35l41_hda_channel_map(struct device *dev, unsigned int tx_num, unsi
- rx_slot);
- }
-
--static void cs35l41_ready_for_reset(struct cs35l41_hda *cs35l41)
-+static int cs35l41_ready_for_reset(struct cs35l41_hda *cs35l41)
- {
-+ int ret = 0;
-+
- mutex_lock(&cs35l41->fw_mutex);
- if (cs35l41->firmware_running) {
-
- regcache_cache_only(cs35l41->regmap, false);
-
-- cs35l41_exit_hibernate(cs35l41->dev, cs35l41->regmap);
-+ ret = cs35l41_exit_hibernate(cs35l41->dev, cs35l41->regmap);
-+ if (ret) {
-+ dev_warn(cs35l41->dev, "Unable to exit Hibernate.");
-+ goto err;
-+ }
-+
-+ /* Test key needs to be unlocked to allow the OTP settings to re-apply */
-+ cs35l41_test_key_unlock(cs35l41->dev, cs35l41->regmap);
-+ ret = regcache_sync(cs35l41->regmap);
-+ cs35l41_test_key_lock(cs35l41->dev, cs35l41->regmap);
-+ if (ret) {
-+ dev_err(cs35l41->dev, "Failed to restore register cache: %d\n", ret);
-+ goto err;
-+ }
-+
-+ if (cs35l41->hw_cfg.bst_type == CS35L41_EXT_BOOST)
-+ cs35l41_init_boost(cs35l41->dev, cs35l41->regmap, &cs35l41->hw_cfg);
-+
- cs35l41_shutdown_dsp(cs35l41);
- cs35l41_safe_reset(cs35l41->regmap, cs35l41->hw_cfg.bst_type);
--
-- regcache_cache_only(cs35l41->regmap, true);
-- regcache_mark_dirty(cs35l41->regmap);
- }
-+err:
-+ regcache_cache_only(cs35l41->regmap, true);
-+ regcache_mark_dirty(cs35l41->regmap);
-+
- mutex_unlock(&cs35l41->fw_mutex);
-+
-+ return ret;
- }
-
- static int cs35l41_system_suspend(struct device *dev)
---
-2.41.0
-
diff --git a/0004-ASoC-Intel-soc-acpi-fix-Dell-SKU-0B34.patch b/0004-ASoC-Intel-soc-acpi-fix-Dell-SKU-0B34.patch
deleted file mode 100644
index 1a6234faa0ef..000000000000
--- a/0004-ASoC-Intel-soc-acpi-fix-Dell-SKU-0B34.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From eb39b2a95930f53bd2cb4fbda0e1372609dff976 Mon Sep 17 00:00:00 2001
-From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
-Date: Tue, 5 Sep 2023 11:16:16 -0400
-Subject: [PATCH 4/8] ASoC: Intel: soc-acpi: fix Dell SKU 0B34
-
-The rule for the SoundWire tables is that the platforms with more
-devices need to be added first. We broke that rule with the Dell SKU
-0B34, and caused the second amplifier for SKU 0AF3 to be ignored.
-
-The fix is simple, we need to move the single-amplifier entry after
-the two-amplifier one.
-
-Fixes: b62a1a839b48 ("ASoC: Intel: soc-acpi: add tables for Dell SKU 0B34")
-Closes: https://github.com/thesofproject/linux/issues/4559
-Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
----
- sound/soc/intel/common/soc-acpi-intel-adl-match.c | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/sound/soc/intel/common/soc-acpi-intel-adl-match.c b/sound/soc/intel/common/soc-acpi-intel-adl-match.c
-index bcd66e0094b4b..c4b57cca6b228 100644
---- a/sound/soc/intel/common/soc-acpi-intel-adl-match.c
-+++ b/sound/soc/intel/common/soc-acpi-intel-adl-match.c
-@@ -648,18 +648,18 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_sdw_machines[] = {
- .drv_name = "sof_sdw",
- .sof_tplg_filename = "sof-adl-rt1316-l2-mono-rt714-l3.tplg",
- },
-- {
-- .link_mask = 0x3, /* rt1316 on link1 & rt714 on link0 */
-- .links = adl_sdw_rt1316_link1_rt714_link0,
-- .drv_name = "sof_sdw",
-- .sof_tplg_filename = "sof-adl-rt1316-l1-mono-rt714-l0.tplg",
-- },
- {
- .link_mask = 0x7, /* rt714 on link0 & two rt1316s on link1 and link2 */
- .links = adl_sdw_rt1316_link12_rt714_link0,
- .drv_name = "sof_sdw",
- .sof_tplg_filename = "sof-adl-rt1316-l12-rt714-l0.tplg",
- },
-+ {
-+ .link_mask = 0x3, /* rt1316 on link1 & rt714 on link0 */
-+ .links = adl_sdw_rt1316_link1_rt714_link0,
-+ .drv_name = "sof_sdw",
-+ .sof_tplg_filename = "sof-adl-rt1316-l1-mono-rt714-l0.tplg",
-+ },
- {
- .link_mask = 0x5, /* 2 active links required */
- .links = adl_sdw_rt1316_link2_rt714_link0,
---
-2.41.0
-
diff --git a/0005-ALSA-hda-cs35l41-Ensure-we-pass-up-any-errors-during.patch b/0005-ALSA-hda-cs35l41-Ensure-we-pass-up-any-errors-during.patch
deleted file mode 100644
index 5ced08481c91..000000000000
--- a/0005-ALSA-hda-cs35l41-Ensure-we-pass-up-any-errors-during.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-From 05bfc01172a34466e660465922d1cab5b460880f Mon Sep 17 00:00:00 2001
-From: Stefan Binding <sbinding@opensource.cirrus.com>
-Date: Fri, 21 Jul 2023 16:18:10 +0100
-Subject: [PATCH 05/11] ALSA: hda: cs35l41: Ensure we pass up any errors during
- system suspend.
-
-There are several steps required to put the system into system suspend.
-Some of these steps may fail, so the driver should pass up the errors
-if they occur.
-
-Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
----
- sound/pci/hda/cs35l41_hda.c | 17 +++++++++++++----
- 1 file changed, 13 insertions(+), 4 deletions(-)
-
-diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
-index f42457147ce4..d4a11f7b5dbd 100644
---- a/sound/pci/hda/cs35l41_hda.c
-+++ b/sound/pci/hda/cs35l41_hda.c
-@@ -626,17 +626,22 @@ static int cs35l41_system_suspend(struct device *dev)
- }
-
- ret = pm_runtime_force_suspend(dev);
-- if (ret)
-+ if (ret) {
-+ dev_err(dev, "System Suspend Failed, unable to runtime suspend: %d\n", ret);
- return ret;
-+ }
-
- /* Shutdown DSP before system suspend */
-- cs35l41_ready_for_reset(cs35l41);
-+ ret = cs35l41_ready_for_reset(cs35l41);
-+
-+ if (ret)
-+ dev_err(dev, "System Suspend Failed, not ready for Reset: %d\n", ret);
-
- /*
- * Reset GPIO may be shared, so cannot reset here.
- * However beyond this point, amps may be powered down.
- */
-- return 0;
-+ return ret;
- }
-
- static int cs35l41_system_resume(struct device *dev)
-@@ -659,9 +664,13 @@ static int cs35l41_system_resume(struct device *dev)
- usleep_range(2000, 2100);
-
- ret = pm_runtime_force_resume(dev);
-+ if (ret) {
-+ dev_err(dev, "System Resume Failed: Unable to runtime resume: %d\n", ret);
-+ return ret;
-+ }
-
- mutex_lock(&cs35l41->fw_mutex);
-- if (!ret && cs35l41->request_fw_load && !cs35l41->fw_request_ongoing) {
-+ if (cs35l41->request_fw_load && !cs35l41->fw_request_ongoing) {
- cs35l41->fw_request_ongoing = true;
- schedule_work(&cs35l41->fw_load_work);
- }
---
-2.41.0
-
diff --git a/0005-Revert-ASoC-Intel-soc-acpi-add-tables-for-Dell-SKU-0.patch b/0005-Revert-ASoC-Intel-soc-acpi-add-tables-for-Dell-SKU-0.patch
deleted file mode 100644
index e719ec2fae81..000000000000
--- a/0005-Revert-ASoC-Intel-soc-acpi-add-tables-for-Dell-SKU-0.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-From 82d8584b889db5166bf7ad7863e079d38c9c6e7a Mon Sep 17 00:00:00 2001
-From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
-Date: Sat, 2 Sep 2023 15:28:31 +0200
-Subject: [PATCH 5/6] Revert "ASoC: Intel: soc-acpi: add tables for Dell SKU
- 0B34"
-
-This reverts commit b62a1a839b48f55046727089c3ba7a8ebbf97f0e.
-
-It broke stereo sound on the Dell XPS 13 Plus 9320 (SKU 0AF3),
-see https://github.com/thesofproject/linux/issues/4559.
-
-Considering that this apparently wasn't enough to get sound working on
-SKU 0B34 (https://github.com/thesofproject/linux/issues/4399) and that
-Dell officially supports Linux on 0AF3 but not 0B34, I think this is
-safe to revert.
-
-Fixes: https://github.com/thesofproject/linux/issues/4559
-Signed-off-by: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
----
- .../intel/common/soc-acpi-intel-adl-match.c | 29 -------------------
- 1 file changed, 29 deletions(-)
-
-diff --git a/sound/soc/intel/common/soc-acpi-intel-adl-match.c b/sound/soc/intel/common/soc-acpi-intel-adl-match.c
-index bcd66e0094b4b..83414bfa8d6c4 100644
---- a/sound/soc/intel/common/soc-acpi-intel-adl-match.c
-+++ b/sound/soc/intel/common/soc-acpi-intel-adl-match.c
-@@ -133,15 +133,6 @@ static const struct snd_soc_acpi_adr_device rt1316_1_group2_adr[] = {
- }
- };
-
--static const struct snd_soc_acpi_adr_device rt1316_1_single_adr[] = {
-- {
-- .adr = 0x000130025D131601ull,
-- .num_endpoints = 1,
-- .endpoints = &single_endpoint,
-- .name_prefix = "rt1316-1"
-- }
--};
--
- static const struct snd_soc_acpi_adr_device rt1316_2_single_adr[] = {
- {
- .adr = 0x000230025D131601ull,
-@@ -321,20 +312,6 @@ static const struct snd_soc_acpi_link_adr adl_sdw_rt1316_link12_rt714_link0[] =
- {}
- };
-
--static const struct snd_soc_acpi_link_adr adl_sdw_rt1316_link1_rt714_link0[] = {
-- {
-- .mask = BIT(1),
-- .num_adr = ARRAY_SIZE(rt1316_1_single_adr),
-- .adr_d = rt1316_1_single_adr,
-- },
-- {
-- .mask = BIT(0),
-- .num_adr = ARRAY_SIZE(rt714_0_adr),
-- .adr_d = rt714_0_adr,
-- },
-- {}
--};
--
- static const struct snd_soc_acpi_link_adr adl_sdw_rt1316_link2_rt714_link3[] = {
- {
- .mask = BIT(2),
-@@ -648,12 +625,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_sdw_machines[] = {
- .drv_name = "sof_sdw",
- .sof_tplg_filename = "sof-adl-rt1316-l2-mono-rt714-l3.tplg",
- },
-- {
-- .link_mask = 0x3, /* rt1316 on link1 & rt714 on link0 */
-- .links = adl_sdw_rt1316_link1_rt714_link0,
-- .drv_name = "sof_sdw",
-- .sof_tplg_filename = "sof-adl-rt1316-l1-mono-rt714-l0.tplg",
-- },
- {
- .link_mask = 0x7, /* rt714 on link0 & two rt1316s on link1 and link2 */
- .links = adl_sdw_rt1316_link12_rt714_link0,
---
-2.41.0
-
diff --git a/0005-btrfs-wait-on-uncached-block-groups-on-every-allocat.patch b/0005-btrfs-wait-on-uncached-block-groups-on-every-allocat.patch
deleted file mode 100644
index 493337c64d42..000000000000
--- a/0005-btrfs-wait-on-uncached-block-groups-on-every-allocat.patch
+++ /dev/null
@@ -1,255 +0,0 @@
-From 8da079307d115705e243d226591dcb4388cef7e2 Mon Sep 17 00:00:00 2001
-From: Josef Bacik <josef@toxicpanda.com>
-Date: Mon, 31 Jul 2023 16:28:43 -0400
-Subject: [PATCH 5/8] btrfs: wait on uncached block groups on every allocation
- loop
-
-My initial fix for the generic/475 hangs was related to metadata, but
-our CI testing uncovered another case where we hang for similar reasons.
-We again have a task with a plug that is holding an outstanding request
-that is keeping the dm device from finishing it's suspend, and that task
-is stuck in the allocator.
-
-This time it is stuck trying to allocate data, but we do not have a
-block group that matches the size class. The larger loop in the
-allocator looks like this (simplified of course)
-
- find_free_extent
- for_each_block_group {
- ffe_ctl->cached == btrfs_block_group_cache_done(bg)
- if (!ffe_ctl->cached)
- ffe_ctl->have_caching_bg = true;
- do_allocation()
- btrfs_wait_block_group_cache_progress();
- }
-
- if (loop == LOOP_CACHING_WAIT && ffe_ctl->have_caching_bg)
- go search again;
-
-In my earlier fix we were trying to allocate from the block group, but
-we weren't waiting for the progress because we were only waiting for the
-free space to be >= the amount of free space we wanted. My fix made it
-so we waited for forward progress to be made as well, so we would be
-sure to wait.
-
-This time however we did not have a block group that matched our size
-class, so what was happening was this
-
- find_free_extent
- for_each_block_group {
- ffe_ctl->cached == btrfs_block_group_cache_done(bg)
- if (!ffe_ctl->cached)
- ffe_ctl->have_caching_bg = true;
- if (size_class_doesn't_match())
- goto loop;
- do_allocation()
- btrfs_wait_block_group_cache_progress();
- loop:
- release_block_group(block_group);
- }
-
- if (loop == LOOP_CACHING_WAIT && ffe_ctl->have_caching_bg)
- go search again;
-
-The size_class_doesn't_match() part was true, so we'd just skip this
-block group and never wait for caching, and then because we found a
-caching block group we'd just go back and do the loop again. We never
-sleep and thus never flush the plug and we have the same deadlock.
-
-Fix the logic for waiting on the block group caching to instead do it
-unconditionally when we goto loop. This takes the logic out of the
-allocation step, so now the loop looks more like this
-
- find_free_extent
- for_each_block_group {
- ffe_ctl->cached == btrfs_block_group_cache_done(bg)
- if (!ffe_ctl->cached)
- ffe_ctl->have_caching_bg = true;
- if (size_class_doesn't_match())
- goto loop;
- do_allocation()
- btrfs_wait_block_group_cache_progress();
- loop:
- if (loop > LOOP_CACHING_NOWAIT && !ffe_ctl->retry_uncached &&
- !ffe_ctl->cached) {
- ffe_ctl->retry_uncached = true;
- btrfs_wait_block_group_cache_progress();
- }
-
- release_block_group(block_group);
- }
-
- if (loop == LOOP_CACHING_WAIT && ffe_ctl->have_caching_bg)
- go search again;
-
-This simplifies the logic a lot, and makes sure that if we're hitting
-uncached block groups we're always waiting on them at some point.
-
-I ran this through 100 iterations of generic/475, as this particular
-case was harder to hit than the previous one.
-
-Signed-off-by: Josef Bacik <josef@toxicpanda.com>
-Signed-off-by: David Sterba <dsterba@suse.com>
----
- fs/btrfs/extent-tree.c | 61 +++++++++++++-----------------------------
- fs/btrfs/extent-tree.h | 13 +++------
- 2 files changed, 22 insertions(+), 52 deletions(-)
-
-diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
-index f396a9afa4032..6096bd98e6c70 100644
---- a/fs/btrfs/extent-tree.c
-+++ b/fs/btrfs/extent-tree.c
-@@ -3427,7 +3427,6 @@ btrfs_release_block_group(struct btrfs_block_group *cache,
- * Helper function for find_free_extent().
- *
- * Return -ENOENT to inform caller that we need fallback to unclustered mode.
-- * Return -EAGAIN to inform caller that we need to re-search this block group
- * Return >0 to inform caller that we find nothing
- * Return 0 means we have found a location and set ffe_ctl->found_offset.
- */
-@@ -3508,14 +3507,6 @@ static int find_free_extent_clustered(struct btrfs_block_group *bg,
- trace_btrfs_reserve_extent_cluster(bg, ffe_ctl);
- return 0;
- }
-- } else if (!ffe_ctl->cached && ffe_ctl->loop > LOOP_CACHING_NOWAIT &&
-- !ffe_ctl->retry_clustered) {
-- spin_unlock(&last_ptr->refill_lock);
--
-- ffe_ctl->retry_clustered = true;
-- btrfs_wait_block_group_cache_progress(bg, ffe_ctl->num_bytes +
-- ffe_ctl->empty_cluster + ffe_ctl->empty_size);
-- return -EAGAIN;
- }
- /*
- * At this point we either didn't find a cluster or we weren't able to
-@@ -3530,7 +3521,6 @@ static int find_free_extent_clustered(struct btrfs_block_group *bg,
- /*
- * Return >0 to inform caller that we find nothing
- * Return 0 when we found an free extent and set ffe_ctrl->found_offset
-- * Return -EAGAIN to inform caller that we need to re-search this block group
- */
- static int find_free_extent_unclustered(struct btrfs_block_group *bg,
- struct find_free_extent_ctl *ffe_ctl)
-@@ -3568,25 +3558,8 @@ static int find_free_extent_unclustered(struct btrfs_block_group *bg,
- offset = btrfs_find_space_for_alloc(bg, ffe_ctl->search_start,
- ffe_ctl->num_bytes, ffe_ctl->empty_size,
- &ffe_ctl->max_extent_size);
--
-- /*
-- * If we didn't find a chunk, and we haven't failed on this block group
-- * before, and this block group is in the middle of caching and we are
-- * ok with waiting, then go ahead and wait for progress to be made, and
-- * set @retry_unclustered to true.
-- *
-- * If @retry_unclustered is true then we've already waited on this
-- * block group once and should move on to the next block group.
-- */
-- if (!offset && !ffe_ctl->retry_unclustered && !ffe_ctl->cached &&
-- ffe_ctl->loop > LOOP_CACHING_NOWAIT) {
-- btrfs_wait_block_group_cache_progress(bg, ffe_ctl->num_bytes +
-- ffe_ctl->empty_size);
-- ffe_ctl->retry_unclustered = true;
-- return -EAGAIN;
-- } else if (!offset) {
-+ if (!offset)
- return 1;
-- }
- ffe_ctl->found_offset = offset;
- return 0;
- }
-@@ -3600,7 +3573,7 @@ static int do_allocation_clustered(struct btrfs_block_group *block_group,
- /* We want to try and use the cluster allocator, so lets look there */
- if (ffe_ctl->last_ptr && ffe_ctl->use_cluster) {
- ret = find_free_extent_clustered(block_group, ffe_ctl, bg_ret);
-- if (ret >= 0 || ret == -EAGAIN)
-+ if (ret >= 0)
- return ret;
- /* ret == -ENOENT case falls through */
- }
-@@ -3816,8 +3789,7 @@ static void release_block_group(struct btrfs_block_group *block_group,
- {
- switch (ffe_ctl->policy) {
- case BTRFS_EXTENT_ALLOC_CLUSTERED:
-- ffe_ctl->retry_clustered = false;
-- ffe_ctl->retry_unclustered = false;
-+ ffe_ctl->retry_uncached = false;
- break;
- case BTRFS_EXTENT_ALLOC_ZONED:
- /* Nothing to do */
-@@ -4168,9 +4140,7 @@ static noinline int find_free_extent(struct btrfs_root *root,
- ffe_ctl->orig_have_caching_bg = false;
- ffe_ctl->index = btrfs_bg_flags_to_raid_index(ffe_ctl->flags);
- ffe_ctl->loop = 0;
-- /* For clustered allocation */
-- ffe_ctl->retry_clustered = false;
-- ffe_ctl->retry_unclustered = false;
-+ ffe_ctl->retry_uncached = false;
- ffe_ctl->cached = 0;
- ffe_ctl->max_extent_size = 0;
- ffe_ctl->total_free_space = 0;
-@@ -4321,16 +4291,12 @@ static noinline int find_free_extent(struct btrfs_root *root,
-
- bg_ret = NULL;
- ret = do_allocation(block_group, ffe_ctl, &bg_ret);
-- if (ret == 0) {
-- if (bg_ret && bg_ret != block_group) {
-- btrfs_release_block_group(block_group,
-- ffe_ctl->delalloc);
-- block_group = bg_ret;
-- }
-- } else if (ret == -EAGAIN) {
-- goto have_block_group;
-- } else if (ret > 0) {
-+ if (ret > 0)
- goto loop;
-+
-+ if (bg_ret && bg_ret != block_group) {
-+ btrfs_release_block_group(block_group, ffe_ctl->delalloc);
-+ block_group = bg_ret;
- }
-
- /* Checks */
-@@ -4371,6 +4337,15 @@ static noinline int find_free_extent(struct btrfs_root *root,
- btrfs_release_block_group(block_group, ffe_ctl->delalloc);
- break;
- loop:
-+ if (!ffe_ctl->cached && ffe_ctl->loop > LOOP_CACHING_NOWAIT &&
-+ !ffe_ctl->retry_uncached) {
-+ ffe_ctl->retry_uncached = true;
-+ btrfs_wait_block_group_cache_progress(block_group,
-+ ffe_ctl->num_bytes +
-+ ffe_ctl->empty_cluster +
-+ ffe_ctl->empty_size);
-+ goto have_block_group;
-+ }
- release_block_group(block_group, ffe_ctl, ffe_ctl->delalloc);
- cond_resched();
- }
-diff --git a/fs/btrfs/extent-tree.h b/fs/btrfs/extent-tree.h
-index 429d5c5700618..6bfba2f22fdd4 100644
---- a/fs/btrfs/extent-tree.h
-+++ b/fs/btrfs/extent-tree.h
-@@ -48,16 +48,11 @@ struct find_free_extent_ctl {
- int loop;
-
- /*
-- * Whether we're refilling a cluster, if true we need to re-search
-- * current block group but don't try to refill the cluster again.
-+ * Set to true if we're retrying the allocation on this block group
-+ * after waiting for caching progress, this is so that we retry only
-+ * once before moving on to another block group.
- */
-- bool retry_clustered;
--
-- /*
-- * Whether we're updating free space cache, if true we need to re-search
-- * current block group but don't try updating free space cache again.
-- */
-- bool retry_unclustered;
-+ bool retry_uncached;
-
- /* If current block group is cached */
- int cached;
---
-2.41.0
-
diff --git a/0006-ALSA-hda-cs35l41-Move-Play-and-Pause-into-separate-f.patch b/0006-ALSA-hda-cs35l41-Move-Play-and-Pause-into-separate-f.patch
deleted file mode 100644
index b79792840f63..000000000000
--- a/0006-ALSA-hda-cs35l41-Move-Play-and-Pause-into-separate-f.patch
+++ /dev/null
@@ -1,193 +0,0 @@
-From f352ce9e5389e4746f25bfec33f4e0ee4dcbf690 Mon Sep 17 00:00:00 2001
-From: Stefan Binding <sbinding@opensource.cirrus.com>
-Date: Fri, 21 Jul 2023 16:18:11 +0100
-Subject: [PATCH 06/11] ALSA: hda: cs35l41: Move Play and Pause into separate
- functions
-
-This allows play and pause to be called from multiple places,
-which is necessary for system suspend and resume.
-
-Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
----
- sound/pci/hda/cs35l41_hda.c | 131 ++++++++++++++++++++++--------------
- 1 file changed, 79 insertions(+), 52 deletions(-)
-
-diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
-index d4a11f7b5dbd..f77583b46b6b 100644
---- a/sound/pci/hda/cs35l41_hda.c
-+++ b/sound/pci/hda/cs35l41_hda.c
-@@ -483,63 +483,103 @@ static void cs35l41_irq_release(struct cs35l41_hda *cs35l41)
- cs35l41->irq_errors = 0;
- }
-
--static void cs35l41_hda_playback_hook(struct device *dev, int action)
-+static void cs35l41_hda_play_start(struct device *dev)
- {
- struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
- struct regmap *reg = cs35l41->regmap;
-- int ret = 0;
-+
-+ dev_dbg(dev, "Play (Start)\n");
-+
-+ if (cs35l41->playback_started) {
-+ dev_dbg(dev, "Playback already started.");
-+ return;
-+ }
-+
-+ cs35l41->playback_started = true;
-+
-+ if (cs35l41->firmware_running) {
-+ regmap_multi_reg_write(reg, cs35l41_hda_config_dsp,
-+ ARRAY_SIZE(cs35l41_hda_config_dsp));
-+ regmap_update_bits(reg, CS35L41_PWR_CTRL2,
-+ CS35L41_VMON_EN_MASK | CS35L41_IMON_EN_MASK,
-+ 1 << CS35L41_VMON_EN_SHIFT | 1 << CS35L41_IMON_EN_SHIFT);
-+ cs35l41_set_cspl_mbox_cmd(cs35l41->dev, reg, CSPL_MBOX_CMD_RESUME);
-+ } else {
-+ regmap_multi_reg_write(reg, cs35l41_hda_config, ARRAY_SIZE(cs35l41_hda_config));
-+ }
-+ regmap_update_bits(reg, CS35L41_PWR_CTRL2, CS35L41_AMP_EN_MASK, 1 << CS35L41_AMP_EN_SHIFT);
-+ if (cs35l41->hw_cfg.bst_type == CS35L41_EXT_BOOST)
-+ regmap_write(reg, CS35L41_GPIO1_CTRL1, 0x00008001);
-+
-+}
-+
-+static void cs35l41_hda_play_done(struct device *dev)
-+{
-+ struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
-+ struct regmap *reg = cs35l41->regmap;
-+
-+ dev_dbg(dev, "Play (Complete)\n");
-+
-+ cs35l41_global_enable(dev, reg, cs35l41->hw_cfg.bst_type, 1, NULL,
-+ cs35l41->firmware_running);
-+}
-+
-+static void cs35l41_hda_pause_start(struct device *dev)
-+{
-+ struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
-+ struct regmap *reg = cs35l41->regmap;
-+
-+ dev_dbg(dev, "Pause (Start)\n");
-+
-+ regmap_multi_reg_write(reg, cs35l41_hda_mute, ARRAY_SIZE(cs35l41_hda_mute));
-+ cs35l41_global_enable(dev, reg, cs35l41->hw_cfg.bst_type, 0, NULL,
-+ cs35l41->firmware_running);
-+}
-+
-+static void cs35l41_hda_pause_done(struct device *dev)
-+{
-+ struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
-+ struct regmap *reg = cs35l41->regmap;
-+
-+ dev_dbg(dev, "Pause (Complete)\n");
-+
-+ regmap_update_bits(reg, CS35L41_PWR_CTRL2, CS35L41_AMP_EN_MASK, 0 << CS35L41_AMP_EN_SHIFT);
-+ if (cs35l41->hw_cfg.bst_type == CS35L41_EXT_BOOST)
-+ regmap_write(reg, CS35L41_GPIO1_CTRL1, 0x00000001);
-+ if (cs35l41->firmware_running) {
-+ cs35l41_set_cspl_mbox_cmd(dev, reg, CSPL_MBOX_CMD_PAUSE);
-+ regmap_update_bits(reg, CS35L41_PWR_CTRL2,
-+ CS35L41_VMON_EN_MASK | CS35L41_IMON_EN_MASK,
-+ 0 << CS35L41_VMON_EN_SHIFT | 0 << CS35L41_IMON_EN_SHIFT);
-+ }
-+ cs35l41_irq_release(cs35l41);
-+ cs35l41->playback_started = false;
-+}
-+
-+static void cs35l41_hda_playback_hook(struct device *dev, int action)
-+{
-+ struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
-
- switch (action) {
- case HDA_GEN_PCM_ACT_OPEN:
- pm_runtime_get_sync(dev);
- mutex_lock(&cs35l41->fw_mutex);
-- cs35l41->playback_started = true;
-- if (cs35l41->firmware_running) {
-- regmap_multi_reg_write(reg, cs35l41_hda_config_dsp,
-- ARRAY_SIZE(cs35l41_hda_config_dsp));
-- regmap_update_bits(cs35l41->regmap, CS35L41_PWR_CTRL2,
-- CS35L41_VMON_EN_MASK | CS35L41_IMON_EN_MASK,
-- 1 << CS35L41_VMON_EN_SHIFT | 1 << CS35L41_IMON_EN_SHIFT);
-- cs35l41_set_cspl_mbox_cmd(cs35l41->dev, cs35l41->regmap,
-- CSPL_MBOX_CMD_RESUME);
-- } else {
-- regmap_multi_reg_write(reg, cs35l41_hda_config,
-- ARRAY_SIZE(cs35l41_hda_config));
-- }
-- ret = regmap_update_bits(reg, CS35L41_PWR_CTRL2,
-- CS35L41_AMP_EN_MASK, 1 << CS35L41_AMP_EN_SHIFT);
-- if (cs35l41->hw_cfg.bst_type == CS35L41_EXT_BOOST)
-- regmap_write(reg, CS35L41_GPIO1_CTRL1, 0x00008001);
-+ cs35l41_hda_play_start(dev);
- mutex_unlock(&cs35l41->fw_mutex);
- break;
- case HDA_GEN_PCM_ACT_PREPARE:
- mutex_lock(&cs35l41->fw_mutex);
-- ret = cs35l41_global_enable(dev, reg, cs35l41->hw_cfg.bst_type, 1, NULL,
-- cs35l41->firmware_running);
-+ cs35l41_hda_play_done(dev);
- mutex_unlock(&cs35l41->fw_mutex);
- break;
- case HDA_GEN_PCM_ACT_CLEANUP:
- mutex_lock(&cs35l41->fw_mutex);
-- regmap_multi_reg_write(reg, cs35l41_hda_mute, ARRAY_SIZE(cs35l41_hda_mute));
-- ret = cs35l41_global_enable(dev, reg, cs35l41->hw_cfg.bst_type, 0, NULL,
-- cs35l41->firmware_running);
-+ cs35l41_hda_pause_start(dev);
- mutex_unlock(&cs35l41->fw_mutex);
- break;
- case HDA_GEN_PCM_ACT_CLOSE:
- mutex_lock(&cs35l41->fw_mutex);
-- ret = regmap_update_bits(reg, CS35L41_PWR_CTRL2,
-- CS35L41_AMP_EN_MASK, 0 << CS35L41_AMP_EN_SHIFT);
-- if (cs35l41->hw_cfg.bst_type == CS35L41_EXT_BOOST)
-- regmap_write(reg, CS35L41_GPIO1_CTRL1, 0x00000001);
-- if (cs35l41->firmware_running) {
-- cs35l41_set_cspl_mbox_cmd(cs35l41->dev, cs35l41->regmap,
-- CSPL_MBOX_CMD_PAUSE);
-- regmap_update_bits(cs35l41->regmap, CS35L41_PWR_CTRL2,
-- CS35L41_VMON_EN_MASK | CS35L41_IMON_EN_MASK,
-- 0 << CS35L41_VMON_EN_SHIFT | 0 << CS35L41_IMON_EN_SHIFT);
-- }
-- cs35l41_irq_release(cs35l41);
-- cs35l41->playback_started = false;
-+ cs35l41_hda_pause_done(dev);
- mutex_unlock(&cs35l41->fw_mutex);
-
- pm_runtime_mark_last_busy(dev);
-@@ -549,9 +589,6 @@ static void cs35l41_hda_playback_hook(struct device *dev, int action)
- dev_warn(cs35l41->dev, "Playback action not supported: %d\n", action);
- break;
- }
--
-- if (ret)
-- dev_err(cs35l41->dev, "Regmap access fail: %d\n", ret);
- }
-
- static int cs35l41_hda_channel_map(struct device *dev, unsigned int tx_num, unsigned int *tx_slot,
-@@ -703,18 +740,8 @@ static int cs35l41_runtime_suspend(struct device *dev)
- mutex_lock(&cs35l41->fw_mutex);
-
- if (cs35l41->playback_started) {
-- regmap_multi_reg_write(cs35l41->regmap, cs35l41_hda_mute,
-- ARRAY_SIZE(cs35l41_hda_mute));
-- cs35l41_global_enable(cs35l41->dev, cs35l41->regmap, cs35l41->hw_cfg.bst_type, 0,
-- NULL, cs35l41->firmware_running);
-- regmap_update_bits(cs35l41->regmap, CS35L41_PWR_CTRL2,
-- CS35L41_AMP_EN_MASK, 0 << CS35L41_AMP_EN_SHIFT);
-- if (cs35l41->hw_cfg.bst_type == CS35L41_EXT_BOOST)
-- regmap_write(cs35l41->regmap, CS35L41_GPIO1_CTRL1, 0x00000001);
-- regmap_update_bits(cs35l41->regmap, CS35L41_PWR_CTRL2,
-- CS35L41_VMON_EN_MASK | CS35L41_IMON_EN_MASK,
-- 0 << CS35L41_VMON_EN_SHIFT | 0 << CS35L41_IMON_EN_SHIFT);
-- cs35l41->playback_started = false;
-+ cs35l41_hda_pause_start(dev);
-+ cs35l41_hda_pause_done(dev);
- }
-
- if (cs35l41->firmware_running) {
---
-2.41.0
-
diff --git a/0006-btrfs-set-last-dir-index-to-the-current-last-index-w.patch b/0006-btrfs-set-last-dir-index-to-the-current-last-index-w.patch
deleted file mode 100644
index c0cbc0f8f5a8..000000000000
--- a/0006-btrfs-set-last-dir-index-to-the-current-last-index-w.patch
+++ /dev/null
@@ -1,86 +0,0 @@
-From c8026dde1f99ec4f682765aaac7993a964184a15 Mon Sep 17 00:00:00 2001
-From: Filipe Manana <fdmanana@suse.com>
-Date: Sat, 9 Sep 2023 11:34:40 +0100
-Subject: [PATCH 6/8] btrfs: set last dir index to the current last index when
- opening dir
-
-When opening a directory for reading it, we set the last index where we
-stop iteration to the value in struct btrfs_inode::index_cnt. That value
-does not match the index of the most recently added directory entry but
-it's instead the index number that will be assigned the next directory
-entry.
-
-This means that if after the call to opendir(3) new directory entries are
-added, a readdir(3) call will return the first new directory entry. This
-is fine because POSIX says the following [1]:
-
- "If a file is removed from or added to the directory after the most
- recent call to opendir() or rewinddir(), whether a subsequent call to
- readdir() returns an entry for that file is unspecified."
-
-For example for the test script from commit 9b378f6ad48c ("btrfs: fix
-infinite directory reads"), where we have 2000 files in a directory, ext4
-doesn't return any new directory entry after opendir(3), while xfs returns
-the first 13 new directory entries added after the opendir(3) call.
-
-If we move to a shorter example with an empty directory when opendir(3) is
-called, and 2 files added to the directory after the opendir(3) call, then
-readdir(3) on btrfs will return the first file, ext4 and xfs return the 2
-files (but in a different order). A test program for this, reported by
-Ian Johnson, is the following:
-
- #include <dirent.h>
- #include <stdio.h>
-
- int main(void) {
- DIR *dir = opendir("test");
-
- FILE *file;
- file = fopen("test/1", "w");
- fwrite("1", 1, 1, file);
- fclose(file);
-
- file = fopen("test/2", "w");
- fwrite("2", 1, 1, file);
- fclose(file);
-
- struct dirent *entry;
- while ((entry = readdir(dir))) {
- printf("%s\n", entry->d_name);
- }
- closedir(dir);
- return 0;
- }
-
-To make this less odd, change the behaviour to never return new entries
-that were added after the opendir(3) call. This is done by setting the
-last_index field of the struct btrfs_file_private attached to the
-directory's file handle with a value matching btrfs_inode::index_cnt
-minus 1, since that value always matches the index of the next new
-directory entry and not the index of the most recently added entry.
-
-[1] https://pubs.opengroup.org/onlinepubs/007904875/functions/readdir_r.html
-
-Link: https://lore.kernel.org/linux-btrfs/YR1P0S.NGASEG570GJ8@ianjohnson.dev/
-Signed-off-by: Filipe Manana <fdmanana@suse.com>
----
- fs/btrfs/inode.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index aa090b0b5d298..e3a52438f4f1f 100644
---- a/fs/btrfs/inode.c
-+++ b/fs/btrfs/inode.c
-@@ -5935,7 +5935,8 @@ static int btrfs_get_dir_last_index(struct btrfs_inode *dir, u64 *index)
- }
- }
-
-- *index = dir->index_cnt;
-+ /* index_cnt is the index number of next new entry, so decrement it. */
-+ *index = dir->index_cnt - 1;
-
- return 0;
- }
---
-2.41.0
-
diff --git a/0006-platform-x86-asus-wmi-disable-USB0-hub-on-ROG-Ally-b.patch b/0006-platform-x86-asus-wmi-disable-USB0-hub-on-ROG-Ally-b.patch
new file mode 100644
index 000000000000..208645a7bc91
--- /dev/null
+++ b/0006-platform-x86-asus-wmi-disable-USB0-hub-on-ROG-Ally-b.patch
@@ -0,0 +1,141 @@
+From "Luke D. Jones" <luke@ljones.dev>
+Subject [PATCH v2 1/1] platform/x86: asus-wmi: disable USB0 hub on ROG Ally before suspend
+Date Mon, 27 Nov 2023 12:05:21 +1300
+
+ASUS have worked around an issue in XInput where it doesn't support USB
+selective suspend, which causes suspend issues in Windows. They worked
+around this by adjusting the MCU firmware to disable the USB0 hub when
+the screen is switched off during the Microsoft DSM suspend path in ACPI.
+
+The issue we have with this however is one of timing - the call the tells
+the MCU to this isn't able to complete before suspend is done so we call
+this in a prepare() and add a small msleep() to ensure it is done. This
+must be done before the screen is switched off to prevent a variety of
+possible races.
+
+Further to this the MCU powersave option must also be disabled as it can
+cause a number of issues such as:
+- unreliable resume connection of N-Key
+- complete loss of N-Key if the power is plugged in while suspended
+Disabling the powersave option prevents this.
+
+Without this the MCU is unable to initialise itself correctly on resume.
+
+Signed-off-by: Luke D. Jones <luke@ljones.dev>
+---
+ drivers/platform/x86/asus-wmi.c | 50 ++++++++++++++++++++++
+ include/linux/platform_data/x86/asus-wmi.h | 3 ++
+ 2 files changed, 53 insertions(+)
+
+diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
+index 6a79f16233ab..4ba33dfebfd4 100644
+--- a/drivers/platform/x86/asus-wmi.c
++++ b/drivers/platform/x86/asus-wmi.c
+@@ -16,6 +16,7 @@
+ #include <linux/acpi.h>
+ #include <linux/backlight.h>
+ #include <linux/debugfs.h>
++#include <linux/delay.h>
+ #include <linux/dmi.h>
+ #include <linux/fb.h>
+ #include <linux/hwmon.h>
+@@ -132,6 +133,11 @@ module_param(fnlock_default, bool, 0444);
+ #define ASUS_SCREENPAD_BRIGHT_MAX 255
+ #define ASUS_SCREENPAD_BRIGHT_DEFAULT 60
+
++/* Controls the power state of the USB0 hub on ROG Ally which input is on */
++#define ASUS_USB0_PWR_EC0_CSEE "\\_SB.PCI0.SBRG.EC0.CSEE"
++/* 300ms so far seems to produce a reliable result on AC and battery */
++#define ASUS_USB0_PWR_EC0_CSEE_WAIT 300
++
+ static const char * const ashs_ids[] = { "ATK4001", "ATK4002", NULL };
+
+ static int throttle_thermal_policy_write(struct asus_wmi *);
+@@ -300,6 +306,9 @@ struct asus_wmi {
+
+ bool fnlock_locked;
+
++ /* The ROG Ally device requires the MCU USB device be disconnected before suspend */
++ bool ally_mcu_usb_switch;
++
+ struct asus_wmi_debug debug;
+
+ struct asus_wmi_driver *driver;
+@@ -4488,6 +4497,8 @@ static int asus_wmi_add(struct platform_device *pdev)
+ asus->nv_temp_tgt_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_NV_THERM_TARGET);
+ asus->panel_overdrive_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PANEL_OD);
+ asus->mini_led_mode_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_MINI_LED_MODE);
++ asus->ally_mcu_usb_switch = acpi_has_method(NULL, ASUS_USB0_PWR_EC0_CSEE)
++ && dmi_match(DMI_BOARD_NAME, "RC71L");
+
+ err = fan_boost_mode_check_present(asus);
+ if (err)
+@@ -4654,6 +4665,43 @@ static int asus_hotk_resume(struct device *device)
+ asus_wmi_fnlock_update(asus);
+
+ asus_wmi_tablet_mode_get_state(asus);
++
++ return 0;
++}
++
++static int asus_hotk_resume_early(struct device *device)
++{
++ struct asus_wmi *asus = dev_get_drvdata(device);
++
++ if (asus->ally_mcu_usb_switch) {
++ if (ACPI_FAILURE(acpi_execute_simple_method(NULL, ASUS_USB0_PWR_EC0_CSEE, 0xB8)))
++ dev_err(device, "ROG Ally MCU failed to connect USB dev\n");
++ else
++ msleep(ASUS_USB0_PWR_EC0_CSEE_WAIT);
++ }
++ return 0;
++}
++
++static int asus_hotk_prepare(struct device *device)
++{
++ struct asus_wmi *asus = dev_get_drvdata(device);
++ int result, err;
++
++ if (asus->ally_mcu_usb_switch) {
++ /* When powersave is enabled it causes many issues with resume of USB hub */
++ result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_MCU_POWERSAVE);
++ if (result == 1) {
++ dev_warn(device, "MCU powersave enabled, disabling to prevent resume issues");
++ err = asus_wmi_set_devstate(ASUS_WMI_DEVID_MCU_POWERSAVE, 0, &result);
++ if (err || result != 1)
++ dev_err(device, "Failed to set MCU powersave mode: %d\n", err);
++ }
++ /* sleep required to ensure USB0 is disabled before sleep continues */
++ if (ACPI_FAILURE(acpi_execute_simple_method(NULL, ASUS_USB0_PWR_EC0_CSEE, 0xB7)))
++ dev_err(device, "ROG Ally MCU failed to disconnect USB dev\n");
++ else
++ msleep(ASUS_USB0_PWR_EC0_CSEE_WAIT);
++ }
+ return 0;
+ }
+
+@@ -4701,6 +4749,8 @@ static const struct dev_pm_ops asus_pm_ops = {
+ .thaw = asus_hotk_thaw,
+ .restore = asus_hotk_restore,
+ .resume = asus_hotk_resume,
++ .resume_early = asus_hotk_resume_early,
++ .prepare = asus_hotk_prepare,
+ };
+
+ /* Registration ***************************************************************/
+diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h
+index 63e630276499..ab1c7deff118 100644
+--- a/include/linux/platform_data/x86/asus-wmi.h
++++ b/include/linux/platform_data/x86/asus-wmi.h
+@@ -114,6 +114,9 @@
+ /* Charging mode - 1=Barrel, 2=USB */
+ #define ASUS_WMI_DEVID_CHARGE_MODE 0x0012006C
+
++/* MCU powersave mode */
++#define ASUS_WMI_DEVID_MCU_POWERSAVE 0x001200E2
++
+ /* epu is connected? 1 == true */
+ #define ASUS_WMI_DEVID_EGPU_CONNECTED 0x00090018
+ /* egpu on/off */
+--
+2.43.0
diff --git a/0007-ALSA-hda-hda_component-Add-pre-and-post-playback-hoo.patch b/0007-ALSA-hda-hda_component-Add-pre-and-post-playback-hoo.patch
deleted file mode 100644
index ab7d89945d9f..000000000000
--- a/0007-ALSA-hda-hda_component-Add-pre-and-post-playback-hoo.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From c1bf8ed3a5f3d011276d975c7b1f62039bed160e Mon Sep 17 00:00:00 2001
-From: Stefan Binding <sbinding@opensource.cirrus.com>
-Date: Fri, 21 Jul 2023 16:18:12 +0100
-Subject: [PATCH 07/11] ALSA: hda: hda_component: Add pre and post playback
- hooks to hda_component
-
-These hooks can be used to add callbacks that would be run before and after
-the main playback hooks. These hooks would be called for all amps, before
-moving on to the next hook, i.e. pre_playback_hook would be called for
-all amps, before the playback_hook is called for all amps, then finally
-the post_playback_hook is called for all amps.
-
-Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
----
- sound/pci/hda/hda_component.h | 2 ++
- sound/pci/hda/patch_realtek.c | 10 +++++++++-
- 2 files changed, 11 insertions(+), 1 deletion(-)
-
-diff --git a/sound/pci/hda/hda_component.h b/sound/pci/hda/hda_component.h
-index 534e845b9cd1..f170aec967c1 100644
---- a/sound/pci/hda/hda_component.h
-+++ b/sound/pci/hda/hda_component.h
-@@ -15,5 +15,7 @@ struct hda_component {
- struct device *dev;
- char name[HDA_MAX_NAME_SIZE];
- struct hda_codec *codec;
-+ void (*pre_playback_hook)(struct device *dev, int action);
- void (*playback_hook)(struct device *dev, int action);
-+ void (*post_playback_hook)(struct device *dev, int action);
- };
-diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
-index 44fccfb93cff..dff92679ae72 100644
---- a/sound/pci/hda/patch_realtek.c
-+++ b/sound/pci/hda/patch_realtek.c
-@@ -6716,9 +6716,17 @@ static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_
- int i;
-
- for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
-- if (spec->comps[i].dev)
-+ if (spec->comps[i].dev && spec->comps[i].pre_playback_hook)
-+ spec->comps[i].pre_playback_hook(spec->comps[i].dev, action);
-+ }
-+ for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
-+ if (spec->comps[i].dev && spec->comps[i].playback_hook)
- spec->comps[i].playback_hook(spec->comps[i].dev, action);
- }
-+ for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
-+ if (spec->comps[i].dev && spec->comps[i].post_playback_hook)
-+ spec->comps[i].post_playback_hook(spec->comps[i].dev, action);
-+ }
- }
-
- struct cs35l41_dev_name {
---
-2.41.0
-
diff --git a/0007-btrfs-refresh-dir-last-index-during-a-rewinddir-3-ca.patch b/0007-btrfs-refresh-dir-last-index-during-a-rewinddir-3-ca.patch
deleted file mode 100644
index 6218aa7ce847..000000000000
--- a/0007-btrfs-refresh-dir-last-index-during-a-rewinddir-3-ca.patch
+++ /dev/null
@@ -1,102 +0,0 @@
-From f2e0f18c8bd9c6d61575a2311d488e21831e1163 Mon Sep 17 00:00:00 2001
-From: Filipe Manana <fdmanana@suse.com>
-Date: Sat, 9 Sep 2023 12:12:14 +0100
-Subject: [PATCH 7/8] btrfs: refresh dir last index during a rewinddir(3) call
-
-When opening a directory we find what's the index of its last entry and
-then store it in the directory's file handle private data (struct
-btrfs_file_private::last_index), so that in the case new directory entries
-are added to a directory after an opendir(3) call we don't end up in an
-infinite loop (see commit 9b378f6ad48c ("btrfs: fix infinite directory
-reads")) when calling readdir(3).
-
-However once rewinddir(3) is called, POSIX states [1] that any new
-directory entries added after the previous opendir(3) call, must be
-returned by subsequent calls to readdir(3):
-
- "The rewinddir() function shall reset the position of the directory
- stream to which dirp refers to the beginning of the directory.
- It shall also cause the directory stream to refer to the current
- state of the corresponding directory, as a call to opendir() would
- have done."
-
-We currently don't refresh the last_index field of the struct
-btrfs_file_private associated to the directory, so after a rewinddir(3)
-we are not returning any new entries added after the opendir(3) call.
-
-Fix this by finding the current last index of the directory when llseek
-is called agains the directory.
-
-This can be reproduced by the following C program provided by Ian Johnson:
-
- #include <dirent.h>
- #include <stdio.h>
-
- int main(void) {
- DIR *dir = opendir("test");
-
- FILE *file;
- file = fopen("test/1", "w");
- fwrite("1", 1, 1, file);
- fclose(file);
-
- file = fopen("test/2", "w");
- fwrite("2", 1, 1, file);
- fclose(file);
-
- rewinddir(dir);
-
- struct dirent *entry;
- while ((entry = readdir(dir))) {
- printf("%s\n", entry->d_name);
- }
- closedir(dir);
- return 0;
- }
-
-[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/rewinddir.html
-
-Reported-by: Ian Johnson <ian@ianjohnson.dev>
-Link: https://lore.kernel.org/linux-btrfs/YR1P0S.NGASEG570GJ8@ianjohnson.dev/
-Fixes: 9b378f6ad48c ("btrfs: fix infinite directory reads")
-Signed-off-by: Filipe Manana <fdmanana@suse.com>
----
- fs/btrfs/inode.c | 15 ++++++++++++++-
- 1 file changed, 14 insertions(+), 1 deletion(-)
-
-diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index e3a52438f4f1f..a50cbcafca03c 100644
---- a/fs/btrfs/inode.c
-+++ b/fs/btrfs/inode.c
-@@ -5973,6 +5973,19 @@ static int btrfs_opendir(struct inode *inode, struct file *file)
- return 0;
- }
-
-+static loff_t btrfs_dir_llseek(struct file *file, loff_t offset, int whence)
-+{
-+ struct btrfs_file_private *private = file->private_data;
-+ int ret;
-+
-+ ret = btrfs_get_dir_last_index(BTRFS_I(file_inode(file)),
-+ &private->last_index);
-+ if (ret)
-+ return ret;
-+
-+ return generic_file_llseek(file, offset, whence);
-+}
-+
- struct dir_entry {
- u64 ino;
- u64 offset;
-@@ -11053,7 +11066,7 @@ static const struct inode_operations btrfs_dir_inode_operations = {
- };
-
- static const struct file_operations btrfs_dir_file_operations = {
-- .llseek = generic_file_llseek,
-+ .llseek = btrfs_dir_llseek,
- .read = generic_read_dir,
- .iterate_shared = btrfs_real_readdir,
- .open = btrfs_opendir,
---
-2.41.0
-
diff --git a/0202-mt7921e_Perform_FLR_to_recovery_the_device.patch b/0007-mt7921e_Perform_FLR_to_recovery_the_device.patch
index 5966c1143c02..5966c1143c02 100644
--- a/0202-mt7921e_Perform_FLR_to_recovery_the_device.patch
+++ b/0007-mt7921e_Perform_FLR_to_recovery_the_device.patch
diff --git a/0008-ALSA-hda-cs35l41-Use-pre-and-post-playback-hooks.patch b/0008-ALSA-hda-cs35l41-Use-pre-and-post-playback-hooks.patch
deleted file mode 100644
index ac5b0290b2bc..000000000000
--- a/0008-ALSA-hda-cs35l41-Use-pre-and-post-playback-hooks.patch
+++ /dev/null
@@ -1,122 +0,0 @@
-From 4f3b42e2f126f96b1e512871d7073fb10d9a7283 Mon Sep 17 00:00:00 2001
-From: Stefan Binding <sbinding@opensource.cirrus.com>
-Date: Fri, 21 Jul 2023 16:18:13 +0100
-Subject: [PATCH 08/11] ALSA: hda: cs35l41: Use pre and post playback hooks
-
-Use new hooks to ensure separation between play/pause actions,
-as required by external boost.
-
-External Boost on CS35L41 requires the amp to go through a
-particular sequence of steps. One of these steps involes
-the setting of a GPIO. This GPIO is connected to one or
-more of the amps, and it may control the boost for all of
-the amps. To ensure that the GPIO is set when it is safe
-to do so, and to ensure that boost is ready for the rest of
-the sequence to be able to continue, we must ensure that
-the each part of the sequence is executed for each amp
-before moving on to the next part of the sequence.
-
-Some of the Play and Pause actions have moved from Open to
-Prepare. This is because Open is not guaranteed to be called
-again on system resume, whereas Prepare should.
-
-Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
----
- sound/pci/hda/cs35l41_hda.c | 53 ++++++++++++++++++++++++++++++-------
- 1 file changed, 43 insertions(+), 10 deletions(-)
-
-diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
-index f77583b46b6b..a482d4752b3f 100644
---- a/sound/pci/hda/cs35l41_hda.c
-+++ b/sound/pci/hda/cs35l41_hda.c
-@@ -556,37 +556,68 @@ static void cs35l41_hda_pause_done(struct device *dev)
- cs35l41->playback_started = false;
- }
-
-+static void cs35l41_hda_pre_playback_hook(struct device *dev, int action)
-+{
-+ struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
-+
-+ switch (action) {
-+ case HDA_GEN_PCM_ACT_CLEANUP:
-+ mutex_lock(&cs35l41->fw_mutex);
-+ cs35l41_hda_pause_start(dev);
-+ mutex_unlock(&cs35l41->fw_mutex);
-+ break;
-+ default:
-+ break;
-+ }
-+}
- static void cs35l41_hda_playback_hook(struct device *dev, int action)
- {
- struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
-
- switch (action) {
- case HDA_GEN_PCM_ACT_OPEN:
-+ /*
-+ * All amps must be resumed before we can start playing back.
-+ * This ensures, for external boost, that all amps are in AMP_SAFE mode.
-+ * Do this in HDA_GEN_PCM_ACT_OPEN, since this is run prior to any of the
-+ * other actions.
-+ */
- pm_runtime_get_sync(dev);
-- mutex_lock(&cs35l41->fw_mutex);
-- cs35l41_hda_play_start(dev);
-- mutex_unlock(&cs35l41->fw_mutex);
- break;
- case HDA_GEN_PCM_ACT_PREPARE:
- mutex_lock(&cs35l41->fw_mutex);
-- cs35l41_hda_play_done(dev);
-+ cs35l41_hda_play_start(dev);
- mutex_unlock(&cs35l41->fw_mutex);
- break;
- case HDA_GEN_PCM_ACT_CLEANUP:
- mutex_lock(&cs35l41->fw_mutex);
-- cs35l41_hda_pause_start(dev);
-+ cs35l41_hda_pause_done(dev);
- mutex_unlock(&cs35l41->fw_mutex);
- break;
- case HDA_GEN_PCM_ACT_CLOSE:
-- mutex_lock(&cs35l41->fw_mutex);
-- cs35l41_hda_pause_done(dev);
-- mutex_unlock(&cs35l41->fw_mutex);
--
-+ /*
-+ * Playback must be finished for all amps before we start runtime suspend.
-+ * This ensures no amps are playing back when we start putting them to sleep.
-+ */
- pm_runtime_mark_last_busy(dev);
- pm_runtime_put_autosuspend(dev);
- break;
- default:
-- dev_warn(cs35l41->dev, "Playback action not supported: %d\n", action);
-+ break;
-+ }
-+}
-+
-+static void cs35l41_hda_post_playback_hook(struct device *dev, int action)
-+{
-+ struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
-+
-+ switch (action) {
-+ case HDA_GEN_PCM_ACT_PREPARE:
-+ mutex_lock(&cs35l41->fw_mutex);
-+ cs35l41_hda_play_done(dev);
-+ mutex_unlock(&cs35l41->fw_mutex);
-+ break;
-+ default:
- break;
- }
- }
-@@ -1037,6 +1068,8 @@ static int cs35l41_hda_bind(struct device *dev, struct device *master, void *mas
- ret = cs35l41_create_controls(cs35l41);
-
- comps->playback_hook = cs35l41_hda_playback_hook;
-+ comps->pre_playback_hook = cs35l41_hda_pre_playback_hook;
-+ comps->post_playback_hook = cs35l41_hda_post_playback_hook;
-
- mutex_unlock(&cs35l41->fw_mutex);
-
---
-2.41.0
-
diff --git a/0008-btrfs-fix-race-between-reading-a-directory-and-addin.patch b/0008-btrfs-fix-race-between-reading-a-directory-and-addin.patch
deleted file mode 100644
index 7da77c9a20cd..000000000000
--- a/0008-btrfs-fix-race-between-reading-a-directory-and-addin.patch
+++ /dev/null
@@ -1,143 +0,0 @@
-From 5c640491ba9cea8c0a01144db26b2c8892506717 Mon Sep 17 00:00:00 2001
-From: Filipe Manana <fdmanana@suse.com>
-Date: Tue, 12 Sep 2023 11:45:39 +0100
-Subject: [PATCH 8/8] btrfs: fix race between reading a directory and adding
- entries to it
-
-When opening a directory (opendir(3)) or rewinding it (rewinddir(3)), we
-are not holding the directory's inode locked, and this can result in later
-attempting to add two entries to the directory with the same index number,
-resulting in a transaction abort, with -EEXIST (-17), when inserting the
-second delayed dir index. This results in a trace like the following:
-
- Sep 11 22:34:59 myhostname kernel: BTRFS error (device dm-3): err add delayed dir index item(name: cockroach-stderr.log) into the insertion tree of the delayed node(root id: 5, inode id: 4539217, errno: -17)
- Sep 11 22:34:59 myhostname kernel: ------------[ cut here ]------------
- Sep 11 22:34:59 myhostname kernel: kernel BUG at fs/btrfs/delayed-inode.c:1504!
- Sep 11 22:34:59 myhostname kernel: invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
- Sep 11 22:34:59 myhostname kernel: CPU: 0 PID: 7159 Comm: cockroach Not tainted 6.4.15-200.fc38.x86_64 #1
- Sep 11 22:34:59 myhostname kernel: Hardware name: ASUS ESC500 G3/P9D WS, BIOS 2402 06/27/2018
- Sep 11 22:34:59 myhostname kernel: RIP: 0010:btrfs_insert_delayed_dir_index+0x1da/0x260
- Sep 11 22:34:59 myhostname kernel: Code: eb dd 48 (...)
- Sep 11 22:34:59 myhostname kernel: RSP: 0000:ffffa9980e0fbb28 EFLAGS: 00010282
- Sep 11 22:34:59 myhostname kernel: RAX: 0000000000000000 RBX: ffff8b10b8f4a3c0 RCX: 0000000000000000
- Sep 11 22:34:59 myhostname kernel: RDX: 0000000000000000 RSI: ffff8b177ec21540 RDI: ffff8b177ec21540
- Sep 11 22:34:59 myhostname kernel: RBP: ffff8b110cf80888 R08: 0000000000000000 R09: ffffa9980e0fb938
- Sep 11 22:34:59 myhostname kernel: R10: 0000000000000003 R11: ffffffff86146508 R12: 0000000000000014
- Sep 11 22:34:59 myhostname kernel: R13: ffff8b1131ae5b40 R14: ffff8b10b8f4a418 R15: 00000000ffffffef
- Sep 11 22:34:59 myhostname kernel: FS: 00007fb14a7fe6c0(0000) GS:ffff8b177ec00000(0000) knlGS:0000000000000000
- Sep 11 22:34:59 myhostname kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
- Sep 11 22:34:59 myhostname kernel: CR2: 000000c00143d000 CR3: 00000001b3b4e002 CR4: 00000000001706f0
- Sep 11 22:34:59 myhostname kernel: Call Trace:
- Sep 11 22:34:59 myhostname kernel: <TASK>
- Sep 11 22:34:59 myhostname kernel: ? die+0x36/0x90
- Sep 11 22:34:59 myhostname kernel: ? do_trap+0xda/0x100
- Sep 11 22:34:59 myhostname kernel: ? btrfs_insert_delayed_dir_index+0x1da/0x260
- Sep 11 22:34:59 myhostname kernel: ? do_error_trap+0x6a/0x90
- Sep 11 22:34:59 myhostname kernel: ? btrfs_insert_delayed_dir_index+0x1da/0x260
- Sep 11 22:34:59 myhostname kernel: ? exc_invalid_op+0x50/0x70
- Sep 11 22:34:59 myhostname kernel: ? btrfs_insert_delayed_dir_index+0x1da/0x260
- Sep 11 22:34:59 myhostname kernel: ? asm_exc_invalid_op+0x1a/0x20
- Sep 11 22:34:59 myhostname kernel: ? btrfs_insert_delayed_dir_index+0x1da/0x260
- Sep 11 22:34:59 myhostname kernel: ? btrfs_insert_delayed_dir_index+0x1da/0x260
- Sep 11 22:34:59 myhostname kernel: btrfs_insert_dir_item+0x200/0x280
- Sep 11 22:34:59 myhostname kernel: btrfs_add_link+0xab/0x4f0
- Sep 11 22:34:59 myhostname kernel: ? ktime_get_real_ts64+0x47/0xe0
- Sep 11 22:34:59 myhostname kernel: btrfs_create_new_inode+0x7cd/0xa80
- Sep 11 22:34:59 myhostname kernel: btrfs_symlink+0x190/0x4d0
- Sep 11 22:34:59 myhostname kernel: ? schedule+0x5e/0xd0
- Sep 11 22:34:59 myhostname kernel: ? __d_lookup+0x7e/0xc0
- Sep 11 22:34:59 myhostname kernel: vfs_symlink+0x148/0x1e0
- Sep 11 22:34:59 myhostname kernel: do_symlinkat+0x130/0x140
- Sep 11 22:34:59 myhostname kernel: __x64_sys_symlinkat+0x3d/0x50
- Sep 11 22:34:59 myhostname kernel: do_syscall_64+0x5d/0x90
- Sep 11 22:34:59 myhostname kernel: ? syscall_exit_to_user_mode+0x2b/0x40
- Sep 11 22:34:59 myhostname kernel: ? do_syscall_64+0x6c/0x90
- Sep 11 22:34:59 myhostname kernel: entry_SYSCALL_64_after_hwframe+0x72/0xdc
-
-The race leading to the problem happens like this:
-
-1) Directory inode X is loaded into memory, its ->index_cnt field is
- initialized to (u64)-1 (at btrfs_alloc_inode());
-
-2) Task A is adding a new file to directory X, holding its vfs inode lock,
- and calls btrfs_set_inode_index() to get an index number for the entry.
-
- Because the inode's index_cnt field is set to (u64)-1 it calls
- btrfs_inode_delayed_dir_index_count() which fails because no dir index
- entries were added yet to the delayed inode and then it calls
- btrfs_set_inode_index_count(). This functions finds the last dir index
- key and then sets index_cnt to that index value + 1. It found that the
- last index key has an offset of 100. However before it assigns a value
- of 101 to index_cnt...
-
-3) Task B calls opendir(3), ending up at btrfs_opendir(), where the vfs
- lock for inode X is not taken, so it calls btrfs_get_dir_last_index()
- and sees index_cnt still with a value of (u64)-1. Because of that it
- calls btrfs_inode_delayed_dir_index_count() which fails since no dir
- index entries were added to the delayed inode yet, and then it also
- calls btrfs_set_inode_index_count(). This also finds that the last
- index key has an offset of 100, and before it assigns the value 101
- to the index_cnt field of inode X...
-
-4) Task A assigns a value of 101 to index_cnt. And then the code flow
- goes to btrfs_set_inode_index() where it increments index_cnt from
- 101 to 102. Task A then creates a delayed dir index entry with a
- sequence number of 101 and adds it to the delayed inode;
-
-5) Task B assigns 101 to the index_cnt field of inode X;
-
-6) At some later point when someone tries to add a new entry to the
- directory, btrfs_set_inode_index() will return 101 again and shortly
- after an attempt to add another delayed dir index key with index
- number 101 will fail with -EEXIST resulting in a transaction abort.
-
-Fix this by locking the inode at btrfs_get_dir_last_index(), which is only
-only used when opening a directory or attempting to lseek on it.
-
-Reported-by: ken <ken@bllue.org>
-Link: https://lore.kernel.org/linux-btrfs/CAE6xmH+Lp=Q=E61bU+v9eWX8gYfLvu6jLYxjxjFpo3zHVPR0EQ@mail.gmail.com/
-Reported-by: syzbot+d13490c82ad5353c779d@syzkaller.appspotmail.com
-Link: https://lore.kernel.org/linux-btrfs/00000000000036e1290603e097e0@google.com/
-Fixes: 9b378f6ad48c ("btrfs: fix infinite directory reads")
-Signed-off-by: Filipe Manana <fdmanana@suse.com>
-Cherry-picked-for: https://bugs.archlinux.org/task/79673
----
- fs/btrfs/inode.c | 11 +++++++----
- 1 file changed, 7 insertions(+), 4 deletions(-)
-
-diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
-index a50cbcafca03c..0d4196cede7d2 100644
---- a/fs/btrfs/inode.c
-+++ b/fs/btrfs/inode.c
-@@ -5924,21 +5924,24 @@ static int btrfs_set_inode_index_count(struct btrfs_inode *inode)
-
- static int btrfs_get_dir_last_index(struct btrfs_inode *dir, u64 *index)
- {
-- if (dir->index_cnt == (u64)-1) {
-- int ret;
-+ int ret = 0;
-
-+ btrfs_inode_lock(dir, 0);
-+ if (dir->index_cnt == (u64)-1) {
- ret = btrfs_inode_delayed_dir_index_count(dir);
- if (ret) {
- ret = btrfs_set_inode_index_count(dir);
- if (ret)
-- return ret;
-+ goto out;
- }
- }
-
- /* index_cnt is the index number of next new entry, so decrement it. */
- *index = dir->index_cnt - 1;
-+out:
-+ btrfs_inode_unlock(dir, 0);
-
-- return 0;
-+ return ret;
- }
-
- /*
---
-2.41.0
-
diff --git a/0009-ALSA-hda-cs35l41-Rework-System-Suspend-to-ensure-cor.patch b/0009-ALSA-hda-cs35l41-Rework-System-Suspend-to-ensure-cor.patch
deleted file mode 100644
index 02d98e408b9f..000000000000
--- a/0009-ALSA-hda-cs35l41-Rework-System-Suspend-to-ensure-cor.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-From 5091ba7ad9ea6a88db464b84b4993cc9e5033a84 Mon Sep 17 00:00:00 2001
-From: Stefan Binding <sbinding@opensource.cirrus.com>
-Date: Fri, 21 Jul 2023 16:18:14 +0100
-Subject: [PATCH 09/11] ALSA: hda: cs35l41: Rework System Suspend to ensure
- correct call separation
-
-In order to correctly pause audio on suspend, amps using external boost
-require parts of the pause sequence to be called for all amps before moving
-on to the next steps.
-For example, as part of pausing the audio, the VSPK GPIO must be disabled,
-but since this GPIO is controlled by one amp, but controls the boost for
-all amps, it is required to separate the calls.
-During playback this is achieved by using the pre and post playback hooks,
-however during system suspend, this is not possible, so to separate the
-calls, we use both the .prepare and .suspend calls to pause the audio.
-
-Currently, for this reason, we do not restart audio on system resume.
-However, we can support this by relying on the playback hook to resume
-playback after system suspend.
-
-Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
----
- sound/pci/hda/cs35l41_hda.c | 40 ++++++++++++++++++++++++++++++++-----
- 1 file changed, 35 insertions(+), 5 deletions(-)
-
-diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
-index a482d4752b3f..70aa819cfbd6 100644
---- a/sound/pci/hda/cs35l41_hda.c
-+++ b/sound/pci/hda/cs35l41_hda.c
-@@ -595,6 +595,15 @@ static void cs35l41_hda_playback_hook(struct device *dev, int action)
- mutex_unlock(&cs35l41->fw_mutex);
- break;
- case HDA_GEN_PCM_ACT_CLOSE:
-+ mutex_lock(&cs35l41->fw_mutex);
-+ if (!cs35l41->firmware_running && cs35l41->request_fw_load &&
-+ !cs35l41->fw_request_ongoing) {
-+ dev_info(dev, "Requesting Firmware Load after HDA_GEN_PCM_ACT_CLOSE\n");
-+ cs35l41->fw_request_ongoing = true;
-+ schedule_work(&cs35l41->fw_load_work);
-+ }
-+ mutex_unlock(&cs35l41->fw_mutex);
-+
- /*
- * Playback must be finished for all amps before we start runtime suspend.
- * This ensures no amps are playing back when we start putting them to sleep.
-@@ -681,6 +690,25 @@ static int cs35l41_ready_for_reset(struct cs35l41_hda *cs35l41)
- return ret;
- }
-
-+static int cs35l41_system_suspend_prep(struct device *dev)
-+{
-+ struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
-+
-+ dev_dbg(cs35l41->dev, "System Suspend Prepare\n");
-+
-+ if (cs35l41->hw_cfg.bst_type == CS35L41_EXT_BOOST_NO_VSPK_SWITCH) {
-+ dev_err_once(cs35l41->dev, "System Suspend not supported\n");
-+ return 0; /* don't block the whole system suspend */
-+ }
-+
-+ mutex_lock(&cs35l41->fw_mutex);
-+ if (cs35l41->playback_started)
-+ cs35l41_hda_pause_start(dev);
-+ mutex_unlock(&cs35l41->fw_mutex);
-+
-+ return 0;
-+}
-+
- static int cs35l41_system_suspend(struct device *dev)
- {
- struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
-@@ -693,6 +721,11 @@ static int cs35l41_system_suspend(struct device *dev)
- return 0; /* don't block the whole system suspend */
- }
-
-+ mutex_lock(&cs35l41->fw_mutex);
-+ if (cs35l41->playback_started)
-+ cs35l41_hda_pause_done(dev);
-+ mutex_unlock(&cs35l41->fw_mutex);
-+
- ret = pm_runtime_force_suspend(dev);
- if (ret) {
- dev_err(dev, "System Suspend Failed, unable to runtime suspend: %d\n", ret);
-@@ -738,6 +771,7 @@ static int cs35l41_system_resume(struct device *dev)
- }
-
- mutex_lock(&cs35l41->fw_mutex);
-+
- if (cs35l41->request_fw_load && !cs35l41->fw_request_ongoing) {
- cs35l41->fw_request_ongoing = true;
- schedule_work(&cs35l41->fw_load_work);
-@@ -770,11 +804,6 @@ static int cs35l41_runtime_suspend(struct device *dev)
-
- mutex_lock(&cs35l41->fw_mutex);
-
-- if (cs35l41->playback_started) {
-- cs35l41_hda_pause_start(dev);
-- cs35l41_hda_pause_done(dev);
-- }
--
- if (cs35l41->firmware_running) {
- ret = cs35l41_enter_hibernate(cs35l41->dev, cs35l41->regmap,
- cs35l41->hw_cfg.bst_type);
-@@ -1641,6 +1670,7 @@ EXPORT_SYMBOL_NS_GPL(cs35l41_hda_remove, SND_HDA_SCODEC_CS35L41);
- const struct dev_pm_ops cs35l41_hda_pm_ops = {
- RUNTIME_PM_OPS(cs35l41_runtime_suspend, cs35l41_runtime_resume,
- cs35l41_runtime_idle)
-+ .prepare = cs35l41_system_suspend_prep,
- SYSTEM_SLEEP_PM_OPS(cs35l41_system_suspend, cs35l41_system_resume)
- };
- EXPORT_SYMBOL_NS_GPL(cs35l41_hda_pm_ops, SND_HDA_SCODEC_CS35L41);
---
-2.41.0
-
diff --git a/0010-ALSA-hda-cs35l41-Add-device_link-between-HDA-and-cs3.patch b/0010-ALSA-hda-cs35l41-Add-device_link-between-HDA-and-cs3.patch
deleted file mode 100644
index ca5244fdbe4c..000000000000
--- a/0010-ALSA-hda-cs35l41-Add-device_link-between-HDA-and-cs3.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-From 74c165859e33b62888b93891d82680350b9a615f Mon Sep 17 00:00:00 2001
-From: Stefan Binding <sbinding@opensource.cirrus.com>
-Date: Fri, 21 Jul 2023 16:18:15 +0100
-Subject: [PATCH 10/11] ALSA: hda: cs35l41: Add device_link between HDA and
- cs35l41_hda
-
-To ensure consistency between the HDA core and the CS35L41 HDA
-driver, add a device_link between them. This ensures that the
-HDA core will suspend first, and resume second, meaning the
-amp driver will not miss any events from the playback hook from
-the HDA core during system suspend and resume.
-
-Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
----
- sound/pci/hda/cs35l41_hda.c | 13 ++++++++++++-
- 1 file changed, 12 insertions(+), 1 deletion(-)
-
-diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
-index 70aa819cfbd6..175378cdf9df 100644
---- a/sound/pci/hda/cs35l41_hda.c
-+++ b/sound/pci/hda/cs35l41_hda.c
-@@ -1063,6 +1063,7 @@ static int cs35l41_hda_bind(struct device *dev, struct device *master, void *mas
- {
- struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
- struct hda_component *comps = master_data;
-+ unsigned int sleep_flags;
- int ret = 0;
-
- if (!comps || cs35l41->index < 0 || cs35l41->index >= HDA_MAX_COMPONENTS)
-@@ -1102,6 +1103,11 @@ static int cs35l41_hda_bind(struct device *dev, struct device *master, void *mas
-
- mutex_unlock(&cs35l41->fw_mutex);
-
-+ sleep_flags = lock_system_sleep();
-+ if (!device_link_add(&comps->codec->core.dev, cs35l41->dev, DL_FLAG_STATELESS))
-+ dev_warn(dev, "Unable to create device link\n");
-+ unlock_system_sleep(sleep_flags);
-+
- pm_runtime_mark_last_busy(dev);
- pm_runtime_put_autosuspend(dev);
-
-@@ -1112,9 +1118,14 @@ static void cs35l41_hda_unbind(struct device *dev, struct device *master, void *
- {
- struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
- struct hda_component *comps = master_data;
-+ unsigned int sleep_flags;
-
-- if (comps[cs35l41->index].dev == dev)
-+ if (comps[cs35l41->index].dev == dev) {
- memset(&comps[cs35l41->index], 0, sizeof(*comps));
-+ sleep_flags = lock_system_sleep();
-+ device_link_remove(&comps->codec->core.dev, cs35l41->dev);
-+ unlock_system_sleep(sleep_flags);
-+ }
- }
-
- static const struct component_ops cs35l41_hda_comp_ops = {
---
-2.41.0
-
diff --git a/0011-ALSA-hda-cs35l41-Ensure-amp-is-only-unmuted-during-p.patch b/0011-ALSA-hda-cs35l41-Ensure-amp-is-only-unmuted-during-p.patch
deleted file mode 100644
index 5049e3963a51..000000000000
--- a/0011-ALSA-hda-cs35l41-Ensure-amp-is-only-unmuted-during-p.patch
+++ /dev/null
@@ -1,73 +0,0 @@
-From 6f1a7b41a626a567fcfe915e9dbe3aea34b6c3ec Mon Sep 17 00:00:00 2001
-From: Stefan Binding <sbinding@opensource.cirrus.com>
-Date: Fri, 21 Jul 2023 16:18:16 +0100
-Subject: [PATCH 11/11] ALSA: hda: cs35l41: Ensure amp is only unmuted during
- playback
-
-Currently we only mute after playback has finished, and unmute
-prior to setting global enable. To prevent any possible pops
-and clicks, mute at probe, and then only unmute after global
-enable is set.
-
-Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
----
- sound/pci/hda/cs35l41_hda.c | 22 ++++++++++++++++++++--
- 1 file changed, 20 insertions(+), 2 deletions(-)
-
-diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
-index 175378cdf9df..98feb5ccd586 100644
---- a/sound/pci/hda/cs35l41_hda.c
-+++ b/sound/pci/hda/cs35l41_hda.c
-@@ -58,8 +58,6 @@ static const struct reg_sequence cs35l41_hda_config[] = {
- { CS35L41_DSP1_RX3_SRC, 0x00000018 }, // DSP1RX3 SRC = VMON
- { CS35L41_DSP1_RX4_SRC, 0x00000019 }, // DSP1RX4 SRC = IMON
- { CS35L41_DSP1_RX5_SRC, 0x00000020 }, // DSP1RX5 SRC = ERRVOL
-- { CS35L41_AMP_DIG_VOL_CTRL, 0x00008000 }, // AMP_HPF_PCM_EN = 1, AMP_VOL_PCM 0.0 dB
-- { CS35L41_AMP_GAIN_CTRL, 0x00000084 }, // AMP_GAIN_PCM 4.5 dB
- };
-
- static const struct reg_sequence cs35l41_hda_config_dsp[] = {
-@@ -82,6 +80,14 @@ static const struct reg_sequence cs35l41_hda_config_dsp[] = {
- { CS35L41_DSP1_RX3_SRC, 0x00000018 }, // DSP1RX3 SRC = VMON
- { CS35L41_DSP1_RX4_SRC, 0x00000019 }, // DSP1RX4 SRC = IMON
- { CS35L41_DSP1_RX5_SRC, 0x00000029 }, // DSP1RX5 SRC = VBSTMON
-+};
-+
-+static const struct reg_sequence cs35l41_hda_unmute[] = {
-+ { CS35L41_AMP_DIG_VOL_CTRL, 0x00008000 }, // AMP_HPF_PCM_EN = 1, AMP_VOL_PCM 0.0 dB
-+ { CS35L41_AMP_GAIN_CTRL, 0x00000084 }, // AMP_GAIN_PCM 4.5 dB
-+};
-+
-+static const struct reg_sequence cs35l41_hda_unmute_dsp[] = {
- { CS35L41_AMP_DIG_VOL_CTRL, 0x00008000 }, // AMP_HPF_PCM_EN = 1, AMP_VOL_PCM 0.0 dB
- { CS35L41_AMP_GAIN_CTRL, 0x00000233 }, // AMP_GAIN_PCM = 17.5dB AMP_GAIN_PDM = 19.5dB
- };
-@@ -522,6 +528,13 @@ static void cs35l41_hda_play_done(struct device *dev)
-
- cs35l41_global_enable(dev, reg, cs35l41->hw_cfg.bst_type, 1, NULL,
- cs35l41->firmware_running);
-+ if (cs35l41->firmware_running) {
-+ regmap_multi_reg_write(reg, cs35l41_hda_unmute_dsp,
-+ ARRAY_SIZE(cs35l41_hda_unmute_dsp));
-+ } else {
-+ regmap_multi_reg_write(reg, cs35l41_hda_unmute,
-+ ARRAY_SIZE(cs35l41_hda_unmute));
-+ }
- }
-
- static void cs35l41_hda_pause_start(struct device *dev)
-@@ -1616,6 +1629,11 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i
- if (ret)
- goto err;
-
-+ ret = regmap_multi_reg_write(cs35l41->regmap, cs35l41_hda_mute,
-+ ARRAY_SIZE(cs35l41_hda_mute));
-+ if (ret)
-+ goto err;
-+
- INIT_WORK(&cs35l41->fw_load_work, cs35l41_fw_load_work);
- mutex_init(&cs35l41->fw_mutex);
-
---
-2.41.0
-
diff --git a/0103-ASoC-Intel-soc-acpi-fix-Dell-SKU-0B34.patch b/0103-ASoC-Intel-soc-acpi-fix-Dell-SKU-0B34.patch
deleted file mode 100644
index 1a6234faa0ef..000000000000
--- a/0103-ASoC-Intel-soc-acpi-fix-Dell-SKU-0B34.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From eb39b2a95930f53bd2cb4fbda0e1372609dff976 Mon Sep 17 00:00:00 2001
-From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
-Date: Tue, 5 Sep 2023 11:16:16 -0400
-Subject: [PATCH 4/8] ASoC: Intel: soc-acpi: fix Dell SKU 0B34
-
-The rule for the SoundWire tables is that the platforms with more
-devices need to be added first. We broke that rule with the Dell SKU
-0B34, and caused the second amplifier for SKU 0AF3 to be ignored.
-
-The fix is simple, we need to move the single-amplifier entry after
-the two-amplifier one.
-
-Fixes: b62a1a839b48 ("ASoC: Intel: soc-acpi: add tables for Dell SKU 0B34")
-Closes: https://github.com/thesofproject/linux/issues/4559
-Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
----
- sound/soc/intel/common/soc-acpi-intel-adl-match.c | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/sound/soc/intel/common/soc-acpi-intel-adl-match.c b/sound/soc/intel/common/soc-acpi-intel-adl-match.c
-index bcd66e0094b4b..c4b57cca6b228 100644
---- a/sound/soc/intel/common/soc-acpi-intel-adl-match.c
-+++ b/sound/soc/intel/common/soc-acpi-intel-adl-match.c
-@@ -648,18 +648,18 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_sdw_machines[] = {
- .drv_name = "sof_sdw",
- .sof_tplg_filename = "sof-adl-rt1316-l2-mono-rt714-l3.tplg",
- },
-- {
-- .link_mask = 0x3, /* rt1316 on link1 & rt714 on link0 */
-- .links = adl_sdw_rt1316_link1_rt714_link0,
-- .drv_name = "sof_sdw",
-- .sof_tplg_filename = "sof-adl-rt1316-l1-mono-rt714-l0.tplg",
-- },
- {
- .link_mask = 0x7, /* rt714 on link0 & two rt1316s on link1 and link2 */
- .links = adl_sdw_rt1316_link12_rt714_link0,
- .drv_name = "sof_sdw",
- .sof_tplg_filename = "sof-adl-rt1316-l12-rt714-l0.tplg",
- },
-+ {
-+ .link_mask = 0x3, /* rt1316 on link1 & rt714 on link0 */
-+ .links = adl_sdw_rt1316_link1_rt714_link0,
-+ .drv_name = "sof_sdw",
-+ .sof_tplg_filename = "sof-adl-rt1316-l1-mono-rt714-l0.tplg",
-+ },
- {
- .link_mask = 0x5, /* 2 active links required */
- .links = adl_sdw_rt1316_link2_rt714_link0,
---
-2.41.0
-
diff --git a/0104-btrfs-wait-on-uncached-block-groups-on-every-allocat.patch b/0104-btrfs-wait-on-uncached-block-groups-on-every-allocat.patch
deleted file mode 100644
index 493337c64d42..000000000000
--- a/0104-btrfs-wait-on-uncached-block-groups-on-every-allocat.patch
+++ /dev/null
@@ -1,255 +0,0 @@
-From 8da079307d115705e243d226591dcb4388cef7e2 Mon Sep 17 00:00:00 2001
-From: Josef Bacik <josef@toxicpanda.com>
-Date: Mon, 31 Jul 2023 16:28:43 -0400
-Subject: [PATCH 5/8] btrfs: wait on uncached block groups on every allocation
- loop
-
-My initial fix for the generic/475 hangs was related to metadata, but
-our CI testing uncovered another case where we hang for similar reasons.
-We again have a task with a plug that is holding an outstanding request
-that is keeping the dm device from finishing it's suspend, and that task
-is stuck in the allocator.
-
-This time it is stuck trying to allocate data, but we do not have a
-block group that matches the size class. The larger loop in the
-allocator looks like this (simplified of course)
-
- find_free_extent
- for_each_block_group {
- ffe_ctl->cached == btrfs_block_group_cache_done(bg)
- if (!ffe_ctl->cached)
- ffe_ctl->have_caching_bg = true;
- do_allocation()
- btrfs_wait_block_group_cache_progress();
- }
-
- if (loop == LOOP_CACHING_WAIT && ffe_ctl->have_caching_bg)
- go search again;
-
-In my earlier fix we were trying to allocate from the block group, but
-we weren't waiting for the progress because we were only waiting for the
-free space to be >= the amount of free space we wanted. My fix made it
-so we waited for forward progress to be made as well, so we would be
-sure to wait.
-
-This time however we did not have a block group that matched our size
-class, so what was happening was this
-
- find_free_extent
- for_each_block_group {
- ffe_ctl->cached == btrfs_block_group_cache_done(bg)
- if (!ffe_ctl->cached)
- ffe_ctl->have_caching_bg = true;
- if (size_class_doesn't_match())
- goto loop;
- do_allocation()
- btrfs_wait_block_group_cache_progress();
- loop:
- release_block_group(block_group);
- }
-
- if (loop == LOOP_CACHING_WAIT && ffe_ctl->have_caching_bg)
- go search again;
-
-The size_class_doesn't_match() part was true, so we'd just skip this
-block group and never wait for caching, and then because we found a
-caching block group we'd just go back and do the loop again. We never
-sleep and thus never flush the plug and we have the same deadlock.
-
-Fix the logic for waiting on the block group caching to instead do it
-unconditionally when we goto loop. This takes the logic out of the
-allocation step, so now the loop looks more like this
-
- find_free_extent
- for_each_block_group {
- ffe_ctl->cached == btrfs_block_group_cache_done(bg)
- if (!ffe_ctl->cached)
- ffe_ctl->have_caching_bg = true;
- if (size_class_doesn't_match())
- goto loop;
- do_allocation()
- btrfs_wait_block_group_cache_progress();
- loop:
- if (loop > LOOP_CACHING_NOWAIT && !ffe_ctl->retry_uncached &&
- !ffe_ctl->cached) {
- ffe_ctl->retry_uncached = true;
- btrfs_wait_block_group_cache_progress();
- }
-
- release_block_group(block_group);
- }
-
- if (loop == LOOP_CACHING_WAIT && ffe_ctl->have_caching_bg)
- go search again;
-
-This simplifies the logic a lot, and makes sure that if we're hitting
-uncached block groups we're always waiting on them at some point.
-
-I ran this through 100 iterations of generic/475, as this particular
-case was harder to hit than the previous one.
-
-Signed-off-by: Josef Bacik <josef@toxicpanda.com>
-Signed-off-by: David Sterba <dsterba@suse.com>
----
- fs/btrfs/extent-tree.c | 61 +++++++++++++-----------------------------
- fs/btrfs/extent-tree.h | 13 +++------
- 2 files changed, 22 insertions(+), 52 deletions(-)
-
-diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
-index f396a9afa4032..6096bd98e6c70 100644
---- a/fs/btrfs/extent-tree.c
-+++ b/fs/btrfs/extent-tree.c
-@@ -3427,7 +3427,6 @@ btrfs_release_block_group(struct btrfs_block_group *cache,
- * Helper function for find_free_extent().
- *
- * Return -ENOENT to inform caller that we need fallback to unclustered mode.
-- * Return -EAGAIN to inform caller that we need to re-search this block group
- * Return >0 to inform caller that we find nothing
- * Return 0 means we have found a location and set ffe_ctl->found_offset.
- */
-@@ -3508,14 +3507,6 @@ static int find_free_extent_clustered(struct btrfs_block_group *bg,
- trace_btrfs_reserve_extent_cluster(bg, ffe_ctl);
- return 0;
- }
-- } else if (!ffe_ctl->cached && ffe_ctl->loop > LOOP_CACHING_NOWAIT &&
-- !ffe_ctl->retry_clustered) {
-- spin_unlock(&last_ptr->refill_lock);
--
-- ffe_ctl->retry_clustered = true;
-- btrfs_wait_block_group_cache_progress(bg, ffe_ctl->num_bytes +
-- ffe_ctl->empty_cluster + ffe_ctl->empty_size);
-- return -EAGAIN;
- }
- /*
- * At this point we either didn't find a cluster or we weren't able to
-@@ -3530,7 +3521,6 @@ static int find_free_extent_clustered(struct btrfs_block_group *bg,
- /*
- * Return >0 to inform caller that we find nothing
- * Return 0 when we found an free extent and set ffe_ctrl->found_offset
-- * Return -EAGAIN to inform caller that we need to re-search this block group
- */
- static int find_free_extent_unclustered(struct btrfs_block_group *bg,
- struct find_free_extent_ctl *ffe_ctl)
-@@ -3568,25 +3558,8 @@ static int find_free_extent_unclustered(struct btrfs_block_group *bg,
- offset = btrfs_find_space_for_alloc(bg, ffe_ctl->search_start,
- ffe_ctl->num_bytes, ffe_ctl->empty_size,
- &ffe_ctl->max_extent_size);
--
-- /*
-- * If we didn't find a chunk, and we haven't failed on this block group
-- * before, and this block group is in the middle of caching and we are
-- * ok with waiting, then go ahead and wait for progress to be made, and
-- * set @retry_unclustered to true.
-- *
-- * If @retry_unclustered is true then we've already waited on this
-- * block group once and should move on to the next block group.
-- */
-- if (!offset && !ffe_ctl->retry_unclustered && !ffe_ctl->cached &&
-- ffe_ctl->loop > LOOP_CACHING_NOWAIT) {
-- btrfs_wait_block_group_cache_progress(bg, ffe_ctl->num_bytes +
-- ffe_ctl->empty_size);
-- ffe_ctl->retry_unclustered = true;
-- return -EAGAIN;
-- } else if (!offset) {
-+ if (!offset)
- return 1;
-- }
- ffe_ctl->found_offset = offset;
- return 0;
- }
-@@ -3600,7 +3573,7 @@ static int do_allocation_clustered(struct btrfs_block_group *block_group,
- /* We want to try and use the cluster allocator, so lets look there */
- if (ffe_ctl->last_ptr && ffe_ctl->use_cluster) {
- ret = find_free_extent_clustered(block_group, ffe_ctl, bg_ret);
-- if (ret >= 0 || ret == -EAGAIN)
-+ if (ret >= 0)
- return ret;
- /* ret == -ENOENT case falls through */
- }
-@@ -3816,8 +3789,7 @@ static void release_block_group(struct btrfs_block_group *block_group,
- {
- switch (ffe_ctl->policy) {
- case BTRFS_EXTENT_ALLOC_CLUSTERED:
-- ffe_ctl->retry_clustered = false;
-- ffe_ctl->retry_unclustered = false;
-+ ffe_ctl->retry_uncached = false;
- break;
- case BTRFS_EXTENT_ALLOC_ZONED:
- /* Nothing to do */
-@@ -4168,9 +4140,7 @@ static noinline int find_free_extent(struct btrfs_root *root,
- ffe_ctl->orig_have_caching_bg = false;
- ffe_ctl->index = btrfs_bg_flags_to_raid_index(ffe_ctl->flags);
- ffe_ctl->loop = 0;
-- /* For clustered allocation */
-- ffe_ctl->retry_clustered = false;
-- ffe_ctl->retry_unclustered = false;
-+ ffe_ctl->retry_uncached = false;
- ffe_ctl->cached = 0;
- ffe_ctl->max_extent_size = 0;
- ffe_ctl->total_free_space = 0;
-@@ -4321,16 +4291,12 @@ static noinline int find_free_extent(struct btrfs_root *root,
-
- bg_ret = NULL;
- ret = do_allocation(block_group, ffe_ctl, &bg_ret);
-- if (ret == 0) {
-- if (bg_ret && bg_ret != block_group) {
-- btrfs_release_block_group(block_group,
-- ffe_ctl->delalloc);
-- block_group = bg_ret;
-- }
-- } else if (ret == -EAGAIN) {
-- goto have_block_group;
-- } else if (ret > 0) {
-+ if (ret > 0)
- goto loop;
-+
-+ if (bg_ret && bg_ret != block_group) {
-+ btrfs_release_block_group(block_group, ffe_ctl->delalloc);
-+ block_group = bg_ret;
- }
-
- /* Checks */
-@@ -4371,6 +4337,15 @@ static noinline int find_free_extent(struct btrfs_root *root,
- btrfs_release_block_group(block_group, ffe_ctl->delalloc);
- break;
- loop:
-+ if (!ffe_ctl->cached && ffe_ctl->loop > LOOP_CACHING_NOWAIT &&
-+ !ffe_ctl->retry_uncached) {
-+ ffe_ctl->retry_uncached = true;
-+ btrfs_wait_block_group_cache_progress(block_group,
-+ ffe_ctl->num_bytes +
-+ ffe_ctl->empty_cluster +
-+ ffe_ctl->empty_size);
-+ goto have_block_group;
-+ }
- release_block_group(block_group, ffe_ctl, ffe_ctl->delalloc);
- cond_resched();
- }
-diff --git a/fs/btrfs/extent-tree.h b/fs/btrfs/extent-tree.h
-index 429d5c5700618..6bfba2f22fdd4 100644
---- a/fs/btrfs/extent-tree.h
-+++ b/fs/btrfs/extent-tree.h
-@@ -48,16 +48,11 @@ struct find_free_extent_ctl {
- int loop;
-
- /*
-- * Whether we're refilling a cluster, if true we need to re-search
-- * current block group but don't try to refill the cluster again.
-+ * Set to true if we're retrying the allocation on this block group
-+ * after waiting for caching progress, this is so that we retry only
-+ * once before moving on to another block group.
- */
-- bool retry_clustered;
--
-- /*
-- * Whether we're updating free space cache, if true we need to re-search
-- * current block group but don't try updating free space cache again.
-- */
-- bool retry_unclustered;
-+ bool retry_uncached;
-
- /* If current block group is cached */
- int cached;
---
-2.41.0
-
diff --git a/0105-net_wwan_t7xx_add-AP-CLDMA.patch b/0105-net_wwan_t7xx_add-AP-CLDMA.patch
deleted file mode 100644
index d3b001a7e58f..000000000000
--- a/0105-net_wwan_t7xx_add-AP-CLDMA.patch
+++ /dev/null
@@ -1,504 +0,0 @@
-From c21ba287d8ffc883987593b24b4058964e242c84 Mon Sep 17 00:00:00 2001
-From: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
-Date: Tue, 11 Jul 2023 08:28:13 +0200
-Subject: [PATCH] net: wwan: t7xx: Add AP CLDMA
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-At this moment with the current status, t7xx is not functional due to
-problems like this after connection, if there is no activity:
-[ 57.370534] mtk_t7xx 0000:72:00.0: [PM] SAP suspend error: -110
-[ 57.370581] mtk_t7xx 0000:72:00.0: can't suspend
- (t7xx_pci_pm_runtime_suspend [mtk_t7xx] returned -110)
-because after this, the traffic no longer works.
-
-The complete series 'net: wwan: t7xx: fw flashing & coredump support'
-was reverted because of issues with the pci implementation.
-In order to have at least the modem working, it would be enough if just
-the first commit of the series is re-applied:
-d20ef656f994 net: wwan: t7xx: Add AP CLDMA
-With that, the Application Processor would be controlled, correctly
-suspended and the commented problems would be fixed (I am testing here
-like this with no related issue).
-
-This commit is independent of the others and not related to the
-commented pci implementation for the new features: fw flashing and
-coredump collection.
-
-Use v2 patch version of d20ef656f994 as JinJian Song suggests
-(https://patchwork.kernel.org/project/netdevbpf/patch/20230105154215.198828-1-m.chetan.kumar@linux.intel.com/).
-
-Original text from the commit that would be re-applied:
-
- d20ef656f994 net: wwan: t7xx: Add AP CLDMA
- Author: Haijun Liu <haijun.liu@mediatek.com>
- Date: Tue Aug 16 09:53:28 2022 +0530
-
- The t7xx device contains two Cross Layer DMA (CLDMA) interfaces to
- communicate with AP and Modem processors respectively. So far only
- MD-CLDMA was being used, this patch enables AP-CLDMA.
-
- Rename small Application Processor (sAP) to AP.
-
- Signed-off-by: Haijun Liu <haijun.liu@mediatek.com>
- Co-developed-by: Madhusmita Sahu <madhusmita.sahu@intel.com>
- Signed-off-by: Madhusmita Sahu <madhusmita.sahu@intel.com>
- Signed-off-by: Moises Veleta <moises.veleta@linux.intel.com>
- Signed-off-by: Devegowda Chandrashekar <chandrashekar.devegowda@intel.com>
- Signed-off-by: M Chetan Kumar <m.chetan.kumar@linux.intel.com>
- Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
- Reviewed-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
- Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
-
-Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
-Reviewed-by: Simon Horman <simon.horman@corigine.com>
-Link: https://lore.kernel.org/r/20230711062817.6108-1-jtornosm@redhat.com
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Cherry-picked-for: https://bugs.archlinux.org/task/79728
----
- drivers/net/wwan/t7xx/t7xx_hif_cldma.c | 17 +++--
- drivers/net/wwan/t7xx/t7xx_hif_cldma.h | 2 +-
- drivers/net/wwan/t7xx/t7xx_mhccif.h | 1 +
- drivers/net/wwan/t7xx/t7xx_modem_ops.c | 76 +++++++++++++++++-----
- drivers/net/wwan/t7xx/t7xx_modem_ops.h | 2 +
- drivers/net/wwan/t7xx/t7xx_port.h | 6 +-
- drivers/net/wwan/t7xx/t7xx_port_ctrl_msg.c | 8 ++-
- drivers/net/wwan/t7xx/t7xx_port_proxy.c | 18 ++++-
- drivers/net/wwan/t7xx/t7xx_reg.h | 2 +-
- drivers/net/wwan/t7xx/t7xx_state_monitor.c | 13 +++-
- drivers/net/wwan/t7xx/t7xx_state_monitor.h | 2 +
- 11 files changed, 116 insertions(+), 31 deletions(-)
-
-diff --git a/drivers/net/wwan/t7xx/t7xx_hif_cldma.c b/drivers/net/wwan/t7xx/t7xx_hif_cldma.c
-index 7162bf38a8c906..cc70360364b7d6 100644
---- a/drivers/net/wwan/t7xx/t7xx_hif_cldma.c
-+++ b/drivers/net/wwan/t7xx/t7xx_hif_cldma.c
-@@ -1066,13 +1066,18 @@ static void t7xx_hw_info_init(struct cldma_ctrl *md_ctrl)
- struct t7xx_cldma_hw *hw_info = &md_ctrl->hw_info;
- u32 phy_ao_base, phy_pd_base;
-
-- if (md_ctrl->hif_id != CLDMA_ID_MD)
-- return;
--
-- phy_ao_base = CLDMA1_AO_BASE;
-- phy_pd_base = CLDMA1_PD_BASE;
-- hw_info->phy_interrupt_id = CLDMA1_INT;
- hw_info->hw_mode = MODE_BIT_64;
-+
-+ if (md_ctrl->hif_id == CLDMA_ID_MD) {
-+ phy_ao_base = CLDMA1_AO_BASE;
-+ phy_pd_base = CLDMA1_PD_BASE;
-+ hw_info->phy_interrupt_id = CLDMA1_INT;
-+ } else {
-+ phy_ao_base = CLDMA0_AO_BASE;
-+ phy_pd_base = CLDMA0_PD_BASE;
-+ hw_info->phy_interrupt_id = CLDMA0_INT;
-+ }
-+
- hw_info->ap_ao_base = t7xx_pcie_addr_transfer(pbase->pcie_ext_reg_base,
- pbase->pcie_dev_reg_trsl_addr, phy_ao_base);
- hw_info->ap_pdn_base = t7xx_pcie_addr_transfer(pbase->pcie_ext_reg_base,
-diff --git a/drivers/net/wwan/t7xx/t7xx_hif_cldma.h b/drivers/net/wwan/t7xx/t7xx_hif_cldma.h
-index 47a35e552da78a..4410bac6993aef 100644
---- a/drivers/net/wwan/t7xx/t7xx_hif_cldma.h
-+++ b/drivers/net/wwan/t7xx/t7xx_hif_cldma.h
-@@ -34,7 +34,7 @@
- /**
- * enum cldma_id - Identifiers for CLDMA HW units.
- * @CLDMA_ID_MD: Modem control channel.
-- * @CLDMA_ID_AP: Application Processor control channel (not used at the moment).
-+ * @CLDMA_ID_AP: Application Processor control channel.
- * @CLDMA_NUM: Number of CLDMA HW units available.
- */
- enum cldma_id {
-diff --git a/drivers/net/wwan/t7xx/t7xx_mhccif.h b/drivers/net/wwan/t7xx/t7xx_mhccif.h
-index 209b386bc08866..20c50dce9fc31e 100644
---- a/drivers/net/wwan/t7xx/t7xx_mhccif.h
-+++ b/drivers/net/wwan/t7xx/t7xx_mhccif.h
-@@ -25,6 +25,7 @@
- D2H_INT_EXCEPTION_CLEARQ_DONE | \
- D2H_INT_EXCEPTION_ALLQ_RESET | \
- D2H_INT_PORT_ENUM | \
-+ D2H_INT_ASYNC_AP_HK | \
- D2H_INT_ASYNC_MD_HK)
-
- void t7xx_mhccif_mask_set(struct t7xx_pci_dev *t7xx_dev, u32 val);
-diff --git a/drivers/net/wwan/t7xx/t7xx_modem_ops.c b/drivers/net/wwan/t7xx/t7xx_modem_ops.c
-index 7d0f5e4f0a7815..24e7d491468e0a 100644
---- a/drivers/net/wwan/t7xx/t7xx_modem_ops.c
-+++ b/drivers/net/wwan/t7xx/t7xx_modem_ops.c
-@@ -44,6 +44,7 @@
- #include "t7xx_state_monitor.h"
-
- #define RT_ID_MD_PORT_ENUM 0
-+#define RT_ID_AP_PORT_ENUM 1
- /* Modem feature query identification code - "ICCC" */
- #define MD_FEATURE_QUERY_ID 0x49434343
-
-@@ -298,6 +299,7 @@ static void t7xx_md_exception(struct t7xx_modem *md, enum hif_ex_stage stage)
- }
-
- t7xx_cldma_exception(md->md_ctrl[CLDMA_ID_MD], stage);
-+ t7xx_cldma_exception(md->md_ctrl[CLDMA_ID_AP], stage);
-
- if (stage == HIF_EX_INIT)
- t7xx_mhccif_h2d_swint_trigger(t7xx_dev, H2D_CH_EXCEPTION_ACK);
-@@ -426,7 +428,7 @@ static int t7xx_parse_host_rt_data(struct t7xx_fsm_ctl *ctl, struct t7xx_sys_inf
- if (ft_spt_st != MTK_FEATURE_MUST_BE_SUPPORTED)
- return -EINVAL;
-
-- if (i == RT_ID_MD_PORT_ENUM)
-+ if (i == RT_ID_MD_PORT_ENUM || i == RT_ID_AP_PORT_ENUM)
- t7xx_port_enum_msg_handler(ctl->md, rt_feature->data);
- }
-
-@@ -456,12 +458,12 @@ static int t7xx_core_reset(struct t7xx_modem *md)
- return 0;
- }
-
--static void t7xx_core_hk_handler(struct t7xx_modem *md, struct t7xx_fsm_ctl *ctl,
-+static void t7xx_core_hk_handler(struct t7xx_modem *md, struct t7xx_sys_info *core_info,
-+ struct t7xx_fsm_ctl *ctl,
- enum t7xx_fsm_event_state event_id,
- enum t7xx_fsm_event_state err_detect)
- {
- struct t7xx_fsm_event *event = NULL, *event_next;
-- struct t7xx_sys_info *core_info = &md->core_md;
- struct device *dev = &md->t7xx_dev->pdev->dev;
- unsigned long flags;
- int ret;
-@@ -531,19 +533,33 @@ static void t7xx_md_hk_wq(struct work_struct *work)
- t7xx_cldma_start(md->md_ctrl[CLDMA_ID_MD]);
- t7xx_fsm_broadcast_state(ctl, MD_STATE_WAITING_FOR_HS2);
- md->core_md.handshake_ongoing = true;
-- t7xx_core_hk_handler(md, ctl, FSM_EVENT_MD_HS2, FSM_EVENT_MD_HS2_EXIT);
-+ t7xx_core_hk_handler(md, &md->core_md, ctl, FSM_EVENT_MD_HS2, FSM_EVENT_MD_HS2_EXIT);
-+}
-+
-+static void t7xx_ap_hk_wq(struct work_struct *work)
-+{
-+ struct t7xx_modem *md = container_of(work, struct t7xx_modem, ap_handshake_work);
-+ struct t7xx_fsm_ctl *ctl = md->fsm_ctl;
-+
-+ /* Clear the HS2 EXIT event appended in t7xx_core_reset(). */
-+ t7xx_fsm_clr_event(ctl, FSM_EVENT_AP_HS2_EXIT);
-+ t7xx_cldma_stop(md->md_ctrl[CLDMA_ID_AP]);
-+ t7xx_cldma_switch_cfg(md->md_ctrl[CLDMA_ID_AP]);
-+ t7xx_cldma_start(md->md_ctrl[CLDMA_ID_AP]);
-+ md->core_ap.handshake_ongoing = true;
-+ t7xx_core_hk_handler(md, &md->core_ap, ctl, FSM_EVENT_AP_HS2, FSM_EVENT_AP_HS2_EXIT);
- }
-
- void t7xx_md_event_notify(struct t7xx_modem *md, enum md_event_id evt_id)
- {
- struct t7xx_fsm_ctl *ctl = md->fsm_ctl;
-- void __iomem *mhccif_base;
- unsigned int int_sta;
- unsigned long flags;
-
- switch (evt_id) {
- case FSM_PRE_START:
-- t7xx_mhccif_mask_clr(md->t7xx_dev, D2H_INT_PORT_ENUM);
-+ t7xx_mhccif_mask_clr(md->t7xx_dev, D2H_INT_PORT_ENUM | D2H_INT_ASYNC_MD_HK |
-+ D2H_INT_ASYNC_AP_HK);
- break;
-
- case FSM_START:
-@@ -556,16 +572,26 @@ void t7xx_md_event_notify(struct t7xx_modem *md, enum md_event_id evt_id)
- ctl->exp_flg = true;
- md->exp_id &= ~D2H_INT_EXCEPTION_INIT;
- md->exp_id &= ~D2H_INT_ASYNC_MD_HK;
-+ md->exp_id &= ~D2H_INT_ASYNC_AP_HK;
- } else if (ctl->exp_flg) {
- md->exp_id &= ~D2H_INT_ASYNC_MD_HK;
-- } else if (md->exp_id & D2H_INT_ASYNC_MD_HK) {
-- queue_work(md->handshake_wq, &md->handshake_work);
-- md->exp_id &= ~D2H_INT_ASYNC_MD_HK;
-- mhccif_base = md->t7xx_dev->base_addr.mhccif_rc_base;
-- iowrite32(D2H_INT_ASYNC_MD_HK, mhccif_base + REG_EP2RC_SW_INT_ACK);
-- t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_MD_HK);
-+ md->exp_id &= ~D2H_INT_ASYNC_AP_HK;
- } else {
-- t7xx_mhccif_mask_clr(md->t7xx_dev, D2H_INT_ASYNC_MD_HK);
-+ void __iomem *mhccif_base = md->t7xx_dev->base_addr.mhccif_rc_base;
-+
-+ if (md->exp_id & D2H_INT_ASYNC_MD_HK) {
-+ queue_work(md->handshake_wq, &md->handshake_work);
-+ md->exp_id &= ~D2H_INT_ASYNC_MD_HK;
-+ iowrite32(D2H_INT_ASYNC_MD_HK, mhccif_base + REG_EP2RC_SW_INT_ACK);
-+ t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_MD_HK);
-+ }
-+
-+ if (md->exp_id & D2H_INT_ASYNC_AP_HK) {
-+ queue_work(md->handshake_wq, &md->ap_handshake_work);
-+ md->exp_id &= ~D2H_INT_ASYNC_AP_HK;
-+ iowrite32(D2H_INT_ASYNC_AP_HK, mhccif_base + REG_EP2RC_SW_INT_ACK);
-+ t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_AP_HK);
-+ }
- }
- spin_unlock_irqrestore(&md->exp_lock, flags);
-
-@@ -578,6 +604,7 @@ void t7xx_md_event_notify(struct t7xx_modem *md, enum md_event_id evt_id)
-
- case FSM_READY:
- t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_MD_HK);
-+ t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_AP_HK);
- break;
-
- default:
-@@ -629,6 +656,12 @@ static struct t7xx_modem *t7xx_md_alloc(struct t7xx_pci_dev *t7xx_dev)
- md->core_md.feature_set[RT_ID_MD_PORT_ENUM] &= ~FEATURE_MSK;
- md->core_md.feature_set[RT_ID_MD_PORT_ENUM] |=
- FIELD_PREP(FEATURE_MSK, MTK_FEATURE_MUST_BE_SUPPORTED);
-+
-+ INIT_WORK(&md->ap_handshake_work, t7xx_ap_hk_wq);
-+ md->core_ap.feature_set[RT_ID_AP_PORT_ENUM] &= ~FEATURE_MSK;
-+ md->core_ap.feature_set[RT_ID_AP_PORT_ENUM] |=
-+ FIELD_PREP(FEATURE_MSK, MTK_FEATURE_MUST_BE_SUPPORTED);
-+
- return md;
- }
-
-@@ -640,6 +673,7 @@ int t7xx_md_reset(struct t7xx_pci_dev *t7xx_dev)
- md->exp_id = 0;
- t7xx_fsm_reset(md);
- t7xx_cldma_reset(md->md_ctrl[CLDMA_ID_MD]);
-+ t7xx_cldma_reset(md->md_ctrl[CLDMA_ID_AP]);
- t7xx_port_proxy_reset(md->port_prox);
- md->md_init_finish = true;
- return t7xx_core_reset(md);
-@@ -669,6 +703,10 @@ int t7xx_md_init(struct t7xx_pci_dev *t7xx_dev)
- if (ret)
- goto err_destroy_hswq;
-
-+ ret = t7xx_cldma_alloc(CLDMA_ID_AP, t7xx_dev);
-+ if (ret)
-+ goto err_destroy_hswq;
-+
- ret = t7xx_fsm_init(md);
- if (ret)
- goto err_destroy_hswq;
-@@ -681,12 +719,16 @@ int t7xx_md_init(struct t7xx_pci_dev *t7xx_dev)
- if (ret)
- goto err_uninit_ccmni;
-
-- ret = t7xx_port_proxy_init(md);
-+ ret = t7xx_cldma_init(md->md_ctrl[CLDMA_ID_AP]);
- if (ret)
- goto err_uninit_md_cldma;
-
-+ ret = t7xx_port_proxy_init(md);
-+ if (ret)
-+ goto err_uninit_ap_cldma;
-+
- ret = t7xx_fsm_append_cmd(md->fsm_ctl, FSM_CMD_START, 0);
-- if (ret) /* fsm_uninit flushes cmd queue */
-+ if (ret) /* t7xx_fsm_uninit() flushes cmd queue */
- goto err_uninit_proxy;
-
- t7xx_md_sys_sw_init(t7xx_dev);
-@@ -696,6 +738,9 @@ int t7xx_md_init(struct t7xx_pci_dev *t7xx_dev)
- err_uninit_proxy:
- t7xx_port_proxy_uninit(md->port_prox);
-
-+err_uninit_ap_cldma:
-+ t7xx_cldma_exit(md->md_ctrl[CLDMA_ID_AP]);
-+
- err_uninit_md_cldma:
- t7xx_cldma_exit(md->md_ctrl[CLDMA_ID_MD]);
-
-@@ -722,6 +767,7 @@ void t7xx_md_exit(struct t7xx_pci_dev *t7xx_dev)
-
- t7xx_fsm_append_cmd(md->fsm_ctl, FSM_CMD_PRE_STOP, FSM_CMD_FLAG_WAIT_FOR_COMPLETION);
- t7xx_port_proxy_uninit(md->port_prox);
-+ t7xx_cldma_exit(md->md_ctrl[CLDMA_ID_AP]);
- t7xx_cldma_exit(md->md_ctrl[CLDMA_ID_MD]);
- t7xx_ccmni_exit(t7xx_dev);
- t7xx_fsm_uninit(md);
-diff --git a/drivers/net/wwan/t7xx/t7xx_modem_ops.h b/drivers/net/wwan/t7xx/t7xx_modem_ops.h
-index 7469ed636ae81a..abe633cf7adc01 100644
---- a/drivers/net/wwan/t7xx/t7xx_modem_ops.h
-+++ b/drivers/net/wwan/t7xx/t7xx_modem_ops.h
-@@ -66,10 +66,12 @@ struct t7xx_modem {
- struct cldma_ctrl *md_ctrl[CLDMA_NUM];
- struct t7xx_pci_dev *t7xx_dev;
- struct t7xx_sys_info core_md;
-+ struct t7xx_sys_info core_ap;
- bool md_init_finish;
- bool rgu_irq_asserted;
- struct workqueue_struct *handshake_wq;
- struct work_struct handshake_work;
-+ struct work_struct ap_handshake_work;
- struct t7xx_fsm_ctl *fsm_ctl;
- struct port_proxy *port_prox;
- unsigned int exp_id;
-diff --git a/drivers/net/wwan/t7xx/t7xx_port.h b/drivers/net/wwan/t7xx/t7xx_port.h
-index 8ea9079af997b0..4ae8a00a85322e 100644
---- a/drivers/net/wwan/t7xx/t7xx_port.h
-+++ b/drivers/net/wwan/t7xx/t7xx_port.h
-@@ -36,9 +36,13 @@
- /* Channel ID and Message ID definitions.
- * The channel number consists of peer_id(15:12) , channel_id(11:0)
- * peer_id:
-- * 0:reserved, 1: to sAP, 2: to MD
-+ * 0:reserved, 1: to AP, 2: to MD
- */
- enum port_ch {
-+ /* to AP */
-+ PORT_CH_AP_CONTROL_RX = 0x1000,
-+ PORT_CH_AP_CONTROL_TX = 0x1001,
-+
- /* to MD */
- PORT_CH_CONTROL_RX = 0x2000,
- PORT_CH_CONTROL_TX = 0x2001,
-diff --git a/drivers/net/wwan/t7xx/t7xx_port_ctrl_msg.c b/drivers/net/wwan/t7xx/t7xx_port_ctrl_msg.c
-index 68430b130a6784..ae632ef966983e 100644
---- a/drivers/net/wwan/t7xx/t7xx_port_ctrl_msg.c
-+++ b/drivers/net/wwan/t7xx/t7xx_port_ctrl_msg.c
-@@ -167,8 +167,12 @@ static int control_msg_handler(struct t7xx_port *port, struct sk_buff *skb)
- case CTL_ID_HS2_MSG:
- skb_pull(skb, sizeof(*ctrl_msg_h));
-
-- if (port_conf->rx_ch == PORT_CH_CONTROL_RX) {
-- ret = t7xx_fsm_append_event(ctl, FSM_EVENT_MD_HS2, skb->data,
-+ if (port_conf->rx_ch == PORT_CH_CONTROL_RX ||
-+ port_conf->rx_ch == PORT_CH_AP_CONTROL_RX) {
-+ int event = port_conf->rx_ch == PORT_CH_CONTROL_RX ?
-+ FSM_EVENT_MD_HS2 : FSM_EVENT_AP_HS2;
-+
-+ ret = t7xx_fsm_append_event(ctl, event, skb->data,
- le32_to_cpu(ctrl_msg_h->data_length));
- if (ret)
- dev_err(port->dev, "Failed to append Handshake 2 event");
-diff --git a/drivers/net/wwan/t7xx/t7xx_port_proxy.c b/drivers/net/wwan/t7xx/t7xx_port_proxy.c
-index 894b1d11b2c9c1..274846d39fbf3f 100644
---- a/drivers/net/wwan/t7xx/t7xx_port_proxy.c
-+++ b/drivers/net/wwan/t7xx/t7xx_port_proxy.c
-@@ -48,7 +48,7 @@
- i < (proxy)->port_count; \
- i++, (p) = &(proxy)->ports[i])
-
--static const struct t7xx_port_conf t7xx_md_port_conf[] = {
-+static const struct t7xx_port_conf t7xx_port_conf[] = {
- {
- .tx_ch = PORT_CH_UART2_TX,
- .rx_ch = PORT_CH_UART2_RX,
-@@ -89,6 +89,14 @@ static const struct t7xx_port_conf t7xx_md_port_conf[] = {
- .path_id = CLDMA_ID_MD,
- .ops = &ctl_port_ops,
- .name = "t7xx_ctrl",
-+ }, {
-+ .tx_ch = PORT_CH_AP_CONTROL_TX,
-+ .rx_ch = PORT_CH_AP_CONTROL_RX,
-+ .txq_index = Q_IDX_CTRL,
-+ .rxq_index = Q_IDX_CTRL,
-+ .path_id = CLDMA_ID_AP,
-+ .ops = &ctl_port_ops,
-+ .name = "t7xx_ap_ctrl",
- },
- };
-
-@@ -428,6 +436,9 @@ static void t7xx_proxy_init_all_ports(struct t7xx_modem *md)
- if (port_conf->tx_ch == PORT_CH_CONTROL_TX)
- md->core_md.ctl_port = port;
-
-+ if (port_conf->tx_ch == PORT_CH_AP_CONTROL_TX)
-+ md->core_ap.ctl_port = port;
-+
- port->t7xx_dev = md->t7xx_dev;
- port->dev = &md->t7xx_dev->pdev->dev;
- spin_lock_init(&port->port_update_lock);
-@@ -442,7 +453,7 @@ static void t7xx_proxy_init_all_ports(struct t7xx_modem *md)
-
- static int t7xx_proxy_alloc(struct t7xx_modem *md)
- {
-- unsigned int port_count = ARRAY_SIZE(t7xx_md_port_conf);
-+ unsigned int port_count = ARRAY_SIZE(t7xx_port_conf);
- struct device *dev = &md->t7xx_dev->pdev->dev;
- struct port_proxy *port_prox;
- int i;
-@@ -456,7 +467,7 @@ static int t7xx_proxy_alloc(struct t7xx_modem *md)
- port_prox->dev = dev;
-
- for (i = 0; i < port_count; i++)
-- port_prox->ports[i].port_conf = &t7xx_md_port_conf[i];
-+ port_prox->ports[i].port_conf = &t7xx_port_conf[i];
-
- port_prox->port_count = port_count;
- t7xx_proxy_init_all_ports(md);
-@@ -481,6 +492,7 @@ int t7xx_port_proxy_init(struct t7xx_modem *md)
- if (ret)
- return ret;
-
-+ t7xx_cldma_set_recv_skb(md->md_ctrl[CLDMA_ID_AP], t7xx_port_proxy_recv_skb);
- t7xx_cldma_set_recv_skb(md->md_ctrl[CLDMA_ID_MD], t7xx_port_proxy_recv_skb);
- return 0;
- }
-diff --git a/drivers/net/wwan/t7xx/t7xx_reg.h b/drivers/net/wwan/t7xx/t7xx_reg.h
-index 7c1b81091a0f3f..c41d7d094c0853 100644
---- a/drivers/net/wwan/t7xx/t7xx_reg.h
-+++ b/drivers/net/wwan/t7xx/t7xx_reg.h
-@@ -56,7 +56,7 @@
- #define D2H_INT_RESUME_ACK BIT(12)
- #define D2H_INT_SUSPEND_ACK_AP BIT(13)
- #define D2H_INT_RESUME_ACK_AP BIT(14)
--#define D2H_INT_ASYNC_SAP_HK BIT(15)
-+#define D2H_INT_ASYNC_AP_HK BIT(15)
- #define D2H_INT_ASYNC_MD_HK BIT(16)
-
- /* Register base */
-diff --git a/drivers/net/wwan/t7xx/t7xx_state_monitor.c b/drivers/net/wwan/t7xx/t7xx_state_monitor.c
-index 0bcca08ff2bd08..80edb8e75a6ad7 100644
---- a/drivers/net/wwan/t7xx/t7xx_state_monitor.c
-+++ b/drivers/net/wwan/t7xx/t7xx_state_monitor.c
-@@ -285,8 +285,9 @@ static int fsm_routine_starting(struct t7xx_fsm_ctl *ctl)
- t7xx_fsm_broadcast_state(ctl, MD_STATE_WAITING_FOR_HS1);
- t7xx_md_event_notify(md, FSM_START);
-
-- wait_event_interruptible_timeout(ctl->async_hk_wq, md->core_md.ready || ctl->exp_flg,
-- HZ * 60);
-+ wait_event_interruptible_timeout(ctl->async_hk_wq,
-+ (md->core_md.ready && md->core_ap.ready) ||
-+ ctl->exp_flg, HZ * 60);
- dev = &md->t7xx_dev->pdev->dev;
-
- if (ctl->exp_flg)
-@@ -297,6 +298,13 @@ static int fsm_routine_starting(struct t7xx_fsm_ctl *ctl)
- if (md->core_md.handshake_ongoing)
- t7xx_fsm_append_event(ctl, FSM_EVENT_MD_HS2_EXIT, NULL, 0);
-
-+ fsm_routine_exception(ctl, NULL, EXCEPTION_HS_TIMEOUT);
-+ return -ETIMEDOUT;
-+ } else if (!md->core_ap.ready) {
-+ dev_err(dev, "AP handshake timeout\n");
-+ if (md->core_ap.handshake_ongoing)
-+ t7xx_fsm_append_event(ctl, FSM_EVENT_AP_HS2_EXIT, NULL, 0);
-+
- fsm_routine_exception(ctl, NULL, EXCEPTION_HS_TIMEOUT);
- return -ETIMEDOUT;
- }
-@@ -335,6 +343,7 @@ static void fsm_routine_start(struct t7xx_fsm_ctl *ctl, struct t7xx_fsm_command
- return;
- }
-
-+ t7xx_cldma_hif_hw_init(md->md_ctrl[CLDMA_ID_AP]);
- t7xx_cldma_hif_hw_init(md->md_ctrl[CLDMA_ID_MD]);
- fsm_finish_command(ctl, cmd, fsm_routine_starting(ctl));
- }
-diff --git a/drivers/net/wwan/t7xx/t7xx_state_monitor.h b/drivers/net/wwan/t7xx/t7xx_state_monitor.h
-index b1af0259d4c557..b6e76f3903c892 100644
---- a/drivers/net/wwan/t7xx/t7xx_state_monitor.h
-+++ b/drivers/net/wwan/t7xx/t7xx_state_monitor.h
-@@ -38,10 +38,12 @@ enum t7xx_fsm_state {
- enum t7xx_fsm_event_state {
- FSM_EVENT_INVALID,
- FSM_EVENT_MD_HS2,
-+ FSM_EVENT_AP_HS2,
- FSM_EVENT_MD_EX,
- FSM_EVENT_MD_EX_REC_OK,
- FSM_EVENT_MD_EX_PASS,
- FSM_EVENT_MD_HS2_EXIT,
-+ FSM_EVENT_AP_HS2_EXIT,
- FSM_EVENT_MAX
- };
diff --git a/0301-drm-Add_GPU_reset_sysfs_event.patch b/0301-drm-Add_GPU_reset_sysfs_event.patch
new file mode 100644
index 000000000000..b1f5ffbf99f6
--- /dev/null
+++ b/0301-drm-Add_GPU_reset_sysfs_event.patch
@@ -0,0 +1,108 @@
+From 1261d730c9639a14b2ee262874247d30a873dd99 Mon Sep 17 00:00:00 2001
+From: Shashank Sharma <shashank.sharma@amd.com>
+Date: Mon, 7 Mar 2022 12:32:49 +0100
+Subject: [PATCH] drm: Add GPU reset sysfs event
+
+This patch adds a new sysfs event, which will indicate
+the userland about a GPU reset, and can also provide
+some information like:
+- process ID of the process involved with the GPU reset
+- process name of the involved process
+- the GPU status info (using flags)
+
+This patch also introduces the first flag of the flags
+bitmap, which can be appended as and when required.
+
+V2: Addressed review comments from Christian and Amar
+ - move the reset information structure to DRM layer
+ - drop _ctx from struct name
+ - make pid 32 bit(than 64)
+ - set flag when VRAM invalid (than valid)
+ - add process name as well (Amar)
+
+Cc: Alexandar Deucher <alexander.deucher@amd.com>
+Cc: Christian Koenig <christian.koenig@amd.com>
+Cc: Amaranath Somalapuram <amaranath.somalapuram@amd.com>
+Signed-off-by: Shashank Sharma <shashank.sharma@amd.com>
+(cherry picked from commit 90230bd9d9c7d979038547460c9a2cbbeff8d6b9)
+[Forward port to 6.0]
+Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
+---
+ drivers/gpu/drm/drm_sysfs.c | 31 +++++++++++++++++++++++++++++++
+ include/drm/drm_sysfs.h | 10 ++++++++++
+ 2 files changed, 41 insertions(+)
+
+diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
+index b169b3e44a921b..5b3835b3ce428a 100644
+--- a/drivers/gpu/drm/drm_sysfs.c
++++ b/drivers/gpu/drm/drm_sysfs.c
+@@ -486,6 +486,37 @@ void drm_sysfs_connector_hotplug_event(struct drm_connector *connector)
+ }
+ EXPORT_SYMBOL(drm_sysfs_connector_hotplug_event);
+
++/**
++ * drm_sysfs_reset_event - generate a DRM uevent to indicate GPU reset
++ * @dev: DRM device
++ * @reset_info: The contextual information about the reset (like PID, flags)
++ *
++ * Send a uevent for the DRM device specified by @dev. This informs
++ * user that a GPU reset has occurred, so that an interested client
++ * can take any recovery or profiling measure.
++ */
++void drm_sysfs_reset_event(struct drm_device *dev, struct drm_reset_event *reset_info)
++{
++ unsigned char pid_str[13];
++ unsigned char flags_str[15];
++ unsigned char pname_str[TASK_COMM_LEN + 6];
++ unsigned char reset_str[] = "RESET=1";
++ char *envp[] = { reset_str, pid_str, pname_str, flags_str, NULL };
++
++ if (!reset_info) {
++ DRM_WARN("No reset info, not sending the event\n");
++ return;
++ }
++
++ DRM_DEBUG("generating reset event\n");
++
++ snprintf(pid_str, ARRAY_SIZE(pid_str), "PID=%u", reset_info->pid);
++ snprintf(pname_str, ARRAY_SIZE(pname_str), "NAME=%s", reset_info->pname);
++ snprintf(flags_str, ARRAY_SIZE(flags_str), "FLAGS=%u", reset_info->flags);
++ kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp);
++}
++EXPORT_SYMBOL(drm_sysfs_reset_event);
++
+ /**
+ * drm_sysfs_connector_property_event - generate a DRM uevent for connector
+ * property change
+diff --git a/include/drm/drm_sysfs.h b/include/drm/drm_sysfs.h
+index 96a5d858404b07..c3d94ec5fadcd2 100644
+--- a/include/drm/drm_sysfs.h
++++ b/include/drm/drm_sysfs.h
+@@ -1,12 +1,21 @@
+ /* SPDX-License-Identifier: GPL-2.0 */
+ #ifndef _DRM_SYSFS_H_
+ #define _DRM_SYSFS_H_
++#include <linux/sched.h>
++
++#define DRM_GPU_RESET_FLAG_VRAM_INVALID (1 << 0)
+
+ struct drm_device;
+ struct device;
+ struct drm_connector;
+ struct drm_property;
+
++struct drm_reset_event {
++ uint32_t pid;
++ uint32_t flags;
++ char pname[TASK_COMM_LEN];
++};
++
+ int drm_class_device_register(struct device *dev);
+ void drm_class_device_unregister(struct device *dev);
+
+@@ -14,4 +23,5 @@ void drm_sysfs_hotplug_event(struct drm_device *dev);
+ void drm_sysfs_connector_hotplug_event(struct drm_connector *connector);
+ void drm_sysfs_connector_property_event(struct drm_connector *connector,
+ struct drm_property *property);
++void drm_sysfs_reset_event(struct drm_device *dev, struct drm_reset_event *reset_info);
+ #endif
diff --git a/0302-drm-amdgpu-add_work_function_for_GPU_reset_event.patch b/0302-drm-amdgpu-add_work_function_for_GPU_reset_event.patch
new file mode 100644
index 000000000000..98c7f5dce3e1
--- /dev/null
+++ b/0302-drm-amdgpu-add_work_function_for_GPU_reset_event.patch
@@ -0,0 +1,97 @@
+From 6cdd4582ad64814b7685c42ed64addaa99c3726c Mon Sep 17 00:00:00 2001
+From: Shashank Sharma <shashank.sharma@amd.com>
+Date: Mon, 7 Mar 2022 15:33:00 +0100
+Subject: [PATCH] drm/amdgpu: add work function for GPU reset event
+
+This patch adds a work function, which sends a GPU reset
+uevent and some contextual infomration, like the PID and
+some status flags. This work should be scheduled during
+a GPU reset.
+
+The userspace can do some recovery and post-processing work
+based on this event and information.
+
+V2: Addressed review comments from Christian
+- Changed the name of the work to gpu_reset_event_work
+- Added a structure to accommodate some additional information
+ (like a PID and some flags)
+- Do not add new structure in amdgpu.h
+
+Cc: Alexander Deucher <alexander.deucher@amd.com>
+Cc: Christian Koenig <christian.koenig@amd.com>
+Cc: Amaranath Somalapuram <amaranath.somalapuram@amd.com>
+Signed-off-by: Shashank Sharma <shashank.sharma@amd.com>
+(cherry picked from commit f63b09e78126f7da67b69409e2cce1d3ab2d7f46)
+[Forward port to 6.0]
+Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 +++
+ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 13 +++++++++++++
+ 2 files changed, 16 insertions(+)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+index a79d53bdbe136a..cf2309ec1da9ac 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+@@ -57,6 +57,7 @@
+ #include <drm/amdgpu_drm.h>
+ #include <drm/drm_gem.h>
+ #include <drm/drm_ioctl.h>
++#include <drm/drm_sysfs.h>
+
+ #include <kgd_kfd_interface.h>
+ #include "dm_pp_interface.h"
+@@ -1017,6 +1018,7 @@ struct amdgpu_device {
+
+ int asic_reset_res;
+ struct work_struct xgmi_reset_work;
++ struct work_struct gpu_reset_event_work;
+ struct list_head reset_list;
+
+ long gfx_timeout;
+@@ -1051,6 +1053,7 @@ struct amdgpu_device {
+ bool barrier_has_auto_waitcnt;
+
+ struct amdgpu_reset_control *reset_cntl;
++ struct drm_reset_event reset_event_info;
+ uint32_t ip_versions[MAX_HWIP][HWIP_MAX_INSTANCE];
+
+ bool ram_is_direct_mapped;
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+index 2b8356699f235d..ace5a79042fc12 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+@@ -80,6 +80,7 @@
+ #include <linux/pm_runtime.h>
+
+ #include <drm/drm_drv.h>
++#include <drm/drm_sysfs.h>
+
+ #if IS_ENABLED(CONFIG_X86)
+ #include <asm/intel-family.h>
+@@ -3332,6 +3333,17 @@ bool amdgpu_device_has_dc_support(struct amdgpu_device *adev)
+ return amdgpu_device_asic_has_dc_support(adev->asic_type);
+ }
+
++static void amdgpu_device_reset_event_func(struct work_struct *__work)
++{
++ struct amdgpu_device *adev = container_of(__work, struct amdgpu_device,
++ gpu_reset_event_work);
++ /*
++ * A GPU reset has happened, inform the userspace and pass the
++ * reset related information.
++ */
++ drm_sysfs_reset_event(&adev->ddev, &adev->reset_event_info);
++}
++
+ static void amdgpu_device_xgmi_reset_func(struct work_struct *__work)
+ {
+ struct amdgpu_device *adev =
+@@ -3603,6 +3615,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
+ amdgpu_device_delay_enable_gfx_off);
+
+ INIT_WORK(&adev->xgmi_reset_work, amdgpu_device_xgmi_reset_func);
++ INIT_WORK(&adev->gpu_reset_event_work, amdgpu_device_reset_event_func);
+
+ adev->gfx.gfx_off_req_count = 1;
+ adev->gfx.gfx_off_residency = 0;
diff --git a/0303-drm-amdgpu-schedule_GPU_reset_event_work_function.patch b/0303-drm-amdgpu-schedule_GPU_reset_event_work_function.patch
new file mode 100644
index 000000000000..6c1b2eb70e38
--- /dev/null
+++ b/0303-drm-amdgpu-schedule_GPU_reset_event_work_function.patch
@@ -0,0 +1,41 @@
+From 0d9213e1b807a79970aa93434b2371f55691b6c4 Mon Sep 17 00:00:00 2001
+From: Somalapuram Amaranath <Amaranath.Somalapuram@amd.com>
+Date: Thu, 10 Mar 2022 11:31:44 +0530
+Subject: [PATCH] drm/amdgpu: schedule GPU reset event work function
+
+Schedule work function with valid PID, process name,
+and vram lost status during a GPU reset/ recovery.
+
+Signed-off-by: Somalapuram Amaranath <Amaranath.Somalapuram@amd.com>
+(cherry picked from commit 293c019a84c6402b08db9579819b555b01cd613b)
+[Forward ported to 6.0]
+Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+index ace5a79042fc12..77243ff1f428cf 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+@@ -4970,6 +4970,20 @@ int amdgpu_do_asic_reset(struct list_head *device_list_handle,
+ reset_context->job->vm->task_info;
+ amdgpu_reset_capture_coredumpm(tmp_adev);
+ #endif
++ if (reset_context->job && reset_context->job->vm) {
++ tmp_adev->reset_event_info.pid =
++ reset_context->job->vm->task_info.pid;
++ memset(tmp_adev->reset_event_info.pname, 0, TASK_COMM_LEN);
++ strcpy(tmp_adev->reset_event_info.pname,
++ reset_context->job->vm->task_info.process_name);
++ } else {
++ tmp_adev->reset_event_info.pid = 0;
++ memset(tmp_adev->reset_event_info.pname, 0, TASK_COMM_LEN);
++ }
++
++ tmp_adev->reset_event_info.flags = vram_lost;
++ schedule_work(&tmp_adev->gpu_reset_event_work);
++
+ if (vram_lost) {
+ DRM_INFO("VRAM is lost due to GPU reset!\n");
+ amdgpu_inc_vram_lost(tmp_adev);
diff --git a/0998-patch_realtek.patch b/0999-patch_realtek.patch
index 2513ec48db10..2513ec48db10 100644
--- a/0998-patch_realtek.patch
+++ b/0999-patch_realtek.patch
diff --git a/PKGBUILD b/PKGBUILD
index 3b77ff9f8d21..3c517f3c4451 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -12,7 +12,7 @@ pkgbase=linux-jcore
pkgname=('linux-jcore' 'linux-jcore-headers')
_kernelname=-jcore
_hostname=jcore
-pkgver=6.5.7
+pkgver=6.6.6
pkgrel=1
pkgdesc="Kernel for Manjaro/EndeavourOS/Arch (ACS override patch include)"
arch=('x86_64')
@@ -24,73 +24,60 @@ options=('!strip')
source=("https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-$pkgver.tar.xz"
config
+ # Upstream Patches
# ARCH Patches
0101-ZEN_Add_sysctl_and_CONFIG_to_disallow_unprivileged_CLONE_NEWUSER.patch
0102-drivers-firmware-skip-simpledrm-if-nvidia-drm.modese.patch
- 0103-ASoC-Intel-soc-acpi-fix-Dell-SKU-0B34.patch
- 0104-btrfs-wait-on-uncached-block-groups-on-every-allocat.patch
- 0105-net_wwan_t7xx_add-AP-CLDMA.patch
# MANJARO Patches
- 0201-asus-ally-asus-hid-6.5.patch
- 0202-mt7921e_Perform_FLR_to_recovery_the_device.patch
- # GPU reset through sysfs
- 0001-GPU-reset.patch
- # No overrides ROG ally
- 0001-Cirrus-no-dsdt.patch
- 0001-ALSA-hda-cs35l41-Support-ASUS-2023-laptops-with-miss.patch
- # Fixup sleep cs35l41
- 0001-ALSA-cs35l41-Use-mbox-command-to-enable-speaker-outp.patch
- 0002-ALSA-cs35l41-Poll-for-Power-Up-Down-rather-than-wait.patch
- 0003-ALSA-hda-cs35l41-Check-mailbox-status-of-pause-comma.patch
- 0004-ALSA-hda-cs35l41-Ensure-we-correctly-re-sync-regmap-.patch
- 0005-ALSA-hda-cs35l41-Ensure-we-pass-up-any-errors-during.patch
- 0006-ALSA-hda-cs35l41-Move-Play-and-Pause-into-separate-f.patch
- 0007-ALSA-hda-hda_component-Add-pre-and-post-playback-hoo.patch
- 0008-ALSA-hda-cs35l41-Use-pre-and-post-playback-hooks.patch
- 0009-ALSA-hda-cs35l41-Rework-System-Suspend-to-ensure-cor.patch
- 0010-ALSA-hda-cs35l41-Add-device_link-between-HDA-and-cs3.patch
- 0011-ALSA-hda-cs35l41-Ensure-amp-is-only-unmuted-during-p.patch
# Realtek patch
- 0998-patch_realtek.patch
- # HID patches
- 0001-HID.patch
+ 0999-patch_realtek.patch
+ # ROG ALLY Patches
+ 0000-hid-asus-add-const-to-read-only-outgoing-usb-buffer.patch
+ 0001-hid-asus-reset-the-backlight-brightness-level-on-resume.patch
+ v14.1-0001-HID-asus-fix-more-n-key-report-descriptors-if-.patch
+ v14.1-0002-HID-asus-make-asus_kbd_init-generic-remove-rog.patch
+ v14.1-0003-HID-asus-add-ROG-Ally-N-Key-ID-and-keycodes.patch
+ v14.1-0004-HID-asus-add-ROG-Ally-xpad-settings.patch
+ v14.1-fix-defaults1.patch
+ 0006-platform-x86-asus-wmi-disable-USB0-hub-on-ROG-Ally-b.patch
+ 0007-mt7921e_Perform_FLR_to_recovery_the_device.patch
+ # AMD GPU reset patches
+ 0301-drm-Add_GPU_reset_sysfs_event.patch
+ 0302-drm-amdgpu-add_work_function_for_GPU_reset_event.patch
+ 0303-drm-amdgpu-schedule_GPU_reset_event_work_function.patch
+ # No overrides ROG ally <= 323 BIOS
+ 0001-ALSA-hda-cs35l41-Support-ASUS-2023-laptops-with-miss.patch
+ 0001-ALSA-hda-cs35l41-Improve-support-for-ASUS-ROG-Ally.patch
# Additional ALLY patches
- ROG-ALLY-LED-fix.patch
ROG-ALLY-NCT6775-PLATFORM.patch
- ROG_ALLY_OLDER_BIOS_AUDIO.patch
0001-ROG-ALLY-bmi323-device.patch
+ # Steamdeck HID patches
+ 0001-HID.patch
# ACS override patch
'0999-acs.gitpatch')
-sha256sums=('0d09ea448005c9cfe5383e4c72a872b39188b928f8c44e146b03b1b7851fbb8c'
- '68c8f0aecfabb6f6eac76daed2985e9255ab62f98669d341d02aa66070ce17ce'
+sha256sums=('ebf70a917934b13169e1be5b95c3b6c2fea5bc14e6dc144f1efb8a0016b224c8'
+ '043ada1688a42e652bb0b339d2f9732c323c22da96bb2ca2bcf144a731c5e981'
'05f04019d4a2ee072238c32860fa80d673687d84d78ef436ae9332b6fb788467'
'e1d17690dd21e8d5482b63ca66bfe6b478d39e8e8b59eedd53adb0a55ebc308d'
- '6a8e31d9e0b9dfb13c1fb96cea1dc17929920038c50db7d731e1af63fd0b26b9'
- '997e873b5fa0fb94ebc7ab88474edc15f7e94340643a1305fd2eab2917f39df6'
- '6a5d3cff6d9887b9f2e6fe8121cadf7b22cafcfabe3bd0d3e80d9174ede7204d'
- '6541760a7b0513ce52c7b2d67810135b1bd172849f52765e74a5ec0c7584dd56'
- 'd673d034fbcd80426fd8d9c6af56537c5fe5b55fe49d74e313474d7fc285ecc1'
- '11ff8e0119e1bd33a572e18a10dfb94f521b4e38ee5948d3c0508faf07835a78'
- 'ec6f9f062e94a62ecbec3a9e30bb6fc7ffd33e279eeb621674bfe4e4c398836a'
- '6536e2f6bcb881d412f99d6bf940487c0a79cc432a0ef7e6e60a24e6a445a8f2'
- '27aaf7e14c7f5e127f5b658352ca5c3650477a92462139557aefb73bcea2b418'
- '74da118887929f06afb57eaee716ff433ee5972c9dc91166fc08e66f44edb8e8'
- 'c5ac510677e58ac6b189939ac853e64bf9ad026a614a47f4cb535ad62bf41163'
- '88f0d69dad01ccfef899b6b08abe162fc7743d40571232dff9a7d9093890d0a8'
- '826bfa21b613d9c198d375d902958c90bb30171aee602c1806aaf99212abbb40'
- '0dae5e24249b712f1501ead600c8ef4a5df21484e39e06a1dbafb57929c4999f'
- '8dddf5537e3feedbf9f9c67f3c19fa7412d9e01b4f78023262b8fa340d3f47b2'
- '3774b4eba753eb5f3768a28a68eb1a17557c0347275c19b8133f9f74d64a80df'
- 'a5daf210a6f72dde5b477d4b6d38a162b2698cac6c5fcfd4e4fd606274f34cec'
- 'b9298bde48a9f6c5d028150d627c05c71880e2693933ef2fe070f090e80876a5'
- '4d53a6853b63c0f01b60b408bee61fa729656f925e50fa55ae3cba309668242a'
'3aa9f1ca47bb078f3c9a52fe61897cf4fe989068cd7e66bfa6644fd605fa40d2'
- 'ed7f4ba3b47c92b5102c9eef81f41e57216e9357d4a638199035a93f080eeb1a'
- '68a9b80e0b8d75880fbf3d8486bfe522cb19b4042554786b23bead9320165fa5'
+ 'fb2cd8a3ea9d47bd78c99b8ece1f3959c20b4de97a7959a12650f989f5c724da'
+ '7f3194f1a7c5ebc27bbfa4559cfd9a2ccffddbbd2d259c0d9c68631cb66c5855'
+ '176adde8fc3069bd28393bf0c9d788f1b0f9a186678aec4dc17b0b081c57f97b'
+ '493fa177cf602f087e981e95fad3764e305f4c486d4c2ef78255388b913be9cf'
+ '50ea381758fb8a8566f38a509fe7cf0448c77eaec5103066cafc2ecf02db1e9f'
+ '970687b811034e722befde62bcf6d51c7442a217074ed0fb71460bb1803f4c64'
+ 'c00b23162fdbf50de375d8e444b6d59e2e3630cfac55ec1d06114b9dad00e542'
+ '836e88044263f7bc474ca466b3d0d98c39e265db94925c300d0b138492946a13'
+ 'd673d034fbcd80426fd8d9c6af56537c5fe5b55fe49d74e313474d7fc285ecc1'
+ '1f62542a889a6c2eafd43acd0699f54720ed891eeda66a4a9261d75b92f28b7f'
+ '6bc2c1b9a485c852b45e4064e8b9b559b9b26113fdc80bf9653af44c0886fde2'
+ '559f01074cda3c161996617f1b7bc6cbbce0efc50e2cf9e843d60922ff2e8063'
+ '79970a4729572cb25fd4644d66f38ecd5b3e1610a42ea4bbe436b501f3469fa2'
+ '430a7f971d78d0873708e0ad38fba602ceafefd4da8ebbf9d9c591bc4799acb5'
'cfcd5c177423df8b7b98b0500fe7ab0757f895ed945c33e205963f0069c7a3be'
- '2d8246d2ff6312cd8ff832c50f4176201e43fe9d55e9b758bec9f0cad75bd0ba'
'5574a68b1c7733769835bb856a8c32e54398dfde59f264708672b87b73b3c6ea'
+ '7c948773d758418d8a436067265d678c444827562c46b9fced2ff31ced108481'
'458d7e024d33d4965b14b9b987f01a2884ff28761cff5da7c6a54132a95e9f36')
prepare() {
diff --git a/ROG-ALLY-LED-fix.patch b/ROG-ALLY-LED-fix.patch
deleted file mode 100644
index e5014cba75de..000000000000
--- a/ROG-ALLY-LED-fix.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
-index e7993d7..c8189f9 100644
---- a/drivers/hid/hid-asus.c
-+++ b/drivers/hid/hid-asus.c
-@@ -454,6 +454,9 @@ static int rog_nkey_led_init(struct hid_device *hdev)
- 0x54, 0x65, 0x63, 0x68, 0x2e, 0x49, 0x6e, 0x63, 0x2e, 0x00 };
- u8 buf_init3[] = { FEATURE_KBD_LED_REPORT_ID1,
- 0x05, 0x20, 0x31, 0x00, 0x08 };
-+ u8 buf_init4[] = { 0x5a, 0xb3};
-+ u8 buf_init5[] = { 0x5a, 0xb5};
-+ u8 buf_init6[] = { 0x5a, 0xb4};
- int ret;
-
- hid_info(hdev, "Asus initialise N-KEY Device");
-@@ -488,6 +491,17 @@ static int rog_nkey_led_init(struct hid_device *hdev)
- ret = asus_kbd_set_report(hdev, buf_init3, sizeof(buf_init3));
- if (ret < 0)
- hid_warn(hdev, "Asus failed to send init command 2.1: %d\n", ret);
-+
-+ /* ROG ALLY LED init */
-+ ret = asus_kbd_set_report(hdev, buf_init4, sizeof(buf_init4));
-+ if (ret < 0)
-+ hid_warn(hdev, "Asus failed to send ROG ALLY LED init command: %d\n", ret);
-+ ret = asus_kbd_set_report(hdev, buf_init5, sizeof(buf_init5));
-+ if (ret < 0)
-+ hid_warn(hdev, "Asus failed to send ROG ALLY LED init command: %d\n", ret);
-+ ret = asus_kbd_set_report(hdev, buf_init6, sizeof(buf_init6));
-+ if (ret < 0)
-+ hid_warn(hdev, "Asus failed to send ROG ALLY LED init command: %d\n", ret);
-
- return ret;
- }
diff --git a/ROG_ALLY_OLDER_BIOS_AUDIO.patch b/ROG_ALLY_OLDER_BIOS_AUDIO.patch
deleted file mode 100644
index d8cf5d888221..000000000000
--- a/ROG_ALLY_OLDER_BIOS_AUDIO.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-diff --git a/sound/pci/hda/cs35l41_hda_property.c b/sound/pci/hda/cs35l41_hda_property.c
-index b39f944..feb4852 100644
---- a/sound/pci/hda/cs35l41_hda_property.c
-+++ b/sound/pci/hda/cs35l41_hda_property.c
-@@ -72,6 +72,13 @@ static int asus_rog_2023_spkr_id2(struct cs35l41_hda *cs35l41, struct device *ph
- } else {
- cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH);
- }
-+
-+ if (strcmp(cs35l41->acpi_subsystem_id, "104317F3") == 0){
-+ hw_cfg->bst_type = CS35L41_INT_BOOST; /* ROG ALLY specific config */
-+ hw_cfg->bst_ind = 1000; /* 1,000nH Inductance value */
-+ hw_cfg->bst_ipk = 4500; /* 4,500mA peak current */
-+ hw_cfg->bst_cap = 24; /* 24 microFarad cap value */
-+ }
-
- hw_cfg->valid = true;
-
diff --git a/config b/config
index 70ae58a567bf..e6be5e9d349a 100644
--- a/config
+++ b/config
@@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
-# Linux/x86 6.5.7-1 Kernel Configuration
+# Linux/x86 6.6.5-1 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="gcc (GCC) 13.2.1 20230801"
CONFIG_CC_IS_GCC=y
@@ -300,7 +300,6 @@ CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y
CONFIG_KCMP=y
CONFIG_RSEQ=y
CONFIG_CACHESTAT_SYSCALL=y
-# CONFIG_EMBEDDED is not set
CONFIG_HAVE_PERF_EVENTS=y
CONFIG_GUEST_PERF_EVENTS=y
@@ -314,6 +313,22 @@ CONFIG_PERF_EVENTS=y
CONFIG_SYSTEM_DATA_VERIFICATION=y
CONFIG_PROFILING=y
CONFIG_TRACEPOINTS=y
+
+#
+# Kexec and crash features
+#
+CONFIG_CRASH_CORE=y
+CONFIG_KEXEC_CORE=y
+CONFIG_KEXEC=y
+CONFIG_KEXEC_FILE=y
+CONFIG_KEXEC_SIG=y
+# CONFIG_KEXEC_SIG_FORCE is not set
+CONFIG_KEXEC_BZIMAGE_VERIFY_SIG=y
+CONFIG_KEXEC_JUMP=y
+CONFIG_CRASH_DUMP=y
+CONFIG_CRASH_HOTPLUG=y
+CONFIG_CRASH_MAX_MEMORY_RANGES=8192
+# end of Kexec and crash features
# end of General setup
CONFIG_64BIT=y
@@ -446,8 +461,6 @@ CONFIG_X86_ESPFIX64=y
CONFIG_X86_VSYSCALL_EMULATION=y
CONFIG_X86_IOPL_IOPERM=y
CONFIG_MICROCODE=y
-CONFIG_MICROCODE_INTEL=y
-CONFIG_MICROCODE_AMD=y
# CONFIG_MICROCODE_LATE_LOADING is not set
CONFIG_X86_MSR=y
CONFIG_X86_CPUID=y
@@ -479,12 +492,14 @@ CONFIG_X86_PAT=y
CONFIG_ARCH_USES_PG_UNCACHED=y
CONFIG_X86_UMIP=y
CONFIG_CC_HAS_IBT=y
+CONFIG_X86_CET=y
CONFIG_X86_KERNEL_IBT=y
CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS=y
# CONFIG_X86_INTEL_TSX_MODE_OFF is not set
# CONFIG_X86_INTEL_TSX_MODE_ON is not set
CONFIG_X86_INTEL_TSX_MODE_AUTO=y
CONFIG_X86_SGX=y
+CONFIG_X86_USER_SHADOW_STACK=y
CONFIG_EFI=y
CONFIG_EFI_STUB=y
CONFIG_EFI_HANDOVER_PROTOCOL=y
@@ -497,14 +512,16 @@ CONFIG_HZ_300=y
# CONFIG_HZ_1000 is not set
CONFIG_HZ=300
CONFIG_SCHED_HRTICK=y
-CONFIG_KEXEC=y
-CONFIG_KEXEC_FILE=y
-CONFIG_ARCH_HAS_KEXEC_PURGATORY=y
-CONFIG_KEXEC_SIG=y
-# CONFIG_KEXEC_SIG_FORCE is not set
-CONFIG_KEXEC_BZIMAGE_VERIFY_SIG=y
-CONFIG_CRASH_DUMP=y
-CONFIG_KEXEC_JUMP=y
+CONFIG_ARCH_SUPPORTS_KEXEC=y
+CONFIG_ARCH_SUPPORTS_KEXEC_FILE=y
+CONFIG_ARCH_SELECTS_KEXEC_FILE=y
+CONFIG_ARCH_SUPPORTS_KEXEC_PURGATORY=y
+CONFIG_ARCH_SUPPORTS_KEXEC_SIG=y
+CONFIG_ARCH_SUPPORTS_KEXEC_SIG_FORCE=y
+CONFIG_ARCH_SUPPORTS_KEXEC_BZIMAGE_VERIFY_SIG=y
+CONFIG_ARCH_SUPPORTS_KEXEC_JUMP=y
+CONFIG_ARCH_SUPPORTS_CRASH_DUMP=y
+CONFIG_ARCH_SUPPORTS_CRASH_HOTPLUG=y
CONFIG_PHYSICAL_START=0x1000000
CONFIG_RELOCATABLE=y
CONFIG_RANDOMIZE_BASE=y
@@ -547,7 +564,6 @@ CONFIG_CPU_SRSO=y
CONFIG_SLS=y
# CONFIG_GDS_FORCE_MITIGATION is not set
CONFIG_ARCH_HAS_ADD_PAGES=y
-CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y
#
# Power management and ACPI options
@@ -760,12 +776,11 @@ CONFIG_AS_SHA1_NI=y
CONFIG_AS_SHA256_NI=y
CONFIG_AS_TPAUSE=y
CONFIG_AS_GFNI=y
+CONFIG_AS_WRUSS=y
#
# General architecture-dependent options
#
-CONFIG_CRASH_CORE=y
-CONFIG_KEXEC_CORE=y
CONFIG_HOTPLUG_SMT=y
CONFIG_HOTPLUG_CORE_SYNC=y
CONFIG_HOTPLUG_CORE_SYNC_DEAD=y
@@ -855,6 +870,7 @@ CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD=y
CONFIG_HAVE_ARCH_HUGE_VMAP=y
CONFIG_HAVE_ARCH_HUGE_VMALLOC=y
CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y
+CONFIG_ARCH_WANT_PMD_MKWRITE=y
CONFIG_HAVE_ARCH_SOFT_DIRTY=y
CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
CONFIG_MODULES_USE_ELF_RELA=y
@@ -1083,6 +1099,7 @@ CONFIG_SLAB_FREELIST_RANDOM=y
CONFIG_SLAB_FREELIST_HARDENED=y
# CONFIG_SLUB_STATS is not set
CONFIG_SLUB_CPU_PARTIAL=y
+# CONFIG_RANDOM_KMALLOC_CACHES is not set
# end of SLAB allocator options
CONFIG_SHUFFLE_PAGE_ALLOCATOR=y
@@ -1091,7 +1108,8 @@ CONFIG_SPARSEMEM=y
CONFIG_SPARSEMEM_EXTREME=y
CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
CONFIG_SPARSEMEM_VMEMMAP=y
-CONFIG_ARCH_WANT_OPTIMIZE_VMEMMAP=y
+CONFIG_ARCH_WANT_OPTIMIZE_DAX_VMEMMAP=y
+CONFIG_ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP=y
CONFIG_HAVE_FAST_GUP=y
CONFIG_NUMA_KEEP_MEMINFO=y
CONFIG_MEMORY_ISOLATION=y
@@ -1103,6 +1121,7 @@ CONFIG_MEMORY_HOTPLUG=y
CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE=y
CONFIG_MEMORY_HOTREMOVE=y
CONFIG_MHP_MEMMAP_ON_MEMORY=y
+CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y
CONFIG_SPLIT_PTLOCK_CPUS=4
CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK=y
CONFIG_MEMORY_BALLOON=y
@@ -1133,7 +1152,6 @@ CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
CONFIG_USE_PERCPU_NUMA_NODE_ID=y
CONFIG_HAVE_SETUP_PER_CPU_AREA=y
-CONFIG_FRONTSWAP=y
CONFIG_CMA=y
# CONFIG_CMA_DEBUG is not set
CONFIG_CMA_DEBUGFS=y
@@ -1162,6 +1180,7 @@ CONFIG_VM_EVENT_COUNTERS=y
# CONFIG_DMAPOOL_TEST is not set
CONFIG_ARCH_HAS_PTE_SPECIAL=y
CONFIG_MAPPING_DIRTY_HELPERS=y
+CONFIG_MEMFD_CREATE=y
CONFIG_SECRETMEM=y
CONFIG_ANON_VMA_NAME=y
CONFIG_USERFAULTFD=y
@@ -1192,6 +1211,7 @@ CONFIG_NET=y
CONFIG_COMPAT_NETLINK_MESSAGES=y
CONFIG_NET_INGRESS=y
CONFIG_NET_EGRESS=y
+CONFIG_NET_XGRESS=y
CONFIG_NET_REDIRECT=y
CONFIG_SKB_EXTENSIONS=y
@@ -2322,6 +2342,11 @@ CONFIG_MHI_BUS_PCI_GENERIC=m
CONFIG_MHI_BUS_EP=m
# end of Bus devices
+#
+# Cache Drivers
+#
+# end of Cache Drivers
+
CONFIG_CONNECTOR=y
CONFIG_PROC_EVENTS=y
@@ -2353,6 +2378,7 @@ CONFIG_GOOGLE_CBMEM=m
CONFIG_GOOGLE_COREBOOT_TABLE=m
CONFIG_GOOGLE_MEMCONSOLE=m
# CONFIG_GOOGLE_MEMCONSOLE_X86_LEGACY is not set
+CONFIG_GOOGLE_FRAMEBUFFER_COREBOOT=m
CONFIG_GOOGLE_MEMCONSOLE_COREBOOT=m
CONFIG_GOOGLE_VPD=m
@@ -2963,6 +2989,7 @@ CONFIG_ATA_GENERIC=m
CONFIG_PATA_LEGACY=m
CONFIG_MD=y
CONFIG_BLK_DEV_MD=m
+CONFIG_MD_BITMAP_FILE=y
CONFIG_MD_LINEAR=m
CONFIG_MD_RAID0=m
CONFIG_MD_RAID1=m
@@ -3076,6 +3103,7 @@ CONFIG_AMT=m
CONFIG_MACSEC=m
CONFIG_NETCONSOLE=m
CONFIG_NETCONSOLE_DYNAMIC=y
+# CONFIG_NETCONSOLE_EXTENDED_LOG is not set
CONFIG_NETPOLL=y
CONFIG_NET_POLL_CONTROLLER=y
CONFIG_NTB_NETDEV=m
@@ -3349,7 +3377,7 @@ CONFIG_MLX5_TC_CT=y
CONFIG_MLX5_TC_SAMPLE=y
CONFIG_MLX5_CORE_EN_DCB=y
CONFIG_MLX5_CORE_IPOIB=y
-CONFIG_MLX5_EN_MACSEC=y
+CONFIG_MLX5_MACSEC=y
CONFIG_MLX5_EN_IPSEC=y
CONFIG_MLX5_EN_TLS=y
CONFIG_MLX5_SW_STEERING=y
@@ -3550,9 +3578,11 @@ CONFIG_INTEL_XWAY_PHY=m
CONFIG_LSI_ET1011C_PHY=m
CONFIG_MARVELL_PHY=m
CONFIG_MARVELL_10G_PHY=m
+CONFIG_MARVELL_88Q2XXX_PHY=m
CONFIG_MARVELL_88X2222_PHY=m
CONFIG_MAXLINEAR_GPHY=m
CONFIG_MEDIATEK_GE_PHY=m
+# CONFIG_MEDIATEK_GE_SOC_PHY is not set
CONFIG_MICREL_PHY=m
CONFIG_MICROCHIP_T1S_PHY=m
CONFIG_MICROCHIP_PHY=m
@@ -3949,6 +3979,8 @@ CONFIG_MT76_SDIO=m
CONFIG_MT76x02_LIB=m
CONFIG_MT76x02_USB=m
CONFIG_MT76_CONNAC_LIB=m
+CONFIG_MT792x_LIB=m
+CONFIG_MT792x_USB=m
CONFIG_MT76x0_COMMON=m
CONFIG_MT76x0U=m
CONFIG_MT76x0E=m
@@ -4392,6 +4424,7 @@ CONFIG_TOUCHSCREEN_ZFORCE=m
CONFIG_TOUCHSCREEN_COLIBRI_VF50=m
CONFIG_TOUCHSCREEN_ROHM_BU21023=m
CONFIG_TOUCHSCREEN_IQS5XX=m
+CONFIG_TOUCHSCREEN_IQS7211=m
CONFIG_TOUCHSCREEN_ZINITIX=m
CONFIG_TOUCHSCREEN_HIMAX_HX83112B=m
CONFIG_INPUT_MISC=y
@@ -4492,8 +4525,6 @@ CONFIG_HYPERV_KEYBOARD=m
CONFIG_SERIO_GPIO_PS2=m
CONFIG_USERIO=m
CONFIG_GAMEPORT=m
-CONFIG_GAMEPORT_NS558=m
-CONFIG_GAMEPORT_L4=m
CONFIG_GAMEPORT_EMU10K1=m
CONFIG_GAMEPORT_FM801=m
# end of Hardware I/O ports
@@ -4580,7 +4611,6 @@ CONFIG_SERIAL_MCTRL_GPIO=y
CONFIG_SERIAL_NONSTANDARD=y
CONFIG_MOXA_INTELLIO=m
CONFIG_MOXA_SMARTIO=m
-CONFIG_SYNCLINK_GT=m
CONFIG_N_HDLC=m
CONFIG_IPWIRELESS=m
CONFIG_N_GSM=m
@@ -4776,6 +4806,7 @@ CONFIG_SPI_AXI_SPI_ENGINE=m
CONFIG_SPI_BITBANG=m
CONFIG_SPI_BUTTERFLY=m
CONFIG_SPI_CADENCE=m
+CONFIG_SPI_CS42L43=m
CONFIG_SPI_DESIGNWARE=m
CONFIG_SPI_DW_DMA=y
CONFIG_SPI_DW_PCI=m
@@ -4843,6 +4874,7 @@ CONFIG_PTP_1588_CLOCK_INES=m
CONFIG_PTP_1588_CLOCK_KVM=m
CONFIG_PTP_1588_CLOCK_IDT82P33=m
CONFIG_PTP_1588_CLOCK_IDTCM=m
+CONFIG_PTP_1588_CLOCK_MOCK=m
CONFIG_PTP_1588_CLOCK_VMW=m
CONFIG_PTP_1588_CLOCK_OCP=m
CONFIG_PTP_DFL_TOD=m
@@ -4860,6 +4892,7 @@ CONFIG_PINCTRL_MCP23S08_I2C=m
CONFIG_PINCTRL_MCP23S08_SPI=m
CONFIG_PINCTRL_MCP23S08=m
CONFIG_PINCTRL_SX150X=y
+CONFIG_PINCTRL_CS42L43=m
CONFIG_PINCTRL_MADERA=m
CONFIG_PINCTRL_CS47L15=y
CONFIG_PINCTRL_CS47L35=y
@@ -4939,6 +4972,7 @@ CONFIG_GPIO_WS16C48=m
# I2C GPIO expanders
#
CONFIG_GPIO_FXL6408=m
+CONFIG_GPIO_DS4520=m
CONFIG_GPIO_MAX7300=m
CONFIG_GPIO_MAX732X=m
CONFIG_GPIO_PCA953X=m
@@ -5198,6 +5232,7 @@ CONFIG_SENSORS_GL520SM=m
CONFIG_SENSORS_G760A=m
CONFIG_SENSORS_G762=m
CONFIG_SENSORS_HIH6130=m
+CONFIG_SENSORS_HS3001=m
CONFIG_SENSORS_IBMAEM=m
CONFIG_SENSORS_IBMPEX=m
CONFIG_SENSORS_IIO_HWMON=m
@@ -5309,6 +5344,7 @@ CONFIG_SENSORS_MAX34440=m
CONFIG_SENSORS_MAX8688=m
CONFIG_SENSORS_MP2888=m
CONFIG_SENSORS_MP2975=m
+CONFIG_SENSORS_MP2975_REGULATOR=y
CONFIG_SENSORS_MP5023=m
CONFIG_SENSORS_MPQ7932_REGULATOR=y
CONFIG_SENSORS_MPQ7932=m
@@ -5351,7 +5387,6 @@ CONFIG_SENSORS_SCH56XX_COMMON=m
CONFIG_SENSORS_SCH5627=m
CONFIG_SENSORS_SCH5636=m
CONFIG_SENSORS_STTS751=m
-CONFIG_SENSORS_SMM665=m
CONFIG_SENSORS_ADC128D818=m
CONFIG_SENSORS_ADS7828=m
CONFIG_SENSORS_ADS7871=m
@@ -5576,6 +5611,9 @@ CONFIG_MFD_BD9571MWV=m
CONFIG_MFD_AXP20X=m
CONFIG_MFD_AXP20X_I2C=m
CONFIG_MFD_CROS_EC_DEV=m
+CONFIG_MFD_CS42L43=m
+CONFIG_MFD_CS42L43_I2C=m
+CONFIG_MFD_CS42L43_SDW=m
CONFIG_MFD_MADERA=m
CONFIG_MFD_MADERA_I2C=m
CONFIG_MFD_MADERA_SPI=m
@@ -5711,6 +5749,7 @@ CONFIG_REGULATOR_ARIZONA_LDO1=m
CONFIG_REGULATOR_ARIZONA_MICSUPP=m
CONFIG_REGULATOR_AS3711=m
CONFIG_REGULATOR_ATC260X=m
+CONFIG_REGULATOR_AW37503=m
CONFIG_REGULATOR_AXP20X=m
CONFIG_REGULATOR_BCM590XX=m
CONFIG_REGULATOR_BD9571MWV=m
@@ -5735,6 +5774,7 @@ CONFIG_REGULATOR_LTC3676=m
CONFIG_REGULATOR_MAX14577=m
CONFIG_REGULATOR_MAX1586=m
CONFIG_REGULATOR_MAX77541=m
+CONFIG_REGULATOR_MAX77857=m
CONFIG_REGULATOR_MAX8649=m
CONFIG_REGULATOR_MAX8660=m
CONFIG_REGULATOR_MAX8893=m
@@ -5785,6 +5825,7 @@ CONFIG_REGULATOR_RT6245=m
CONFIG_REGULATOR_RTQ2134=m
CONFIG_REGULATOR_RTMV20=m
CONFIG_REGULATOR_RTQ6752=m
+CONFIG_REGULATOR_RTQ2208=m
CONFIG_REGULATOR_SKY81452=m
CONFIG_REGULATOR_SLG51000=m
CONFIG_REGULATOR_SY7636A=m
@@ -5893,8 +5934,8 @@ CONFIG_V4L2_MEM2MEM_DEV=m
CONFIG_V4L2_FLASH_LED_CLASS=m
CONFIG_V4L2_FWNODE=m
CONFIG_V4L2_ASYNC=m
-CONFIG_VIDEOBUF_GEN=m
-CONFIG_VIDEOBUF_DMA_SG=m
+CONFIG_V4L2_CCI=m
+CONFIG_V4L2_CCI_I2C=m
# end of Video4Linux options
#
@@ -6142,9 +6183,9 @@ CONFIG_DVB_BUDGET_CORE=m
CONFIG_DVB_BUDGET=m
CONFIG_DVB_BUDGET_CI=m
CONFIG_DVB_BUDGET_AV=m
-CONFIG_IPU_BRIDGE=m
CONFIG_VIDEO_IPU3_CIO2=m
-CONFIG_CIO2_BRIDGE=y
+CONFIG_INTEL_VSC=m
+CONFIG_IPU_BRIDGE=m
CONFIG_RADIO_ADAPTERS=m
CONFIG_RADIO_MAXIRADIO=m
CONFIG_RADIO_SAA7706H=m
@@ -6397,6 +6438,7 @@ CONFIG_VIDEO_ET8EK8=m
CONFIG_VIDEO_AD5820=m
CONFIG_VIDEO_AK7375=m
CONFIG_VIDEO_DW9714=m
+CONFIG_VIDEO_DW9719=m
CONFIG_VIDEO_DW9768=m
CONFIG_VIDEO_DW9807_VCM=m
# end of Lens drivers
@@ -6445,6 +6487,11 @@ CONFIG_VIDEO_SAA6752HS=m
CONFIG_VIDEO_M52790=m
#
+# Video serializers and deserializers
+#
+# end of Video serializers and deserializers
+
+#
# SPI I2C drivers auto-selected by 'Autoselect ancillary drivers'
#
@@ -6666,6 +6713,8 @@ CONFIG_DVB_DUMMY_FE=m
CONFIG_APERTURE_HELPERS=y
CONFIG_VIDEO_CMDLINE=y
CONFIG_VIDEO_NOMODESET=y
+# CONFIG_AUXDISPLAY is not set
+# CONFIG_PANEL is not set
CONFIG_AGP=y
CONFIG_AGP_AMD64=m
CONFIG_AGP_INTEL=m
@@ -6688,6 +6737,7 @@ CONFIG_DRM_DISPLAY_HDMI_HELPER=y
CONFIG_DRM_DP_AUX_CHARDEV=y
CONFIG_DRM_DP_CEC=y
CONFIG_DRM_TTM=m
+CONFIG_DRM_EXEC=m
CONFIG_DRM_BUDDY=m
CONFIG_DRM_VRAM_HELPER=m
CONFIG_DRM_TTM_HELPER=m
@@ -6790,6 +6840,7 @@ CONFIG_DRM_ANALOGIX_ANX78XX=m
CONFIG_DRM_ANALOGIX_DP=m
# end of Display Interface Bridges
+CONFIG_DRM_LOONGSON=m
# CONFIG_DRM_ETNAVIV is not set
CONFIG_DRM_BOCHS=m
CONFIG_DRM_CIRRUS_QEMU=m
@@ -6820,27 +6871,7 @@ CONFIG_DRM_PRIVACY_SCREEN=y
#
# Frame buffer Devices
#
-CONFIG_FB_NOTIFY=y
CONFIG_FB=y
-# CONFIG_FIRMWARE_EDID is not set
-CONFIG_FB_CFB_FILLRECT=y
-CONFIG_FB_CFB_COPYAREA=y
-CONFIG_FB_CFB_IMAGEBLIT=y
-CONFIG_FB_SYS_FILLRECT=y
-CONFIG_FB_SYS_COPYAREA=y
-CONFIG_FB_SYS_IMAGEBLIT=y
-# CONFIG_FB_FOREIGN_ENDIAN is not set
-CONFIG_FB_SYS_FOPS=y
-CONFIG_FB_DEFERRED_IO=y
-CONFIG_FB_IO_HELPERS=y
-CONFIG_FB_SYS_HELPERS=y
-CONFIG_FB_SYS_HELPERS_DEFERRED=y
-# CONFIG_FB_MODE_HELPERS is not set
-# CONFIG_FB_TILEBLITTING is not set
-
-#
-# Frame buffer hardware drivers
-#
# CONFIG_FB_CIRRUS is not set
# CONFIG_FB_PM2 is not set
# CONFIG_FB_CYBER2000 is not set
@@ -6887,6 +6918,25 @@ CONFIG_XEN_FBDEV_FRONTEND=m
# CONFIG_FB_HYPERV is not set
# CONFIG_FB_SSD1307 is not set
# CONFIG_FB_SM712 is not set
+CONFIG_FB_CORE=y
+CONFIG_FB_NOTIFY=y
+# CONFIG_FIRMWARE_EDID is not set
+CONFIG_FB_DEVICE=y
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+CONFIG_FB_SYS_FILLRECT=y
+CONFIG_FB_SYS_COPYAREA=y
+CONFIG_FB_SYS_IMAGEBLIT=y
+# CONFIG_FB_FOREIGN_ENDIAN is not set
+CONFIG_FB_SYS_FOPS=y
+CONFIG_FB_DEFERRED_IO=y
+CONFIG_FB_DMAMEM_HELPERS=y
+CONFIG_FB_IOMEM_HELPERS=y
+CONFIG_FB_SYSMEM_HELPERS=y
+CONFIG_FB_SYSMEM_HELPERS_DEFERRED=y
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
# end of Frame buffer Devices
#
@@ -6976,7 +7026,7 @@ CONFIG_SND_HWDEP=m
CONFIG_SND_SEQ_DEVICE=m
CONFIG_SND_RAWMIDI=m
CONFIG_SND_UMP=m
-# CONFIG_SND_UMP_LEGACY_RAWMIDI is not set
+CONFIG_SND_UMP_LEGACY_RAWMIDI=y
CONFIG_SND_COMPRESS_OFFLOAD=m
CONFIG_SND_JACK=y
CONFIG_SND_JACK_INPUT_DEV=y
@@ -7120,6 +7170,10 @@ CONFIG_SND_HDA_SCODEC_CS35L41=m
CONFIG_SND_HDA_CS_DSP_CONTROLS=m
CONFIG_SND_HDA_SCODEC_CS35L41_I2C=m
CONFIG_SND_HDA_SCODEC_CS35L41_SPI=m
+CONFIG_SND_HDA_SCODEC_CS35L56=m
+CONFIG_SND_HDA_SCODEC_CS35L56_I2C=m
+CONFIG_SND_HDA_SCODEC_CS35L56_SPI=m
+CONFIG_SND_HDA_SCODEC_TAS2781_I2C=m
CONFIG_SND_HDA_CODEC_REALTEK=m
CONFIG_SND_HDA_CODEC_ANALOG=m
CONFIG_SND_HDA_CODEC_SIGMATEL=m
@@ -7205,6 +7259,7 @@ CONFIG_SND_SOC_AMD_YC_MACH=m
CONFIG_SND_AMD_ACP_CONFIG=m
CONFIG_SND_SOC_AMD_ACP_COMMON=m
CONFIG_SND_SOC_AMD_ACP_PDM=m
+CONFIG_SND_SOC_AMD_ACP_LEGACY_COMMON=m
CONFIG_SND_SOC_AMD_ACP_I2S=m
CONFIG_SND_SOC_AMD_ACP_PCM=m
CONFIG_SND_SOC_AMD_ACP_PCI=m
@@ -7280,6 +7335,7 @@ CONFIG_SND_SOC_INTEL_AVS=m
#
CONFIG_SND_SOC_INTEL_AVS_MACH_DA7219=m
CONFIG_SND_SOC_INTEL_AVS_MACH_DMIC=m
+CONFIG_SND_SOC_INTEL_AVS_MACH_ES8336=m
CONFIG_SND_SOC_INTEL_AVS_MACH_HDAUDIO=m
CONFIG_SND_SOC_INTEL_AVS_MACH_I2S_TEST=m
CONFIG_SND_SOC_INTEL_AVS_MACH_MAX98927=m
@@ -7290,6 +7346,7 @@ CONFIG_SND_SOC_INTEL_AVS_MACH_PROBE=m
CONFIG_SND_SOC_INTEL_AVS_MACH_RT274=m
CONFIG_SND_SOC_INTEL_AVS_MACH_RT286=m
CONFIG_SND_SOC_INTEL_AVS_MACH_RT298=m
+CONFIG_SND_SOC_INTEL_AVS_MACH_RT5663=m
CONFIG_SND_SOC_INTEL_AVS_MACH_RT5682=m
CONFIG_SND_SOC_INTEL_AVS_MACH_SSM4567=m
# end of Intel AVS Machine drivers
@@ -7357,7 +7414,9 @@ CONFIG_SND_SOC_SOF_INTEL_IPC4=y
CONFIG_SND_SOC_SOF_AMD_TOPLEVEL=m
CONFIG_SND_SOC_SOF_AMD_COMMON=m
CONFIG_SND_SOC_SOF_AMD_RENOIR=m
+CONFIG_SND_SOC_SOF_AMD_VANGOGH=m
CONFIG_SND_SOC_SOF_AMD_REMBRANDT=m
+CONFIG_SND_SOC_SOF_ACP_PROBES=m
CONFIG_SND_SOC_SOF_INTEL_TOPLEVEL=y
CONFIG_SND_SOC_SOF_INTEL_HIFI_EP_IPC=m
CONFIG_SND_SOC_SOF_INTEL_ATOM_HIFI_EP=m
@@ -7383,6 +7442,8 @@ CONFIG_SND_SOC_SOF_ELKHARTLAKE=m
CONFIG_SND_SOC_SOF_ALDERLAKE=m
CONFIG_SND_SOC_SOF_INTEL_MTL=m
CONFIG_SND_SOC_SOF_METEORLAKE=m
+CONFIG_SND_SOC_SOF_INTEL_LNL=m
+CONFIG_SND_SOC_SOF_LUNARLAKE=m
CONFIG_SND_SOC_SOF_HDA_COMMON=m
CONFIG_SND_SOC_SOF_HDA_MLINK=m
CONFIG_SND_SOC_SOF_HDA_LINK=y
@@ -7434,9 +7495,11 @@ CONFIG_SND_SOC_AK4642=m
CONFIG_SND_SOC_AK5386=m
CONFIG_SND_SOC_AK5558=m
CONFIG_SND_SOC_ALC5623=m
+CONFIG_SND_SOC_AUDIO_IIO_AUX=m
CONFIG_SND_SOC_AW8738=m
CONFIG_SND_SOC_AW88395_LIB=m
CONFIG_SND_SOC_AW88395=m
+CONFIG_SND_SOC_AW88261=m
CONFIG_SND_SOC_BD28623=m
# CONFIG_SND_SOC_BT_SCO is not set
CONFIG_SND_SOC_CHV3_CODEC=m
@@ -7461,6 +7524,8 @@ CONFIG_SND_SOC_CS35L56_SDW=m
CONFIG_SND_SOC_CS42L42_CORE=m
CONFIG_SND_SOC_CS42L42=m
CONFIG_SND_SOC_CS42L42_SDW=m
+CONFIG_SND_SOC_CS42L43=m
+CONFIG_SND_SOC_CS42L43_SDW=m
CONFIG_SND_SOC_CS42L51=m
CONFIG_SND_SOC_CS42L51_I2C=m
CONFIG_SND_SOC_CS42L52=m
@@ -7543,6 +7608,7 @@ CONFIG_SND_SOC_RT298=m
CONFIG_SND_SOC_RT1011=m
CONFIG_SND_SOC_RT1015=m
CONFIG_SND_SOC_RT1015P=m
+CONFIG_SND_SOC_RT1017_SDCA_SDW=m
CONFIG_SND_SOC_RT1019=m
CONFIG_SND_SOC_RT1308=m
CONFIG_SND_SOC_RT1308_SDW=m
@@ -7630,6 +7696,7 @@ CONFIG_SND_SOC_TS3A227E=m
CONFIG_SND_SOC_TSCS42XX=m
CONFIG_SND_SOC_TSCS454=m
CONFIG_SND_SOC_UDA1334=m
+CONFIG_SND_SOC_WCD_CLASSH=m
CONFIG_SND_SOC_WCD9335=m
CONFIG_SND_SOC_WCD_MBHC=m
CONFIG_SND_SOC_WCD934X=m
@@ -7742,6 +7809,7 @@ CONFIG_HID_HOLTEK=m
CONFIG_HOLTEK_FF=y
CONFIG_HID_VIVALDI_COMMON=m
CONFIG_HID_GOOGLE_HAMMER=m
+CONFIG_HID_GOOGLE_STADIA_FF=m
CONFIG_HID_VIVALDI=m
CONFIG_HID_GT683R=m
CONFIG_HID_KEYTOUCH=m
@@ -8196,6 +8264,7 @@ CONFIG_USB_F_UAC1_LEGACY=m
CONFIG_USB_F_UAC2=m
CONFIG_USB_F_UVC=m
CONFIG_USB_F_MIDI=m
+CONFIG_USB_F_MIDI2=m
CONFIG_USB_F_HID=m
CONFIG_USB_F_PRINTER=m
CONFIG_USB_F_TCM=m
@@ -8216,6 +8285,7 @@ CONFIG_USB_CONFIGFS_F_UAC1=y
CONFIG_USB_CONFIGFS_F_UAC1_LEGACY=y
CONFIG_USB_CONFIGFS_F_UAC2=y
CONFIG_USB_CONFIGFS_F_MIDI=y
+CONFIG_USB_CONFIGFS_F_MIDI2=y
CONFIG_USB_CONFIGFS_F_HID=y
CONFIG_USB_CONFIGFS_F_UVC=y
CONFIG_USB_CONFIGFS_F_PRINTER=y
@@ -8332,7 +8402,6 @@ CONFIG_MMC_SDHCI_XENON=m
CONFIG_SCSI_UFSHCD=m
CONFIG_SCSI_UFS_BSG=y
CONFIG_SCSI_UFS_CRYPTO=y
-CONFIG_SCSI_UFS_HPB=y
CONFIG_SCSI_UFS_HWMON=y
CONFIG_SCSI_UFSHCD_PCI=m
# CONFIG_SCSI_UFS_DWC_TC_PCI is not set
@@ -8384,6 +8453,7 @@ CONFIG_LEDS_LP8788=m
CONFIG_LEDS_PCA955X=m
CONFIG_LEDS_PCA955X_GPIO=y
CONFIG_LEDS_PCA963X=m
+CONFIG_LEDS_PCA995X=m
CONFIG_LEDS_WM831X_STATUS=m
CONFIG_LEDS_WM8350=m
CONFIG_LEDS_DA903X=m
@@ -8462,6 +8532,7 @@ CONFIG_LEDS_TRIGGER_TTY=m
CONFIG_LEDS_SIEMENS_SIMATIC_IPC=m
CONFIG_LEDS_SIEMENS_SIMATIC_IPC_APOLLOLAKE=m
CONFIG_LEDS_SIEMENS_SIMATIC_IPC_F7188X=m
+CONFIG_LEDS_SIEMENS_SIMATIC_IPC_ELKHARTLAKE=m
CONFIG_ACCESSIBILITY=y
CONFIG_A11Y_BRAILLE_CONSOLE=y
@@ -8664,7 +8735,6 @@ CONFIG_RTC_DRV_M48T86=m
CONFIG_RTC_DRV_M48T35=m
CONFIG_RTC_DRV_M48T59=m
CONFIG_RTC_DRV_MSM6242=m
-CONFIG_RTC_DRV_BQ4802=m
CONFIG_RTC_DRV_RP5C01=m
CONFIG_RTC_DRV_WM831X=m
CONFIG_RTC_DRV_WM8350=m
@@ -8703,6 +8773,7 @@ CONFIG_INTEL_IDXD_SVM=y
CONFIG_INTEL_IDXD_PERFMON=y
CONFIG_INTEL_IOATDMA=m
CONFIG_PLX_DMA=m
+CONFIG_XILINX_DMA=m
CONFIG_XILINX_XDMA=m
CONFIG_AMD_PTDMA=m
CONFIG_QCOM_HIDMA_MGMT=m
@@ -8739,8 +8810,6 @@ CONFIG_DMABUF_HEAPS_CMA=y
# end of DMABUF options
CONFIG_DCA=m
-# CONFIG_AUXDISPLAY is not set
-# CONFIG_PANEL is not set
CONFIG_UIO=m
CONFIG_UIO_CIF=m
CONFIG_UIO_PDRV_GENIRQ=m
@@ -8754,6 +8823,8 @@ CONFIG_UIO_MF624=m
CONFIG_UIO_HV_GENERIC=m
CONFIG_UIO_DFL=m
CONFIG_VFIO=m
+CONFIG_VFIO_DEVICE_CDEV=y
+CONFIG_VFIO_GROUP=y
CONFIG_VFIO_CONTAINER=y
CONFIG_VFIO_IOMMU_TYPE1=m
# CONFIG_VFIO_NOIOMMU is not set
@@ -8769,6 +8840,7 @@ CONFIG_VFIO_PCI=m
CONFIG_VFIO_PCI_VGA=y
CONFIG_VFIO_PCI_IGD=y
CONFIG_MLX5_VFIO_PCI=m
+CONFIG_PDS_VFIO_PCI=m
# end of VFIO support for PCI devices
CONFIG_VFIO_MDEV=m
@@ -8854,6 +8926,7 @@ CONFIG_XEN_PVCALLS_FRONTEND=m
CONFIG_XEN_PVCALLS_BACKEND=y
CONFIG_XEN_SCSI_BACKEND=m
CONFIG_XEN_PRIVCMD=m
+CONFIG_XEN_PRIVCMD_IRQFD=y
CONFIG_XEN_ACPI_PROCESSOR=m
CONFIG_XEN_MCE_LOG=y
CONFIG_XEN_HAVE_PVMMU=y
@@ -9050,6 +9123,7 @@ CONFIG_GPD_POCKET_FAN=m
CONFIG_X86_PLATFORM_DRIVERS_HP=y
CONFIG_HP_ACCEL=m
CONFIG_HP_WMI=m
+CONFIG_HP_BIOSCFG=m
CONFIG_WIRELESS_HOTKEY=m
CONFIG_IBM_RTL=m
CONFIG_IDEAPAD_LAPTOP=m
@@ -9141,7 +9215,12 @@ CONFIG_INTEL_SCU_PCI=y
CONFIG_INTEL_SCU_PLATFORM=m
CONFIG_INTEL_SCU_IPC_UTIL=m
CONFIG_SIEMENS_SIMATIC_IPC=m
+CONFIG_SIEMENS_SIMATIC_IPC_BATT=m
+CONFIG_SIEMENS_SIMATIC_IPC_BATT_APOLLOLAKE=m
+CONFIG_SIEMENS_SIMATIC_IPC_BATT_ELKHARTLAKE=m
+CONFIG_SIEMENS_SIMATIC_IPC_BATT_F7188X=m
CONFIG_WINMATE_FM07_KEYS=m
+CONFIG_SEL3350_PLATFORM=m
CONFIG_P2SB=y
CONFIG_HAVE_CLK=y
CONFIG_HAVE_CLK_PREPARE=y
@@ -9553,6 +9632,7 @@ CONFIG_HID_SENSOR_IIO_COMMON=m
CONFIG_HID_SENSOR_IIO_TRIGGER=m
# end of Hid Sensor IIO Common
+CONFIG_IIO_INV_SENSORS_TIMESTAMP=m
CONFIG_IIO_MS_SENSORS_I2C=m
#
@@ -9609,6 +9689,7 @@ CONFIG_MAX517=m
CONFIG_MAX5522=m
CONFIG_MAX5821=m
CONFIG_MCP4725=m
+CONFIG_MCP4728=m
CONFIG_MCP4922=m
CONFIG_TI_DAC082S085=m
CONFIG_TI_DAC5571=m
@@ -9922,6 +10003,7 @@ CONFIG_AS3935=m
# Proximity and distance sensors
#
CONFIG_CROS_EC_MKBP_PROXIMITY=m
+CONFIG_IRSD200=m
CONFIG_ISL29501=m
CONFIG_LIDAR_LITE_V2=m
CONFIG_MB1232=m
@@ -10163,6 +10245,7 @@ CONFIG_HTE=y
CONFIG_DCACHE_WORD_ACCESS=y
CONFIG_VALIDATE_FS_PARSER=y
CONFIG_FS_IOMAP=y
+CONFIG_BUFFER_HEAD=y
CONFIG_LEGACY_DIRECT_IO=y
# CONFIG_EXT2_FS is not set
# CONFIG_EXT3_FS is not set
@@ -10193,6 +10276,7 @@ CONFIG_XFS_POSIX_ACL=y
CONFIG_XFS_RT=y
CONFIG_XFS_DRAIN_INTENTS=y
CONFIG_XFS_ONLINE_SCRUB=y
+# CONFIG_XFS_ONLINE_SCRUB_STATS is not set
CONFIG_XFS_ONLINE_REPAIR=y
# CONFIG_XFS_WARN is not set
# CONFIG_XFS_DEBUG is not set
@@ -10262,6 +10346,7 @@ CONFIG_OVERLAY_FS_REDIRECT_DIR=y
CONFIG_OVERLAY_FS_INDEX=y
CONFIG_OVERLAY_FS_XINO_AUTO=y
CONFIG_OVERLAY_FS_METACOPY=y
+# CONFIG_OVERLAY_FS_DEBUG is not set
#
# Caches
@@ -10322,11 +10407,11 @@ CONFIG_TMPFS=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_TMPFS_XATTR=y
CONFIG_TMPFS_INODE64=y
+CONFIG_TMPFS_QUOTA=y
CONFIG_HUGETLBFS=y
CONFIG_HUGETLB_PAGE=y
CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP=y
# CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_ON is not set
-CONFIG_MEMFD_CREATE=y
CONFIG_ARCH_HAS_GIGANTIC_PAGE=y
CONFIG_CONFIGFS_FS=y
CONFIG_EFIVAR_FS=y
@@ -10397,19 +10482,7 @@ CONFIG_ROMFS_BACKED_BY_BLOCK=y
CONFIG_ROMFS_ON_BLOCK=y
CONFIG_PSTORE=y
CONFIG_PSTORE_DEFAULT_KMSG_BYTES=10240
-CONFIG_PSTORE_DEFLATE_COMPRESS=m
-CONFIG_PSTORE_LZO_COMPRESS=m
-CONFIG_PSTORE_LZ4_COMPRESS=m
-CONFIG_PSTORE_LZ4HC_COMPRESS=m
-# CONFIG_PSTORE_842_COMPRESS is not set
-CONFIG_PSTORE_ZSTD_COMPRESS=y
CONFIG_PSTORE_COMPRESS=y
-# CONFIG_PSTORE_DEFLATE_COMPRESS_DEFAULT is not set
-# CONFIG_PSTORE_LZO_COMPRESS_DEFAULT is not set
-# CONFIG_PSTORE_LZ4_COMPRESS_DEFAULT is not set
-# CONFIG_PSTORE_LZ4HC_COMPRESS_DEFAULT is not set
-CONFIG_PSTORE_ZSTD_COMPRESS_DEFAULT=y
-CONFIG_PSTORE_COMPRESS_DEFAULT="zstd"
# CONFIG_PSTORE_CONSOLE is not set
# CONFIG_PSTORE_PMSG is not set
# CONFIG_PSTORE_FTRACE is not set
@@ -10430,6 +10503,7 @@ CONFIG_EROFS_FS_POSIX_ACL=y
CONFIG_EROFS_FS_SECURITY=y
CONFIG_EROFS_FS_ZIP=y
CONFIG_EROFS_FS_ZIP_LZMA=y
+CONFIG_EROFS_FS_ZIP_DEFLATE=y
CONFIG_EROFS_FS_ONDEMAND=y
CONFIG_EROFS_FS_PCPU_KTHREAD=y
CONFIG_EROFS_FS_PCPU_KTHREAD_HIPRI=y
@@ -10447,7 +10521,7 @@ CONFIG_PNFS_FILE_LAYOUT=m
CONFIG_PNFS_BLOCK=m
CONFIG_PNFS_FLEXFILE_LAYOUT=m
CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org"
-CONFIG_NFS_V4_1_MIGRATION=y
+# CONFIG_NFS_V4_1_MIGRATION is not set
CONFIG_NFS_V4_SECURITY_LABEL=y
CONFIG_NFS_FSCACHE=y
# CONFIG_NFS_USE_LEGACY_DNS is not set
@@ -10476,8 +10550,6 @@ CONFIG_SUNRPC_GSS=m
CONFIG_SUNRPC_BACKCHANNEL=y
CONFIG_SUNRPC_SWAP=y
CONFIG_RPCSEC_GSS_KRB5=m
-CONFIG_RPCSEC_GSS_KRB5_CRYPTOSYSTEM=y
-# CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_DES is not set
CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_AES_SHA1=y
CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_CAMELLIA=y
CONFIG_RPCSEC_GSS_KRB5_ENCTYPES_AES_SHA2=y
@@ -10565,6 +10637,7 @@ CONFIG_NLS_MAC_INUIT=m
CONFIG_NLS_MAC_ROMANIAN=m
CONFIG_NLS_MAC_TURKISH=m
CONFIG_NLS_UTF8=m
+CONFIG_NLS_UCS2_UTILS=m
CONFIG_DLM=m
CONFIG_DLM_DEBUG=y
CONFIG_UNICODE=y
@@ -10603,6 +10676,7 @@ CONFIG_SECURITY_SELINUX_DEVELOP=y
CONFIG_SECURITY_SELINUX_AVC_STATS=y
CONFIG_SECURITY_SELINUX_SIDTAB_HASH_BITS=9
CONFIG_SECURITY_SELINUX_SID2STR_CACHE_SIZE=256
+# CONFIG_SECURITY_SELINUX_DEBUG is not set
CONFIG_SECURITY_SMACK=y
CONFIG_SECURITY_SMACK_BRINGUP=y
CONFIG_SECURITY_SMACK_NETFILTER=y
@@ -10670,6 +10744,13 @@ CONFIG_CC_HAS_ZERO_CALL_USED_REGS=y
# CONFIG_ZERO_CALL_USED_REGS is not set
# end of Memory initialization
+#
+# Hardening of kernel data structures
+#
+CONFIG_LIST_HARDENED=y
+# CONFIG_BUG_ON_DATA_CORRUPTION is not set
+# end of Hardening of kernel data structures
+
CONFIG_RANDSTRUCT_NONE=y
# CONFIG_RANDSTRUCT_FULL is not set
# CONFIG_RANDSTRUCT_PERFORMANCE is not set
@@ -11074,9 +11155,10 @@ CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_ARCH_DMA_ADDR_T_64BIT=y
CONFIG_ARCH_HAS_FORCE_DMA_UNENCRYPTED=y
CONFIG_SWIOTLB=y
+# CONFIG_SWIOTLB_DYNAMIC is not set
CONFIG_DMA_COHERENT_POOL=y
CONFIG_DMA_CMA=y
-# CONFIG_DMA_PERNUMA_CMA is not set
+# CONFIG_DMA_NUMA_CMA is not set
#
# Default contiguous memory area size:
@@ -11172,9 +11254,9 @@ CONFIG_AS_HAS_NON_CONST_LEB128=y
# CONFIG_DEBUG_INFO_DWARF4 is not set
CONFIG_DEBUG_INFO_DWARF5=y
# CONFIG_DEBUG_INFO_REDUCED is not set
-# CONFIG_DEBUG_INFO_COMPRESSED_NONE is not set
+CONFIG_DEBUG_INFO_COMPRESSED_NONE=y
# CONFIG_DEBUG_INFO_COMPRESSED_ZLIB is not set
-CONFIG_DEBUG_INFO_COMPRESSED_ZSTD=y
+# CONFIG_DEBUG_INFO_COMPRESSED_ZSTD is not set
# CONFIG_DEBUG_INFO_SPLIT is not set
CONFIG_DEBUG_INFO_BTF=y
CONFIG_PAHOLE_HAS_SPLIT_BTF=y
@@ -11339,7 +11421,6 @@ CONFIG_DEBUG_LIST=y
# CONFIG_DEBUG_PLIST is not set
# CONFIG_DEBUG_SG is not set
# CONFIG_DEBUG_NOTIFIERS is not set
-# CONFIG_BUG_ON_DATA_CORRUPTION is not set
# CONFIG_DEBUG_MAPLE_TREE is not set
# end of Debug kernel data structures
diff --git a/v14.1-0001-HID-asus-fix-more-n-key-report-descriptors-if-.patch b/v14.1-0001-HID-asus-fix-more-n-key-report-descriptors-if-.patch
new file mode 100644
index 000000000000..b5fb39f5f4ae
--- /dev/null
+++ b/v14.1-0001-HID-asus-fix-more-n-key-report-descriptors-if-.patch
@@ -0,0 +1,89 @@
+From f311b6a3ff32c8221a0003c4a154aecbf04fb12c Mon Sep 17 00:00:00 2001
+From: "Luke D. Jones" <luke@ljones.dev>
+Date: Sat, 2 Dec 2023 17:27:23 +1300
+Subject: [PATCH v14.1 1/4] HID: asus: fix more n-key report descriptors if
+ n-key quirked
+
+Adjusts the report descriptor for N-Key devices to
+make the output count 0x01 which completely avoids
+the need for a block of filtering.
+
+Signed-off-by: Luke D. Jones <luke@ljones.dev>
+---
+ drivers/hid/hid-asus.c | 49 ++++++++++++++++++++----------------------
+ 1 file changed, 23 insertions(+), 26 deletions(-)
+
+diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
+index 78cdfb8b9a7a..855972a4470f 100644
+--- a/drivers/hid/hid-asus.c
++++ b/drivers/hid/hid-asus.c
+@@ -335,36 +335,20 @@ static int asus_raw_event(struct hid_device *hdev,
+ if (drvdata->quirks & QUIRK_MEDION_E1239T)
+ return asus_e1239t_event(drvdata, data, size);
+
+- if (drvdata->quirks & QUIRK_USE_KBD_BACKLIGHT) {
++ /*
++ * Skip these report ID, the device emits a continuous stream associated
++ * with the AURA mode it is in which looks like an 'echo'.
++ */
++ if (report->id == FEATURE_KBD_LED_REPORT_ID1 || report->id == FEATURE_KBD_LED_REPORT_ID2)
++ return -1;
++ if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) {
+ /*
+- * Skip these report ID, the device emits a continuous stream associated
+- * with the AURA mode it is in which looks like an 'echo'.
++ * G713 and G733 send these codes on some keypresses, depending on
++ * the key pressed it can trigger a shutdown event if not caught.
+ */
+- if (report->id == FEATURE_KBD_LED_REPORT_ID1 ||
+- report->id == FEATURE_KBD_LED_REPORT_ID2) {
++ if(data[0] == 0x02 && data[1] == 0x30) {
+ return -1;
+- /* Additional report filtering */
+- } else if (report->id == FEATURE_KBD_REPORT_ID) {
+- /*
+- * G14 and G15 send these codes on some keypresses with no
+- * discernable reason for doing so. We'll filter them out to avoid
+- * unmapped warning messages later.
+- */
+- if (data[1] == 0xea || data[1] == 0xec || data[1] == 0x02 ||
+- data[1] == 0x8a || data[1] == 0x9e) {
+- return -1;
+- }
+ }
+- if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) {
+- /*
+- * G713 and G733 send these codes on some keypresses, depending on
+- * the key pressed it can trigger a shutdown event if not caught.
+- */
+- if(data[0] == 0x02 && data[1] == 0x30) {
+- return -1;
+- }
+- }
+-
+ }
+
+ if (drvdata->quirks & QUIRK_ROG_CLAYMORE_II_KEYBOARD) {
+@@ -1250,6 +1234,19 @@ static __u8 *asus_report_fixup(struct hid_device *hdev, __u8 *rdesc,
+ rdesc[205] = 0x01;
+ }
+
++ /* match many more n-key devices */
++ if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) {
++ for (int i = 0; i < *rsize + 1; i++) {
++ /* offset to the count from 0x5a report part always 14 */
++ if (rdesc[i] == 0x85 && rdesc[i + 1] == 0x5a &&
++ rdesc[i + 14] == 0x95 && rdesc[i + 15] == 0x05) {
++ hid_info(hdev, "Fixing up Asus N-Key report descriptor\n");
++ rdesc[i + 15] = 0x01;
++ break;
++ }
++ }
++ }
++
+ return rdesc;
+ }
+
+--
+2.41.0
+
diff --git a/v14.1-0002-HID-asus-make-asus_kbd_init-generic-remove-rog.patch b/v14.1-0002-HID-asus-make-asus_kbd_init-generic-remove-rog.patch
new file mode 100644
index 000000000000..2a2fa5ba18ce
--- /dev/null
+++ b/v14.1-0002-HID-asus-make-asus_kbd_init-generic-remove-rog.patch
@@ -0,0 +1,130 @@
+From 119615a0034ee5f8d7a949c1c9d992b1be125fcb Mon Sep 17 00:00:00 2001
+From: "Luke D. Jones" <luke@ljones.dev>
+Date: Sat, 2 Dec 2023 17:47:59 +1300
+Subject: [PATCH v14.1 2/4] HID: asus: make asus_kbd_init() generic, remove
+ rog_nkey_led_init()
+
+Some of the n-key stuff is old and outdated, so
+make asus_kbd_init() generic to use with other
+report ID and remove rog_nkey_led_init().
+
+Signed-off-by: Luke D. Jones <luke@ljones.dev>
+---
+ drivers/hid/hid-asus.c | 70 +++++++++++-------------------------------
+ 1 file changed, 18 insertions(+), 52 deletions(-)
+
+diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
+index 855972a4470f..cdd998a761fe 100644
+--- a/drivers/hid/hid-asus.c
++++ b/drivers/hid/hid-asus.c
+@@ -386,9 +386,9 @@ static int asus_kbd_set_report(struct hid_device *hdev, const u8 *buf, size_t bu
+ return ret;
+ }
+
+-static int asus_kbd_init(struct hid_device *hdev)
++static int asus_kbd_init(struct hid_device *hdev, u8 report_id)
+ {
+- const u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x41, 0x53, 0x55, 0x53, 0x20, 0x54,
++ const u8 buf[] = { report_id, 0x41, 0x53, 0x55, 0x53, 0x20, 0x54,
+ 0x65, 0x63, 0x68, 0x2e, 0x49, 0x6e, 0x63, 0x2e, 0x00 };
+ int ret;
+
+@@ -400,9 +400,10 @@ static int asus_kbd_init(struct hid_device *hdev)
+ }
+
+ static int asus_kbd_get_functions(struct hid_device *hdev,
+- unsigned char *kbd_func)
++ unsigned char *kbd_func,
++ u8 report_id)
+ {
+- const u8 buf[] = { FEATURE_KBD_REPORT_ID, 0x05, 0x20, 0x31, 0x00, 0x08 };
++ const u8 buf[] = { report_id, 0x05, 0x20, 0x31, 0x00, 0x08 };
+ u8 *readbuf;
+ int ret;
+
+@@ -431,51 +432,6 @@ static int asus_kbd_get_functions(struct hid_device *hdev,
+ return ret;
+ }
+
+-static int rog_nkey_led_init(struct hid_device *hdev)
+-{
+- const u8 buf_init_start[] = { FEATURE_KBD_LED_REPORT_ID1, 0xB9 };
+- u8 buf_init2[] = { FEATURE_KBD_LED_REPORT_ID1, 0x41, 0x53, 0x55, 0x53, 0x20,
+- 0x54, 0x65, 0x63, 0x68, 0x2e, 0x49, 0x6e, 0x63, 0x2e, 0x00 };
+- u8 buf_init3[] = { FEATURE_KBD_LED_REPORT_ID1,
+- 0x05, 0x20, 0x31, 0x00, 0x08 };
+- int ret;
+-
+- hid_info(hdev, "Asus initialise N-KEY Device");
+- /* The first message is an init start */
+- ret = asus_kbd_set_report(hdev, buf_init_start, sizeof(buf_init_start));
+- if (ret < 0) {
+- hid_warn(hdev, "Asus failed to send init start command: %d\n", ret);
+- return ret;
+- }
+- /* Followed by a string */
+- ret = asus_kbd_set_report(hdev, buf_init2, sizeof(buf_init2));
+- if (ret < 0) {
+- hid_warn(hdev, "Asus failed to send init command 1.0: %d\n", ret);
+- return ret;
+- }
+- /* Followed by a string */
+- ret = asus_kbd_set_report(hdev, buf_init3, sizeof(buf_init3));
+- if (ret < 0) {
+- hid_warn(hdev, "Asus failed to send init command 1.1: %d\n", ret);
+- return ret;
+- }
+-
+- /* begin second report ID with same data */
+- buf_init2[0] = FEATURE_KBD_LED_REPORT_ID2;
+- buf_init3[0] = FEATURE_KBD_LED_REPORT_ID2;
+-
+- ret = asus_kbd_set_report(hdev, buf_init2, sizeof(buf_init2));
+- if (ret < 0) {
+- hid_warn(hdev, "Asus failed to send init command 2.0: %d\n", ret);
+- return ret;
+- }
+- ret = asus_kbd_set_report(hdev, buf_init3, sizeof(buf_init3));
+- if (ret < 0)
+- hid_warn(hdev, "Asus failed to send init command 2.1: %d\n", ret);
+-
+- return ret;
+-}
+-
+ static void asus_schedule_work(struct asus_kbd_leds *led)
+ {
+ unsigned long flags;
+@@ -558,17 +514,27 @@ static int asus_kbd_register_leds(struct hid_device *hdev)
+ int ret;
+
+ if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) {
+- ret = rog_nkey_led_init(hdev);
++ /* Initialize keyboard */
++ ret = asus_kbd_init(hdev, FEATURE_KBD_REPORT_ID);
++ if (ret < 0)
++ return ret;
++
++ /* The LED endpoint is initialised in two HID */
++ ret = asus_kbd_init(hdev, FEATURE_KBD_LED_REPORT_ID1);
++ if (ret < 0)
++ return ret;
++
++ ret = asus_kbd_init(hdev, FEATURE_KBD_LED_REPORT_ID2);
+ if (ret < 0)
+ return ret;
+ } else {
+ /* Initialize keyboard */
+- ret = asus_kbd_init(hdev);
++ ret = asus_kbd_init(hdev, FEATURE_KBD_REPORT_ID);
+ if (ret < 0)
+ return ret;
+
+ /* Get keyboard functions */
+- ret = asus_kbd_get_functions(hdev, &kbd_func);
++ ret = asus_kbd_get_functions(hdev, &kbd_func, FEATURE_KBD_REPORT_ID);
+ if (ret < 0)
+ return ret;
+
+--
+2.41.0
+
diff --git a/0201-asus-ally-asus-hid-6.5.patch b/v14.1-0003-HID-asus-add-ROG-Ally-N-Key-ID-and-keycodes.patch
index 82e7242cee56..a40a650b018d 100644
--- a/0201-asus-ally-asus-hid-6.5.patch
+++ b/v14.1-0003-HID-asus-add-ROG-Ally-N-Key-ID-and-keycodes.patch
@@ -1,36 +1,40 @@
+From 2b1a33a519668105eb7261c2d8964da576be6146 Mon Sep 17 00:00:00 2001
+From: "Luke D. Jones" <luke@ljones.dev>
+Date: Wed, 29 Nov 2023 22:18:11 +1300
+Subject: [PATCH v14.1 3/4] HID: asus: add ROG Ally N-Key ID and keycodes
+
+---
+ drivers/hid/hid-asus.c | 7 +++++++
+ drivers/hid/hid-ids.h | 1 +
+ 2 files changed, 8 insertions(+)
+
diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
-index d1094bb1aa42..47fb048bb5fd 100644
+index cdd998a761fe..3a1a6024d299 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
-@@ -897,7 +897,15 @@ static int asus_input_mapping(struct hid
+@@ -847,6 +847,10 @@ static int asus_input_mapping(struct hid_device *hdev,
case 0xb3: asus_map_key_clear(KEY_PROG3); break; /* Fn+Left next aura */
case 0x6a: asus_map_key_clear(KEY_F13); break; /* Screenpad toggle */
case 0x4b: asus_map_key_clear(KEY_F14); break; /* Arrows/Pg-Up/Dn toggle */
--
-+ case 0xa0: asus_map_key_clear(KEY_F10); break; /* ROG Ally back paddle + A */
-+ case 0xa1: asus_map_key_clear(KEY_F11); break;
-+ case 0xa2: asus_map_key_clear(KEY_F12); break; /* ROG Ally back paddle + D Pad Up */
-+ case 0xa3: asus_map_key_clear(KEY_F13); break;
-+ case 0xa4: asus_map_key_clear(KEY_F14); break; /* ROG Ally back paddle + Y */
+ case 0xa5: asus_map_key_clear(KEY_F15); break; /* ROG Ally left back */
+ case 0xa6: asus_map_key_clear(KEY_F16); break; /* ROG Ally QAM button */
+ case 0xa7: asus_map_key_clear(KEY_F17); break; /* ROG Ally ROG long-press */
+ case 0xa8: asus_map_key_clear(KEY_F18); break; /* ROG Ally ROG long-press-release */
+
default:
- /* ASUS lazily declares 256 usages, ignore the rest,
-@@ -1259,6 +1267,9 @@ static const struct hid_device_id asus_d
+@@ -1239,6 +1243,9 @@ static const struct hid_device_id asus_devices[] = {
+ { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD3),
QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD },
- { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
++ { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
+ USB_DEVICE_ID_ASUSTEK_ROG_NKEY_ALLY),
+ QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD },
-+ { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
+ { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
USB_DEVICE_ID_ASUSTEK_ROG_CLAYMORE_II_KEYBOARD),
QUIRK_ROG_CLAYMORE_II_KEYBOARD },
- { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
-index c2e9b6d1fd7d..cd6efa46a2bd 100644
+index c6e4e0d1f214..6debff9ad678 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -208,6 +208,7 @@
@@ -41,3 +45,6 @@ index c2e9b6d1fd7d..cd6efa46a2bd 100644
#define USB_DEVICE_ID_ASUSTEK_ROG_CLAYMORE_II_KEYBOARD 0x196b
#define USB_DEVICE_ID_ASUSTEK_FX503VD_KEYBOARD 0x1869
+--
+2.41.0
+
diff --git a/v14.1-0004-HID-asus-add-ROG-Ally-xpad-settings.patch b/v14.1-0004-HID-asus-add-ROG-Ally-xpad-settings.patch
new file mode 100644
index 000000000000..13bfbd78c677
--- /dev/null
+++ b/v14.1-0004-HID-asus-add-ROG-Ally-xpad-settings.patch
@@ -0,0 +1,2317 @@
+From fc88194fbc824967cce666a6e2ab4b47722f8d01 Mon Sep 17 00:00:00 2001
+From: "Luke D. Jones" <luke@ljones.dev>
+Date: Fri, 1 Dec 2023 16:57:19 +1300
+Subject: [PATCH v14.1 4/4] HID: asus: add ROG Ally xpad settings
+
+- move ROG specific stuff to new .c
+- add a header for common parts
+- add xpad mode
+- add deadzones
+- add anti-deadzones
+- add gamepad button remapping
+- add gamepad mapping reset for xpad and wasd modes
+- add turbo mode for individual buttons
+- add joystick response curves
+- add vibration intensity settings
+- add calibration setting
+---
+ .../ABI/testing/sysfs-driver-hid-asus | 85 +
+ drivers/hid/Makefile | 2 +
+ drivers/hid/{hid-asus.c => hid-asus-core.c} | 71 +-
+ drivers/hid/hid-asus-rog.c | 1457 +++++++++++++++++
+ drivers/hid/hid-asus-rog.h | 482 ++++++
+ drivers/hid/hid-asus.h | 58 +
+ 6 files changed, 2114 insertions(+), 41 deletions(-)
+ create mode 100644 Documentation/ABI/testing/sysfs-driver-hid-asus
+ rename drivers/hid/{hid-asus.c => hid-asus-core.c} (96%)
+ create mode 100644 drivers/hid/hid-asus-rog.c
+ create mode 100644 drivers/hid/hid-asus-rog.h
+ create mode 100644 drivers/hid/hid-asus.h
+
+diff --git a/Documentation/ABI/testing/sysfs-driver-hid-asus b/Documentation/ABI/testing/sysfs-driver-hid-asus
+new file mode 100644
+index 000000000000..736233ebb38f
+--- /dev/null
++++ b/Documentation/ABI/testing/sysfs-driver-hid-asus
+@@ -0,0 +1,85 @@
++What: /sys/bus/usb/devices/1-3:1.0/0003:0B05:1ABE.0001/gamepad_mode
++Date: December 2023
++Contact: linux-input@vger.kernel.org
++Description: Set the mode the ROG Ally xpad operates in:
++ - 1 = Game mode
++ - 2 = WASD mode
++ - 3 = Mouse mode
++ This setting applies instantly and applies settings that were previously changed
++ under that mode which are:
++ - deadzones
++ - anti-deadzones
++ - button mapping
++ - button turbo settings
++ - response curves
++
++What: /sys/bus/usb/devices/1-3:1.0/0003:0B05:1ABE.0001/apply
++Date: December 2023
++Contact: linux-input@vger.kernel.org
++Description: Apply the settings that have been stored in attributes so far. Because there are
++ many individual settings across a dozen packets this separation is required to
++ prevent spamming the MCU when userspace applications apply many changes at once.
++
++What: /sys/bus/usb/devices/1-3:1.0/0003:0B05:1ABE.0001/reset_btn_mapping
++Date: December 2023
++Contact: linux-input@vger.kernel.org
++Description: Reset a gamepad mode to its default button mapping.
++
++What: /sys/bus/usb/devices/1-3:1.0/0003:0B05:1ABE.0001/axis_<x/y/z>_<left/right>/deadzone
++Date: December 2023
++Contact: linux-input@vger.kernel.org
++Description: Set the inner and outer deadzones of joysticks and triggers. These settings are not
++ written to the MCU until `apply` is set.
++ - range 0-64 (corresponds to 0-100%)
++
++What: /sys/bus/usb/devices/1-3:1.0/0003:0B05:1ABE.0001/axis_<x/y/z>_<left/right>/deadzone_index
++Date: December 2023
++Contact: linux-input@vger.kernel.org
++Description: Descriptive labels for joystick deadzone array.
++
++What: /sys/bus/usb/devices/1-3:1.0/0003:0B05:1ABE.0001/axis_<x/y/z>_<left/right>/calibration
++Date: December 2023
++Contact: linux-input@vger.kernel.org
++Description: Calibration values for the joysticks and trigger analogues. There are no default
++ values as the calibration is determined in userspace.
++
++What: /sys/bus/usb/devices/1-3:1.0/0003:0B05:1ABE.0001/axis_<x/y/z>_<left/right>/calibration_index
++Date: December 2023
++Contact: linux-input@vger.kernel.org
++Description: Descriptive labels for joystick and triggers calibration array.
++
++What: /sys/bus/usb/devices/1-3:1.0/0003:0B05:1ABE.0001/axis_<x/y>_<left/right>/anti-deadzone
++Date: December 2023
++Contact: linux-input@vger.kernel.org
++Description: Set the joystick anti-deadzone feature:
++ - range 0-64 (corresponds to 0-100%)
++
++What: /sys/bus/usb/devices/1-3:1.0/0003:0B05:1ABE.0001/axis_<x/y>_<left/right>/rc_point<n>
++Date: December 2023
++Contact: linux-input@vger.kernel.org
++Description: Set the joystick response curve. There are 4 points available with 1 being the lowest
++ point and 4 being the highest point.
++ - range 0-64 (corresponds to 0-100%)
++
++What: /sys/bus/usb/devices/1-3:1.0/0003:0B05:1ABE.0001/axis_<x/y>_<left/right>/rc_point_index
++Date: December 2023
++Contact: linux-input@vger.kernel.org
++Description: Descriptive labels for joystick response curve points.
++
++What: /sys/bus/usb/devices/1-3:1.0/0003:0B05:1ABE.0001/btn_<label>/turbo
++Date: December 2023
++Contact: linux-input@vger.kernel.org
++Description: Set the turbo mode of the button:
++ - 0 = no turbo, a separate press and release is registered on press and release
++ - 1-16 = interval between presses if button held down in steps of 1000ms/16
++ These settings are not written to the MCU until `apply` is set.
++
++What: /sys/bus/usb/devices/1-3:1.0/0003:0B05:1ABE.0001/vibration_intensity
++Date: December 2023
++Contact: linux-input@vger.kernel.org
++Description: Set the vibration intensity for left and right haptics. Applies instantly.
++
++What: /sys/bus/usb/devices/1-3:1.0/0003:0B05:1ABE.0001/vibration_intensity_index
++Date: December 2023
++Contact: linux-input@vger.kernel.org
++Description: Descriptive labels for index points of vibration_intensity.
+\ No newline at end of file
+diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
+index 8a06d0f840bc..7c2436ed05d6 100644
+--- a/drivers/hid/Makefile
++++ b/drivers/hid/Makefile
+@@ -23,6 +23,8 @@ hid-logitech-$(CONFIG_LOGIWHEELS_FF) += hid-lg4ff.o
+ hid-wiimote-y := hid-wiimote-core.o hid-wiimote-modules.o
+ hid-wiimote-$(CONFIG_DEBUG_FS) += hid-wiimote-debug.o
+
++hid-asus-y := hid-asus-core.o hid-asus-rog.o
++
+ obj-$(CONFIG_HID_A4TECH) += hid-a4tech.o
+ obj-$(CONFIG_HID_ACCUTOUCH) += hid-accutouch.o
+ obj-$(CONFIG_HID_ALPS) += hid-alps.o
+diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus-core.c
+similarity index 96%
+rename from drivers/hid/hid-asus.c
+rename to drivers/hid/hid-asus-core.c
+index 3a1a6024d299..026705c43ee1 100644
+--- a/drivers/hid/hid-asus.c
++++ b/drivers/hid/hid-asus-core.c
+@@ -20,9 +20,8 @@
+ * Copyright (c) 2016 Frederik Wenigwieser <frederik.wenigwieser@gmail.com>
+ */
+
+-/*
+- */
+-
++#include <asm-generic/errno-base.h>
++#include <asm-generic/errno.h>
+ #include <linux/dmi.h>
+ #include <linux/hid.h>
+ #include <linux/module.h>
+@@ -32,6 +31,7 @@
+ #include <linux/power_supply.h>
+ #include <linux/leds.h>
+
++#include "hid-asus.h"
+ #include "hid-ids.h"
+
+ MODULE_AUTHOR("Yusuke Fujimaki <usk.fujimaki@gmail.com>");
+@@ -47,10 +47,6 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");
+ #define T100CHI_MOUSE_REPORT_ID 0x06
+ #define FEATURE_REPORT_ID 0x0d
+ #define INPUT_REPORT_ID 0x5d
+-#define FEATURE_KBD_REPORT_ID 0x5a
+-#define FEATURE_KBD_REPORT_SIZE 16
+-#define FEATURE_KBD_LED_REPORT_ID1 0x5d
+-#define FEATURE_KBD_LED_REPORT_ID2 0x5e
+
+ #define SUPPORT_KBD_BACKLIGHT BIT(0)
+
+@@ -71,20 +67,6 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad");
+ #define BATTERY_STAT_CHARGING (1)
+ #define BATTERY_STAT_FULL (2)
+
+-#define QUIRK_FIX_NOTEBOOK_REPORT BIT(0)
+-#define QUIRK_NO_INIT_REPORTS BIT(1)
+-#define QUIRK_SKIP_INPUT_MAPPING BIT(2)
+-#define QUIRK_IS_MULTITOUCH BIT(3)
+-#define QUIRK_NO_CONSUMER_USAGES BIT(4)
+-#define QUIRK_USE_KBD_BACKLIGHT BIT(5)
+-#define QUIRK_T100_KEYBOARD BIT(6)
+-#define QUIRK_T100CHI BIT(7)
+-#define QUIRK_G752_KEYBOARD BIT(8)
+-#define QUIRK_T90CHI BIT(9)
+-#define QUIRK_MEDION_E1239T BIT(10)
+-#define QUIRK_ROG_NKEY_KEYBOARD BIT(11)
+-#define QUIRK_ROG_CLAYMORE_II_KEYBOARD BIT(12)
+-
+ #define I2C_KEYBOARD_QUIRKS (QUIRK_FIX_NOTEBOOK_REPORT | \
+ QUIRK_NO_INIT_REPORTS | \
+ QUIRK_NO_CONSUMER_USAGES)
+@@ -113,22 +95,6 @@ struct asus_touchpad_info {
+ int report_size;
+ };
+
+-struct asus_drvdata {
+- unsigned long quirks;
+- struct hid_device *hdev;
+- struct input_dev *input;
+- struct input_dev *tp_kbd_input;
+- struct asus_kbd_leds *kbd_backlight;
+- const struct asus_touchpad_info *tp;
+- bool enable_backlight;
+- struct power_supply *battery;
+- struct power_supply_desc battery_desc;
+- int battery_capacity;
+- int battery_stat;
+- bool battery_in_query;
+- unsigned long battery_next_query;
+-};
+-
+ static int asus_report_battery(struct asus_drvdata *, u8 *, int);
+
+ static const struct asus_touchpad_info asus_i2c_tp = {
+@@ -329,6 +295,16 @@ static int asus_raw_event(struct hid_device *hdev,
+ if (drvdata->battery && data[0] == BATTERY_REPORT_ID)
+ return asus_report_battery(drvdata, data, size);
+
++ // TODO: remove after debugging
++ // if (data[0] == 0x5a || data[0] == 0x5d || data[0] == 0x5e){
++ // for (int i = 0; i < size; i++) {
++ // if (i == 0)
++ // printk(KERN_INFO "GOT: %02x,", data[i]);
++ // else
++ // printk(KERN_CONT "%02x,", data[i]);
++ // }
++ // }
++
+ if (drvdata->tp && data[0] == INPUT_REPORT_ID)
+ return asus_report_input(drvdata, data, size);
+
+@@ -365,7 +341,7 @@ static int asus_raw_event(struct hid_device *hdev,
+ return 0;
+ }
+
+-static int asus_kbd_set_report(struct hid_device *hdev, const u8 *buf, size_t buf_size)
++int asus_kbd_set_report(struct hid_device *hdev, const u8 *buf, size_t buf_size)
+ {
+ unsigned char *dmabuf;
+ int ret;
+@@ -386,6 +362,13 @@ static int asus_kbd_set_report(struct hid_device *hdev, const u8 *buf, size_t bu
+ return ret;
+ }
+
++int asus_kbd_get_report(struct hid_device *hdev, u8 *out_buf, size_t out_buf_size)
++{
++ return hid_hw_raw_request(hdev, FEATURE_KBD_REPORT_ID, out_buf,
++ out_buf_size, HID_FEATURE_REPORT,
++ HID_REQ_GET_REPORT);
++}
++
+ static int asus_kbd_init(struct hid_device *hdev, u8 report_id)
+ {
+ const u8 buf[] = { report_id, 0x41, 0x53, 0x55, 0x53, 0x20, 0x54,
+@@ -846,8 +829,8 @@ static int asus_input_mapping(struct hid_device *hdev,
+ case 0xb2: asus_map_key_clear(KEY_PROG2); break; /* Fn+Left previous aura */
+ case 0xb3: asus_map_key_clear(KEY_PROG3); break; /* Fn+Left next aura */
+ case 0x6a: asus_map_key_clear(KEY_F13); break; /* Screenpad toggle */
+- case 0x4b: asus_map_key_clear(KEY_F14); break; /* Arrows/Pg-Up/Dn toggle */
+- case 0xa5: asus_map_key_clear(KEY_F15); break; /* ROG Ally left back */
++ case 0x4b: asus_map_key_clear(KEY_F14); break; /* Arrows/Pg-Up/Dn toggle, Ally M1 */
++ case 0xa5: asus_map_key_clear(KEY_F15); break; /* ROG Ally M2 */
+ case 0xa6: asus_map_key_clear(KEY_F16); break; /* ROG Ally QAM button */
+ case 0xa7: asus_map_key_clear(KEY_F17); break; /* ROG Ally ROG long-press */
+ case 0xa8: asus_map_key_clear(KEY_F18); break; /* ROG Ally ROG long-press-release */
+@@ -1063,6 +1046,10 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
+ }
+ }
+
++ /* all ROG devices have this HID interface but we will focus on Ally for now */
++ if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD && hid_is_usb(hdev))
++ rog_ally.probe(hdev, &rog_ally);
++
+ ret = hid_parse(hdev);
+ if (ret) {
+ hid_err(hdev, "Asus hid parse failed: %d\n", ret);
+@@ -1112,6 +1099,8 @@ static void asus_remove(struct hid_device *hdev)
+ cancel_work_sync(&drvdata->kbd_backlight->work);
+ }
+
++ rog_ally.remove(hdev, &rog_ally);
++
+ hid_hw_stop(hdev);
+ }
+
+@@ -1245,7 +1234,7 @@ static const struct hid_device_id asus_devices[] = {
+ QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD },
+ { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
+ USB_DEVICE_ID_ASUSTEK_ROG_NKEY_ALLY),
+- QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD },
++ QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD | QUIRK_ROG_ALLY_XPAD },
+ { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
+ USB_DEVICE_ID_ASUSTEK_ROG_CLAYMORE_II_KEYBOARD),
+ QUIRK_ROG_CLAYMORE_II_KEYBOARD },
+diff --git a/drivers/hid/hid-asus-rog.c b/drivers/hid/hid-asus-rog.c
+new file mode 100644
+index 000000000000..f0a2b366a298
+--- /dev/null
++++ b/drivers/hid/hid-asus-rog.c
+@@ -0,0 +1,1457 @@
++// SPDX-License-Identifier: GPL-2.0-or-later
++/*
++ * HID driver for Asus ROG laptops and Ally
++ *
++ * Copyright (c) 2023 Luke Jones <luke@ljones.dev>
++ */
++
++#include <linux/hid.h>
++#include <linux/types.h>
++#include <linux/usb.h>
++
++#include "hid-asus.h"
++#include "hid-asus-rog.h"
++
++/* ROG Ally has many settings related to the gamepad, all using the same n-key endpoint */
++struct asus_rog_ally {
++ enum xpad_mode mode;
++ /*
++ * index: [joysticks/triggers][left(2 bytes), right(2 bytes)]
++ * joysticks: 2 bytes: inner, outer
++ * triggers: 2 bytes: lower, upper
++ * min/max: 0-64
++ */
++ u8 deadzones[xpad_mode_mouse][2][4];
++ /*
++ * index: left, right
++ * max: 64
++ */
++ u8 vibration_intensity[xpad_mode_mouse][2];
++ /*
++ * index: [joysticks][2 byte stepping per point]
++ * - 4 points of 2 bytes each
++ * - byte 0 of pair = stick move %
++ * - byte 1 of pair = stick response %
++ * - min/max: 1-63
++ */
++ bool supports_response_curves;
++ u8 response_curve[xpad_mode_mouse][2][8];
++ /*
++ * left = byte 0, right = byte 1
++ */
++ bool supports_anti_deadzones;
++ u8 anti_deadzones[xpad_mode_mouse][2];
++ /*
++ * index: [mode][phys pair][b1, b1 secondary, b2, b2 secondary, blocks of 11]
++ */
++ u8 key_mapping[xpad_mode_mouse][btn_pair_lt_rt][MAPPING_BLOCK_LEN];
++ /*
++ *
++ */
++ u8 turbo_btns[xpad_mode_mouse][TURBO_BLOCK_LEN];
++ /*
++ */
++ u32 js_calibrations[2][6];
++ u32 tr_calibrations[2][2];
++};
++
++static struct asus_rog_ally *__rog_ally_data(struct device *raw_dev)
++{
++ struct hid_device *hdev = to_hid_device(raw_dev);
++ return ((struct asus_drvdata *)hid_get_drvdata(hdev))->rog_ally_data;
++}
++
++#define STR_TO_CODE_IF(_idx, _code, _label) \
++ if (!strcmp(buf, _label)) \
++ out[_idx] = _code;
++
++#define STR_TO_CODE_ELIF(_idx, _code, _label) else if (!strcmp(buf, _label)) out[_idx] = _code;
++
++/* writes the bytes for a requested key/function in to the out buffer */
++const static int __string_to_key_code(const char *buf, u8 *out, int out_len)
++{
++ u8 *save_buf;
++
++ if (out_len != BTN_CODE_LEN)
++ return -EINVAL;
++
++ save_buf = kzalloc(out_len, GFP_KERNEL);
++ if (!save_buf)
++ return -ENOMEM;
++ memcpy(save_buf, out, out_len);
++ memset(out, 0, out_len); // always clear before adjusting
++
++ // Allow clearing
++ if (!strcmp(buf, " ") || !strcmp(buf, "\n"))
++ goto success;
++
++ // set group xpad
++ out[0] = 0x01;
++ STR_TO_CODE_IF(1, 0x01, PAD_A)
++ STR_TO_CODE_ELIF(1, 0x02, PAD_B)
++ STR_TO_CODE_ELIF(1, 0x03, PAD_X)
++ STR_TO_CODE_ELIF(1, 0x04, PAD_Y)
++ STR_TO_CODE_ELIF(1, 0x05, PAD_LB)
++ STR_TO_CODE_ELIF(1, 0x06, PAD_RB)
++ STR_TO_CODE_ELIF(1, 0x07, PAD_LS)
++ STR_TO_CODE_ELIF(1, 0x08, PAD_RS)
++ STR_TO_CODE_ELIF(1, 0x09, PAD_DPAD_UP)
++ STR_TO_CODE_ELIF(1, 0x0a, PAD_DPAD_DOWN)
++ STR_TO_CODE_ELIF(1, 0x0b, PAD_DPAD_LEFT)
++ STR_TO_CODE_ELIF(1, 0x0c, PAD_DPAD_RIGHT)
++ STR_TO_CODE_ELIF(1, 0x11, PAD_VIEW)
++ STR_TO_CODE_ELIF(1, 0x12, PAD_MENU)
++ STR_TO_CODE_ELIF(1, 0x13, PAD_XBOX)
++ if (out[1])
++ goto success;
++
++ // set group keyboard
++ out[0] = 0x02;
++ STR_TO_CODE_IF(2, 0x8f, KB_M1)
++ STR_TO_CODE_ELIF(2, 0x8e, KB_M2)
++
++ STR_TO_CODE_ELIF(2, 0x76, KB_ESC)
++ STR_TO_CODE_ELIF(2, 0x50, KB_F1)
++ STR_TO_CODE_ELIF(2, 0x60, KB_F2)
++ STR_TO_CODE_ELIF(2, 0x40, KB_F3)
++ STR_TO_CODE_ELIF(2, 0x0c, KB_F4)
++ STR_TO_CODE_ELIF(2, 0x03, KB_F5)
++ STR_TO_CODE_ELIF(2, 0x0b, KB_F6)
++ STR_TO_CODE_ELIF(2, 0x80, KB_F7)
++ STR_TO_CODE_ELIF(2, 0x0a, KB_F8)
++ STR_TO_CODE_ELIF(2, 0x01, KB_F9)
++ STR_TO_CODE_ELIF(2, 0x09, KB_F10)
++ STR_TO_CODE_ELIF(2, 0x78, KB_F11)
++ STR_TO_CODE_ELIF(2, 0x07, KB_F12)
++ STR_TO_CODE_ELIF(2, 0x10, KB_F14)
++ STR_TO_CODE_ELIF(2, 0x18, KB_F15)
++
++ STR_TO_CODE_ELIF(2, 0x0e, KB_BACKTICK)
++ STR_TO_CODE_ELIF(2, 0x16, KB_1)
++ STR_TO_CODE_ELIF(2, 0x1e, KB_2)
++ STR_TO_CODE_ELIF(2, 0x26, KB_3)
++ STR_TO_CODE_ELIF(2, 0x25, KB_4)
++ STR_TO_CODE_ELIF(2, 0x2e, KB_5)
++ STR_TO_CODE_ELIF(2, 0x36, KB_6)
++ STR_TO_CODE_ELIF(2, 0x3d, KB_7)
++ STR_TO_CODE_ELIF(2, 0x3e, KB_8)
++ STR_TO_CODE_ELIF(2, 0x46, KB_9)
++ STR_TO_CODE_ELIF(2, 0x45, KB_0)
++ STR_TO_CODE_ELIF(2, 0x4e, KB_HYPHEN)
++ STR_TO_CODE_ELIF(2, 0x55, KB_EQUALS)
++ STR_TO_CODE_ELIF(2, 0x66, KB_BACKSPACE)
++
++ STR_TO_CODE_ELIF(2, 0x0d, KB_TAB)
++ STR_TO_CODE_ELIF(2, 0x15, KB_Q)
++ STR_TO_CODE_ELIF(2, 0x1d, KB_W)
++ STR_TO_CODE_ELIF(2, 0x24, KB_E)
++ STR_TO_CODE_ELIF(2, 0x2d, KB_R)
++ STR_TO_CODE_ELIF(2, 0x2d, KB_T)
++ STR_TO_CODE_ELIF(2, 0x35, KB_Y)
++ STR_TO_CODE_ELIF(2, 0x3c, KB_U)
++ STR_TO_CODE_ELIF(2, 0x43, KB_I)
++ STR_TO_CODE_ELIF(2, 0x44, KB_O)
++ STR_TO_CODE_ELIF(2, 0x4d, KB_P)
++ STR_TO_CODE_ELIF(2, 0x54, KB_LBRACKET)
++ STR_TO_CODE_ELIF(2, 0x5b, KB_RBRACKET)
++ STR_TO_CODE_ELIF(2, 0x5d, KB_BACKSLASH)
++
++ STR_TO_CODE_ELIF(2, 0x58, KB_CAPS)
++ STR_TO_CODE_ELIF(2, 0x1c, KB_A)
++ STR_TO_CODE_ELIF(2, 0x1b, KB_S)
++ STR_TO_CODE_ELIF(2, 0x23, KB_D)
++ STR_TO_CODE_ELIF(2, 0x2b, KB_F)
++ STR_TO_CODE_ELIF(2, 0x34, KB_G)
++ STR_TO_CODE_ELIF(2, 0x33, KB_H)
++ STR_TO_CODE_ELIF(2, 0x3b, KB_J)
++ STR_TO_CODE_ELIF(2, 0x42, KB_K)
++ STR_TO_CODE_ELIF(2, 0x4b, KB_L)
++ STR_TO_CODE_ELIF(2, 0x4c, KB_SEMI)
++ STR_TO_CODE_ELIF(2, 0x52, KB_QUOTE)
++ STR_TO_CODE_ELIF(2, 0x5a, KB_RET)
++
++ STR_TO_CODE_ELIF(2, 0x88, KB_LSHIFT)
++ STR_TO_CODE_ELIF(2, 0x1a, KB_Z)
++ STR_TO_CODE_ELIF(2, 0x22, KB_X)
++ STR_TO_CODE_ELIF(2, 0x21, KB_C)
++ STR_TO_CODE_ELIF(2, 0x2a, KB_V)
++ STR_TO_CODE_ELIF(2, 0x32, KB_B)
++ STR_TO_CODE_ELIF(2, 0x31, KB_N)
++ STR_TO_CODE_ELIF(2, 0x3a, KB_M)
++ STR_TO_CODE_ELIF(2, 0x41, KB_COMA)
++ STR_TO_CODE_ELIF(2, 0x49, KB_PERIOD)
++ STR_TO_CODE_ELIF(2, 0x4a, KB_FWDSLASH)
++ STR_TO_CODE_ELIF(2, 0x89, KB_RSHIFT)
++
++ STR_TO_CODE_ELIF(2, 0x8c, KB_LCTL)
++ STR_TO_CODE_ELIF(2, 0x82, KB_META)
++ STR_TO_CODE_ELIF(2, 0xba, KB_LALT)
++ STR_TO_CODE_ELIF(2, 0x29, KB_SPACE)
++ STR_TO_CODE_ELIF(2, 0x8b, KB_RALT)
++ STR_TO_CODE_ELIF(2, 0x84, KB_MENU)
++ STR_TO_CODE_ELIF(2, 0x8d, KB_RCTL)
++
++ STR_TO_CODE_ELIF(2, 0xc3, KB_PRNTSCN)
++ STR_TO_CODE_ELIF(2, 0x7e, KB_SCRLCK)
++ STR_TO_CODE_ELIF(2, 0x91, KB_PAUSE)
++ STR_TO_CODE_ELIF(2, 0xc2, KB_INS)
++ STR_TO_CODE_ELIF(2, 0x94, KB_HOME)
++ STR_TO_CODE_ELIF(2, 0x96, KB_PGUP)
++ STR_TO_CODE_ELIF(2, 0xc0, KB_DEL)
++ STR_TO_CODE_ELIF(2, 0x95, KB_END)
++ STR_TO_CODE_ELIF(2, 0x97, KB_PGDWN)
++
++ STR_TO_CODE_ELIF(2, 0x99, KB_UP_ARROW)
++ STR_TO_CODE_ELIF(2, 0x98, KB_DOWN_ARROW)
++ STR_TO_CODE_ELIF(2, 0x91, KB_LEFT_ARROW)
++ STR_TO_CODE_ELIF(2, 0x9b, KB_RIGHT_ARROW)
++
++ STR_TO_CODE_ELIF(2, 0x77, NUMPAD_LCK)
++ STR_TO_CODE_ELIF(2, 0x90, NUMPAD_FWDSLASH)
++ STR_TO_CODE_ELIF(2, 0x7c, NUMPAD_STAR)
++ STR_TO_CODE_ELIF(2, 0x7b, NUMPAD_HYPHEN)
++ STR_TO_CODE_ELIF(2, 0x70, NUMPAD_0)
++ STR_TO_CODE_ELIF(2, 0x69, NUMPAD_1)
++ STR_TO_CODE_ELIF(2, 0x72, NUMPAD_2)
++ STR_TO_CODE_ELIF(2, 0x7a, NUMPAD_3)
++ STR_TO_CODE_ELIF(2, 0x6b, NUMPAD_4)
++ STR_TO_CODE_ELIF(2, 0x73, NUMPAD_5)
++ STR_TO_CODE_ELIF(2, 0x74, NUMPAD_6)
++ STR_TO_CODE_ELIF(2, 0x6c, NUMPAD_7)
++ STR_TO_CODE_ELIF(2, 0x75, NUMPAD_8)
++ STR_TO_CODE_ELIF(2, 0x7d, NUMPAD_9)
++ STR_TO_CODE_ELIF(2, 0x79, NUMPAD_PLUS)
++ STR_TO_CODE_ELIF(2, 0x81, NUMPAD_ENTER)
++ STR_TO_CODE_ELIF(2, 0x71, NUMPAD_PERIOD)
++ if (out[2])
++ goto success;
++
++ out[0] = 0x03;
++ STR_TO_CODE_IF(4, 0x01, RAT_LCLICK)
++ STR_TO_CODE_ELIF(4, 0x02, RAT_RCLICK)
++ STR_TO_CODE_ELIF(4, 0x03, RAT_MCLICK)
++ STR_TO_CODE_ELIF(4, 0x04, RAT_WHEEL_UP)
++ STR_TO_CODE_ELIF(4, 0x05, RAT_WHEEL_DOWN)
++ if (out[4] != 0)
++ goto success;
++
++ out[0] = 0x05;
++ STR_TO_CODE_IF(3, 0x16, MEDIA_SCREENSHOT)
++ STR_TO_CODE_ELIF(3, 0x19, MEDIA_SHOW_KEYBOARD)
++ STR_TO_CODE_ELIF(3, 0x1c, MEDIA_SHOW_DESKTOP)
++ STR_TO_CODE_ELIF(3, 0x1e, MEDIA_START_RECORDING)
++ STR_TO_CODE_ELIF(3, 0x01, MEDIA_MIC_OFF)
++ STR_TO_CODE_ELIF(3, 0x02, MEDIA_VOL_DOWN)
++ STR_TO_CODE_ELIF(3, 0x03, MEDIA_VOL_UP)
++ if (out[3])
++ goto success;
++
++ // restore bytes if invalid input
++ memcpy(out, save_buf, out_len);
++ kfree(save_buf);
++ return -EINVAL;
++
++success:
++ kfree(save_buf);
++ return 0;
++}
++
++#define CODE_TO_STR_IF(_idx, _code, _label) \
++ if (btn_block[_idx] == _code) \
++ return _label;
++
++const static char *__btn_map_to_string(struct device *raw_dev, enum btn_pair pair,
++ enum btn_pair_side side, bool secondary)
++{
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev);
++ u8 *btn_block;
++ int offs;
++
++ // TODO: this little block is common
++ offs = side ? MAPPING_BLOCK_LEN / 2 : 0;
++ offs = secondary ? offs + BTN_CODE_LEN : offs;
++ btn_block = rog_ally->key_mapping[rog_ally->mode - 1][pair - 1] + offs;
++
++ if (btn_block[0] == 0x01) {
++ CODE_TO_STR_IF(1, 0x01, PAD_A)
++ CODE_TO_STR_IF(1, 0x02, PAD_B)
++ CODE_TO_STR_IF(1, 0x03, PAD_X)
++ CODE_TO_STR_IF(1, 0x04, PAD_Y)
++ CODE_TO_STR_IF(1, 0x05, PAD_LB)
++ CODE_TO_STR_IF(1, 0x06, PAD_RB)
++ CODE_TO_STR_IF(1, 0x07, PAD_LS)
++ CODE_TO_STR_IF(1, 0x08, PAD_RS)
++ CODE_TO_STR_IF(1, 0x09, PAD_DPAD_UP)
++ CODE_TO_STR_IF(1, 0x0a, PAD_DPAD_DOWN)
++ CODE_TO_STR_IF(1, 0x0b, PAD_DPAD_LEFT)
++ CODE_TO_STR_IF(1, 0x0c, PAD_DPAD_RIGHT)
++ CODE_TO_STR_IF(1, 0x11, PAD_VIEW)
++ CODE_TO_STR_IF(1, 0x12, PAD_MENU)
++ CODE_TO_STR_IF(1, 0x13, PAD_XBOX)
++ }
++
++ if (btn_block[0] == 0x02) {
++ CODE_TO_STR_IF(2, 0x8f, KB_M1)
++ CODE_TO_STR_IF(2, 0x8e, KB_M2)
++ CODE_TO_STR_IF(2, 0x76, KB_ESC)
++ CODE_TO_STR_IF(2, 0x50, KB_F1)
++ CODE_TO_STR_IF(2, 0x60, KB_F2)
++ CODE_TO_STR_IF(2, 0x40, KB_F3)
++ CODE_TO_STR_IF(2, 0x0c, KB_F4)
++ CODE_TO_STR_IF(2, 0x03, KB_F5)
++ CODE_TO_STR_IF(2, 0x0b, KB_F6)
++ CODE_TO_STR_IF(2, 0x80, KB_F7)
++ CODE_TO_STR_IF(2, 0x0a, KB_F8)
++ CODE_TO_STR_IF(2, 0x01, KB_F9)
++ CODE_TO_STR_IF(2, 0x09, KB_F10)
++ CODE_TO_STR_IF(2, 0x78, KB_F11)
++ CODE_TO_STR_IF(2, 0x07, KB_F12)
++ CODE_TO_STR_IF(2, 0x10, KB_F14)
++ CODE_TO_STR_IF(2, 0x18, KB_F15)
++
++ CODE_TO_STR_IF(2, 0x0e, KB_BACKTICK)
++ CODE_TO_STR_IF(2, 0x16, KB_1)
++ CODE_TO_STR_IF(2, 0x1e, KB_2)
++ CODE_TO_STR_IF(2, 0x26, KB_3)
++ CODE_TO_STR_IF(2, 0x25, KB_4)
++ CODE_TO_STR_IF(2, 0x2e, KB_5)
++ CODE_TO_STR_IF(2, 0x36, KB_6)
++ CODE_TO_STR_IF(2, 0x3d, KB_7)
++ CODE_TO_STR_IF(2, 0x3e, KB_8)
++ CODE_TO_STR_IF(2, 0x46, KB_9)
++ CODE_TO_STR_IF(2, 0x45, KB_0)
++ CODE_TO_STR_IF(2, 0x4e, KB_HYPHEN)
++ CODE_TO_STR_IF(2, 0x55, KB_EQUALS)
++ CODE_TO_STR_IF(2, 0x66, KB_BACKSPACE)
++
++ CODE_TO_STR_IF(2, 0x0d, KB_TAB)
++ CODE_TO_STR_IF(2, 0x15, KB_Q)
++ CODE_TO_STR_IF(2, 0x1d, KB_W)
++ CODE_TO_STR_IF(2, 0x24, KB_E)
++ CODE_TO_STR_IF(2, 0x2d, KB_R)
++ CODE_TO_STR_IF(2, 0x2d, KB_T)
++ CODE_TO_STR_IF(2, 0x35, KB_Y)
++ CODE_TO_STR_IF(2, 0x3c, KB_U)
++ CODE_TO_STR_IF(2, 0x43, KB_I)
++ CODE_TO_STR_IF(2, 0x44, KB_O)
++ CODE_TO_STR_IF(2, 0x4d, KB_P)
++ CODE_TO_STR_IF(2, 0x54, KB_LBRACKET)
++ CODE_TO_STR_IF(2, 0x5b, KB_RBRACKET)
++ CODE_TO_STR_IF(2, 0x5d, KB_BACKSLASH)
++
++ CODE_TO_STR_IF(2, 0x58, KB_CAPS)
++ CODE_TO_STR_IF(2, 0x1c, KB_A)
++ CODE_TO_STR_IF(2, 0x1b, KB_S)
++ CODE_TO_STR_IF(2, 0x23, KB_D)
++ CODE_TO_STR_IF(2, 0x2b, KB_F)
++ CODE_TO_STR_IF(2, 0x34, KB_G)
++ CODE_TO_STR_IF(2, 0x33, KB_H)
++ CODE_TO_STR_IF(2, 0x3b, KB_J)
++ CODE_TO_STR_IF(2, 0x42, KB_K)
++ CODE_TO_STR_IF(2, 0x4b, KB_L)
++ CODE_TO_STR_IF(2, 0x4c, KB_SEMI)
++ CODE_TO_STR_IF(2, 0x52, KB_QUOTE)
++ CODE_TO_STR_IF(2, 0x5a, KB_RET)
++
++ CODE_TO_STR_IF(2, 0x88, KB_LSHIFT)
++ CODE_TO_STR_IF(2, 0x1a, KB_Z)
++ CODE_TO_STR_IF(2, 0x22, KB_X)
++ CODE_TO_STR_IF(2, 0x21, KB_C)
++ CODE_TO_STR_IF(2, 0x2a, KB_V)
++ CODE_TO_STR_IF(2, 0x32, KB_B)
++ CODE_TO_STR_IF(2, 0x31, KB_N)
++ CODE_TO_STR_IF(2, 0x3a, KB_M)
++ CODE_TO_STR_IF(2, 0x41, KB_COMA)
++ CODE_TO_STR_IF(2, 0x49, KB_PERIOD)
++ CODE_TO_STR_IF(2, 0x4a, KB_FWDSLASH)
++ CODE_TO_STR_IF(2, 0x89, KB_RSHIFT)
++
++ CODE_TO_STR_IF(2, 0x8c, KB_LCTL)
++ CODE_TO_STR_IF(2, 0x82, KB_META)
++ CODE_TO_STR_IF(2, 0xba, KB_LALT)
++ CODE_TO_STR_IF(2, 0x29, KB_SPACE)
++ CODE_TO_STR_IF(2, 0x8b, KB_RALT)
++ CODE_TO_STR_IF(2, 0x84, KB_MENU)
++ CODE_TO_STR_IF(2, 0x8d, KB_RCTL)
++
++ CODE_TO_STR_IF(2, 0xc3, KB_PRNTSCN)
++ CODE_TO_STR_IF(2, 0x7e, KB_SCRLCK)
++ CODE_TO_STR_IF(2, 0x91, KB_PAUSE)
++ CODE_TO_STR_IF(2, 0xc2, KB_INS)
++ CODE_TO_STR_IF(2, 0x94, KB_HOME)
++ CODE_TO_STR_IF(2, 0x96, KB_PGUP)
++ CODE_TO_STR_IF(2, 0xc0, KB_DEL)
++ CODE_TO_STR_IF(2, 0x95, KB_END)
++ CODE_TO_STR_IF(2, 0x97, KB_PGDWN)
++
++ CODE_TO_STR_IF(2, 0x99, KB_UP_ARROW)
++ CODE_TO_STR_IF(2, 0x98, KB_DOWN_ARROW)
++ CODE_TO_STR_IF(2, 0x91, KB_LEFT_ARROW)
++ CODE_TO_STR_IF(2, 0x9b, KB_RIGHT_ARROW)
++
++ CODE_TO_STR_IF(2, 0x77, NUMPAD_LCK)
++ CODE_TO_STR_IF(2, 0x90, NUMPAD_FWDSLASH)
++ CODE_TO_STR_IF(2, 0x7c, NUMPAD_STAR)
++ CODE_TO_STR_IF(2, 0x7b, NUMPAD_HYPHEN)
++ CODE_TO_STR_IF(2, 0x70, NUMPAD_0)
++ CODE_TO_STR_IF(2, 0x69, NUMPAD_1)
++ CODE_TO_STR_IF(2, 0x72, NUMPAD_2)
++ CODE_TO_STR_IF(2, 0x7a, NUMPAD_3)
++ CODE_TO_STR_IF(2, 0x6b, NUMPAD_4)
++ CODE_TO_STR_IF(2, 0x73, NUMPAD_5)
++ CODE_TO_STR_IF(2, 0x74, NUMPAD_6)
++ CODE_TO_STR_IF(2, 0x6c, NUMPAD_7)
++ CODE_TO_STR_IF(2, 0x75, NUMPAD_8)
++ CODE_TO_STR_IF(2, 0x7d, NUMPAD_9)
++ CODE_TO_STR_IF(2, 0x79, NUMPAD_PLUS)
++ CODE_TO_STR_IF(2, 0x81, NUMPAD_ENTER)
++ CODE_TO_STR_IF(2, 0x71, NUMPAD_PERIOD)
++ }
++
++ if (btn_block[0] == 0x03) {
++ CODE_TO_STR_IF(4, 0x01, RAT_LCLICK)
++ CODE_TO_STR_IF(4, 0x02, RAT_RCLICK)
++ CODE_TO_STR_IF(4, 0x03, RAT_MCLICK)
++ CODE_TO_STR_IF(4, 0x04, RAT_WHEEL_UP)
++ CODE_TO_STR_IF(4, 0x05, RAT_WHEEL_DOWN)
++ }
++
++ if (btn_block[0] == 0x05) {
++ CODE_TO_STR_IF(3, 0x16, MEDIA_SCREENSHOT)
++ CODE_TO_STR_IF(3, 0x19, MEDIA_SHOW_KEYBOARD)
++ CODE_TO_STR_IF(3, 0x1c, MEDIA_SHOW_DESKTOP)
++ CODE_TO_STR_IF(3, 0x1e, MEDIA_START_RECORDING)
++ CODE_TO_STR_IF(3, 0x01, MEDIA_MIC_OFF)
++ CODE_TO_STR_IF(3, 0x02, MEDIA_VOL_DOWN)
++ CODE_TO_STR_IF(3, 0x03, MEDIA_VOL_UP)
++ }
++
++ return "";
++}
++
++/* ASUS ROG Ally device specific attributes */
++
++/* This should be called before any attempts to set device functions */
++static int __gamepad_check_ready(struct hid_device *hdev)
++{
++ u8 *hidbuf;
++ int ret;
++
++ hidbuf = kzalloc(FEATURE_ROG_ALLY_REPORT_SIZE, GFP_KERNEL);
++ if (!hidbuf)
++ return -ENOMEM;
++
++ hidbuf[0] = FEATURE_KBD_REPORT_ID;
++ hidbuf[1] = 0xD1;
++ hidbuf[2] = xpad_cmd_check_ready;
++ hidbuf[3] = 01;
++ ret = asus_kbd_set_report(hdev, hidbuf, FEATURE_ROG_ALLY_REPORT_SIZE);
++ if (ret < 0)
++ goto report_fail;
++
++ hidbuf[0] = hidbuf[1] = hidbuf[2] = hidbuf[3] = 0;
++ ret = asus_kbd_get_report(hdev, hidbuf, FEATURE_ROG_ALLY_REPORT_SIZE);
++ if (ret < 0)
++ goto report_fail;
++
++ ret = hidbuf[2] == xpad_cmd_check_ready;
++ if (!ret) {
++ hid_warn(hdev, "ROG Ally not ready\n");
++ ret = -ENOMSG;
++ }
++
++ kfree(hidbuf);
++ return ret;
++
++report_fail:
++ hid_dbg(hdev, "ROG Ally check failed get report: %d\n", ret);
++ kfree(hidbuf);
++ return ret;
++}
++
++/********** BUTTON REMAPPING *********************************************************************/
++static void __btn_pair_to_pkt(struct device *raw_dev, enum btn_pair pair, u8 *out, int out_len)
++{
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev);
++
++ out[0] = FEATURE_KBD_REPORT_ID;
++ out[1] = 0xD1;
++ out[2] = xpad_cmd_set_mapping;
++ out[3] = pair;
++ out[4] = 0x2c; //length
++ memcpy(&out[5], &rog_ally->key_mapping[rog_ally->mode - 1][pair - 1], MAPPING_BLOCK_LEN);
++}
++
++/* Store the button setting in driver data. Does not apply to device until __gamepad_set_mapping */
++static int __gamepad_mapping_store(struct device *raw_dev, const char *buf, enum btn_pair pair,
++ int side, bool secondary)
++{
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev);
++ u8 *key_code;
++ int offs;
++
++ offs = side ? MAPPING_BLOCK_LEN / 2 : 0;
++ offs = secondary ? offs + BTN_CODE_LEN : offs;
++ key_code = rog_ally->key_mapping[rog_ally->mode - 1][pair - 1] + offs;
++
++ return __string_to_key_code(buf, key_code, BTN_CODE_LEN);
++}
++
++/* Apply the mapping pair to the device */
++static int __gamepad_set_mapping(struct device *raw_dev, enum btn_pair pair)
++{
++ struct hid_device *hdev = to_hid_device(raw_dev);
++ u8 *hidbuf;
++ int ret;
++
++ ret = __gamepad_check_ready(hdev);
++ if (ret < 0)
++ return ret;
++
++ hidbuf = kzalloc(FEATURE_ROG_ALLY_REPORT_SIZE, GFP_KERNEL);
++ if (!hidbuf)
++ return -ENOMEM;
++
++ __btn_pair_to_pkt(raw_dev, pair, hidbuf, FEATURE_ROG_ALLY_REPORT_SIZE);
++ ret = asus_kbd_set_report(hdev, hidbuf, FEATURE_ROG_ALLY_REPORT_SIZE);
++ kfree(hidbuf);
++
++ return ret;
++}
++
++static ssize_t btn_mapping_apply_store(struct device *raw_dev, struct device_attribute *attr,
++ const char *buf, size_t count)
++{
++ int ret = __gamepad_write_all_to_mcu(raw_dev);
++ if (ret < 0)
++ return ret;
++ return count;
++}
++ALLY_DEVICE_ATTR_WO(btn_mapping_apply, apply);
++
++/********** BUTTON TURBO *************************************************************************/
++static int __gamepad_turbo_index(enum btn_pair pair, int side)
++{
++ return (pair - 1) * (2 * TURBO_BLOCK_STEP) + (side * TURBO_BLOCK_STEP);
++};
++
++static int __gamepad_turbo_show(struct device *raw_dev, enum btn_pair pair, int side)
++{
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev);
++ return rog_ally->turbo_btns[rog_ally->mode][__gamepad_turbo_index(pair, side)];
++};
++
++static int __gamepad_turbo_store(struct device *raw_dev, const char *buf, enum btn_pair pair,
++ int side)
++{
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev);
++ int ret, val;
++
++ ret = kstrtoint(buf, 0, &val);
++ if (ret)
++ return ret;
++ if (val < 0 || val > 16)
++ return -EINVAL;
++
++ rog_ally->turbo_btns[rog_ally->mode][__gamepad_turbo_index(pair, side)] = val;
++
++ return 0;
++};
++
++/* button map attributes, regular and macro*/
++ALLY_BTN_MAPPING(m2, btn_pair_m1_m2, btn_pair_side_left);
++ALLY_BTN_MAPPING(m1, btn_pair_m1_m2, btn_pair_side_right);
++ALLY_BTN_MAPPING(a, btn_pair_a_b, btn_pair_side_left);
++ALLY_BTN_MAPPING(b, btn_pair_a_b, btn_pair_side_right);
++ALLY_BTN_MAPPING(x, btn_pair_x_y, btn_pair_side_left);
++ALLY_BTN_MAPPING(y, btn_pair_x_y, btn_pair_side_right);
++ALLY_BTN_MAPPING(lb, btn_pair_lb_rb, btn_pair_side_left);
++ALLY_BTN_MAPPING(rb, btn_pair_lb_rb, btn_pair_side_right);
++ALLY_BTN_MAPPING(ls, btn_pair_ls_rs, btn_pair_side_left);
++ALLY_BTN_MAPPING(rs, btn_pair_ls_rs, btn_pair_side_right);
++ALLY_BTN_MAPPING(lt, btn_pair_lt_rt, btn_pair_side_left);
++ALLY_BTN_MAPPING(rt, btn_pair_lt_rt, btn_pair_side_right);
++ALLY_BTN_MAPPING(dpad_u, btn_pair_dpad_u_d, btn_pair_side_left);
++ALLY_BTN_MAPPING(dpad_d, btn_pair_dpad_u_d, btn_pair_side_right);
++ALLY_BTN_MAPPING(dpad_l, btn_pair_dpad_l_r, btn_pair_side_left);
++ALLY_BTN_MAPPING(dpad_r, btn_pair_dpad_l_r, btn_pair_side_right);
++ALLY_BTN_MAPPING(view, btn_pair_view_menu, btn_pair_side_left);
++ALLY_BTN_MAPPING(menu, btn_pair_view_menu, btn_pair_side_right);
++
++static void __gamepad_mapping_xpad_default(struct asus_rog_ally *rog_ally)
++{
++ memcpy(&rog_ally->key_mapping[0][0], &XPAD_DEF1, MAPPING_BLOCK_LEN);
++ memcpy(&rog_ally->key_mapping[0][1], &XPAD_DEF2, MAPPING_BLOCK_LEN);
++ memcpy(&rog_ally->key_mapping[0][2], &XPAD_DEF3, MAPPING_BLOCK_LEN);
++ memcpy(&rog_ally->key_mapping[0][3], &XPAD_DEF4, MAPPING_BLOCK_LEN);
++ memcpy(&rog_ally->key_mapping[0][4], &XPAD_DEF5, MAPPING_BLOCK_LEN);
++ memcpy(&rog_ally->key_mapping[0][5], &XPAD_DEF6, MAPPING_BLOCK_LEN);
++ memcpy(&rog_ally->key_mapping[0][6], &XPAD_DEF7, MAPPING_BLOCK_LEN);
++ memcpy(&rog_ally->key_mapping[0][7], &XPAD_DEF8, MAPPING_BLOCK_LEN);
++ memcpy(&rog_ally->key_mapping[0][8], &XPAD_DEF9, MAPPING_BLOCK_LEN);
++}
++
++static void __gamepad_mapping_wasd_default(struct asus_rog_ally *rog_ally)
++{
++ memcpy(&rog_ally->key_mapping[1][0], &WASD_DEF1, MAPPING_BLOCK_LEN);
++ memcpy(&rog_ally->key_mapping[1][1], &WASD_DEF2, MAPPING_BLOCK_LEN);
++ memcpy(&rog_ally->key_mapping[1][2], &WASD_DEF3, MAPPING_BLOCK_LEN);
++ memcpy(&rog_ally->key_mapping[1][3], &WASD_DEF4, MAPPING_BLOCK_LEN);
++ memcpy(&rog_ally->key_mapping[1][4], &WASD_DEF5, MAPPING_BLOCK_LEN);
++ memcpy(&rog_ally->key_mapping[1][5], &WASD_DEF6, MAPPING_BLOCK_LEN);
++ memcpy(&rog_ally->key_mapping[1][6], &WASD_DEF7, MAPPING_BLOCK_LEN);
++ memcpy(&rog_ally->key_mapping[1][7], &WASD_DEF8, MAPPING_BLOCK_LEN);
++ memcpy(&rog_ally->key_mapping[1][8], &WASD_DEF9, MAPPING_BLOCK_LEN);
++}
++
++static ssize_t btn_mapping_reset_store(struct device *raw_dev, struct device_attribute *attr,
++ const char *buf, size_t count)
++{
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev);
++ switch (rog_ally->mode) {
++ case xpad_mode_game:
++ __gamepad_mapping_xpad_default(rog_ally);
++ break;
++ case xpad_mode_wasd:
++ __gamepad_mapping_wasd_default(rog_ally);
++ break;
++ default:
++ __gamepad_mapping_xpad_default(rog_ally);
++ break;
++ }
++
++ return count;
++}
++
++ALLY_DEVICE_ATTR_WO(btn_mapping_reset, reset_btn_mapping);
++
++/********** GAMEPAD MODE *************************************************************************/
++static ssize_t __gamepad_set_mode(struct device *raw_dev, int val)
++{
++ struct hid_device *hdev = to_hid_device(raw_dev);
++ u8 *hidbuf;
++ int ret;
++
++ ret = __gamepad_check_ready(hdev);
++ if (ret < 0)
++ return ret;
++
++ hidbuf = kzalloc(FEATURE_ROG_ALLY_REPORT_SIZE, GFP_KERNEL);
++ if (!hidbuf)
++ return -ENOMEM;
++
++ hidbuf[0] = FEATURE_KBD_REPORT_ID;
++ hidbuf[1] = 0xD1;
++ hidbuf[2] = xpad_cmd_set_mode;
++ hidbuf[3] = 0x01;
++ hidbuf[4] = val;
++
++ ret = asus_kbd_set_report(hdev, hidbuf, FEATURE_ROG_ALLY_REPORT_SIZE);
++ if (ret < 0)
++ goto report_fail;
++
++ ret = __gamepad_write_all_to_mcu(raw_dev);
++ if (ret < 0)
++ goto report_fail;
++
++report_fail:
++ kfree(hidbuf);
++ return ret;
++}
++
++static ssize_t gamepad_mode_show(struct device *raw_dev, struct device_attribute *attr, char *buf)
++{
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev);
++ return sysfs_emit(buf, "%d\n", rog_ally->mode);
++}
++
++static ssize_t gamepad_mode_store(struct device *raw_dev, struct device_attribute *attr,
++ const char *buf, size_t count)
++{
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev);
++ int ret, val;
++
++ ret = kstrtoint(buf, 0, &val);
++ if (ret)
++ return ret;
++
++ if (val < xpad_mode_game || val > xpad_mode_mouse)
++ return -EINVAL;
++
++ rog_ally->mode = val;
++
++ ret = __gamepad_set_mode(raw_dev, val);
++ if (ret < 0)
++ return ret;
++
++ return count;
++}
++
++DEVICE_ATTR_RW(gamepad_mode);
++
++/********** VIBRATION INTENSITY ******************************************************************/
++static ssize_t gamepad_vibration_intensity_index_show(struct device *raw_dev,
++ struct device_attribute *attr, char *buf)
++{
++ return sysfs_emit(buf, "left right\n");
++}
++
++ALLY_DEVICE_ATTR_RO(gamepad_vibration_intensity_index, vibration_intensity_index);
++
++static ssize_t __gamepad_write_vibe_intensity_to_mcu(struct device *raw_dev)
++{
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev);
++ struct hid_device *hdev = to_hid_device(raw_dev);
++ u8 *hidbuf;
++ int ret;
++
++ ret = __gamepad_check_ready(hdev);
++ if (ret < 0)
++ return ret;
++
++ hidbuf = kzalloc(FEATURE_ROG_ALLY_REPORT_SIZE, GFP_KERNEL);
++ if (!hidbuf)
++ return -ENOMEM;
++
++ hidbuf[0] = FEATURE_KBD_REPORT_ID;
++ hidbuf[1] = 0xD1;
++ hidbuf[2] = xpad_cmd_set_vibe_intensity;
++ hidbuf[3] = 0x02; // length
++ hidbuf[4] = rog_ally->anti_deadzones[rog_ally->mode][btn_pair_side_left];
++ hidbuf[5] = rog_ally->anti_deadzones[rog_ally->mode][btn_pair_side_right];
++
++ ret = __gamepad_check_ready(hdev);
++ if (ret < 0)
++ goto report_fail;
++
++ ret = asus_kbd_set_report(hdev, hidbuf, FEATURE_ROG_ALLY_REPORT_SIZE);
++ if (ret < 0)
++ goto report_fail;
++
++report_fail:
++ kfree(hidbuf);
++ return ret;
++}
++
++static ssize_t gamepad_vibration_intensity_show(struct device *raw_dev,
++ struct device_attribute *attr, char *buf)
++{
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev);
++ return sysfs_emit(buf, "%d %d\n",
++ rog_ally->anti_deadzones[rog_ally->mode][btn_pair_side_left],
++ rog_ally->anti_deadzones[rog_ally->mode][btn_pair_side_right]);
++}
++
++static ssize_t gamepad_vibration_intensity_store(struct device *raw_dev,
++ struct device_attribute *attr, const char *buf,
++ size_t count)
++{
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev);
++ u32 left, right;
++
++ if (sscanf(buf, "%d %d", &left, &right) != 2)
++ return -EINVAL;
++
++ if (left > 64 || right > 64)
++ return -EINVAL;
++
++ rog_ally->vibration_intensity[rog_ally->mode][btn_pair_side_left] = left;
++ rog_ally->vibration_intensity[rog_ally->mode][btn_pair_side_right] = right;
++
++ return count;
++}
++
++ALLY_DEVICE_ATTR_RW(gamepad_vibration_intensity, vibration_intensity);
++
++/********** ROOT LEVEL ATTRS **********************************************************************/
++static struct attribute *gamepad_device_attrs[] = { &dev_attr_gamepad_mode.attr,
++ &dev_attr_btn_mapping_reset.attr,
++ &dev_attr_btn_mapping_apply.attr,
++ &dev_attr_gamepad_vibration_intensity.attr,
++ &dev_attr_gamepad_vibration_intensity_index.attr,
++ NULL };
++
++static const struct attribute_group ally_controller_attr_group = {
++ .attrs = gamepad_device_attrs,
++};
++
++/********** ANALOGUE DEADZONES ********************************************************************/
++static ssize_t __gamepad_set_deadzones(struct device *raw_dev)
++{
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev);
++ struct hid_device *hdev = to_hid_device(raw_dev);
++ u8 *hidbuf;
++ int ret;
++
++ ret = __gamepad_check_ready(hdev);
++ if (ret < 0)
++ return ret;
++
++ hidbuf = kzalloc(FEATURE_ROG_ALLY_REPORT_SIZE, GFP_KERNEL);
++ if (!hidbuf)
++ return -ENOMEM;
++
++ hidbuf[0] = FEATURE_KBD_REPORT_ID;
++ hidbuf[1] = 0xD1;
++ hidbuf[2] = xpad_cmd_set_js_dz;
++ hidbuf[3] = 0x04; // length
++ hidbuf[4] = rog_ally->deadzones[rog_ally->mode][0][0];
++ hidbuf[5] = rog_ally->deadzones[rog_ally->mode][0][1];
++ hidbuf[6] = rog_ally->deadzones[rog_ally->mode][0][2];
++ hidbuf[7] = rog_ally->deadzones[rog_ally->mode][0][3];
++
++ ret = asus_kbd_set_report(hdev, hidbuf, FEATURE_ROG_ALLY_REPORT_SIZE);
++ if (ret < 0)
++ goto end;
++
++ hidbuf[2] = xpad_cmd_set_tr_dz;
++ hidbuf[4] = rog_ally->deadzones[rog_ally->mode][1][0];
++ hidbuf[5] = rog_ally->deadzones[rog_ally->mode][1][1];
++ hidbuf[6] = rog_ally->deadzones[rog_ally->mode][1][2];
++ hidbuf[7] = rog_ally->deadzones[rog_ally->mode][1][3];
++
++ ret = asus_kbd_set_report(hdev, hidbuf, FEATURE_ROG_ALLY_REPORT_SIZE);
++ if (ret < 0)
++ goto end;
++
++end:
++ kfree(hidbuf);
++ return ret;
++}
++
++static ssize_t __gamepad_store_deadzones(struct device *raw_dev, enum xpad_axis axis,
++ const char *buf)
++{
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev);
++ int cmd, side, is_tr;
++ u32 inner, outer;
++
++ if (sscanf(buf, "%d %d", &inner, &outer) != 2)
++ return -EINVAL;
++
++ if (inner > 64 || outer > 64 || inner > outer)
++ return -EINVAL;
++
++ is_tr = axis > xpad_axis_xy_right;
++ side = axis == xpad_axis_xy_right || axis == xpad_axis_z_right ? 2 : 0;
++ cmd = is_tr ? xpad_cmd_set_js_dz : xpad_cmd_set_tr_dz;
++
++ rog_ally->deadzones[rog_ally->mode][is_tr][side] = inner;
++ rog_ally->deadzones[rog_ally->mode][is_tr][side + 1] = outer;
++
++ return 0;
++}
++
++static ssize_t axis_xyz_deadzone_index_show(struct device *raw_dev, struct device_attribute *attr,
++ char *buf)
++{
++ return sysfs_emit(buf, "inner outer\n");
++}
++
++ALLY_DEVICE_ATTR_RO(axis_xyz_deadzone_index, deadzone_index);
++
++ALLY_AXIS_DEADZONE(xpad_axis_xy_left, deadzone);
++ALLY_AXIS_DEADZONE(xpad_axis_xy_right, deadzone);
++ALLY_AXIS_DEADZONE(xpad_axis_z_left, deadzone);
++ALLY_AXIS_DEADZONE(xpad_axis_z_right, deadzone);
++
++/********** ANTI-DEADZONES ***********************************************************************/
++static ssize_t __gamepad_write_js_ADZ_to_mcu(struct device *raw_dev)
++{
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev);
++ struct hid_device *hdev = to_hid_device(raw_dev);
++ u8 *hidbuf;
++ int ret;
++
++ ret = __gamepad_check_ready(hdev);
++ if (ret < 0)
++ return ret;
++
++ hidbuf = kzalloc(FEATURE_ROG_ALLY_REPORT_SIZE, GFP_KERNEL);
++ if (!hidbuf)
++ return -ENOMEM;
++
++ hidbuf[0] = FEATURE_KBD_REPORT_ID;
++ hidbuf[1] = 0xD1;
++ hidbuf[2] = xpad_cmd_set_adz;
++ hidbuf[3] = 0x02; // length
++ hidbuf[4] = rog_ally->anti_deadzones[rog_ally->mode][btn_pair_side_left];
++ hidbuf[5] = rog_ally->anti_deadzones[rog_ally->mode][btn_pair_side_right];
++
++ ret = __gamepad_check_ready(hdev);
++ if (ret < 0)
++ goto report_fail;
++
++ ret = asus_kbd_set_report(hdev, hidbuf, FEATURE_ROG_ALLY_REPORT_SIZE);
++ if (ret < 0)
++ goto report_fail;
++
++report_fail:
++ kfree(hidbuf);
++ return ret;
++}
++
++static ssize_t __gamepad_js_ADZ_store(struct device *raw_dev, const char *buf,
++ enum btn_pair_side side)
++{
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev);
++ int ret, val;
++
++ ret = kstrtoint(buf, 0, &val);
++ if (ret)
++ return ret;
++
++ if (val < 0 || val > 64)
++ return -EINVAL;
++
++ rog_ally->anti_deadzones[rog_ally->mode][side] = val;
++
++ return ret;
++}
++
++static ssize_t xpad_axis_xy_left_ADZ_show(struct device *raw_dev, struct device_attribute *attr,
++ char *buf)
++{
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev);
++ return sysfs_emit(buf, "%d\n",
++ rog_ally->anti_deadzones[rog_ally->mode][btn_pair_side_left]);
++}
++
++static ssize_t xpad_axis_xy_left_ADZ_store(struct device *raw_dev, struct device_attribute *attr,
++ const char *buf, size_t count)
++{
++ int ret = __gamepad_js_ADZ_store(raw_dev, buf, btn_pair_side_left);
++ if (ret)
++ return ret;
++
++ return count;
++}
++
++ALLY_DEVICE_ATTR_RW(xpad_axis_xy_left_ADZ, anti_deadzone);
++
++static ssize_t xpad_axis_xy_right_ADZ_show(struct device *raw_dev, struct device_attribute *attr,
++ char *buf)
++{
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev);
++ return sysfs_emit(buf, "%d\n",
++ rog_ally->anti_deadzones[rog_ally->mode][btn_pair_side_right]);
++}
++
++static ssize_t xpad_axis_xy_right_ADZ_store(struct device *raw_dev, struct device_attribute *attr,
++ const char *buf, size_t count)
++{
++ int ret = __gamepad_js_ADZ_store(raw_dev, buf, btn_pair_side_right);
++ if (ret)
++ return ret;
++
++ return count;
++}
++
++ALLY_DEVICE_ATTR_RW(xpad_axis_xy_right_ADZ, anti_deadzone);
++
++/********** JS RESPONSE CURVES *******************************************************************/
++static ssize_t rc_point_index_show(struct device *raw_dev, struct device_attribute *attr, char *buf)
++{
++ return sysfs_emit(buf, "move response\n");
++}
++
++ALLY_DEVICE_ATTR_RO(rc_point_index, rc_point_index);
++
++static ssize_t __gamepad_write_response_curves_to_mcu(struct device *raw_dev)
++{
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev);
++ struct hid_device *hdev = to_hid_device(raw_dev);
++ u8 *hidbuf;
++ int ret;
++
++ ret = __gamepad_check_ready(hdev);
++ if (ret < 0)
++ return ret;
++
++ hidbuf = kzalloc(FEATURE_ROG_ALLY_REPORT_SIZE, GFP_KERNEL);
++ if (!hidbuf)
++ return -ENOMEM;
++
++ hidbuf[0] = FEATURE_KBD_REPORT_ID;
++ hidbuf[1] = 0xD1;
++ hidbuf[2] = xpad_cmd_set_response_curve;
++ hidbuf[3] = 0x09; // length
++ hidbuf[4] = 0x01;
++ memcpy(&hidbuf[5], &rog_ally->response_curve[rog_ally->mode][btn_pair_side_left], 8);
++
++ ret = __gamepad_check_ready(hdev);
++ if (ret < 0)
++ goto report_fail;
++
++ hidbuf[4] = 0x02;
++ memcpy(&hidbuf[5], &rog_ally->response_curve[rog_ally->mode][btn_pair_side_right], 8);
++
++ ret = __gamepad_check_ready(hdev);
++ if (ret < 0)
++ goto report_fail;
++
++ ret = asus_kbd_set_report(hdev, hidbuf, FEATURE_ROG_ALLY_REPORT_SIZE);
++ if (ret < 0)
++ goto report_fail;
++
++report_fail:
++ kfree(hidbuf);
++ return ret;
++}
++
++static ssize_t __gamepad_store_response_curve(struct device *raw_dev, const char *buf,
++ enum btn_pair_side side, int point)
++{
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev);
++ int idx = (point - 1) * 2;
++ u32 move, response;
++
++ if (sscanf(buf, "%d %d", &move, &response) != 2)
++ return -EINVAL;
++
++ if (move > 64 || response > 64)
++ return -EINVAL;
++
++ rog_ally->response_curve[rog_ally->mode][side][idx] = move;
++ rog_ally->response_curve[rog_ally->mode][side][idx + 1] = response;
++
++ return 0;
++}
++
++ALLY_JS_RC_POINT(left, 1, rc_point_);
++ALLY_JS_RC_POINT(left, 2, rc_point_);
++ALLY_JS_RC_POINT(left, 3, rc_point_);
++ALLY_JS_RC_POINT(left, 4, rc_point_);
++
++ALLY_JS_RC_POINT(right, 1, rc_point_);
++ALLY_JS_RC_POINT(right, 2, rc_point_);
++ALLY_JS_RC_POINT(right, 3, rc_point_);
++ALLY_JS_RC_POINT(right, 4, rc_point_);
++
++/********** CALIBRATIONS *************************************************************************/
++static ssize_t __gamepad_write_cal_to_mcu(struct device *raw_dev, enum xpad_axis axis)
++{
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev);
++ struct hid_device *hdev = to_hid_device(raw_dev);
++ u8 *hidbuf;
++ u8 *c, side, pkt_len, data_len;
++ int ret, cal, checksum = 0;
++
++ ret = __gamepad_check_ready(hdev);
++ if (ret < 0)
++ return ret;
++
++ hidbuf = kzalloc(FEATURE_ROG_ALLY_REPORT_SIZE, GFP_KERNEL);
++ if (!hidbuf)
++ return -ENOMEM;
++
++ side = axis == xpad_axis_xy_right || axis == xpad_axis_z_right ? 1 : 0;
++ pkt_len = axis > xpad_axis_xy_right ? 0x06 : 0x0E;
++ data_len = axis > xpad_axis_xy_right ? 2 : 6;
++
++ hidbuf[0] = FEATURE_KBD_REPORT_ID;
++ hidbuf[1] = 0xD1;
++ hidbuf[2] = xpad_cmd_set_calibration;
++ hidbuf[3] = pkt_len;
++ hidbuf[4] = 0x01; // second command (set)
++ hidbuf[5] = axis;
++ c = &hidbuf[6]; // pointer
++
++ for (size_t i = 0; i < data_len; i++) {
++ if (axis == xpad_axis_xy_left || axis == xpad_axis_xy_right)
++ cal = rog_ally->js_calibrations[side][i];
++ else
++ cal = rog_ally->tr_calibrations[side][i];
++ *c = (u8)((cal & 0xff00) >> 8);
++ checksum += *c;
++ c += 1;
++ *c = (u8)(cal & 0xff);
++ checksum += *c;
++ c += 1;
++ }
++
++ hidbuf[6 + data_len * 2] = checksum;
++
++ // TODO: debug if
++ printk("CAL: ");
++ for (size_t i = 0; i < 19; i++) {
++ printk(KERN_CONT "%02x,", hidbuf[i]);
++ }
++
++ ret = asus_kbd_set_report(hdev, hidbuf, FEATURE_ROG_ALLY_REPORT_SIZE);
++ if (ret < 0)
++ goto report_fail;
++
++ memset(hidbuf, 0, FEATURE_ROG_ALLY_REPORT_SIZE);
++ hidbuf[0] = FEATURE_KBD_REPORT_ID;
++ hidbuf[1] = 0xD1;
++ hidbuf[2] = xpad_cmd_set_calibration;
++ hidbuf[3] = 0x01; // pkt len
++ hidbuf[4] = 0x03; // second command (set)
++
++ ret = asus_kbd_set_report(hdev, hidbuf, FEATURE_ROG_ALLY_REPORT_SIZE);
++ if (ret < 0)
++ goto report_fail;
++
++report_fail:
++ kfree(hidbuf);
++ return ret;
++}
++
++static ssize_t __gamepad_cal_store(struct device *raw_dev, const char *buf, enum xpad_axis axis)
++{
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev);
++ u32 x_stable, x_min, x_max, y_stable, y_min, y_max, side;
++
++ if (axis == xpad_axis_xy_left || axis == xpad_axis_xy_right) {
++ if (sscanf(buf, "%d %d %d %d %d %d", &x_stable, &x_min, &x_max, &y_stable, &y_min,
++ &y_max) != 6)
++ return -EINVAL;
++ //TODO: validate input
++
++ side = axis == xpad_axis_xy_right || axis == xpad_axis_z_right ? 1 : 0;
++ /* stored in reverse order for easy copy to packet */
++ rog_ally->js_calibrations[side][0] = y_stable;
++ rog_ally->js_calibrations[side][1] = y_min;
++ rog_ally->js_calibrations[side][2] = y_max;
++ rog_ally->js_calibrations[side][3] = x_stable;
++ rog_ally->js_calibrations[side][4] = x_min;
++ rog_ally->js_calibrations[side][5] = x_max;
++
++ return __gamepad_write_cal_to_mcu(raw_dev, axis);
++ } else {
++ if (sscanf(buf, "%d %d", &x_stable, &x_max) != 2)
++ return -EINVAL;
++ //TODO: validate input
++
++ side = axis == xpad_axis_xy_right || axis == xpad_axis_z_right ? 1 : 0;
++ rog_ally->tr_calibrations[side][0] = x_stable;
++ rog_ally->tr_calibrations[side][1] = x_max;
++
++ return __gamepad_write_cal_to_mcu(raw_dev, axis);
++ }
++}
++
++static ssize_t __gamepad_cal_show(struct device *raw_dev, char *buf, enum xpad_axis axis)
++{
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev);
++ int side = axis == xpad_axis_xy_right || axis == xpad_axis_z_right ? 1 : 0;
++
++ if (axis == xpad_axis_xy_left || axis == xpad_axis_xy_right) {
++ return sysfs_emit(buf, "%d %d %d %d %d %d\n", rog_ally->js_calibrations[side][3],
++ rog_ally->js_calibrations[side][4],
++ rog_ally->js_calibrations[side][5],
++ rog_ally->js_calibrations[side][0],
++ rog_ally->js_calibrations[side][1],
++ rog_ally->js_calibrations[side][2]);
++ } else {
++ return sysfs_emit(buf, "%d %d\n", rog_ally->tr_calibrations[side][0],
++ rog_ally->tr_calibrations[side][1]);
++ }
++}
++
++ALLY_CAL_ATTR(xpad_axis_xy_left_cal, xpad_axis_xy_left, calibration);
++ALLY_CAL_ATTR(xpad_axis_xy_right_cal, xpad_axis_xy_right, calibration);
++ALLY_CAL_ATTR(xpad_axis_z_left_cal, xpad_axis_z_left, calibration);
++ALLY_CAL_ATTR(xpad_axis_z_right_cal, xpad_axis_z_right, calibration);
++
++static ssize_t xpad_axis_xy_cal_index_show(struct device *raw_dev, struct device_attribute *attr,
++ char *buf)
++{
++ return sysfs_emit(buf, "x_stable x_min x_max y_stable y_min y_max\n");
++}
++
++ALLY_DEVICE_ATTR_RO(xpad_axis_xy_cal_index, calibration_index);
++
++static ssize_t xpad_axis_z_cal_index_show(struct device *raw_dev, struct device_attribute *attr,
++ char *buf)
++{
++ return sysfs_emit(buf, "z_stable z_max\n");
++}
++
++ALLY_DEVICE_ATTR_RO(xpad_axis_z_cal_index, calibration_index);
++
++static ssize_t __gamepad_cal_reset(struct device *raw_dev, const char *buf, enum xpad_axis axis)
++{
++ struct hid_device *hdev = to_hid_device(raw_dev);
++ u8 *hidbuf;
++ u8 side;
++ int ret;
++
++ ret = __gamepad_check_ready(hdev);
++ if (ret < 0)
++ return ret;
++
++ hidbuf = kzalloc(FEATURE_ROG_ALLY_REPORT_SIZE, GFP_KERNEL);
++ if (!hidbuf)
++ return -ENOMEM;
++
++ side = axis == xpad_axis_xy_right || axis == xpad_axis_z_right ? 1 : 0;
++
++ hidbuf[0] = FEATURE_KBD_REPORT_ID;
++ hidbuf[1] = 0xD1;
++ hidbuf[2] = xpad_cmd_set_calibration;
++ hidbuf[3] = 0x02; // pkt len
++ hidbuf[4] = 0x02; // second command (reset)
++ hidbuf[5] = axis;
++
++ ret = asus_kbd_set_report(hdev, hidbuf, FEATURE_ROG_ALLY_REPORT_SIZE);
++ if (ret < 0)
++ goto report_fail;
++
++ memset(hidbuf, 0, FEATURE_ROG_ALLY_REPORT_SIZE);
++ hidbuf[0] = FEATURE_KBD_REPORT_ID;
++ hidbuf[1] = 0xD1;
++ hidbuf[2] = xpad_cmd_set_calibration;
++ hidbuf[3] = 0x01; // pkt len
++ hidbuf[4] = 0x03; // second command (set)
++
++ ret = asus_kbd_set_report(hdev, hidbuf, FEATURE_ROG_ALLY_REPORT_SIZE);
++ if (ret < 0)
++ goto report_fail;
++
++report_fail:
++ kfree(hidbuf);
++ return ret;
++}
++
++ALLY_CAL_RESET_ATTR(xpad_axis_xy_left_cal_reset, xpad_axis_xy_left, calibration_reset);
++ALLY_CAL_RESET_ATTR(xpad_axis_xy_right_cal_reset, xpad_axis_xy_right, calibration_reset);
++ALLY_CAL_RESET_ATTR(xpad_axis_z_left_cal_reset, xpad_axis_z_left, calibration_reset);
++ALLY_CAL_RESET_ATTR(xpad_axis_z_right_cal_reset, xpad_axis_z_right, calibration_reset);
++
++static struct attribute *gamepad_axis_xy_left_attrs[] = { &dev_attr_xpad_axis_xy_left_deadzone.attr,
++ &dev_attr_axis_xyz_deadzone_index.attr,
++ &dev_attr_xpad_axis_xy_left_ADZ.attr,
++ &dev_attr_xpad_axis_xy_left_cal_reset.attr,
++ &dev_attr_xpad_axis_xy_left_cal.attr,
++ &dev_attr_xpad_axis_xy_cal_index.attr,
++ &dev_attr_rc_point_left_1.attr,
++ &dev_attr_rc_point_left_2.attr,
++ &dev_attr_rc_point_left_3.attr,
++ &dev_attr_rc_point_left_4.attr,
++ &dev_attr_rc_point_index.attr,
++ NULL };
++static const struct attribute_group ally_controller_axis_xy_left_attr_group = {
++ .name = "axis_xy_left",
++ .attrs = gamepad_axis_xy_left_attrs,
++};
++
++static struct attribute *gamepad_axis_xy_right_attrs[] = {
++ &dev_attr_xpad_axis_xy_right_deadzone.attr,
++ &dev_attr_axis_xyz_deadzone_index.attr,
++ &dev_attr_xpad_axis_xy_right_ADZ.attr,
++ &dev_attr_xpad_axis_xy_right_cal_reset.attr,
++ &dev_attr_xpad_axis_xy_right_cal.attr,
++ &dev_attr_xpad_axis_xy_cal_index.attr,
++ &dev_attr_rc_point_right_1.attr,
++ &dev_attr_rc_point_right_2.attr,
++ &dev_attr_rc_point_right_3.attr,
++ &dev_attr_rc_point_right_4.attr,
++ &dev_attr_rc_point_index.attr,
++ NULL
++};
++static const struct attribute_group ally_controller_axis_xy_right_attr_group = {
++ .name = "axis_xy_right",
++ .attrs = gamepad_axis_xy_right_attrs,
++};
++
++static struct attribute *gamepad_axis_z_left_attrs[] = {
++ &dev_attr_xpad_axis_z_left_deadzone.attr, &dev_attr_axis_xyz_deadzone_index.attr,
++ &dev_attr_xpad_axis_z_left_cal.attr, &dev_attr_xpad_axis_z_cal_index.attr,
++ &dev_attr_xpad_axis_z_left_cal_reset.attr, NULL
++};
++static const struct attribute_group ally_controller_axis_z_left_attr_group = {
++ .name = "axis_z_left",
++ .attrs = gamepad_axis_z_left_attrs,
++};
++
++static struct attribute *gamepad_axis_z_right_attrs[] = {
++ &dev_attr_xpad_axis_z_right_deadzone.attr, &dev_attr_axis_xyz_deadzone_index.attr,
++ &dev_attr_xpad_axis_z_right_cal.attr, &dev_attr_xpad_axis_z_cal_index.attr,
++ &dev_attr_xpad_axis_z_right_cal_reset.attr, NULL
++};
++static const struct attribute_group ally_controller_axis_z_right_attr_group = {
++ .name = "axis_z_right",
++ .attrs = gamepad_axis_z_right_attrs,
++};
++
++static const struct attribute_group *gamepad_device_attr_groups[] = {
++ &ally_controller_attr_group,
++ &ally_controller_axis_xy_left_attr_group,
++ &ally_controller_axis_xy_right_attr_group,
++ &ally_controller_axis_z_left_attr_group,
++ &ally_controller_axis_z_right_attr_group,
++ &btn_mapping_m1_attr_group,
++ &btn_mapping_m2_attr_group,
++ &btn_mapping_a_attr_group,
++ &btn_mapping_b_attr_group,
++ &btn_mapping_x_attr_group,
++ &btn_mapping_y_attr_group,
++ &btn_mapping_lb_attr_group,
++ &btn_mapping_rb_attr_group,
++ &btn_mapping_ls_attr_group,
++ &btn_mapping_rs_attr_group,
++ &btn_mapping_dpad_u_attr_group,
++ &btn_mapping_dpad_d_attr_group,
++ &btn_mapping_dpad_l_attr_group,
++ &btn_mapping_dpad_r_attr_group,
++ &btn_mapping_view_attr_group,
++ &btn_mapping_menu_attr_group,
++ NULL
++};
++
++static int __gamepad_write_all_to_mcu(struct device *raw_dev)
++{
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev);
++ struct hid_device *hdev = to_hid_device(raw_dev);
++ u8 *hidbuf;
++ int ret = 0;
++
++ ret = __gamepad_set_mapping(&hdev->dev, btn_pair_dpad_u_d);
++ if (ret < 0)
++ return ret;
++ ret = __gamepad_set_mapping(&hdev->dev, btn_pair_dpad_l_r);
++ if (ret < 0)
++ return ret;
++ ret = __gamepad_set_mapping(&hdev->dev, btn_pair_ls_rs);
++ if (ret < 0)
++ return ret;
++ ret = __gamepad_set_mapping(&hdev->dev, btn_pair_lb_rb);
++ if (ret < 0)
++ return ret;
++ ret = __gamepad_set_mapping(&hdev->dev, btn_pair_a_b);
++ if (ret < 0)
++ return ret;
++ ret = __gamepad_set_mapping(&hdev->dev, btn_pair_x_y);
++ if (ret < 0)
++ return ret;
++ ret = __gamepad_set_mapping(&hdev->dev, btn_pair_view_menu);
++ if (ret < 0)
++ return ret;
++ ret = __gamepad_set_mapping(&hdev->dev, btn_pair_m1_m2);
++ if (ret < 0)
++ return ret;
++ __gamepad_set_mapping(&hdev->dev, btn_pair_lt_rt);
++ if (ret < 0)
++ return ret;
++ __gamepad_set_deadzones(raw_dev);
++ if (ret < 0)
++ return ret;
++ __gamepad_write_js_ADZ_to_mcu(raw_dev);
++ if (ret < 0)
++ return ret;
++ __gamepad_write_vibe_intensity_to_mcu(raw_dev);
++ if (ret < 0)
++ return ret;
++ __gamepad_write_response_curves_to_mcu(raw_dev);
++ if (ret < 0)
++ return ret;
++
++ ret = __gamepad_check_ready(hdev);
++ if (ret < 0)
++ return ret;
++
++ /* set turbo */
++ hidbuf = kzalloc(FEATURE_ROG_ALLY_REPORT_SIZE, GFP_KERNEL);
++ if (!hidbuf)
++ return -ENOMEM;
++ hidbuf[0] = FEATURE_KBD_REPORT_ID;
++ hidbuf[1] = 0xD1;
++ hidbuf[2] = xpad_cmd_set_turbo;
++ hidbuf[3] = 0x20; // length
++ memcpy(&hidbuf[4], rog_ally->turbo_btns[rog_ally->mode], TURBO_BLOCK_LEN);
++ ret = asus_kbd_set_report(hdev, hidbuf, FEATURE_ROG_ALLY_REPORT_SIZE);
++
++ kfree(hidbuf);
++ return ret;
++}
++
++static int asus_rog_ally_probe(struct hid_device *hdev, const struct rog_ops *ops)
++{
++ struct asus_drvdata *drvdata = hid_get_drvdata(hdev);
++ int ret;
++
++ /* all ROG devices have this HID interface but we will focus on Ally for now */
++ if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD && hid_is_usb(hdev)) {
++ struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
++
++ if (intf->altsetting->desc.bInterfaceNumber == 0) {
++ hid_info(hdev, "Setting up ROG USB interface\n");
++ /* initialise and set up USB, common to ROG */
++ // TODO:
++
++ /* initialise the Ally data */
++ if (drvdata->quirks & QUIRK_ROG_ALLY_XPAD) {
++ hid_info(hdev, "Setting up ROG Ally interface\n");
++
++ drvdata->rog_ally_data = devm_kzalloc(
++ &hdev->dev, sizeof(*drvdata->rog_ally_data), GFP_KERNEL);
++ if (!drvdata->rog_ally_data) {
++ hid_err(hdev, "Can't alloc Asus ROG USB interface\n");
++ ret = -ENOMEM;
++ goto err_stop_hw;
++ }
++ // TODO: move these to functions
++ drvdata->rog_ally_data->mode = xpad_mode_game;
++ drvdata->rog_ally_data->deadzones[xpad_mode_game][0][1] = 64;
++ drvdata->rog_ally_data->deadzones[xpad_mode_game][0][3] = 64;
++ drvdata->rog_ally_data->deadzones[xpad_mode_game][1][1] = 64;
++ drvdata->rog_ally_data->deadzones[xpad_mode_game][1][3] = 64;
++
++ drvdata->rog_ally_data->anti_deadzones[xpad_mode_game][0] = 64;
++ drvdata->rog_ally_data->anti_deadzones[xpad_mode_game][1] = 64;
++
++ drvdata->rog_ally_data->response_curve[xpad_mode_game][0][0] = 0x14;
++ drvdata->rog_ally_data->response_curve[xpad_mode_game][0][1] = 0x14;
++ drvdata->rog_ally_data->response_curve[xpad_mode_game][0][2] = 0x28;
++ drvdata->rog_ally_data->response_curve[xpad_mode_game][0][3] = 0x28;
++ drvdata->rog_ally_data->response_curve[xpad_mode_game][0][4] = 0x3c;
++ drvdata->rog_ally_data->response_curve[xpad_mode_game][0][5] = 0x3c;
++ drvdata->rog_ally_data->response_curve[xpad_mode_game][0][6] = 0x50;
++ drvdata->rog_ally_data->response_curve[xpad_mode_game][0][7] = 0x50;
++
++ drvdata->rog_ally_data->response_curve[xpad_mode_game][1][0] = 0x14;
++ drvdata->rog_ally_data->response_curve[xpad_mode_game][1][1] = 0x14;
++ drvdata->rog_ally_data->response_curve[xpad_mode_game][1][2] = 0x28;
++ drvdata->rog_ally_data->response_curve[xpad_mode_game][1][3] = 0x28;
++ drvdata->rog_ally_data->response_curve[xpad_mode_game][1][4] = 0x3c;
++ drvdata->rog_ally_data->response_curve[xpad_mode_game][1][5] = 0x3c;
++ drvdata->rog_ally_data->response_curve[xpad_mode_game][1][6] = 0x50;
++ drvdata->rog_ally_data->response_curve[xpad_mode_game][1][7] = 0x50;
++
++ __gamepad_mapping_xpad_default(drvdata->rog_ally_data);
++ // these calls will never error so ignore the return
++ __gamepad_mapping_store(&hdev->dev, "kb_f14", btn_pair_m1_m2,
++ btn_pair_side_left, false); // M2
++ __gamepad_mapping_store(&hdev->dev, "kb_f15", btn_pair_m1_m2,
++ btn_pair_side_right, false); // M1
++ ret = __gamepad_set_mode(&hdev->dev, xpad_mode_game);
++ if (ret < 0)
++ return ret;
++ }
++
++ if (sysfs_create_groups(&hdev->dev.kobj, gamepad_device_attr_groups))
++ goto err_stop_hw;
++ }
++ }
++
++ return 0;
++err_stop_hw:
++ hid_hw_stop(hdev);
++ return ret;
++}
++
++void asus_rog_ally_remove(struct hid_device *hdev, const struct rog_ops *ops)
++{
++ struct asus_drvdata *drvdata = hid_get_drvdata(hdev);
++ if (drvdata->rog_ally_data) {
++ __gamepad_set_mode(&hdev->dev, xpad_mode_mouse);
++ sysfs_remove_groups(&hdev->dev.kobj, gamepad_device_attr_groups);
++ }
++}
++
++const struct rog_ops rog_ally = {
++ .probe = asus_rog_ally_probe,
++ .remove = asus_rog_ally_remove,
++};
+diff --git a/drivers/hid/hid-asus-rog.h b/drivers/hid/hid-asus-rog.h
+new file mode 100644
+index 000000000000..4d81f0ce8c59
+--- /dev/null
++++ b/drivers/hid/hid-asus-rog.h
+@@ -0,0 +1,482 @@
++// SPDX-License-Identifier: GPL-2.0-or-later
++/*
++ * HID driver for Asus ROG laptops and Ally
++ *
++ * Copyright (c) 2023 Luke Jones <luke@ljones.dev>
++ */
++
++/* data that is private to the hid-asus-rog module */
++
++#include <linux/hid.h>
++#include <linux/types.h>
++
++#define BTN_CODE_LEN 11
++#define MAPPING_BLOCK_LEN 44
++
++#define TURBO_BLOCK_LEN 32
++#define TURBO_BLOCK_STEP 2
++
++#define PAD_A "pad_a"
++#define PAD_B "pad_b"
++#define PAD_X "pad_x"
++#define PAD_Y "pad_y"
++#define PAD_LB "pad_lb"
++#define PAD_RB "pad_rb"
++#define PAD_LS "pad_ls"
++#define PAD_RS "pad_rs"
++#define PAD_DPAD_UP "pad_dpad_up"
++#define PAD_DPAD_DOWN "pad_dpad_down"
++#define PAD_DPAD_LEFT "pad_dpad_left"
++#define PAD_DPAD_RIGHT "pad_dpad_right"
++#define PAD_VIEW "pad_view"
++#define PAD_MENU "pad_menu"
++#define PAD_XBOX "pad_xbox"
++
++#define KB_M1 "kb_m1"
++#define KB_M2 "kb_m2"
++#define KB_ESC "kb_esc"
++#define KB_F1 "kb_f1"
++#define KB_F2 "kb_f2"
++#define KB_F3 "kb_f3"
++#define KB_F4 "kb_f4"
++#define KB_F5 "kb_f5"
++#define KB_F6 "kb_f6"
++#define KB_F7 "kb_f7"
++#define KB_F8 "kb_f8"
++#define KB_F9 "kb_f9"
++#define KB_F10 "kb_f10"
++#define KB_F11 "kb_f11"
++#define KB_F12 "kb_f12"
++#define KB_F14 "kb_f14"
++#define KB_F15 "kb_f15"
++
++#define KB_BACKTICK "kb_`"
++#define KB_1 "kb_1"
++#define KB_2 "kb_2"
++#define KB_3 "kb_3"
++#define KB_4 "kb_4"
++#define KB_5 "kb_5"
++#define KB_6 "kb_6"
++#define KB_7 "kb_7"
++#define KB_8 "kb_8"
++#define KB_9 "kb_9"
++#define KB_0 "kb_0"
++#define KB_HYPHEN "kb_-"
++#define KB_EQUALS "kb_="
++#define KB_BACKSPACE "kb_backspace"
++
++#define KB_TAB "kb_tab"
++#define KB_Q "kb_q"
++#define KB_W "kb_w"
++#define KB_E "kb_e"
++#define KB_R "kb_r"
++#define KB_T "kb_t"
++#define KB_Y "kb_y"
++#define KB_U "kb_u"
++#define KB_I "kb_i"
++#define KB_O "kb_o"
++#define KB_P "kb_p"
++#define KB_LBRACKET "kb_["
++#define KB_RBRACKET "kb_]"
++#define KB_BACKSLASH "kb_bkslash"
++
++#define KB_CAPS "kb_caps"
++#define KB_A "kb_a"
++#define KB_S "kb_s"
++#define KB_D "kb_d"
++#define KB_F "kb_f"
++#define KB_G "kb_g"
++#define KB_H "kb_h"
++#define KB_J "kb_j"
++#define KB_K "kb_k"
++#define KB_L "kb_l"
++#define KB_SEMI "kb_;"
++#define KB_QUOTE "kb_'"
++#define KB_RET "kb_enter"
++
++#define KB_LSHIFT "kb_lshift"
++#define KB_Z "kb_z"
++#define KB_X "kb_x"
++#define KB_C "kb_c"
++#define KB_V "kb_v"
++#define KB_B "kb_b"
++#define KB_N "kb_n"
++#define KB_M "kb_m"
++#define KB_COMA "kb_,"
++#define KB_PERIOD "kb_."
++#define KB_FWDSLASH "kb_/"
++#define KB_RSHIFT "kb_rshift"
++
++#define KB_LCTL "kb_lctl"
++#define KB_META "kb_meta"
++#define KB_LALT "kb_lalt"
++#define KB_SPACE "kb_space"
++#define KB_RALT "kb_ralt"
++#define KB_MENU "kb_menu"
++#define KB_RCTL "kb_rctl"
++
++#define KB_PRNTSCN "kb_prntscn"
++#define KB_SCRLCK "kb_scrlck"
++#define KB_PAUSE "kb_pause"
++#define KB_INS "kb_ins"
++#define KB_HOME "kb_home"
++#define KB_PGUP "kb_pgup"
++#define KB_DEL "kb_del"
++#define KB_END "kb_end"
++#define KB_PGDWN "kb_pgdwn"
++
++#define KB_UP_ARROW "kb_up_arrow"
++#define KB_DOWN_ARROW "kb_down_arrow"
++#define KB_LEFT_ARROW "kb_left_arrow"
++#define KB_RIGHT_ARROW "kb_right_arrow"
++
++#define NUMPAD_LCK "numpad_lck"
++#define NUMPAD_FWDSLASH "numpad_/"
++#define NUMPAD_STAR "numpad_*"
++#define NUMPAD_HYPHEN "numpad_-"
++#define NUMPAD_0 "numpad_0"
++#define NUMPAD_1 "numpad_1"
++#define NUMPAD_2 "numpad_2"
++#define NUMPAD_3 "numpad_3"
++#define NUMPAD_4 "numpad_4"
++#define NUMPAD_5 "numpad_5"
++#define NUMPAD_6 "numpad_6"
++#define NUMPAD_7 "numpad_7"
++#define NUMPAD_8 "numpad_8"
++#define NUMPAD_9 "numpad_9"
++#define NUMPAD_PLUS "numpad_+"
++#define NUMPAD_ENTER "numpad_enter"
++#define NUMPAD_PERIOD "numpad_."
++
++#define RAT_LCLICK "rat_lclick"
++#define RAT_RCLICK "rat_rclick"
++#define RAT_MCLICK "rat_mclick"
++#define RAT_WHEEL_UP "rat_wheel_up"
++#define RAT_WHEEL_DOWN "rat_wheel_down"
++
++#define MEDIA_SCREENSHOT "media_screenshot"
++#define MEDIA_SHOW_KEYBOARD "media_show_keyboard"
++#define MEDIA_SHOW_DESKTOP "media_show_desktop"
++#define MEDIA_START_RECORDING "media_start_recording"
++#define MEDIA_MIC_OFF "media_mic_off"
++#define MEDIA_VOL_DOWN "media_vol_down"
++#define MEDIA_VOL_UP "media_vol_up"
++
++/* required so we can have nested attributes with same name but different functions */
++#define ALLY_DEVICE_ATTR_RW(_name, _sysfs_name) \
++ struct device_attribute dev_attr_##_name = \
++ __ATTR(_sysfs_name, 0644, _name##_show, _name##_store)
++
++#define ALLY_DEVICE_ATTR_RO(_name, _sysfs_name) \
++ struct device_attribute dev_attr_##_name = __ATTR(_sysfs_name, 0444, _name##_show, NULL)
++
++#define ALLY_DEVICE_ATTR_WO(_name, _sysfs_name) \
++ struct device_attribute dev_attr_##_name = __ATTR(_sysfs_name, 0200, NULL, _name##_store)
++
++/* response curve macros */
++#define ALLY_RESP_CURVE_SHOW(_name, _point_n) \
++ static ssize_t _name##_show(struct device *raw_dev, struct device_attribute *attr, \
++ char *buf) \
++ { \
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev); \
++ int idx = (_point_n - 1) * 2; \
++ return sysfs_emit( \
++ buf, "%d %d\n", \
++ rog_ally->response_curve[rog_ally->mode][btn_pair_side_left][idx], \
++ rog_ally->response_curve[rog_ally->mode][btn_pair_side_right][idx + 1]); \
++ }
++
++#define ALLY_RESP_CURVE_STORE(_name, _side, _point_n) \
++ static ssize_t _name##_store(struct device *raw_dev, struct device_attribute *attr, \
++ const char *buf, size_t count) \
++ { \
++ int ret = __gamepad_store_response_curve(raw_dev, buf, btn_pair_side_##_side, \
++ _point_n); \
++ if (ret < 0) \
++ return ret; \
++ return count; \
++ }
++
++/* _point_n must start at 1 */
++#define ALLY_JS_RC_POINT(_side, _point_n, _sysfs_label) \
++ ALLY_RESP_CURVE_SHOW(rc_point_##_side##_##_point_n, _point_n); \
++ ALLY_RESP_CURVE_STORE(rc_point_##_side##_##_point_n, _side, _point_n); \
++ ALLY_DEVICE_ATTR_RW(rc_point_##_side##_##_point_n, _sysfs_label##_point_n);
++
++/* deadzone macros */
++#define ALLY_AXIS_DEADZONE_SHOW(_axis) \
++ static ssize_t _axis##_deadzone_show(struct device *raw_dev, \
++ struct device_attribute *attr, char *buf) \
++ { \
++ struct asus_rog_ally *rog_ally = __rog_ally_data(raw_dev); \
++ int side, is_tr; \
++ \
++ is_tr = _axis > xpad_axis_xy_right; \
++ side = _axis == xpad_axis_xy_right || _axis == xpad_axis_z_right ? 2 : 0; \
++ \
++ return sysfs_emit(buf, "%d %d\n", \
++ rog_ally->deadzones[rog_ally->mode][is_tr][side], \
++ rog_ally->deadzones[rog_ally->mode][is_tr][side + 1]); \
++ }
++
++#define ALLY_AXIS_DEADZONE_STORE(_axis) \
++ static ssize_t _axis##_deadzone_store(struct device *raw_dev, \
++ struct device_attribute *attr, const char *buf, \
++ size_t count) \
++ { \
++ int ret = __gamepad_store_deadzones(raw_dev, _axis, buf); \
++ if (ret < 0) \
++ return ret; \
++ return count; \
++ }
++
++#define ALLY_AXIS_DEADZONE(_axis, _sysfs_label) \
++ ALLY_AXIS_DEADZONE_SHOW(_axis); \
++ ALLY_AXIS_DEADZONE_STORE(_axis); \
++ ALLY_DEVICE_ATTR_RW(_axis##_deadzone, _sysfs_label);
++
++/* button specific macros */
++#define ALLY_BTN_SHOW(_fname, _pair, _side, _secondary) \
++ static ssize_t _fname##_show(struct device *raw_dev, struct device_attribute *attr, \
++ char *buf) \
++ { \
++ return sysfs_emit(buf, "%s\n", \
++ __btn_map_to_string(raw_dev, _pair, _side, _secondary)); \
++ }
++
++#define ALLY_BTN_STORE(_fname, _pair, _side, _secondary) \
++ static ssize_t _fname##_store(struct device *raw_dev, struct device_attribute *attr, \
++ const char *buf, size_t count) \
++ { \
++ int ret = __gamepad_mapping_store(raw_dev, buf, _pair, _side, _secondary); \
++ if (ret < 0) \
++ return ret; \
++ return count; \
++ }
++
++#define ALLY_BTN_TURBO_SHOW(_fname, _pair, _side) \
++ static ssize_t _fname##_turbo_show(struct device *raw_dev, struct device_attribute *attr, \
++ char *buf) \
++ { \
++ return sysfs_emit(buf, "%d\n", __gamepad_turbo_show(raw_dev, _pair, _side)); \
++ }
++
++#define ALLY_BTN_TURBO_STORE(_fname, _pair, _side) \
++ static ssize_t _fname##_turbo_store(struct device *raw_dev, struct device_attribute *attr, \
++ const char *buf, size_t count) \
++ { \
++ int ret = __gamepad_turbo_store(raw_dev, buf, _pair, _side); \
++ if (ret < 0) \
++ return ret; \
++ return count; \
++ }
++
++#define ALLY_BTN_ATTRS_GROUP(_name, _fname) \
++ static struct attribute *_fname##_attrs[] = { &dev_attr_##_fname.attr, \
++ &dev_attr_##_fname##_macro.attr, \
++ &dev_attr_##_fname##_turbo.attr, NULL }; \
++ static const struct attribute_group _fname##_attr_group = { \
++ .name = __stringify(_name), \
++ .attrs = _fname##_attrs, \
++ };
++
++#define ALLY_BTN_MAPPING(_fname, _pair, _side) \
++ ALLY_BTN_SHOW(btn_mapping_##_fname, _pair, _side, false); \
++ ALLY_BTN_STORE(btn_mapping_##_fname, _pair, _side, false); \
++ \
++ ALLY_BTN_SHOW(btn_mapping_##_fname##_macro, _pair, _side, true); \
++ ALLY_BTN_STORE(btn_mapping_##_fname##_macro, _pair, _side, true); \
++ \
++ ALLY_BTN_TURBO_SHOW(btn_mapping_##_fname, _pair, _side); \
++ ALLY_BTN_TURBO_STORE(btn_mapping_##_fname, _pair, _side); \
++ \
++ ALLY_DEVICE_ATTR_RW(btn_mapping_##_fname, remap); \
++ ALLY_DEVICE_ATTR_RW(btn_mapping_##_fname##_macro, macro_remap); \
++ ALLY_DEVICE_ATTR_RW(btn_mapping_##_fname##_turbo, turbo); \
++ \
++ ALLY_BTN_ATTRS_GROUP(btn_##_fname, btn_mapping_##_fname);
++
++/* calibration macros */
++#define ALLY_CAL_STORE(_fname, _axis) \
++ static ssize_t _fname##_store(struct device *raw_dev, struct device_attribute *attr, \
++ const char *buf, size_t count) \
++ { \
++ int ret = __gamepad_cal_store(raw_dev, buf, _axis); \
++ if (ret < 0) \
++ return ret; \
++ return count; \
++ };
++
++#define ALLY_CAL_SHOW(_fname, _axis) \
++ static ssize_t _fname##_show(struct device *raw_dev, struct device_attribute *attr, \
++ char *buf) \
++ { \
++ return __gamepad_cal_show(raw_dev, buf, _axis); \
++ }
++
++#define ALLY_CAL_ATTR(_fname, _axis, _sysfs_label) \
++ ALLY_CAL_STORE(_fname, _axis); \
++ ALLY_CAL_SHOW(_fname, _axis); \
++ ALLY_DEVICE_ATTR_RW(_fname, _sysfs_label);
++
++#define ALLY_CAL_RESET_STORE(_fname, _axis) \
++ static ssize_t _fname##_store(struct device *raw_dev, struct device_attribute *attr, \
++ const char *buf, size_t count) \
++ { \
++ int ret = __gamepad_cal_reset(raw_dev, buf, _axis); \
++ if (ret < 0) \
++ return ret; \
++ return count; \
++ };
++
++#define ALLY_CAL_RESET_ATTR(_fname, _axis, _sysfs_label) \
++ ALLY_CAL_RESET_STORE(_fname, _axis); \
++ ALLY_DEVICE_ATTR_WO(_fname, _sysfs_label);
++
++/* Default blocks for the xpad mode */
++static const u8 XPAD_DEF1[MAPPING_BLOCK_LEN] = {
++ 0x01, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x19,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x8c, 0x88, 0x76, 0x00, 0x00
++};
++static const u8 XPAD_DEF2[MAPPING_BLOCK_LEN] = {
++ 0x01, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
++ 0x00, 0x02, 0x82, 0x23, 0x00, 0x00, 0x00, 0x01, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x02, 0x82, 0x0d, 0x00, 0x00, 0x00
++};
++static const u8 XPAD_DEF3[MAPPING_BLOCK_LEN] = {
++ 0x01, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
++};
++static const u8 XPAD_DEF4[MAPPING_BLOCK_LEN] = {
++ 0x01, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
++};
++static const u8 XPAD_DEF5[MAPPING_BLOCK_LEN] = {
++ 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x16,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x02, 0x82, 0x31, 0x00, 0x00, 0x00
++};
++static const u8 XPAD_DEF6[MAPPING_BLOCK_LEN] = {
++ 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
++ 0x00, 0x02, 0x82, 0x4d, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
++};
++static const u8 XPAD_DEF7[MAPPING_BLOCK_LEN] = {
++ 0x01, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
++};
++static const u8 XPAD_DEF8[MAPPING_BLOCK_LEN] = {
++ 0x02, 0x00, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x8e, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x8f, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x02, 0x00, 0x8f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
++};
++static const u8 XPAD_DEF9[MAPPING_BLOCK_LEN] = {
++ 0x01, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
++};
++
++/* default blocks for the wasd mode */
++static const u8 WASD_DEF1[MAPPING_BLOCK_LEN] = {
++ 0x02, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x19,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x8c, 0x88, 0x76, 0x00, 0x00
++};
++static const u8 WASD_DEF2[MAPPING_BLOCK_LEN] = {
++ 0x02, 0x00, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
++ 0x00, 0x02, 0x82, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x02, 0x82, 0x0d, 0x00, 0x00, 0x00
++};
++static const u8 WASD_DEF3[MAPPING_BLOCK_LEN] = {
++ 0x02, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
++};
++static const u8 WASD_DEF4[MAPPING_BLOCK_LEN] = {
++ 0x02, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
++};
++static const u8 WASD_DEF5[MAPPING_BLOCK_LEN] = {
++ 0x02, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x16,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x02, 0x82, 0x31, 0x00, 0x00, 0x00
++};
++static const u8 WASD_DEF6[MAPPING_BLOCK_LEN] = {
++ 0x02, 0x00, 0x97, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
++ 0x00, 0x02, 0x82, 0x4d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
++};
++static const u8 WASD_DEF7[MAPPING_BLOCK_LEN] = {
++ 0x01, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
++};
++static const u8 WASD_DEF8[MAPPING_BLOCK_LEN] = {
++ 0x02, 0x00, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x8e, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x8f, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x02, 0x00, 0x8f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
++};
++static const u8 WASD_DEF9[MAPPING_BLOCK_LEN] = {
++ 0x04, 0x00, 0x00, 0x00, 0x00, 0x02, 0x88, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
++};
++
++enum xpad_mode {
++ xpad_mode_game = 0x01,
++ xpad_mode_wasd = 0x02,
++ xpad_mode_mouse = 0x03,
++};
++
++enum xpad_cmd {
++ xpad_cmd_set_mode = 0x01,
++ xpad_cmd_set_mapping = 0x02,
++ xpad_cmd_set_js_dz = 0x04, /* deadzones */
++ xpad_cmd_set_tr_dz = 0x05, /* deadzones */
++ xpad_cmd_set_vibe_intensity = 0x06,
++ xpad_cmd_check_ready = 0x0A,
++ xpad_cmd_set_calibration = 0x0D,
++ xpad_cmd_set_turbo = 0x0F,
++ xpad_cmd_set_response_curve = 0x13,
++ xpad_cmd_set_adz = 0x18,
++};
++
++enum xpad_axis {
++ xpad_axis_xy_left = 0x01,
++ xpad_axis_xy_right = 0x02,
++ xpad_axis_z_left = 0x03,
++ xpad_axis_z_right = 0x04,
++};
++
++enum mcu_output_dev {
++ mcu_output_dev_blank = 0x00,
++ mcu_output_dev_xpad = 0x01,
++ mcu_output_dev_keyboard = 0x02,
++ mcu_output_dev_mouse = 0x03,
++ mcu_output_dev_macro = 0x04,
++ mcu_output_dev_media = 0x05,
++};
++
++enum btn_pair {
++ btn_pair_dpad_u_d = 0x01,
++ btn_pair_dpad_l_r = 0x02,
++ btn_pair_ls_rs = 0x03,
++ btn_pair_lb_rb = 0x04,
++ btn_pair_a_b = 0x05,
++ btn_pair_x_y = 0x06,
++ btn_pair_view_menu = 0x07,
++ btn_pair_m1_m2 = 0x08,
++ btn_pair_lt_rt = 0x09,
++};
++
++enum btn_pair_side {
++ btn_pair_side_left = 0x00,
++ btn_pair_side_right = 0x01,
++};
++
++static int __gamepad_write_all_to_mcu(struct device *raw_dev);
+\ No newline at end of file
+diff --git a/drivers/hid/hid-asus.h b/drivers/hid/hid-asus.h
+new file mode 100644
+index 000000000000..18317cad7110
+--- /dev/null
++++ b/drivers/hid/hid-asus.h
+@@ -0,0 +1,58 @@
++// SPDX-License-Identifier: GPL-2.0-or-later
++/*
++ * HID driver for Asus ROG laptops and Ally
++ *
++ * Copyright (c) 2023 Luke Jones <luke@ljones.dev>
++ */
++
++#include <linux/hid.h>
++#include <linux/types.h>
++
++#define FEATURE_KBD_REPORT_ID 0x5a
++#define FEATURE_KBD_REPORT_SIZE 16
++#define FEATURE_KBD_LED_REPORT_ID1 0x5d
++#define FEATURE_KBD_LED_REPORT_ID2 0x5e
++#define FEATURE_ROG_ALLY_REPORT_SIZE 64
++
++#define QUIRK_FIX_NOTEBOOK_REPORT BIT(0)
++#define QUIRK_NO_INIT_REPORTS BIT(1)
++#define QUIRK_SKIP_INPUT_MAPPING BIT(2)
++#define QUIRK_IS_MULTITOUCH BIT(3)
++#define QUIRK_NO_CONSUMER_USAGES BIT(4)
++#define QUIRK_USE_KBD_BACKLIGHT BIT(5)
++#define QUIRK_T100_KEYBOARD BIT(6)
++#define QUIRK_T100CHI BIT(7)
++#define QUIRK_G752_KEYBOARD BIT(8)
++#define QUIRK_T90CHI BIT(9)
++#define QUIRK_MEDION_E1239T BIT(10)
++#define QUIRK_ROG_NKEY_KEYBOARD BIT(11)
++#define QUIRK_ROG_CLAYMORE_II_KEYBOARD BIT(12)
++#define QUIRK_ROG_ALLY_XPAD BIT(13)
++
++struct asus_drvdata {
++ unsigned long quirks;
++ struct hid_device *hdev;
++ struct input_dev *input;
++ struct input_dev *tp_kbd_input;
++ struct asus_kbd_leds *kbd_backlight;
++ const struct asus_touchpad_info *tp;
++ bool enable_backlight;
++ struct power_supply *battery;
++ struct power_supply_desc battery_desc;
++ int battery_capacity;
++ int battery_stat;
++ bool battery_in_query;
++ unsigned long battery_next_query;
++ struct asus_rog_ally *rog_ally_data;
++};
++
++extern int asus_kbd_set_report(struct hid_device *hdev, const u8 *buf, size_t buf_size);
++
++extern int asus_kbd_get_report(struct hid_device *hdev, u8 *out_buf, size_t out_buf_size);
++
++struct rog_ops {
++ int (*probe) (struct hid_device *hdev, const struct rog_ops *ops);
++ void (*remove) (struct hid_device *hdev, const struct rog_ops *ops);
++};
++
++extern const struct rog_ops rog_ally;
+\ No newline at end of file
+--
+2.41.0
+
diff --git a/v14.1-fix-defaults1.patch b/v14.1-fix-defaults1.patch
new file mode 100644
index 000000000000..a057f043c432
--- /dev/null
+++ b/v14.1-fix-defaults1.patch
@@ -0,0 +1,63 @@
+diff --git a/drivers/hid/hid-asus-rog.c b/drivers/hid/hid-asus-rog.c
+index 91f3a7786893..d765ca7fc3a9 100644
+--- a/drivers/hid/hid-asus-rog.c
++++ b/drivers/hid/hid-asus-rog.c
+@@ -1396,31 +1396,33 @@ static int asus_rog_ally_probe(struct hid_device *hdev, const struct rog_ops *op
+ }
+ // TODO: move these to functions
+ drvdata->rog_ally_data->mode = xpad_mode_game;
+- drvdata->rog_ally_data->deadzones[xpad_mode_game][0][1] = 64;
+- drvdata->rog_ally_data->deadzones[xpad_mode_game][0][3] = 64;
+- drvdata->rog_ally_data->deadzones[xpad_mode_game][1][1] = 64;
+- drvdata->rog_ally_data->deadzones[xpad_mode_game][1][3] = 64;
+-
+- drvdata->rog_ally_data->anti_deadzones[xpad_mode_game][0] = 64;
+- drvdata->rog_ally_data->anti_deadzones[xpad_mode_game][1] = 64;
+-
+- drvdata->rog_ally_data->response_curve[xpad_mode_game][0][0] = 0x14;
+- drvdata->rog_ally_data->response_curve[xpad_mode_game][0][1] = 0x14;
+- drvdata->rog_ally_data->response_curve[xpad_mode_game][0][2] = 0x28;
+- drvdata->rog_ally_data->response_curve[xpad_mode_game][0][3] = 0x28;
+- drvdata->rog_ally_data->response_curve[xpad_mode_game][0][4] = 0x3c;
+- drvdata->rog_ally_data->response_curve[xpad_mode_game][0][5] = 0x3c;
+- drvdata->rog_ally_data->response_curve[xpad_mode_game][0][6] = 0x50;
+- drvdata->rog_ally_data->response_curve[xpad_mode_game][0][7] = 0x50;
+-
+- drvdata->rog_ally_data->response_curve[xpad_mode_game][1][0] = 0x14;
+- drvdata->rog_ally_data->response_curve[xpad_mode_game][1][1] = 0x14;
+- drvdata->rog_ally_data->response_curve[xpad_mode_game][1][2] = 0x28;
+- drvdata->rog_ally_data->response_curve[xpad_mode_game][1][3] = 0x28;
+- drvdata->rog_ally_data->response_curve[xpad_mode_game][1][4] = 0x3c;
+- drvdata->rog_ally_data->response_curve[xpad_mode_game][1][5] = 0x3c;
+- drvdata->rog_ally_data->response_curve[xpad_mode_game][1][6] = 0x50;
+- drvdata->rog_ally_data->response_curve[xpad_mode_game][1][7] = 0x50;
++ for (int i = 0; i < xpad_mode_mouse; i++) {
++ drvdata->rog_ally_data->deadzones[i][0][1] = 64;
++ drvdata->rog_ally_data->deadzones[i][0][3] = 64;
++ drvdata->rog_ally_data->deadzones[i][1][1] = 64;
++ drvdata->rog_ally_data->deadzones[i][1][3] = 64;
++
++ drvdata->rog_ally_data->response_curve[i][0][0] = 0x14;
++ drvdata->rog_ally_data->response_curve[i][0][1] = 0x14;
++ drvdata->rog_ally_data->response_curve[i][0][2] = 0x28;
++ drvdata->rog_ally_data->response_curve[i][0][3] = 0x28;
++ drvdata->rog_ally_data->response_curve[i][0][4] = 0x3c;
++ drvdata->rog_ally_data->response_curve[i][0][5] = 0x3c;
++ drvdata->rog_ally_data->response_curve[i][0][6] = 0x50;
++ drvdata->rog_ally_data->response_curve[i][0][7] = 0x50;
++
++ drvdata->rog_ally_data->response_curve[i][1][0] = 0x14;
++ drvdata->rog_ally_data->response_curve[i][1][1] = 0x14;
++ drvdata->rog_ally_data->response_curve[i][1][2] = 0x28;
++ drvdata->rog_ally_data->response_curve[i][1][3] = 0x28;
++ drvdata->rog_ally_data->response_curve[i][1][4] = 0x3c;
++ drvdata->rog_ally_data->response_curve[i][1][5] = 0x3c;
++ drvdata->rog_ally_data->response_curve[i][1][6] = 0x50;
++ drvdata->rog_ally_data->response_curve[i][1][7] = 0x50;
++
++ drvdata->rog_ally_data->vibration_intensity[i][0] = 64;
++ drvdata->rog_ally_data->vibration_intensity[i][1] = 64;
++ }
+
+ ret = __gamepad_set_mode(&hdev->dev, xpad_mode_game);
+ if (ret < 0)
diff --git a/wifi-nl80211-fix-deadlock-in-nl80211_set_cqm_rssi-(6.6.x).patch b/wifi-nl80211-fix-deadlock-in-nl80211_set_cqm_rssi-(6.6.x).patch
new file mode 100644
index 000000000000..372271120e30
--- /dev/null
+++ b/wifi-nl80211-fix-deadlock-in-nl80211_set_cqm_rssi-(6.6.x).patch
@@ -0,0 +1,61 @@
+Commit 4a7e92551618f3737b305f62451353ee05662f57 ("wifi: cfg80211: fix
+CQM for non-range use" on 6.6.x) causes nl80211_set_cqm_rssi not to
+release the wdev lock in some situations.
+
+Of course, the ensuing deadlock causes userland network managers to
+break pretty badly, and on typical systems this also causes lockups on
+on suspend, poweroff and reboot. See [1], [2], [3] for example reports.
+
+The upstream commit, 7e7efdda6adb385fbdfd6f819d76bc68c923c394
+("wifi: cfg80211: fix CQM for non-range use"), does not trigger this
+issue because the wdev lock does not exist there.
+
+Fix the deadlock by releasing the lock before returning.
+
+[1] https://bugzilla.kernel.org/show_bug.cgi?id=218247
+[2] https://bbs.archlinux.org/viewtopic.php?id=290976
+[3] https://lore.kernel.org/all/87sf4belmm.fsf@xxxxxxxxxxxxx/
+
+Fixes: 4a7e92551618 ("wifi: cfg80211: fix CQM for non-range use")
+Cc: stable@xxxxxxxxxxxxxxx
+Signed-off-by: Léo Lam <leo@xxxxxxxxx>
+---
+ net/wireless/nl80211.c | 18 ++++++++++++------
+ 1 file changed, 12 insertions(+), 6 deletions(-)
+
+diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
+index 6a82dd876f27..0b0dfecedc50 100644
+--- a/net/wireless/nl80211.c
++++ b/net/wireless/nl80211.c
+@@ -12906,17 +12906,23 @@ static int nl80211_set_cqm_rssi(struct genl_info *info,
+ lockdep_is_held(&wdev->mtx));
+
+ /* if already disabled just succeed */
+- if (!n_thresholds && !old)
+- return 0;
++ if (!n_thresholds && !old) {
++ err = 0;
++ goto unlock;
++ }
+
+ if (n_thresholds > 1) {
+ if (!wiphy_ext_feature_isset(&rdev->wiphy,
+ NL80211_EXT_FEATURE_CQM_RSSI_LIST) ||
+- !rdev->ops->set_cqm_rssi_range_config)
+- return -EOPNOTSUPP;
++ !rdev->ops->set_cqm_rssi_range_config) {
++ err = -EOPNOTSUPP;
++ goto unlock;
++ }
+ } else {
+- if (!rdev->ops->set_cqm_rssi_config)
+- return -EOPNOTSUPP;
++ if (!rdev->ops->set_cqm_rssi_config) {
++ err = -EOPNOTSUPP;
++ goto unlock;
++ }
+ }
+
+ if (n_thresholds) {
+--
+2.43.0