aboutsummaryrefslogtreecommitdiff
path: root/SOURCES/asus-linux.patch
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2023-08-24 18:26:58 +0200
committerJan200101 <sentrycraft123@gmail.com>2023-08-24 18:26:58 +0200
commit031b0717ecac32986cc641d429c85b2300360809 (patch)
treeee950c1cbb203d4046c9250b131d240d506b77dd /SOURCES/asus-linux.patch
parenta2f74a299563d8dad4947f0ec95a18d8ee9e4317 (diff)
downloadkernel-fsync-031b0717ecac32986cc641d429c85b2300360809.tar.gz
kernel-fsync-031b0717ecac32986cc641d429c85b2300360809.zip
kernel 6.4.12
Diffstat (limited to 'SOURCES/asus-linux.patch')
-rw-r--r--SOURCES/asus-linux.patch566
1 files changed, 356 insertions, 210 deletions
diff --git a/SOURCES/asus-linux.patch b/SOURCES/asus-linux.patch
index ad11400..e554970 100644
--- a/SOURCES/asus-linux.patch
+++ b/SOURCES/asus-linux.patch
@@ -1,34 +1,3 @@
-From 60c4d6d8392d9f3f78b8a56bae349f1f9fffa81e Mon Sep 17 00:00:00 2001
-From: "Luke D. Jones" <luke@ljones.dev>
-Date: Thu, 6 Jul 2023 21:11:00 +1200
-Subject: [PATCH] ALSA: hda/realtek: Add quirk for ASUS ROG GZ301V
-
-Adds the required quirk to enable the Cirrus amp and correct pins
-on the ASUS ROG GZ301V series which uses an SPI connected Cirrus amp.
-
-While this works if the related _DSD properties are made available, these
-aren't included in the ACPI of these laptops (yet).
-
-Signed-off-by: Luke D. Jones <luke@ljones.dev>
----
- sound/pci/hda/patch_realtek.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
-index 1547c40dc7e9..969eb0736bca 100644
---- a/sound/pci/hda/patch_realtek.c
-+++ b/sound/pci/hda/patch_realtek.c
-@@ -9607,6 +9607,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
- SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603V", ALC285_FIXUP_ASUS_HEADSET_MIC),
- SND_PCI_QUIRK(0x1043, 0x1493, "ASUS GV601V", ALC285_FIXUP_ASUS_HEADSET_MIC),
- SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
-+ SND_PCI_QUIRK(0x1043, 0x1573, "ASUS GZ301V", ALC285_FIXUP_ASUS_HEADSET_MIC),
- SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
- SND_PCI_QUIRK(0x1043, 0x1683, "ASUS UM3402YAR", ALC287_FIXUP_CS35L41_I2C_2),
- SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
---
-2.41.0
-
From 56e04226a7083c234b1bb04f7c0dca6f15e9ca2b Mon Sep 17 00:00:00 2001
From: "Luke D. Jones" <luke@ljones.dev>
Date: Sun, 4 Jun 2023 18:48:11 +1200
@@ -1570,185 +1539,6 @@ index 16e99a1c37fc..63e630276499 100644
--
2.41.0
-From 6245df2816f6f2d99e21ae3eb6b0c64d4df1c298 Mon Sep 17 00:00:00 2001
-From: "Luke D. Jones" <luke@ljones.dev>
-Date: Fri, 30 Jun 2023 16:24:05 +1200
-Subject: [PATCH 10/15] ALSA: hda/realtek: Add quirk for ASUS ROG GX650P
-
-Adds the required quirk to enable the Cirrus amp and correct pins
-on the ASUS ROG GV601V series which uses an I2C connected Cirrus amp.
-
-While this works if the related _DSD properties are made available, these
-aren't included in the ACPI of these laptops (yet).
-
-Signed-off-by: Luke D. Jones <luke@ljones.dev>
----
- sound/pci/hda/patch_realtek.c | 19 +++++++++++++++++++
- 1 file changed, 19 insertions(+)
-
-diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
-index afe8253f9a4f..b41fdf22157c 100644
---- a/sound/pci/hda/patch_realtek.c
-+++ b/sound/pci/hda/patch_realtek.c
-@@ -7068,6 +7068,8 @@ enum {
- ALC285_FIXUP_SPEAKER2_TO_DAC1,
- ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1,
- ALC285_FIXUP_ASUS_HEADSET_MIC,
-+ ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1,
-+ ALC285_FIXUP_ASUS_I2C_HEADSET_MIC,
- ALC280_FIXUP_HP_HEADSET_MIC,
- ALC221_FIXUP_HP_FRONT_MIC,
- ALC292_FIXUP_TPT460,
-@@ -8058,6 +8060,22 @@ static const struct hda_fixup alc269_fixups[] = {
- .chained = true,
- .chain_id = ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1
- },
-+ [ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1] = {
-+ .type = HDA_FIXUP_FUNC,
-+ .v.func = alc285_fixup_speaker2_to_dac1,
-+ .chained = true,
-+ .chain_id = ALC287_FIXUP_CS35L41_I2C_2
-+ },
-+ [ALC285_FIXUP_ASUS_I2C_HEADSET_MIC] = {
-+ .type = HDA_FIXUP_PINS,
-+ .v.pins = (const struct hda_pintbl[]) {
-+ { 0x19, 0x03a11050 },
-+ { 0x1b, 0x03a11c30 },
-+ { }
-+ },
-+ .chained = true,
-+ .chain_id = ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1
-+ },
- [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
- .type = HDA_FIXUP_PINS,
- .v.pins = (const struct hda_pintbl[]) {
-@@ -9573,6 +9591,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
- SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE),
- SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
- SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
-+ SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650P", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
- SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604V", ALC285_FIXUP_ASUS_HEADSET_MIC),
- SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603V", ALC285_FIXUP_ASUS_HEADSET_MIC),
- SND_PCI_QUIRK(0x1043, 0x1493, "ASUS GV601V", ALC285_FIXUP_ASUS_HEADSET_MIC),
---
-2.41.0
-
-From 49b44a6e2bcf5617052cf5215475db209641f1c9 Mon Sep 17 00:00:00 2001
-From: "Luke D. Jones" <luke@ljones.dev>
-Date: Fri, 30 Jun 2023 16:25:02 +1200
-Subject: [PATCH 11/15] ALSA: hda/realtek: Add quirk for ASUS ROG GA402X
-
-Adds the required quirk to enable the Cirrus amp and correct pins
-on the ASUS ROG GA402X series which uses an I2C connected Cirrus amp.
-
-While this works if the related _DSD properties are made available, these
-aren't included in the ACPI of these laptops (yet).
-
-Signed-off-by: Luke D. Jones <luke@ljones.dev>
----
- sound/pci/hda/patch_realtek.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
-index b41fdf22157c..1fae8e8b1234 100644
---- a/sound/pci/hda/patch_realtek.c
-+++ b/sound/pci/hda/patch_realtek.c
-@@ -9592,6 +9592,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
- SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
- SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
- SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650P", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
-+ SND_PCI_QUIRK(0x1043, 0x1463, "Asus GA402X", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC),
- SND_PCI_QUIRK(0x1043, 0x1473, "ASUS GU604V", ALC285_FIXUP_ASUS_HEADSET_MIC),
- SND_PCI_QUIRK(0x1043, 0x1483, "ASUS GU603V", ALC285_FIXUP_ASUS_HEADSET_MIC),
- SND_PCI_QUIRK(0x1043, 0x1493, "ASUS GV601V", ALC285_FIXUP_ASUS_HEADSET_MIC),
---
-2.41.0
-
-From a67d5c467f9648701e8e80b7465bc288d18bdd57 Mon Sep 17 00:00:00 2001
-From: "Luke D. Jones" <luke@ljones.dev>
-Date: Tue, 4 Jul 2023 16:01:58 +1200
-Subject: [PATCH 12/15] ALSA: hda/realtek: Amend G634 quirk to enable rear
- speakers
-
-Amends the last quirk for the G634 with 0x1caf subsys to enable the rear
-speakers via pincfg.
-
-Signed-off-by: Luke D. Jones <luke@ljones.dev>
----
- sound/pci/hda/patch_realtek.c | 12 +++++++++++-
- 1 file changed, 11 insertions(+), 1 deletion(-)
-
-diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
-index 1fae8e8b1234..50becdc86daa 100644
---- a/sound/pci/hda/patch_realtek.c
-+++ b/sound/pci/hda/patch_realtek.c
-@@ -7068,6 +7068,7 @@ enum {
- ALC285_FIXUP_SPEAKER2_TO_DAC1,
- ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1,
- ALC285_FIXUP_ASUS_HEADSET_MIC,
-+ ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS,
- ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1,
- ALC285_FIXUP_ASUS_I2C_HEADSET_MIC,
- ALC280_FIXUP_HP_HEADSET_MIC,
-@@ -8060,6 +8061,15 @@ static const struct hda_fixup alc269_fixups[] = {
- .chained = true,
- .chain_id = ALC285_FIXUP_ASUS_SPEAKER2_TO_DAC1
- },
-+ [ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS] = {
-+ .type = HDA_FIXUP_PINS,
-+ .v.pins = (const struct hda_pintbl[]) {
-+ { 0x14, 0x90170120 },
-+ { }
-+ },
-+ .chained = true,
-+ .chain_id = ALC285_FIXUP_ASUS_HEADSET_MIC
-+ },
- [ALC285_FIXUP_ASUS_I2C_SPEAKER2_TO_DAC1] = {
- .type = HDA_FIXUP_FUNC,
- .v.func = alc285_fixup_speaker2_to_dac1,
-@@ -9627,7 +9627,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
- SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
- SND_PCI_QUIRK(0x1043, 0x1c62, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
- SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
-- SND_PCI_QUIRK(0x1043, 0x1caf, "ASUS G634JYR/JZR", ALC285_FIXUP_ASUS_HEADSET_MIC),
-+ SND_PCI_QUIRK(0x1043, 0x1caf, "ASUS G634JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
- SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
- SND_PCI_QUIRK(0x1043, 0x1d1f, "ASUS ROG Strix G17 2023 (G713PV)", ALC287_FIXUP_CS35L41_I2C_2),
- SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
---
-2.41.0
-
-From 8a047029b95af218469ec083490f5682c01852e0 Mon Sep 17 00:00:00 2001
-From: "Luke D. Jones" <luke@ljones.dev>
-Date: Tue, 4 Jul 2023 16:06:46 +1200
-Subject: [PATCH 13/15] ALSA: hda/realtek: Add quirk for ASUS ROG G614Jx
-
-Adds the required quirk to enable the Cirrus amp and correct pins
-on the ASUS ROG G614J series which uses an SPI connected Cirrus amp.
-
-While this works if the related _DSD properties are made available, these
-aren't included in the ACPI of these laptops (yet).
-
-Signed-off-by: Luke D. Jones <luke@ljones.dev>
----
- sound/pci/hda/patch_realtek.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
-index 50becdc86daa..ba3c113f0be1 100644
---- a/sound/pci/hda/patch_realtek.c
-+++ b/sound/pci/hda/patch_realtek.c
-@@ -9627,6 +9627,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
- SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
- SND_PCI_QUIRK(0x1043, 0x1c62, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
- SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
-+ SND_PCI_QUIRK(0x1043, 0x1c9f, "ASUS G614JI", ALC285_FIXUP_ASUS_HEADSET_MIC),
- SND_PCI_QUIRK(0x1043, 0x1caf, "ASUS G634JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
- SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
- SND_PCI_QUIRK(0x1043, 0x1d1f, "ASUS ROG Strix G17 2023 (G713PV)", ALC287_FIXUP_CS35L41_I2C_2),
---
-2.41.0
-
From 44d4dc37d2311e4bc0cf5be59925391c3b6b2b9c Mon Sep 17 00:00:00 2001
From: "Luke D. Jones" <luke@ljones.dev>
Date: Tue, 4 Jul 2023 16:34:23 +1200
@@ -1979,3 +1769,359 @@ index d14d0ea9d65f..14ee43c61eb2 100644
--
2.41.0
+From 43fd8da367ca2e69faf9a380dfcea6ceb423a114 Mon Sep 17 00:00:00 2001
+From: Stefan Binding <sbinding@opensource.cirrus.com>
+Date: Tue, 15 Aug 2023 17:10:33 +0100
+Subject: [PATCH 1/2] ALSA: hda: cs35l41: Support systems with missing _DSD
+ properties
+
+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 00d306104484..3b259239c48a 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-cs-dsp-ctls-objs := hda_cs_dsp_ctl.o
+diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c
+index ce5faa620517..692b69f24138 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"
+@@ -1156,8 +1157,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;
+@@ -1211,49 +1211,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;
+@@ -1279,12 +1236,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;
+@@ -1374,7 +1336,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.41.0
+
+From a29254f8aeb5ac7a7bd869648c518bff111dc65c 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
+
+Support adding the missing DSD properties required for ASUS ROG 2023
+laptops and other ASUS laptops to properly utilise the cs35l41.
+
+The currently added laptops are:
+- ASUS GS650P, i2c
+- ASUS GA402X, i2c
+- ASUS GU604V, spi
+- ASUS GU603V, spi
+- ASUS GV601V, spi
+- ASUS GZ301V, spi
+- ASUS ROG ALLY, i2c
+- ASUS G614J, spi
+- 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.
+
+Co-developed-by: Jonathan LoBue <jlobue10@gmail.com>
+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 | 39 ++++++++++++++++++++++++++++
+ 1 file changed, 39 insertions(+)
+
+diff --git a/sound/pci/hda/cs35l41_hda_property.c b/sound/pci/hda/cs35l41_hda_property.c
+index 673f23257a09..128d478f53f2 100644
+--- a/sound/pci/hda/cs35l41_hda_property.c
++++ b/sound/pci/hda/cs35l41_hda_property.c
+@@ -43,6 +43,33 @@ static int lenovo_legion_no_acpi(struct cs35l41_hda *cs35l41, struct device *phy
+ return 0;
+ }
+
++/*
++ * 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_spkr_id2(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
++ const char *hid)
++{
++ struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg;
++
++ /* 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;
++ hw_cfg->valid = true;
++
++ return 0;
++}
++
+ struct cs35l41_prop_model {
+ const char *hid;
+ const char *ssid;
+@@ -53,6 +80,18 @@ struct cs35l41_prop_model {
+ const struct cs35l41_prop_model cs35l41_prop_model_table[] = {
+ { "CLSA0100", NULL, lenovo_legion_no_acpi },
+ { "CLSA0101", NULL, lenovo_legion_no_acpi },
++ { "CSC3551", "10431433", asus_rog_2023_spkr_id2 }, // ASUS GS650P - i2c
++ { "CSC3551", "10431463", asus_rog_2023_spkr_id2 }, // ASUS GA402X/N - i2c
++ { "CSC3551", "10431473", asus_rog_2023_spkr_id2 }, // ASUS GU604V - spi
++ { "CSC3551", "10431483", asus_rog_2023_spkr_id2 }, // ASUS GU603V - spi
++ { "CSC3551", "10431493", asus_rog_2023_spkr_id2 }, // ASUS GV601V - spi
++ { "CSC3551", "10431573", asus_rog_2023_spkr_id2 }, // ASUS GZ301V - spi
++ { "CSC3551", "104317F3", asus_rog_2023_spkr_id2 }, // ASUS ROG ALLY - i2c
++ { "CSC3551", "10431B93", asus_rog_2023_spkr_id2 }, // ASUS G614J - spi
++ { "CSC3551", "10431CAF", asus_rog_2023_spkr_id2 }, // ASUS G634J - spi
++ { "CSC3551", "10431C9F", asus_rog_2023_spkr_id2 }, // ASUS G614JI -spi
++ { "CSC3551", "10431D1F", asus_rog_2023_spkr_id2 }, // ASUS G713P - i2c
++ { "CSC3551", "10431F1F", asus_rog_2023_spkr_id2 }, // ASUS H7604JV - spi
+ {}
+ };
+
+--
+2.41.0
+