ALSA: Add support for Cirrus Logic CS35L54 and CS35L57
Subsystems (6)
Richard Fitzgerald
maintainercover ALSA: Add support for Cirrus Logic CS35L54 and CS35L57
The CS35L54 and CS35L57 are Boosted Smart Amplifiers. The CS35L54 has I2C/SPI control and I2S/TDM audio. The CS35L57 also has SoundWire control and audio.
The hardware differences between L54, L56 and L57 do not affect the driver control interface so they can all be handled by the same driver.
The HDA patch has build dependencies on the ASoC patch.
The final patch updates serial-multi-instantiate and scan.c to trap the ACPI HID for HDA systems that declare multiple amps all under one Device() node. This patch does not have any build dependency on the first two patches so can be taken separately.
Simon Trimmer (3):
ASoC: cs35l56: Add support for CS35L54 and CS35L57
ALSA: hda: cs35l56: Add support for CS35L54 and CS35L57 platform/x86: serial-multi-instantiate: Add support for CS35L54 and
CS35L57
drivers/acpi/scan.c | 2 ++ .../platform/x86/serial-multi-instantiate.c | 28 +++++++++++++++++++ include/sound/cs35l56.h | 1 + sound/pci/hda/cs35l56_hda.c | 16 +++++++---- sound/pci/hda/cs35l56_hda.h | 2 +- sound/pci/hda/cs35l56_hda_i2c.c | 7 +++-- sound/pci/hda/cs35l56_hda_spi.c | 7 +++-- sound/soc/codecs/cs35l56-sdw.c | 3 +- sound/soc/codecs/cs35l56-shared.c | 8 ++++-- sound/soc/codecs/cs35l56.c | 14 +++++++++- 10 files changed, 73 insertions(+), 15 deletions(-)
Signature · 1 line
2.30.2
Richard Fitzgerald
maintainerPATCH 1/3 ASoC: cs35l56: Add support for CS35L54 and CS35L57
From: Simon Trimmer <[email protected]>
The CS35L54 and CS35L57 are Boosted Smart Amplifiers. The CS35L54 has I2C/SPI control and I2S/TDM audio. The CS35L57 also has SoundWire control and audio.
The hardware differences between L54, L56 and L57 do not affect the driver control interface so they can all be handled by the same driver.
--- include/sound/cs35l56.h | 1 + sound/soc/codecs/cs35l56-sdw.c | 3 ++- sound/soc/codecs/cs35l56-shared.c | 8 ++++++-- sound/soc/codecs/cs35l56.c | 14 +++++++++++++- 4 files changed, 22 insertions(+), 4 deletions(-)
include/sound/cs35l56.h +1 -0
@@ -261,6 +261,7 @@ struct cs35l56_base {struct regmap *regmap;int irq;struct mutex irq_lock; +u8 type;u8 rev;bool init_done;bool fw_patched;
sound/soc/codecs/cs35l56-sdw.c +2 -1
@@ -386,7 +386,7 @@ static int cs35l56_sdw_bus_config(struct sdw_slave *peripheral,dev_dbg (cs35l56->base.dev,"%s: sclk=%u c=%u r=%u\n" , __func__, sclk, params->col, params->row); -if (cs35l56->base.rev <0xb0 ) +if ((cs35l56->base.type ==0x56 ) && (cs35l56->base.rev <0xb0 ))return cs35l56_a1_kick_divider (cs35l56, peripheral);return 0 ;
@@ -563,6 +563,7 @@ static const struct dev_pm_ops cs35l56_sdw_pm = {static const struct sdw_device_id cs35l56_sdw_id[] = {SDW_SLAVE_ENTRY (0x01FA ,0x3556 ,0 ), +SDW_SLAVE_ENTRY (0x01FA ,0x3557 ,0 ), {}, };MODULE_DEVICE_TABLE (sdw, cs35l56_sdw_id);
sound/soc/codecs/cs35l56-shared.c +6 -2
@@ -776,13 +776,17 @@ int cs35l56_hw_init(struct cs35l56_base *cs35l56_base) devid &=CS35L56_DEVID_MASK ;switch (devid) { +case 0x35A54 :case 0x35A56 : +case 0x35A57 :break ;default :dev_err (cs35l56_base->dev,"Unknown device %x\n" , devid);return ret; } + cs35l56_base->type = devid &0xFF ; + ret =regmap_read (cs35l56_base->regmap,CS35L56_DSP_RESTRICT_STS1 , &secured);if (ret) {dev_err (cs35l56_base->dev,"Get Secure status failed\n" );
@@ -803,8 +807,8 @@ int cs35l56_hw_init(struct cs35l56_base *cs35l56_base)if (ret)return ret; -dev_info (cs35l56_base->dev,"Cirrus Logic CS35L56%s Rev %02X OTP%d fw:%d.%d.%d (patched=%u)\n" , - cs35l56_base->secured ?"s" :"" , cs35l56_base->rev, otpid, +dev_info (cs35l56_base->dev,"Cirrus Logic CS35L%02X%s Rev %02X OTP%d fw:%d.%d.%d (patched=%u)\n" , + cs35l56_base->type, cs35l56_base->secured ?"s" :"" , cs35l56_base->rev, otpid, fw_ver >>16 , (fw_ver >>8 ) &0xff , fw_ver &0xff , !fw_missing);/* Wake source and *_BLOCKED interrupts default to unmasked, so mask them */
sound/soc/codecs/cs35l56.c +13 -1
@@ -1004,6 +1004,10 @@ static int cs35l56_component_probe(struct snd_soc_component *component)return -ENODEV ; } + cs35l56->dsp.part =kasprintf (GFP_KERNEL ,"cs35l%02x" , cs35l56->base.type); +if (!cs35l56->dsp.part) +return -ENOMEM ; + cs35l56->component = component;wm_adsp2_component_probe (&cs35l56->dsp, component);
@@ -1034,6 +1038,9 @@ static void cs35l56_component_remove(struct snd_soc_component *component)wm_adsp2_component_remove (&cs35l56->dsp, component); +kfree (cs35l56->dsp.part); + cs35l56->dsp.part =NULL ; +kfree (cs35l56->dsp.fwf_name); cs35l56->dsp.fwf_name =NULL ;
@@ -1253,7 +1260,12 @@ static int cs35l56_dsp_init(struct cs35l56_private *cs35l56) dsp = &cs35l56->dsp;cs35l56_init_cs_dsp (&cs35l56->base, &dsp->cs_dsp); - dsp->part ="cs35l56" ; + +/* +* dsp->part is filled in later as it is based on the DEVID. In a +* SoundWire system that cannot be read until enumeration has occurred +* and the device has attached. +*/ dsp->fw =12 ; dsp->wmfw_optional = true;
Signature · 1 line
2.30.2
Re: [PATCH 1/3] ASoC: cs35l56: Add support for CS35L54 and CS35L57
Quoted 5 lines · Richard Fitzgerald
From: Simon Trimmer <[email protected]>
The CS35L54 and CS35L57 are Boosted Smart Amplifiers. The CS35L54 has I2C/SPI control and I2S/TDM audio. The CS35L57 also has SoundWire control and audio.
Richard Fitzgerald
maintainerPATCH 2/3 ALSA: hda: cs35l56: Add support for CS35L54 and CS35L57
In reply to Richard FitzgeraldFrom: Simon Trimmer <[email protected]>
Add the HID for the CS35L54 and CS35L57 Boosted Smart Amplifiers. These have the same control interface as the CS35L56 so are handled by the cs35l56-hda driver.
--- sound/pci/hda/cs35l56_hda.c | 16 ++++++++++------ sound/pci/hda/cs35l56_hda.h | 2 +- sound/pci/hda/cs35l56_hda_i2c.c | 7 +++++-- sound/pci/hda/cs35l56_hda_spi.c | 7 +++++-- 4 files changed, 21 insertions(+), 11 deletions(-)
sound/pci/hda/cs35l56_hda.c +10 -6
@@ -459,13 +459,15 @@ static void cs35l56_hda_request_firmware_files(struct cs35l56_hda *cs35l56,if (preloaded_fw_ver) {snprintf (base_name,sizeof (base_name), -"cirrus/cs35l56-%02x%s-%06x-dsp1-misc" , +"cirrus/cs35l%02x-%02x%s-%06x-dsp1-misc" , + cs35l56->base.type, cs35l56->base.rev, cs35l56->base.secured ?"-s" :"" , preloaded_fw_ver &0xffffff ); }else {snprintf (base_name,sizeof (base_name), -"cirrus/cs35l56-%02x%s-dsp1-misc" , +"cirrus/cs35l%02x-%02x%s-dsp1-misc" , + cs35l56->base.type, cs35l56->base.rev, cs35l56->base.secured ?"-s" :"" ); }
@@ -852,9 +854,10 @@ static int cs35l56_hda_system_resume(struct device *dev)return 0 ; } -static int cs35l56_hda_read_acpi (struct cs35l56_hda *cs35l56,int id) +static int cs35l56_hda_read_acpi (struct cs35l56_hda *cs35l56,int hid,int id) {u32 values[HDA_MAX_COMPONENTS ]; +char hid_string[8 ];struct acpi_device *adev;const char *property, *sub;size_t nval;
@@ -865,7 +868,8 @@ static int cs35l56_hda_read_acpi(struct cs35l56_hda *cs35l56, int id)* the serial-multi-instantiate driver, so lookup the node by HID */ if (!ACPI_COMPANION (cs35l56->base.dev)) { - adev =acpi_dev_get_first_match_dev ("CSC3556" ,NULL ,-1 ); +snprintf (hid_string,sizeof (hid_string),"CSC%04X" , hid); + adev =acpi_dev_get_first_match_dev (hid_string,NULL ,-1 );if (!adev) {dev_err (cs35l56->base.dev,"Failed to find an ACPI device for %s\n" ,dev_name (cs35l56->base.dev));
@@ -953,14 +957,14 @@ static int cs35l56_hda_read_acpi(struct cs35l56_hda *cs35l56, int id)return ret; } -int cs35l56_hda_common_probe (struct cs35l56_hda *cs35l56,int id) +int cs35l56_hda_common_probe (struct cs35l56_hda *cs35l56,int hid,int id) {int ret;mutex_init (&cs35l56->base.irq_lock);dev_set_drvdata (cs35l56->base.dev, cs35l56); - ret =cs35l56_hda_read_acpi (cs35l56, id); + ret =cs35l56_hda_read_acpi (cs35l56, hid, id);if (ret) goto err;
sound/pci/hda/cs35l56_hda.h +1 -1
@@ -42,7 +42,7 @@ struct cs35l56_hda {extern const struct dev_pm_ops cs35l56_hda_pm_ops; -int cs35l56_hda_common_probe (struct cs35l56_hda *cs35l56,int id); +int cs35l56_hda_common_probe (struct cs35l56_hda *cs35l56,int hid,int id);void cs35l56_hda_remove (struct device *dev);#endif /*__CS35L56_HDA_H__*/
sound/pci/hda/cs35l56_hda_i2c.c +5 -2
@@ -13,6 +13,7 @@static int cs35l56_hda_i2c_probe (struct i2c_client *clt) { +const struct i2c_device_id *id =i2c_client_get_device_id (clt);struct cs35l56_hda *cs35l56;int ret;
@@ -33,7 +34,7 @@ static int cs35l56_hda_i2c_probe(struct i2c_client *clt)return ret; } - ret =cs35l56_hda_common_probe (cs35l56, clt->addr); + ret =cs35l56_hda_common_probe (cs35l56, id->driver_data, clt->addr);if (ret)return ret; ret =cs35l56_irq_request (&cs35l56->base, clt->irq);
@@ -49,7 +50,9 @@ static void cs35l56_hda_i2c_remove(struct i2c_client *clt) }static const struct i2c_device_id cs35l56_hda_i2c_id[] = { - {"cs35l56-hda" ,0 }, + {"cs35l54-hda" ,0x3554 }, + {"cs35l56-hda" ,0x3556 }, + {"cs35l57-hda" ,0x3557 }, {} };
sound/pci/hda/cs35l56_hda_spi.c +5 -2
@@ -13,6 +13,7 @@static int cs35l56_hda_spi_probe (struct spi_device *spi) { +const struct spi_device_id *id =spi_get_device_id (spi);struct cs35l56_hda *cs35l56;int ret;
@@ -33,7 +34,7 @@ static int cs35l56_hda_spi_probe(struct spi_device *spi)return ret; } - ret =cs35l56_hda_common_probe (cs35l56,spi_get_chipselect (spi,0 )); + ret =cs35l56_hda_common_probe (cs35l56, id->driver_data,spi_get_chipselect (spi,0 ));if (ret)return ret; ret =cs35l56_irq_request (&cs35l56->base, spi->irq);
@@ -49,7 +50,9 @@ static void cs35l56_hda_spi_remove(struct spi_device *spi) }static const struct spi_device_id cs35l56_hda_spi_id[] = { - {"cs35l56-hda" ,0 }, + {"cs35l54-hda" ,0x3554 }, + {"cs35l56-hda" ,0x3556 }, + {"cs35l57-hda" ,0x3557 }, {} };
Signature · 1 line
2.30.2
Richard Fitzgerald
maintainerPATCH 3/3 platform/x86: serial-multi-instantiate: Add support for CS35L54 and CS35L57
In reply to Richard FitzgeraldFrom: Simon Trimmer <[email protected]>
Add the ACPI HIDs and smi_node descriptions for the CS35L54 and CS35L57 Boosted Smart Amplifiers.
---
This patch doesn't have any build dependencies on the ASOC/HDA code so can be take separately.
--- drivers/acpi/scan.c | 2 ++ .../platform/x86/serial-multi-instantiate.c | 28 +++++++++++++++++++ 2 files changed, 30 insertions(+)
drivers/acpi/scan.c +2 -0
@@ -1725,7 +1725,9 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device) {"BSG1160", }, {"BSG2150", }, {"CSC3551", }, + {"CSC3554", }, {"CSC3556", }, + {"CSC3557", }, {"INT33FE", }, {"INT3515", },/* Non-conforming _HID for Cirrus Logic already released */
drivers/platform/x86/serial-multi-instantiate.c +28 -0
@@ -329,6 +329,19 @@ static const struct smi_node cs35l41_hda = { .bus_type = SMI_AUTO_DETECT, }; +static const struct smi_node cs35l54_hda = { + .instances = { + {"cs35l54-hda" ,IRQ_RESOURCE_AUTO ,0 }, + {"cs35l54-hda" ,IRQ_RESOURCE_AUTO ,0 }, + {"cs35l54-hda" ,IRQ_RESOURCE_AUTO ,0 }, + {"cs35l54-hda" ,IRQ_RESOURCE_AUTO ,0 }, +/* a 5th entry is an alias address, not a real device */ + {"cs35l54-hda_dummy_dev" }, + {} + }, + .bus_type =SMI_AUTO_DETECT , +}; +static const struct smi_node cs35l56_hda = { .instances = { {"cs35l56-hda" ,IRQ_RESOURCE_AUTO ,0 },
@@ -342,6 +355,19 @@ static const struct smi_node cs35l56_hda = { .bus_type = SMI_AUTO_DETECT, }; +static const struct smi_node cs35l57_hda = { + .instances = { + {"cs35l57-hda" ,IRQ_RESOURCE_AUTO ,0 }, + {"cs35l57-hda" ,IRQ_RESOURCE_AUTO ,0 }, + {"cs35l57-hda" ,IRQ_RESOURCE_AUTO ,0 }, + {"cs35l57-hda" ,IRQ_RESOURCE_AUTO ,0 }, +/* a 5th entry is an alias address, not a real device */ + {"cs35l57-hda_dummy_dev" }, + {} + }, + .bus_type =SMI_AUTO_DETECT , +}; +/* * Note new device-ids must also be added to ignore_serial_bus_ids in * drivers/acpi/scan.c: acpi_device_enumeration_by_parent().
@@ -350,7 +376,9 @@ static const struct acpi_device_id smi_acpi_ids[] = { { "BSG1160", (unsigned long)&bsg1160_data }, { "BSG2150", (unsigned long)&bsg2150_data }, { "CSC3551", (unsigned long)&cs35l41_hda }, + { "CSC3554", (unsigned long)&cs35l54_hda }, { "CSC3556", (unsigned long)&cs35l56_hda }, + { "CSC3557", (unsigned long)&cs35l57_hda }, { "INT3515", (unsigned long)&int3515_data },/* Non-conforming _HID for Cirrus Logic already released */ { "CLSA0100", (unsigned long)&cs35l41_hda },
Signature · 1 line
2.30.2
Re: [PATCH 3/3] platform/x86: serial-multi-instantiate: Add support for CS35L54 and CS35L57
Quoted 10 lines · Richard Fitzgerald
From: Simon Trimmer <[email protected]>
Add the ACPI HIDs and
smi_nodedescriptions for the CS35L54 and CS35L57 Boosted Smart Amplifiers.Signed-off-by Simon Trimmer <[email protected]>Signed-off-by Richard Fitzgerald <[email protected]>---
This patch doesn't have any build dependencies on the ASOC/HDA code so can be take separately.
Signature · 1 line
i.
Quoted 74 lines
--- drivers/acpi/scan.c | 2 ++ .../platform/x86/serial-multi-instantiate.c | 28 +++++++++++++++++++ 2 files changed, 30 insertions(+)drivers/acpi/scan.c +2
-0@@ -1725,7 +1725,9 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device) {"BSG1160", }, {"BSG2150", }, {"CSC3551", }, + {"CSC3554", }, {"CSC3556", }, + {"CSC3557", }, {"INT33FE", }, {"INT3515", },/* Non-conforming _HID for Cirrus Logic already released */ drivers/platform/x86/serial-multi-instantiate.c +28
-0@@ -329,6 +329,19 @@ static const struct smi_node cs35l41_hda = { .bus_type = SMI_AUTO_DETECT, }; +static const struct smi_node cs35l54_hda = { + .instances = { + {"cs35l54-hda" ,IRQ_RESOURCE_AUTO ,0 }, + {"cs35l54-hda" ,IRQ_RESOURCE_AUTO ,0 }, + {"cs35l54-hda" ,IRQ_RESOURCE_AUTO ,0 }, + {"cs35l54-hda" ,IRQ_RESOURCE_AUTO ,0 }, +/* a 5th entry is an alias address, not a real device */ + {"cs35l54-hda_dummy_dev" }, + {} + }, + .bus_type =SMI_AUTO_DETECT , +}; +static const struct smi_node cs35l56_hda = { .instances = { {"cs35l56-hda" ,IRQ_RESOURCE_AUTO ,0 },@@ -342,6 +355,19 @@ static const struct smi_node cs35l56_hda = { .bus_type = SMI_AUTO_DETECT, }; +static const struct smi_node cs35l57_hda = { + .instances = { + {"cs35l57-hda" ,IRQ_RESOURCE_AUTO ,0 }, + {"cs35l57-hda" ,IRQ_RESOURCE_AUTO ,0 }, + {"cs35l57-hda" ,IRQ_RESOURCE_AUTO ,0 }, + {"cs35l57-hda" ,IRQ_RESOURCE_AUTO ,0 }, +/* a 5th entry is an alias address, not a real device */ + {"cs35l57-hda_dummy_dev" }, + {} + }, + .bus_type =SMI_AUTO_DETECT , +}; +/* * Note new device-ids must also be added to ignore_serial_bus_ids in * drivers/acpi/scan.c: acpi_device_enumeration_by_parent(). @@ -350,7 +376,9 @@ static const struct acpi_device_id smi_acpi_ids[] = { { "BSG1160", (unsigned long)&bsg1160_data }, { "BSG2150", (unsigned long)&bsg2150_data }, { "CSC3551", (unsigned long)&cs35l41_hda }, + { "CSC3554", (unsigned long)&cs35l54_hda }, { "CSC3556", (unsigned long)&cs35l56_hda }, + { "CSC3557", (unsigned long)&cs35l57_hda }, { "INT3515", (unsigned long)&int3515_data },/* Non-conforming _HID for Cirrus Logic already released */ { "CLSA0100", (unsigned long)&cs35l41_hda },
Takashi Iwai
AppliedQuoted 15 lines · Richard Fitzgerald
The CS35L54 and CS35L57 are Boosted Smart Amplifiers. The CS35L54 has I2C/SPI control and I2S/TDM audio. The CS35L57 also has SoundWire control and audio.
The hardware differences between L54, L56 and L57 do not affect the driver control interface so they can all be handled by the same driver.
The HDA patch has build dependencies on the ASoC patch.
The final patch updates serial-multi-instantiate and
scan.cto trap the ACPI HID for HDA systems that declare multiple amps all under oneDevice()node. This patch does not have any build dependency on the first two patches so can be taken separately.
Quoted 5 lines
Simon Trimmer (3):
ASoC: cs35l56: Add support for CS35L54 and CS35L57
ALSA: hda: cs35l56: Add support for CS35L54 and CS35L57 platform/x86: serial-multi-instantiate: Add support for CS35L54 andCS35L57
Applied all three patches to for-next branch now.
thanks,
Takashi