Support Dell models without _DSD
v2 cover Support Dell models without _DSD
Add Quirks and driver properties for Dell models.
Driver properties are required since these models do not have _DSD. Additionally, some laptops, including some of these, have an issue with their BIOS which causes the SPI speed to be set too slow. To ensure a decent performance for laptops with this slow speed, disable firmware loading. Running without firmware results in lower volume.
Changes since v1:
- Rebased onto for-linus
Stefan Binding (3):
ALSA: hda: cs35l41: Support additional Dell models without _DSD
ALSA: hda: cs35l41: Prevent firmware load if SPI speed too low
ALSA: hda/realtek: Add quirks for Dell models
sound/pci/hda/cs35l41_hda.c | 25 ++++++++-- sound/pci/hda/cs35l41_hda.h | 12 ++++- sound/pci/hda/cs35l41_hda_i2c.c | 2 +- sound/pci/hda/cs35l41_hda_property.c | 74 +++++++++++++++------------- sound/pci/hda/cs35l41_hda_spi.c | 2 +- sound/pci/hda/patch_realtek.c | 13 +++++ 6 files changed, 87 insertions(+), 41 deletions(-)
Signature · 1 line
2.34.1
PATCH v2 1/3 ALSA: hda: cs35l41: Support additional Dell models without _DSD
Add new model entries into configuration table.
--- sound/pci/hda/cs35l41_hda_property.c | 8 ++++++++ 1 file changed, 8 insertions(+)
sound/pci/hda/cs35l41_hda_property.c +8 -0
@@ -35,6 +35,10 @@ struct cs35l41_config { };static const struct cs35l41_config cs35l41_config_table[] = { + {"10280B27" ,SPI ,2 ,INTERNAL , {CS35L41_LEFT ,CS35L41_RIGHT ,0 ,0 },1 ,2 ,0 ,1000 ,4500 ,24 }, + {"10280B28" ,SPI ,2 ,INTERNAL , {CS35L41_LEFT ,CS35L41_RIGHT ,0 ,0 },1 ,2 ,0 ,1000 ,4500 ,24 }, + {"10280BEB" ,SPI ,2 ,EXTERNAL , {CS35L41_LEFT ,CS35L41_RIGHT ,0 ,0 },1 ,-1 ,0 ,0 ,0 ,0 }, + {"10280C4D" ,I2C ,4 ,INTERNAL , {CS35L41_LEFT ,CS35L41_RIGHT ,CS35L41_LEFT ,CS35L41_RIGHT },0 ,1 ,-1 ,1000 ,4500 ,24 },/* * Device 103C89C6 does have _DSD, however it is setup to use the wrong boost type. * We can override the _DSD to correct the boost type here.
@@ -347,6 +351,10 @@ struct cs35l41_prop_model {static const struct cs35l41_prop_model cs35l41_prop_model_table[] = { {"CLSA0100" ,NULL , lenovo_legion_no_acpi }, {"CLSA0101" ,NULL , lenovo_legion_no_acpi }, + {"CSC3551" ,"10280B27" , generic_dsd_config }, + {"CSC3551" ,"10280B28" , generic_dsd_config }, + {"CSC3551" ,"10280BEB" , generic_dsd_config }, + {"CSC3551" ,"10280C4D" , generic_dsd_config }, {"CSC3551" ,"103C89C6" , generic_dsd_config }, {"CSC3551" ,"104312AF" , generic_dsd_config }, {"CSC3551" ,"10431433" , generic_dsd_config },
Signature · 1 line
2.34.1
PATCH v2 2/3 ALSA: hda: cs35l41: Prevent firmware load if SPI speed too low
In reply to Stefan BindingSome laptops without _DSD have the SPI speed set very low in the BIOS. Since the SPI controller uses this speed as its max speed, the SPI transactions are very slow. Firmware download writes to many registers, and if the SPI speed is too slow, it can take a long time to download. For this reason, disable firmware loading if the maximum SPI speed is too low. Without Firmware, audio playback will work, but the volume will be low to ensure safe operation of the CS35L41.
--- sound/pci/hda/cs35l41_hda.c | 25 ++++++++-- sound/pci/hda/cs35l41_hda.h | 12 ++++- sound/pci/hda/cs35l41_hda_i2c.c | 2 +- sound/pci/hda/cs35l41_hda_property.c | 74 +++++++++++++--------------- sound/pci/hda/cs35l41_hda_spi.c | 2 +- 5 files changed, 70 insertions(+), 45 deletions(-)
sound/pci/hda/cs35l41_hda.c +22 -3
@@ -12,6 +12,7 @@#include <sound/hda_codec.h> #include <sound/soc.h> #include <linux/pm_runtime.h> +#include <linux/spi/spi.h> #include "hda_local.h" #include "hda_auto_parser.h" #include "hda_jack.h"
@@ -996,6 +997,11 @@ static int cs35l41_smart_amp(struct cs35l41_hda *cs35l41)__be32 halo_sts;int ret; +if (cs35l41->bypass_fw) { +dev_warn (cs35l41->dev,"Bypassing Firmware.\n" ); +return 0 ; + } + ret =cs35l41_init_dsp (cs35l41);if (ret) {dev_warn (cs35l41->dev,"Cannot Initialize Firmware. Error: %d\n" , ret);
@@ -1588,6 +1594,7 @@ static int cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41, const char *hid, iu32 values[HDA_MAX_COMPONENTS ];struct acpi_device *adev;struct device *physdev; +struct spi_device *spi;const char *sub;char *property;size_t nval;
@@ -1610,7 +1617,7 @@ static int cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41, const char *hid, i 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; + goto out; } property ="cirrus,dev-index" ;
@@ -1701,8 +1708,20 @@ static int cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41, const char *hid, i hw_cfg->bst_type =CS35L41_EXT_BOOST ; hw_cfg->valid = true; +out:put_device (physdev); + cs35l41->bypass_fw = false; +if (cs35l41->control_bus ==SPI ) { + spi =to_spi_device (cs35l41->dev); +if (spi->max_speed_hz <CS35L41_MAX_ACCEPTABLE_SPI_SPEED_HZ ) { +dev_warn (cs35l41->dev, +"SPI speed is too slow to support firmware download: %d Hz.\n" , + spi->max_speed_hz); + cs35l41->bypass_fw = true; + } + } +return 0 ; err:
@@ -1711,14 +1730,13 @@ static int cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41, const char *hid, i hw_cfg->gpio1.valid = false; hw_cfg->gpio2.valid = false;acpi_dev_put (cs35l41->dacpi); -put_physdev:put_device (physdev);return ret; }int cs35l41_hda_probe (struct device *dev,const char *device_name,int id,int irq, -struct regmap *regmap) +struct regmap *regmap,enum control_bus control_bus) {unsigned int regid, reg_revid;struct cs35l41_hda *cs35l41;
@@ -1737,6 +1755,7 @@ int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int i cs35l41->dev = dev; cs35l41->irq = irq; cs35l41->regmap = regmap; + cs35l41->control_bus = control_bus;dev_set_drvdata (dev, cs35l41); ret =cs35l41_hda_read_acpi (cs35l41, device_name, id);
sound/pci/hda/cs35l41_hda.h +11 -1
@@ -20,6 +20,8 @@#include <linux/firmware/cirrus/cs_dsp.h> #include <linux/firmware/cirrus/wmfw.h> +#define CS35L41_MAX_ACCEPTABLE_SPI_SPEED_HZ 1000000 +struct cs35l41_amp_cal_data {u32 calTarget[2 ];u32 calTime[2 ];
@@ -46,6 +48,11 @@ enum cs35l41_hda_gpio_function { CS35l41_SYNC, }; +enum control_bus { +I2C , +SPI +}; +struct cs35l41_hda {struct device *dev;struct regmap *regmap;
@@ -74,6 +81,9 @@ struct cs35l41_hda {struct cs_dsp cs_dsp;struct acpi_device *dacpi;bool mute_override; +enum control_bus control_bus; +bool bypass_fw; + };enum halo_state {
@@ -85,7 +95,7 @@ enum halo_state {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); +struct regmap *regmap,enum control_bus control_bus);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);
sound/pci/hda/cs35l41_hda_i2c.c +1 -1
@@ -30,7 +30,7 @@ static int cs35l41_hda_i2c_probe(struct i2c_client *clt)return -ENODEV ;return cs35l41_hda_probe (&clt->dev, device_name, clt->addr, clt->irq, -devm_regmap_init_i2c (clt, &cs35l41_regmap_i2c)); +devm_regmap_init_i2c (clt, &cs35l41_regmap_i2c),I2C ); }static void cs35l41_hda_i2c_remove (struct i2c_client *clt)
sound/pci/hda/cs35l41_hda_property.c +35 -39
98 lines not on this page · raw message
sound/pci/hda/cs35l41_hda_spi.c +1 -1
@@ -26,7 +26,7 @@ static int cs35l41_hda_spi_probe(struct spi_device *spi)return -ENODEV ;return cs35l41_hda_probe (&spi->dev, device_name,spi_get_chipselect (spi,0 ), spi->irq, -devm_regmap_init_spi (spi, &cs35l41_regmap_spi)); +devm_regmap_init_spi (spi, &cs35l41_regmap_spi),SPI ); }static void cs35l41_hda_spi_remove (struct spi_device *spi)
Signature · 1 line
2.34.1
PATCH v2 3/3 ALSA: hda/realtek: Add quirks for Dell models
In reply to Stefan BindingThese models use 2 or 4 CS35L41 amps 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
--- sound/pci/hda/patch_realtek.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
sound/pci/hda/patch_realtek.c +13 -0
@@ -6956,6 +6956,11 @@ static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixupcs35l41_generic_fixup (cdc, action,"i2c" ,"CSC3551" ,2 ); } +static void cs35l41_fixup_i2c_four (struct hda_codec *cdc,const struct hda_fixup *fix,int action) +{ +cs35l41_generic_fixup (cdc, action,"i2c" ,"CSC3551" ,4 ); +} +static void cs35l41_fixup_spi_two (struct hda_codec *codec,const struct hda_fixup *fix,int action) {cs35l41_generic_fixup (codec, action,"spi" ,"CSC3551" ,2 );
@@ -7441,6 +7446,7 @@ enum {ALC287_FIXUP_LEGION_16ACHG6 ,ALC287_FIXUP_CS35L41_I2C_2 ,ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED , +ALC287_FIXUP_CS35L41_I2C_4 ,ALC245_FIXUP_CS35L41_SPI_2 ,ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED , ALC245_FIXUP_CS35L41_SPI_4,
@@ -9427,6 +9433,10 @@ static const struct hda_fixup alc269_fixups[] = { .chained = true, .chain_id = ALC285_FIXUP_HP_MUTE_LED, }, + [ALC287_FIXUP_CS35L41_I2C_4] = { + .type = HDA_FIXUP_FUNC, + .v.func = cs35l41_fixup_i2c_four, + }, [ALC245_FIXUP_CS35L41_SPI_2] = { .type = HDA_FIXUP_FUNC, .v.func = cs35l41_fixup_spi_two,
@@ -9703,6 +9713,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1028 ,0x0a9e ,"Dell Latitude 5430" ,ALC269_FIXUP_DELL4_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x0b19 ,"Dell XPS 15 9520" ,ALC289_FIXUP_DUAL_SPK ),SND_PCI_QUIRK (0x1028 ,0x0b1a ,"Dell Precision 5570" ,ALC289_FIXUP_DUAL_SPK ), +SND_PCI_QUIRK (0x1028 ,0x0b27 ,"Dell" ,ALC245_FIXUP_CS35L41_SPI_2 ), +SND_PCI_QUIRK (0x1028 ,0x0b28 ,"Dell" ,ALC245_FIXUP_CS35L41_SPI_2 ),SND_PCI_QUIRK (0x1028 ,0x0b37 ,"Dell Inspiron 16 Plus 7620 2-in-1" ,ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS ),SND_PCI_QUIRK (0x1028 ,0x0b71 ,"Dell Inspiron 16 Plus 7620" ,ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS ), SND_PCI_QUIRK(0x1028, 0x0beb, "Dell XPS 15 9530 (2023)", ALC289_FIXUP_DELL_CS35L41_SPI_2),
@@ -9713,6 +9725,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1028 ,0x0c1c ,"Dell Precision 3540" ,ALC236_FIXUP_DELL_DUAL_CODECS ),SND_PCI_QUIRK (0x1028 ,0x0c1d ,"Dell Precision 3440" ,ALC236_FIXUP_DELL_DUAL_CODECS ),SND_PCI_QUIRK (0x1028 ,0x0c1e ,"Dell Precision 3540" ,ALC236_FIXUP_DELL_DUAL_CODECS ), +SND_PCI_QUIRK (0x1028 ,0x0c4d ,"Dell" ,ALC287_FIXUP_CS35L41_I2C_4 ),SND_PCI_QUIRK (0x1028 ,0x0cbd ,"Dell Oasis 13 CS MTL-U" ,ALC289_FIXUP_DELL_CS35L41_SPI_2 ),SND_PCI_QUIRK (0x1028 ,0x0cbe ,"Dell Oasis 13 2-IN-1 MTL-U" ,ALC289_FIXUP_DELL_CS35L41_SPI_2 ), SND_PCI_QUIRK(0x1028, 0x0cbf, "Dell Oasis 13 Low Weight MTU-L", ALC289_FIXUP_DELL_CS35L41_SPI_2),
Signature · 1 line
2.34.1
Takashi Iwai
AppliedQuoted 9 lines · Stefan Binding
Add Quirks and driver properties for Dell models.
Driver properties are required since these models do not have_DSD. Additionally, some laptops, including some of these, have an issue with their BIOS which causes the SPI speed to be set too slow. To ensure a decent performance for laptops with this slow speed, disable firmware loading. Running without firmware results in lower volume.
Quoted 7 lines
Changes since v1:
- Rebased onto for-linusStefan Binding (3):
ALSA: hda: cs35l41: Support additional Dell models without_DSD
ALSA: hda: cs35l41: Prevent firmware load if SPI speed too low
ALSA: hda/realtek: Add quirks for Dell models
Applied to topic/cs35l41 branch, which is merged to for-next (for 6.8).
thanks,
Takashi