2023-12-18 15:26:27

by Stefan Binding

[permalink] [raw]
Subject: [PATCH v1 0/7] Add support for various laptops using CS35L41 HDA without _DSD

The CS35L41 HDA driver requires various system defined properties to configure
the driver for an individual system. For some laptops, these properties are
missing in the BIOS. To be able to support these laptops, there is a mechanism
in the driver to get this configuration from a lookup table, to be able to add
or patch _DSD as necessary.

However this mechanism currently only allows for laptops to be patched one at
a time, however, in the case where there are many laptops which need to be
configured generically, a generic function has been added, with an additional
lookup table to the individual laptops, indexed by SSID.

To support laptops using SPI without _DSD, an additional workaround is needed
to be able to support the SPI Chip Select GPIOs whose resources are defined
inside the _CRS for the Speaker ACPI Node. This workaround only works for
SPI laptops which contain up to 2 amps, since the SPI controller would not
allow more than 2 amps to be instantiated without the cs-gpios entry in
_DSD.

These patches add support for various ASUS laptops without _DSD, but the
framework added here allows for support for more laptops in the future
for other manufacturers. Support for laptops without _DSD from other
manufacturers is coming in the future.

Note: for systems which use modified _DSD to emulate the missing _DSD,
these patches are incompatible, and the modified _DSD must be removed in
order for the support through this framework to work for those laptops.

Stefan Binding (7):
ALSA: hda: cs35l41: Add config table to support many laptops without
_DSD
ALSA: hda: cs35l41: Support additional ASUS ROG 2023 models
ALSA: hda/realtek: Add quirks for ASUS ROG 2023 models
ALSA: hda: cs35l41: Support additional ASUS Zenbook 2022 Models
ALSA: hda/realtek: Add quirks for ASUS Zenbook 2022 Models
ALSA: hda: cs35l41: Support additional ASUS Zenbook 2023 Models
ALSA: hda/realtek: Add quirks for ASUS Zenbook 2023 Models

sound/pci/hda/cs35l41_hda.c | 2 +
sound/pci/hda/cs35l41_hda.h | 5 +-
sound/pci/hda/cs35l41_hda_property.c | 362 ++++++++++++++++++++++++---
sound/pci/hda/patch_realtek.c | 39 ++-
4 files changed, 353 insertions(+), 55 deletions(-)

--
2.34.1



2023-12-18 15:27:02

by Stefan Binding

[permalink] [raw]
Subject: [PATCH v1 5/7] ALSA: hda/realtek: Add quirks for ASUS Zenbook 2022 Models

These models use 2xCS35L41amps with HDA using SPI and I2C.
Models use internal and external boost.
All models require DSD support to be added inside
cs35l41_hda_property.c

Signed-off-by: Stefan Binding <[email protected]>
---
sound/pci/hda/patch_realtek.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 9c3de6a80e73..66652320822f 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -10000,17 +10000,20 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x1043, 0x1d1f, "ASUS G713PI/PU/PV/PVN", ALC287_FIXUP_CS35L41_I2C_2),
SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
+ SND_PCI_QUIRK(0x1043, 0x1da2, "ASUS UP6502ZA/ZD", ALC245_FIXUP_CS35L41_SPI_2),
SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402ZA", ALC245_FIXUP_CS35L41_SPI_2),
SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS UX3402VA", ALC245_FIXUP_CS35L41_SPI_2),
SND_PCI_QUIRK(0x1043, 0x1f62, "ASUS UX7602ZM", ALC245_FIXUP_CS35L41_SPI_2),
SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
- SND_PCI_QUIRK(0x1043, 0x1e12, "ASUS UM3402", ALC287_FIXUP_CS35L41_I2C_2),
+ SND_PCI_QUIRK(0x1043, 0x1e12, "ASUS UM6702RA/RC", ALC287_FIXUP_CS35L41_I2C_2),
SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
+ SND_PCI_QUIRK(0x1043, 0x1ee2, "ASUS UM3402", ALC287_FIXUP_CS35L41_I2C_2),
SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
SND_PCI_QUIRK(0x1043, 0x1f12, "ASUS UM5302", ALC287_FIXUP_CS35L41_I2C_2),
+ SND_PCI_QUIRK(0x1043, 0x1f62, "ASUS UX7602ZM", ALC245_FIXUP_CS35L41_SPI_2),
SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401),
SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
SND_PCI_QUIRK(0x1043, 0x3a20, "ASUS G614JZR", ALC245_FIXUP_CS35L41_SPI_2),
--
2.34.1


2023-12-18 15:29:08

by Stefan Binding

[permalink] [raw]
Subject: [PATCH v1 6/7] ALSA: hda: cs35l41: Support additional ASUS Zenbook 2023 Models

Add new model entries into configuration table.

Signed-off-by: Stefan Binding <[email protected]>
---
sound/pci/hda/cs35l41_hda_property.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/sound/pci/hda/cs35l41_hda_property.c b/sound/pci/hda/cs35l41_hda_property.c
index 07fe72bb128a..c9eb70290973 100644
--- a/sound/pci/hda/cs35l41_hda_property.c
+++ b/sound/pci/hda/cs35l41_hda_property.c
@@ -54,7 +54,11 @@ static const struct cs35l41_config cs35l41_config_table[] = {
{ "10431533", I2C, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
{ "10431573", SPI, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
{ "10431663", SPI, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 1000, 4500, 24 },
+ { "104316D3", SPI, 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 0, 0, 0 },
+ { "104316F3", SPI, 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 0, 0, 0 },
{ "104317F3", I2C, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
+ { "10431863", SPI, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
+ { "104318D3", I2C, 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
{ "10431C9F", SPI, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
{ "10431CAF", SPI, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
{ "10431CCF", SPI, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
@@ -65,6 +69,7 @@ static const struct cs35l41_config cs35l41_config_table[] = {
{ "10431E02", SPI, 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 0, 0, 0 },
{ "10431EE2", I2C, 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, -1, -1, 0, 0, 0 },
{ "10431F12", I2C, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
+ { "10431F1F", SPI, 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 0, 0, 0 },
{ "10431F62", SPI, 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 0, 0, 0 },
{}
};
@@ -352,7 +357,11 @@ static const struct cs35l41_prop_model cs35l41_prop_model_table[] = {
{ "CSC3551", "10431533", generic_dsd_config },
{ "CSC3551", "10431573", generic_dsd_config },
{ "CSC3551", "10431663", generic_dsd_config },
+ { "CSC3551", "104316D3", generic_dsd_config },
+ { "CSC3551", "104316F3", generic_dsd_config },
{ "CSC3551", "104317F3", generic_dsd_config },
+ { "CSC3551", "10431863", generic_dsd_config },
+ { "CSC3551", "104318D3", generic_dsd_config },
{ "CSC3551", "10431C9F", generic_dsd_config },
{ "CSC3551", "10431CAF", generic_dsd_config },
{ "CSC3551", "10431CCF", generic_dsd_config },
@@ -363,6 +372,7 @@ static const struct cs35l41_prop_model cs35l41_prop_model_table[] = {
{ "CSC3551", "10431E02", generic_dsd_config },
{ "CSC3551", "10431EE2", generic_dsd_config },
{ "CSC3551", "10431F12", generic_dsd_config },
+ { "CSC3551", "10431F1F", generic_dsd_config },
{ "CSC3551", "10431F62", generic_dsd_config },
{}
};
--
2.34.1


2023-12-18 15:30:05

by Stefan Binding

[permalink] [raw]
Subject: [PATCH v1 7/7] ALSA: hda/realtek: Add quirks for ASUS Zenbook 2023 Models

These models use 2xCS35L41amps with HDA using SPI and I2C.
Models use internal and external boost.
All models require DSD support to be added inside
cs35l41_hda_property.c

Signed-off-by: Stefan Binding <[email protected]>
---
sound/pci/hda/patch_realtek.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 66652320822f..c3a756528886 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -9963,10 +9963,13 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x1043, 0x1663, "ASUS GU603ZI/ZJ/ZQ/ZU/ZV", ALC285_FIXUP_ASUS_HEADSET_MIC),
SND_PCI_QUIRK(0x1043, 0x1683, "ASUS UM3402YAR", ALC287_FIXUP_CS35L41_I2C_2),
SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
+ SND_PCI_QUIRK(0x1043, 0x16d3, "ASUS UX5304VA", ALC245_FIXUP_CS35L41_SPI_2),
SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
+ SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS UX7602VI/BZ", ALC245_FIXUP_CS35L41_SPI_2),
SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
SND_PCI_QUIRK(0x1043, 0x17f3, "ROG Ally NR2301L/X", ALC294_FIXUP_ASUS_ALLY),
+ SND_PCI_QUIRK(0x1043, 0x1863, "ASUS UX6404VI/VV", ALC245_FIXUP_CS35L41_SPI_2),
SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC294_FIXUP_CS35L41_I2C_2),
@@ -10013,6 +10016,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
SND_PCI_QUIRK(0x1043, 0x1f12, "ASUS UM5302", ALC287_FIXUP_CS35L41_I2C_2),
+ SND_PCI_QUIRK(0x1043, 0x1f1f, "ASUS H7604JI/JV/J3D", ALC245_FIXUP_CS35L41_SPI_2),
SND_PCI_QUIRK(0x1043, 0x1f62, "ASUS UX7602ZM", ALC245_FIXUP_CS35L41_SPI_2),
SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401),
SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
--
2.34.1


2023-12-18 17:55:07

by Takashi Iwai

[permalink] [raw]
Subject: Re: [PATCH v1 0/7] Add support for various laptops using CS35L41 HDA without _DSD

On Mon, 18 Dec 2023 16:12:14 +0100,
Stefan Binding wrote:
>
> The CS35L41 HDA driver requires various system defined properties to configure
> the driver for an individual system. For some laptops, these properties are
> missing in the BIOS. To be able to support these laptops, there is a mechanism
> in the driver to get this configuration from a lookup table, to be able to add
> or patch _DSD as necessary.
>
> However this mechanism currently only allows for laptops to be patched one at
> a time, however, in the case where there are many laptops which need to be
> configured generically, a generic function has been added, with an additional
> lookup table to the individual laptops, indexed by SSID.
>
> To support laptops using SPI without _DSD, an additional workaround is needed
> to be able to support the SPI Chip Select GPIOs whose resources are defined
> inside the _CRS for the Speaker ACPI Node. This workaround only works for
> SPI laptops which contain up to 2 amps, since the SPI controller would not
> allow more than 2 amps to be instantiated without the cs-gpios entry in
> _DSD.
>
> These patches add support for various ASUS laptops without _DSD, but the
> framework added here allows for support for more laptops in the future
> for other manufacturers. Support for laptops without _DSD from other
> manufacturers is coming in the future.
>
> Note: for systems which use modified _DSD to emulate the missing _DSD,
> these patches are incompatible, and the modified _DSD must be removed in
> order for the support through this framework to work for those laptops.
>
> Stefan Binding (7):
> ALSA: hda: cs35l41: Add config table to support many laptops without
> _DSD
> ALSA: hda: cs35l41: Support additional ASUS ROG 2023 models
> ALSA: hda/realtek: Add quirks for ASUS ROG 2023 models
> ALSA: hda: cs35l41: Support additional ASUS Zenbook 2022 Models
> ALSA: hda/realtek: Add quirks for ASUS Zenbook 2022 Models
> ALSA: hda: cs35l41: Support additional ASUS Zenbook 2023 Models
> ALSA: hda/realtek: Add quirks for ASUS Zenbook 2023 Models

Applied all seven patches now. Thanks.


Takashi

2024-04-19 10:20:20

by Niclas Söderlund

[permalink] [raw]
Subject: Re: [PATCH v1 0/7] Add support for various laptops using CS35L41 HDA without _DSD


Hi,

amazingly high level of laymanship here and equally high level of dispear. But model after model is added to fix the problem with speakers not working, but nowhere is my model seen. I have the Lenovo 13X G2 model and even at kernel 6.8.7 my speakers still doesnt work.

Where can I add a request to also include this model in the patches, so I have a hope of having the speakers start working?

I do apologise in advance but it would be a huge loss if this laptop is not appended as being one of the models being fixed.

Mvh, Niclas S?derlund