ASoC: Initial support for Cirrus Logic CS35L56
Subsystems (5)
Richard Fitzgerald
maintainerv3 cover ASoC: Initial support for Cirrus Logic CS35L56
The CS35L56 is a high-performance boosted mono audio amplifier. Supported control interfaces are I2C, SPI or SoundWire. Supported audio interfaces are I2S/TDM or SoundWire.
The CS35L56 has a self-booting firmware in ROM, with the ability to patch the firmware and/or apply tunings.
Patches #1 to #7 add support to cs_dsp and wm_adsp for self-booting firmware and the ability to apply a .bin file without having to apply a .wmfw.
Changes since v2:
- Fix Kconfig to prevent the driver being built-in if the SoundWire core is a module.
Changes since v1:
- Check for error when getting pm_runtime in cs35l56_irq().
- Use SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK instead of the old define.
- Re-word two comments in cs35l56-sdw.c.
- Add an comment explaining the wait for init_completion in cs35l56_dsp_work().
- Omit patches to Intel machine driver. These will be done as a separate thread.
Richard Fitzgerald (1):
ASoC: cs35l56: Add driver for Cirrus Logic CS35L56
Simon Trimmer (7):
firmware: cs_dsp: Introduce no_core_startstop for self-booting DSPs
ASoC: wm_adsp: Use no_core_startstop to prevent creating preload
control
firmware: cs_dsp: Support DSPs that don't require firmware download
ASoC: wm_adsp: Support DSPs that don't require firmware download
ASoC: wm_adsp: Expose the DSP boot work actions as wm_adsp_power_up()
ASoC: wm_adsp: Add support for loading bin files without wmfw
ASoC: wm_adsp: Simplify the logging of requested firmware files
MAINTAINERS | 1 + drivers/firmware/cirrus/cs_dsp.c | 17 +- include/linux/firmware/cirrus/cs_dsp.h | 1 + include/sound/cs35l56.h | 266 +++++ sound/soc/codecs/Kconfig | 40 + sound/soc/codecs/Makefile | 10 + sound/soc/codecs/cs35l56-i2c.c | 83 ++ sound/soc/codecs/cs35l56-sdw.c | 528 +++++++++ sound/soc/codecs/cs35l56-shared.c | 390 +++++++ sound/soc/codecs/cs35l56-spi.c | 81 ++ sound/soc/codecs/cs35l56.c | 1461 ++++++++++++++++++++++++ sound/soc/codecs/cs35l56.h | 77 ++ sound/soc/codecs/wm_adsp.c | 63 +- sound/soc/codecs/wm_adsp.h | 3 + 14 files changed, 3005 insertions(+), 16 deletions(-) create mode 100644 include/sound/cs35l56.h create mode 100644 sound/soc/codecs/cs35l56-i2c.c create mode 100644 sound/soc/codecs/cs35l56-sdw.c create mode 100644 sound/soc/codecs/cs35l56-shared.c create mode 100644 sound/soc/codecs/cs35l56-spi.c create mode 100644 sound/soc/codecs/cs35l56.c create mode 100644 sound/soc/codecs/cs35l56.h
Signature · 1 line
2.30.2
Richard Fitzgerald
maintainerPATCH v3 1/8 firmware: cs_dsp: Introduce no_core_startstop for self-booting DSPs
From: Simon Trimmer <[email protected]>
There are devices containing Halo Core DSPs that self-boot, cs_dsp is used to manage the running firmware but the host does not have direct control over starting and stopping the DSP and so cs_dsp should consider the DSP to be always running.
--- drivers/firmware/cirrus/cs_dsp.c | 14 +++++++++++++- include/linux/firmware/cirrus/cs_dsp.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-)
drivers/firmware/cirrus/cs_dsp.c +13 -1
@@ -301,6 +301,7 @@ struct cs_dsp_ops {static const struct cs_dsp_ops cs_dsp_adsp1_ops;static const struct cs_dsp_ops cs_dsp_adsp2_ops[];static const struct cs_dsp_ops cs_dsp_halo_ops; +static const struct cs_dsp_ops cs_dsp_halo_ao_ops;struct cs_dsp_buf {struct list_head list;
@@ -2821,7 +2822,10 @@ EXPORT_SYMBOL_NS_GPL(cs_dsp_adsp2_init, FW_CS_DSP);*/ int cs_dsp_halo_init (struct cs_dsp *dsp) { - dsp->ops = &cs_dsp_halo_ops; +if (dsp->no_core_startstop) + dsp->ops = &cs_dsp_halo_ao_ops; +else + dsp->ops = &cs_dsp_halo_ops;return cs_dsp_common_init (dsp); }
@@ -3187,6 +3191,14 @@ static const struct cs_dsp_ops cs_dsp_halo_ops = { .stop_core = cs_dsp_halo_stop_core, }; +static const struct cs_dsp_ops cs_dsp_halo_ao_ops = { + .parse_sizes = cs_dsp_adsp2_parse_sizes, + .validate_version = cs_dsp_halo_validate_version, + .setup_algs = cs_dsp_halo_setup_algs, + .region_to_reg = cs_dsp_halo_region_to_reg, + .show_fw_status = cs_dsp_halo_show_fw_status, +}; +/** * cs_dsp_chunk_write() - Format data to a DSP memory chunk * @ch: Pointer to the chunk structure
include/linux/firmware/cirrus/cs_dsp.h +1 -0
@@ -156,6 +156,7 @@ struct cs_dsp {unsigned int sysclk_reg;unsigned int sysclk_mask;unsigned int sysclk_shift; +bool no_core_startstop;struct list_head alg_regions;
Signature · 1 line
2.30.2
Richard Fitzgerald
maintainerPATCH v3 2/8 ASoC: wm_adsp: Use no_core_startstop to prevent creating preload control
In reply to Richard FitzgeraldFrom: Simon Trimmer <[email protected]>
The no_core_startstop flag indicates a self-booting DSP - they are considered to be always running and therefore cannot be pre-loaded.
--- sound/soc/codecs/wm_adsp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
sound/soc/codecs/wm_adsp.c +4 -2
@@ -1102,8 +1102,10 @@ int wm_adsp2_component_probe(struct wm_adsp *dsp, struct snd_soc_component *comp {char preload[32 ]; -snprintf (preload,ARRAY_SIZE (preload),"%s Preload" , dsp->cs_dsp.name); -snd_soc_component_disable_pin (component, preload); +if (!dsp->cs_dsp.no_core_startstop) { +snprintf (preload,ARRAY_SIZE (preload),"%s Preload" , dsp->cs_dsp.name); +snd_soc_component_disable_pin (component, preload); + }cs_dsp_init_debugfs (&dsp->cs_dsp, component->debugfs_root);
Signature · 1 line
2.30.2
Richard Fitzgerald
maintainerPATCH v3 3/8 firmware: cs_dsp: Support DSPs that don't require firmware download
In reply to Richard FitzgeraldFrom: Simon Trimmer <[email protected]>
When a DSP can self-boot from ROM it is not necessary to download firmware during the powering up sequence.
A DSP that required firmware download would fail in a previous configuration step if firmware was not available.
--- drivers/firmware/cirrus/cs_dsp.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/firmware/cirrus/cs_dsp.c +3 -0
@@ -1301,6 +1301,9 @@ static int cs_dsp_load(struct cs_dsp *dsp, const struct firmware *firmware,int regions =0 ;int ret, offset, type; +if (!firmware) +return 0 ; + ret = -EINVAL ; pos =sizeof (*header) +sizeof (*adsp1_sizes) +sizeof (*footer);
Signature · 1 line
2.30.2
Richard Fitzgerald
maintainerPATCH v3 4/8 ASoC: wm_adsp: Support DSPs that don't require firmware download
In reply to Richard FitzgeraldFrom: Simon Trimmer <[email protected]>
When a DSP can self-boot from ROM it is not necessary to download firmware - when the DSP has the wmfw_optional flag set not finding a wmfw firmware file is a successful outcome and not an error condition.
--- sound/soc/codecs/wm_adsp.c | 3 +++ sound/soc/codecs/wm_adsp.h | 1 + 2 files changed, 4 insertions(+)
sound/soc/codecs/wm_adsp.c +3 -0
@@ -850,6 +850,9 @@ static int wm_adsp_request_firmware_files(struct wm_adsp *dsp,return 0 ; } +if (dsp->wmfw_optional) +return 0 ; +adsp_err (dsp,"Failed to request firmware <%s>%s-%s-%s<-%s<%s>>.wmfw\n" , cirrus_dir, dsp->part, dsp->fwf_name, wm_adsp_fw[dsp->fw].file, system_name, asoc_component_prefix);
sound/soc/codecs/wm_adsp.h +1 -0
@@ -34,6 +34,7 @@ struct wm_adsp {unsigned int sys_config_size;int fw; +bool wmfw_optional;struct work_struct boot_work;int (*pre_run)(struct wm_adsp *dsp);
Signature · 1 line
2.30.2
Richard Fitzgerald
maintainerPATCH v3 5/8 ASoC: wm_adsp: Expose the DSP boot work actions as wm_adsp_power_up()
In reply to Richard FitzgeraldFrom: Simon Trimmer <[email protected]>
To support self-booting DSPs that are considered always running, the work that is usually invoked as part of a DAPM sequence needs to be triggered by a client of wm_adsp as part of it's startup sequence.
These actions load firmware files that might create ALSA controls and apply configuration to the device.
--- sound/soc/codecs/wm_adsp.c | 27 ++++++++++++++++++--------- sound/soc/codecs/wm_adsp.h | 2 ++ 2 files changed, 20 insertions(+), 9 deletions(-)
sound/soc/codecs/wm_adsp.c +18 -9
@@ -998,11 +998,8 @@ int wm_adsp2_preloader_put(struct snd_kcontrol *kcontrol, }EXPORT_SYMBOL_GPL (wm_adsp2_preloader_put); -static void wm_adsp_boot_work (struct work_struct *work) +int wm_adsp_power_up (struct wm_adsp *dsp) { -struct wm_adsp *dsp =container_of (work, - struct wm_adsp, - boot_work);int ret =0 ;char *wmfw_filename =NULL ;const struct firmware *wmfw_firmware =NULL ;
@@ -1013,16 +1010,28 @@ static void wm_adsp_boot_work(struct work_struct *work) &wmfw_firmware, &wmfw_filename, &coeff_firmware, &coeff_filename);if (ret) -return ; +return ret; -cs_dsp_power_up (&dsp->cs_dsp, - wmfw_firmware, wmfw_filename, - coeff_firmware, coeff_filename, - wm_adsp_fw_text[dsp->fw]); + ret =cs_dsp_power_up (&dsp->cs_dsp, + wmfw_firmware, wmfw_filename, + coeff_firmware, coeff_filename, + wm_adsp_fw_text[dsp->fw]);wm_adsp_release_firmware_files (dsp, wmfw_firmware, wmfw_filename, coeff_firmware, coeff_filename); + +return ret; +} +EXPORT_SYMBOL_GPL (wm_adsp_power_up); + +static void wm_adsp_boot_work (struct work_struct *work) +{ +struct wm_adsp *dsp =container_of (work, + struct wm_adsp, + boot_work); + +wm_adsp_power_up (dsp); } int wm_adsp_early_event(struct snd_soc_dapm_widget *w,
sound/soc/codecs/wm_adsp.h +2 -0
@@ -91,6 +91,8 @@ int wm_adsp1_event(struct snd_soc_dapm_widget *w,int wm_adsp_early_event (struct snd_soc_dapm_widget *w,struct snd_kcontrol *kcontrol,int event); +int wm_adsp_power_up (struct wm_adsp *dsp); +irqreturn_t wm_adsp2_bus_error (int irq,void *data);irqreturn_t wm_halo_bus_error (int irq,void *data);irqreturn_t wm_halo_wdt_expire (int irq,void *data);
Signature · 1 line
2.30.2
Richard Fitzgerald
maintainerPATCH v3 6/8 ASoC: wm_adsp: Add support for loading bin files without wmfw
In reply to Richard FitzgeraldFrom: Simon Trimmer <[email protected]>
A self-booted DSP may have a file of coefficients to apply to the device even when there is no firmware to download.
--- sound/soc/codecs/wm_adsp.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
sound/soc/codecs/wm_adsp.c +22 -1
@@ -850,8 +850,29 @@ static int wm_adsp_request_firmware_files(struct wm_adsp *dsp,return 0 ; } -if (dsp->wmfw_optional) +if (dsp->wmfw_optional) { +if (system_name) { +if (asoc_component_prefix) +wm_adsp_request_firmware_file (dsp, coeff_firmware, coeff_filename, + cirrus_dir, system_name, + asoc_component_prefix,"bin" ); + +if (!*coeff_firmware) +wm_adsp_request_firmware_file (dsp, coeff_firmware, coeff_filename, + cirrus_dir, system_name, +NULL ,"bin" ); + } + +if (!*coeff_firmware) +wm_adsp_request_firmware_file (dsp, coeff_firmware, coeff_filename, +"" ,NULL ,NULL ,"bin" ); + +if (!*coeff_firmware) +wm_adsp_request_firmware_file (dsp, coeff_firmware, coeff_filename, + cirrus_dir,NULL ,NULL ,"bin" ); +return 0 ; + } adsp_err(dsp, "Failed to request firmware <%s>%s-%s-%s<-%s<%s>>.wmfw\n", cirrus_dir, dsp->part, dsp->fwf_name, wm_adsp_fw[dsp->fw].file,
Signature · 1 line
2.30.2
Richard Fitzgerald
maintainerPATCH v3 7/8 ASoC: wm_adsp: Simplify the logging of requested firmware files
In reply to Richard FitzgeraldFrom: Simon Trimmer <[email protected]>
This change makes the logging of firmware files more consistent and simplifies the code - a debug message is logged whether the requested file was found or not and this applies to both wmfw and bin files.
--- sound/soc/codecs/wm_adsp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
sound/soc/codecs/wm_adsp.c +2 -4
@@ -787,6 +787,8 @@ static int wm_adsp_request_firmware_file(struct wm_adsp *dsp,adsp_dbg (dsp,"Failed to request '%s'\n" , *filename);kfree (*filename); *filename =NULL ; + }else { +adsp_dbg (dsp,"Found '%s'\n" , *filename); }return ret;
@@ -807,7 +809,6 @@ static int wm_adsp_request_firmware_files(struct wm_adsp *dsp,if (!wm_adsp_request_firmware_file (dsp, wmfw_firmware, wmfw_filename, cirrus_dir, system_name, asoc_component_prefix,"wmfw" )) { -adsp_dbg (dsp,"Found '%s'\n" , *wmfw_filename);wm_adsp_request_firmware_file (dsp, coeff_firmware, coeff_filename, cirrus_dir, system_name, asoc_component_prefix,"bin" );
@@ -819,7 +820,6 @@ static int wm_adsp_request_firmware_files(struct wm_adsp *dsp,if (!wm_adsp_request_firmware_file (dsp, wmfw_firmware, wmfw_filename, cirrus_dir, system_name,NULL ,"wmfw" )) { -adsp_dbg (dsp,"Found '%s'\n" , *wmfw_filename);if (asoc_component_prefix) wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename, cirrus_dir, system_name,
@@ -835,7 +835,6 @@ static int wm_adsp_request_firmware_files(struct wm_adsp *dsp,if (!wm_adsp_request_firmware_file (dsp, wmfw_firmware, wmfw_filename,"" ,NULL ,NULL ,"wmfw" )) { -adsp_dbg (dsp,"Found '%s'\n" , *wmfw_filename);wm_adsp_request_firmware_file (dsp, coeff_firmware, coeff_filename,"" ,NULL ,NULL ,"bin" );return 0 ;
@@ -844,7 +843,6 @@ static int wm_adsp_request_firmware_files(struct wm_adsp *dsp, ret =wm_adsp_request_firmware_file (dsp, wmfw_firmware, wmfw_filename, cirrus_dir,NULL ,NULL ,"wmfw" );if (!ret) { -adsp_dbg (dsp,"Found '%s'\n" , *wmfw_filename);wm_adsp_request_firmware_file (dsp, coeff_firmware, coeff_filename, cirrus_dir,NULL ,NULL ,"bin" );return 0 ;
Signature · 1 line
2.30.2
Richard Fitzgerald
maintainerPATCH v3 8/8 ASoC: cs35l56: Add driver for Cirrus Logic CS35L56
In reply to Richard FitzgeraldThe CS35L56 combines a high-performance mono audio amplifier, Class-H tracking inductive boost converter, Halo Core(TM) DSP and a DC-DC boost converter supporting Class-H tracking.
Supported control interfaces are I2C, SPI or SoundWire. Supported audio interfaces are I2S/TDM or SoundWire.
Most chip functionality is controlled by on-board ROM firmware that is always running. The driver must apply patch/tune to the firmware before using the CS35L56.
--- MAINTAINERS | 1 + include/sound/cs35l56.h | 266 ++++++ sound/soc/codecs/Kconfig | 40 + sound/soc/codecs/Makefile | 10 + sound/soc/codecs/cs35l56-i2c.c | 83 ++ sound/soc/codecs/cs35l56-sdw.c | 528 +++++++++++ sound/soc/codecs/cs35l56-shared.c | 390 ++++++++ sound/soc/codecs/cs35l56-spi.c | 81 ++ sound/soc/codecs/cs35l56.c | 1461 +++++++++++++++++++++++++++++ sound/soc/codecs/cs35l56.h | 77 ++ 10 files changed, 2937 insertions(+) create mode 100644 include/sound/cs35l56.h create mode 100644 sound/soc/codecs/cs35l56-i2c.c create mode 100644 sound/soc/codecs/cs35l56-sdw.c create mode 100644 sound/soc/codecs/cs35l56-shared.c create mode 100644 sound/soc/codecs/cs35l56-spi.c create mode 100644 sound/soc/codecs/cs35l56.c create mode 100644 sound/soc/codecs/cs35l56.h
MAINTAINERS +1 -0
@@ -4905,6 +4905,7 @@ L: [email protected] S: Maintained F: Documentation/devicetree/bindings/sound/cirrus,cs* F: include/dt-bindings/sound/cs* +F: include/sound/cs* F: sound/pci/hda/cs* F: sound/pci/hda/hda_cs_dsp_ctl.* F: sound/soc/codecs/cs*
include/sound/cs35l56.h new file +266 -0
266 lines not on this page · raw message
sound/soc/codecs/Kconfig +40 -0
@@ -68,6 +68,9 @@ config SND_SOC_ALL_CODECS imply SND_SOC_CS35L41_I2C imply SND_SOC_CS35L45_I2C imply SND_SOC_CS35L45_SPI + imply SND_SOC_CS35L56_I2C + imply SND_SOC_CS35L56_SPI + imply SND_SOC_CS35L56_SDW imply SND_SOC_CS42L42 imply SND_SOC_CS42L42_SDW imply SND_SOC_CS42L51_I2C
@@ -364,6 +367,7 @@ config SND_SOC_WM_ADSP default y if SND_SOC_WM2200=y default y if SND_SOC_CS35L41_SPI=y default y if SND_SOC_CS35L41_I2C=y + default y if SND_SOC_CS35L56=y default m if SND_SOC_MADERA=m default m if SND_SOC_CS47L24=m default m if SND_SOC_WM5102=m
@@ -371,6 +375,7 @@ config SND_SOC_WM_ADSP default m if SND_SOC_WM2200=m default m if SND_SOC_CS35L41_SPI=m default m if SND_SOC_CS35L41_I2C=m + default m if SND_SOC_CS35L56=m config SND_SOC_AB8500_CODEC tristate
@@ -711,6 +716,41 @@ config SND_SOC_CS35L45_I2C Enable support for Cirrus Logic CS35L45 smart speaker amplifier with I2C control. +config SND_SOC_CS35L56 + tristate + +config SND_SOC_CS35L56_SHARED + tristate + +config SND_SOC_CS35L56_I2C + tristate "Cirrus Logic CS35L56 CODEC (I2C)" + depends on I2C + depends on SOUNDWIRE || !SOUNDWIRE + select REGMAP_I2C + select SND_SOC_CS35L56 + select SND_SOC_CS35L56_SHARED + help + Enable support for Cirrus Logic CS35L56 boosted amplifier with I2C control + +config SND_SOC_CS35L56_SPI + tristate "Cirrus Logic CS35L56 CODEC (SPI)" + depends on SPI_MASTER + depends on SOUNDWIRE || !SOUNDWIRE + select REGMAP_SPI + select SND_SOC_CS35L56 + select SND_SOC_CS35L56_SHARED + help + Enable support for Cirrus Logic CS35L56 boosted amplifier with SPI control + +config SND_SOC_CS35L56_SDW + tristate "Cirrus Logic CS35L56 CODEC (SDW)" + depends on SOUNDWIRE + select REGMAP + select SND_SOC_CS35L56 + select SND_SOC_CS35L56_SHARED + help + Enable support for Cirrus Logic CS35L56 boosted amplifier with SoundWire control + config SND_SOC_CS42L42_CORE tristate
sound/soc/codecs/Makefile +10 -0
@@ -66,6 +66,11 @@ snd-soc-cs35l41-i2c-objs := cs35l41-i2c.o snd-soc-cs35l45-objs := cs35l45.o cs35l45-tables.o snd-soc-cs35l45-spi-objs := cs35l45-spi.o snd-soc-cs35l45-i2c-objs := cs35l45-i2c.o +snd-soc-cs35l56-objs := cs35l56.o +snd-soc-cs35l56-shared-objs := cs35l56-shared.o +snd-soc-cs35l56-i2c-objs := cs35l56-i2c.o +snd-soc-cs35l56-spi-objs := cs35l56-spi.o +snd-soc-cs35l56-sdw-objs := cs35l56-sdw.o snd-soc-cs42l42-objs := cs42l42.o snd-soc-cs42l42-i2c-objs := cs42l42-i2c.o snd-soc-cs42l42-sdw-objs := cs42l42-sdw.o
@@ -433,6 +438,11 @@ obj-$(CONFIG_SND_SOC_CS35L41_I2C) += snd-soc-cs35l41-i2c.o obj-$(CONFIG_SND_SOC_CS35L45) += snd-soc-cs35l45.o obj-$(CONFIG_SND_SOC_CS35L45_SPI) += snd-soc-cs35l45-spi.o obj-$(CONFIG_SND_SOC_CS35L45_I2C) += snd-soc-cs35l45-i2c.o +obj-$(CONFIG_SND_SOC_CS35L56) += snd-soc-cs35l56.o +obj-$(CONFIG_SND_SOC_CS35L56_SHARED) += snd-soc-cs35l56-shared.o +obj-$(CONFIG_SND_SOC_CS35L56_I2C) += snd-soc-cs35l56-i2c.o +obj-$(CONFIG_SND_SOC_CS35L56_SPI) += snd-soc-cs35l56-spi.o +obj-$(CONFIG_SND_SOC_CS35L56_SDW) += snd-soc-cs35l56-sdw.o obj-$(CONFIG_SND_SOC_CS42L42_CORE) += snd-soc-cs42l42.o obj-$(CONFIG_SND_SOC_CS42L42) += snd-soc-cs42l42-i2c.o obj-$(CONFIG_SND_SOC_CS42L42_SDW) += snd-soc-cs42l42-sdw.o
sound/soc/codecs/cs35l56-i2c.c new file +83 -0
83 lines not on this page · raw message
sound/soc/codecs/cs35l56-sdw.c new file +528 -0
528 lines not on this page · raw message
sound/soc/codecs/cs35l56-shared.c new file +390 -0
390 lines not on this page · raw message
sound/soc/codecs/cs35l56-spi.c new file +81 -0
81 lines not on this page · raw message
sound/soc/codecs/cs35l56.c new file +1461 -0
1,461 lines not on this page · raw message
sound/soc/codecs/cs35l56.h new file +77 -0
77 lines not on this page · raw message
Signature · 1 line
2.30.2
PATCH v3 1/8 firmware: cs_dsp: Introduce no_core_startstop for self-booting DSPs
In reply to Richard FitzgeraldFrom: Simon Trimmer <[email protected]>
There are devices containing Halo Core DSPs that self-boot, cs_dsp is used to manage the running firmware but the host does not have direct control over starting and stopping the DSP and so cs_dsp should consider the DSP to be always running.
--- drivers/firmware/cirrus/cs_dsp.c | 14 +++++++++++++- include/linux/firmware/cirrus/cs_dsp.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-)
drivers/firmware/cirrus/cs_dsp.c +13 -1
@@ -301,6 +301,7 @@ struct cs_dsp_ops {static const struct cs_dsp_ops cs_dsp_adsp1_ops;static const struct cs_dsp_ops cs_dsp_adsp2_ops[];static const struct cs_dsp_ops cs_dsp_halo_ops; +static const struct cs_dsp_ops cs_dsp_halo_ao_ops;struct cs_dsp_buf {struct list_head list;
@@ -2821,7 +2822,10 @@ EXPORT_SYMBOL_NS_GPL(cs_dsp_adsp2_init, FW_CS_DSP);*/ int cs_dsp_halo_init (struct cs_dsp *dsp) { - dsp->ops = &cs_dsp_halo_ops; +if (dsp->no_core_startstop) + dsp->ops = &cs_dsp_halo_ao_ops; +else + dsp->ops = &cs_dsp_halo_ops;return cs_dsp_common_init (dsp); }
@@ -3187,6 +3191,14 @@ static const struct cs_dsp_ops cs_dsp_halo_ops = { .stop_core = cs_dsp_halo_stop_core, }; +static const struct cs_dsp_ops cs_dsp_halo_ao_ops = { + .parse_sizes = cs_dsp_adsp2_parse_sizes, + .validate_version = cs_dsp_halo_validate_version, + .setup_algs = cs_dsp_halo_setup_algs, + .region_to_reg = cs_dsp_halo_region_to_reg, + .show_fw_status = cs_dsp_halo_show_fw_status, +}; +/** * cs_dsp_chunk_write() - Format data to a DSP memory chunk * @ch: Pointer to the chunk structure
include/linux/firmware/cirrus/cs_dsp.h +1 -0
@@ -156,6 +156,7 @@ struct cs_dsp {unsigned int sysclk_reg;unsigned int sysclk_mask;unsigned int sysclk_shift; +bool no_core_startstop;struct list_head alg_regions;
Signature · 1 line
2.30.2
PATCH v3 2/8 ASoC: wm_adsp: Use no_core_startstop to prevent creating preload control
In reply to Richard FitzgeraldFrom: Simon Trimmer <[email protected]>
The no_core_startstop flag indicates a self-booting DSP - they are considered to be always running and therefore cannot be pre-loaded.
--- sound/soc/codecs/wm_adsp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
sound/soc/codecs/wm_adsp.c +4 -2
@@ -1102,8 +1102,10 @@ int wm_adsp2_component_probe(struct wm_adsp *dsp, struct snd_soc_component *comp {char preload[32 ]; -snprintf (preload,ARRAY_SIZE (preload),"%s Preload" , dsp->cs_dsp.name); -snd_soc_component_disable_pin (component, preload); +if (!dsp->cs_dsp.no_core_startstop) { +snprintf (preload,ARRAY_SIZE (preload),"%s Preload" , dsp->cs_dsp.name); +snd_soc_component_disable_pin (component, preload); + }cs_dsp_init_debugfs (&dsp->cs_dsp, component->debugfs_root);
Signature · 1 line
2.30.2
PATCH v3 3/8 firmware: cs_dsp: Support DSPs that don't require firmware download
In reply to Richard FitzgeraldFrom: Simon Trimmer <[email protected]>
When a DSP can self-boot from ROM it is not necessary to download firmware during the powering up sequence.
A DSP that required firmware download would fail in a previous configuration step if firmware was not available.
--- drivers/firmware/cirrus/cs_dsp.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/firmware/cirrus/cs_dsp.c +3 -0
@@ -1301,6 +1301,9 @@ static int cs_dsp_load(struct cs_dsp *dsp, const struct firmware *firmware,int regions =0 ;int ret, offset, type; +if (!firmware) +return 0 ; + ret = -EINVAL ; pos =sizeof (*header) +sizeof (*adsp1_sizes) +sizeof (*footer);
Signature · 1 line
2.30.2
PATCH v3 4/8 ASoC: wm_adsp: Support DSPs that don't require firmware download
In reply to Richard FitzgeraldFrom: Simon Trimmer <[email protected]>
When a DSP can self-boot from ROM it is not necessary to download firmware - when the DSP has the wmfw_optional flag set not finding a wmfw firmware file is a successful outcome and not an error condition.
--- sound/soc/codecs/wm_adsp.c | 3 +++ sound/soc/codecs/wm_adsp.h | 1 + 2 files changed, 4 insertions(+)
sound/soc/codecs/wm_adsp.c +3 -0
@@ -850,6 +850,9 @@ static int wm_adsp_request_firmware_files(struct wm_adsp *dsp,return 0 ; } +if (dsp->wmfw_optional) +return 0 ; +adsp_err (dsp,"Failed to request firmware <%s>%s-%s-%s<-%s<%s>>.wmfw\n" , cirrus_dir, dsp->part, dsp->fwf_name, wm_adsp_fw[dsp->fw].file, system_name, asoc_component_prefix);
sound/soc/codecs/wm_adsp.h +1 -0
@@ -34,6 +34,7 @@ struct wm_adsp {unsigned int sys_config_size;int fw; +bool wmfw_optional;struct work_struct boot_work;int (*pre_run)(struct wm_adsp *dsp);
Signature · 1 line
2.30.2
PATCH v3 5/8 ASoC: wm_adsp: Expose the DSP boot work actions as wm_adsp_power_up()
In reply to Richard FitzgeraldFrom: Simon Trimmer <[email protected]>
To support self-booting DSPs that are considered always running, the work that is usually invoked as part of a DAPM sequence needs to be triggered by a client of wm_adsp as part of it's startup sequence.
These actions load firmware files that might create ALSA controls and apply configuration to the device.
--- sound/soc/codecs/wm_adsp.c | 27 ++++++++++++++++++--------- sound/soc/codecs/wm_adsp.h | 2 ++ 2 files changed, 20 insertions(+), 9 deletions(-)
sound/soc/codecs/wm_adsp.c +18 -9
@@ -998,11 +998,8 @@ int wm_adsp2_preloader_put(struct snd_kcontrol *kcontrol, }EXPORT_SYMBOL_GPL (wm_adsp2_preloader_put); -static void wm_adsp_boot_work (struct work_struct *work) +int wm_adsp_power_up (struct wm_adsp *dsp) { -struct wm_adsp *dsp =container_of (work, - struct wm_adsp, - boot_work);int ret =0 ;char *wmfw_filename =NULL ;const struct firmware *wmfw_firmware =NULL ;
@@ -1013,16 +1010,28 @@ static void wm_adsp_boot_work(struct work_struct *work) &wmfw_firmware, &wmfw_filename, &coeff_firmware, &coeff_filename);if (ret) -return ; +return ret; -cs_dsp_power_up (&dsp->cs_dsp, - wmfw_firmware, wmfw_filename, - coeff_firmware, coeff_filename, - wm_adsp_fw_text[dsp->fw]); + ret =cs_dsp_power_up (&dsp->cs_dsp, + wmfw_firmware, wmfw_filename, + coeff_firmware, coeff_filename, + wm_adsp_fw_text[dsp->fw]);wm_adsp_release_firmware_files (dsp, wmfw_firmware, wmfw_filename, coeff_firmware, coeff_filename); + +return ret; +} +EXPORT_SYMBOL_GPL (wm_adsp_power_up); + +static void wm_adsp_boot_work (struct work_struct *work) +{ +struct wm_adsp *dsp =container_of (work, + struct wm_adsp, + boot_work); + +wm_adsp_power_up (dsp); } int wm_adsp_early_event(struct snd_soc_dapm_widget *w,
sound/soc/codecs/wm_adsp.h +2 -0
@@ -91,6 +91,8 @@ int wm_adsp1_event(struct snd_soc_dapm_widget *w,int wm_adsp_early_event (struct snd_soc_dapm_widget *w,struct snd_kcontrol *kcontrol,int event); +int wm_adsp_power_up (struct wm_adsp *dsp); +irqreturn_t wm_adsp2_bus_error (int irq,void *data);irqreturn_t wm_halo_bus_error (int irq,void *data);irqreturn_t wm_halo_wdt_expire (int irq,void *data);
Signature · 1 line
2.30.2
PATCH v3 6/8 ASoC: wm_adsp: Add support for loading bin files without wmfw
In reply to Richard FitzgeraldFrom: Simon Trimmer <[email protected]>
A self-booted DSP may have a file of coefficients to apply to the device even when there is no firmware to download.
--- sound/soc/codecs/wm_adsp.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
sound/soc/codecs/wm_adsp.c +22 -1
@@ -850,8 +850,29 @@ static int wm_adsp_request_firmware_files(struct wm_adsp *dsp,return 0 ; } -if (dsp->wmfw_optional) +if (dsp->wmfw_optional) { +if (system_name) { +if (asoc_component_prefix) +wm_adsp_request_firmware_file (dsp, coeff_firmware, coeff_filename, + cirrus_dir, system_name, + asoc_component_prefix,"bin" ); + +if (!*coeff_firmware) +wm_adsp_request_firmware_file (dsp, coeff_firmware, coeff_filename, + cirrus_dir, system_name, +NULL ,"bin" ); + } + +if (!*coeff_firmware) +wm_adsp_request_firmware_file (dsp, coeff_firmware, coeff_filename, +"" ,NULL ,NULL ,"bin" ); + +if (!*coeff_firmware) +wm_adsp_request_firmware_file (dsp, coeff_firmware, coeff_filename, + cirrus_dir,NULL ,NULL ,"bin" ); +return 0 ; + } adsp_err(dsp, "Failed to request firmware <%s>%s-%s-%s<-%s<%s>>.wmfw\n", cirrus_dir, dsp->part, dsp->fwf_name, wm_adsp_fw[dsp->fw].file,
Signature · 1 line
2.30.2
PATCH v3 7/8 ASoC: wm_adsp: Simplify the logging of requested firmware files
In reply to Richard FitzgeraldFrom: Simon Trimmer <[email protected]>
This change makes the logging of firmware files more consistent and simplifies the code - a debug message is logged whether the requested file was found or not and this applies to both wmfw and bin files.
--- sound/soc/codecs/wm_adsp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
sound/soc/codecs/wm_adsp.c +2 -4
@@ -787,6 +787,8 @@ static int wm_adsp_request_firmware_file(struct wm_adsp *dsp,adsp_dbg (dsp,"Failed to request '%s'\n" , *filename);kfree (*filename); *filename =NULL ; + }else { +adsp_dbg (dsp,"Found '%s'\n" , *filename); }return ret;
@@ -807,7 +809,6 @@ static int wm_adsp_request_firmware_files(struct wm_adsp *dsp,if (!wm_adsp_request_firmware_file (dsp, wmfw_firmware, wmfw_filename, cirrus_dir, system_name, asoc_component_prefix,"wmfw" )) { -adsp_dbg (dsp,"Found '%s'\n" , *wmfw_filename);wm_adsp_request_firmware_file (dsp, coeff_firmware, coeff_filename, cirrus_dir, system_name, asoc_component_prefix,"bin" );
@@ -819,7 +820,6 @@ static int wm_adsp_request_firmware_files(struct wm_adsp *dsp,if (!wm_adsp_request_firmware_file (dsp, wmfw_firmware, wmfw_filename, cirrus_dir, system_name,NULL ,"wmfw" )) { -adsp_dbg (dsp,"Found '%s'\n" , *wmfw_filename);if (asoc_component_prefix) wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename, cirrus_dir, system_name,
@@ -835,7 +835,6 @@ static int wm_adsp_request_firmware_files(struct wm_adsp *dsp,if (!wm_adsp_request_firmware_file (dsp, wmfw_firmware, wmfw_filename,"" ,NULL ,NULL ,"wmfw" )) { -adsp_dbg (dsp,"Found '%s'\n" , *wmfw_filename);wm_adsp_request_firmware_file (dsp, coeff_firmware, coeff_filename,"" ,NULL ,NULL ,"bin" );return 0 ;
@@ -844,7 +843,6 @@ static int wm_adsp_request_firmware_files(struct wm_adsp *dsp, ret =wm_adsp_request_firmware_file (dsp, wmfw_firmware, wmfw_filename, cirrus_dir,NULL ,NULL ,"wmfw" );if (!ret) { -adsp_dbg (dsp,"Found '%s'\n" , *wmfw_filename);wm_adsp_request_firmware_file (dsp, coeff_firmware, coeff_filename, cirrus_dir,NULL ,NULL ,"bin" );return 0 ;
Signature · 1 line
2.30.2
PATCH v3 8/8 ASoC: cs35l56: Add driver for Cirrus Logic CS35L56
In reply to Richard FitzgeraldThe CS35L56 combines a high-performance mono audio amplifier, Class-H tracking inductive boost converter, Halo Core(TM) DSP and a DC-DC boost converter supporting Class-H tracking.
Supported control interfaces are I2C, SPI or SoundWire. Supported audio interfaces are I2S/TDM or SoundWire.
Most chip functionality is controlled by on-board ROM firmware that is always running. The driver must apply patch/tune to the firmware before using the CS35L56.
--- MAINTAINERS | 1 + include/sound/cs35l56.h | 266 ++++++ sound/soc/codecs/Kconfig | 40 + sound/soc/codecs/Makefile | 10 + sound/soc/codecs/cs35l56-i2c.c | 83 ++ sound/soc/codecs/cs35l56-sdw.c | 528 +++++++++++ sound/soc/codecs/cs35l56-shared.c | 390 ++++++++ sound/soc/codecs/cs35l56-spi.c | 81 ++ sound/soc/codecs/cs35l56.c | 1461 +++++++++++++++++++++++++++++ sound/soc/codecs/cs35l56.h | 77 ++ 10 files changed, 2937 insertions(+) create mode 100644 include/sound/cs35l56.h create mode 100644 sound/soc/codecs/cs35l56-i2c.c create mode 100644 sound/soc/codecs/cs35l56-sdw.c create mode 100644 sound/soc/codecs/cs35l56-shared.c create mode 100644 sound/soc/codecs/cs35l56-spi.c create mode 100644 sound/soc/codecs/cs35l56.c create mode 100644 sound/soc/codecs/cs35l56.h
MAINTAINERS +1 -0
@@ -4905,6 +4905,7 @@ L: [email protected] S: Maintained F: Documentation/devicetree/bindings/sound/cirrus,cs* F: include/dt-bindings/sound/cs* +F: include/sound/cs* F: sound/pci/hda/cs* F: sound/pci/hda/hda_cs_dsp_ctl.* F: sound/soc/codecs/cs*
include/sound/cs35l56.h new file +266 -0
266 lines not on this page · raw message
sound/soc/codecs/Kconfig +40 -0
@@ -68,6 +68,9 @@ config SND_SOC_ALL_CODECS imply SND_SOC_CS35L41_I2C imply SND_SOC_CS35L45_I2C imply SND_SOC_CS35L45_SPI + imply SND_SOC_CS35L56_I2C + imply SND_SOC_CS35L56_SPI + imply SND_SOC_CS35L56_SDW imply SND_SOC_CS42L42 imply SND_SOC_CS42L42_SDW imply SND_SOC_CS42L51_I2C
@@ -364,6 +367,7 @@ config SND_SOC_WM_ADSP default y if SND_SOC_WM2200=y default y if SND_SOC_CS35L41_SPI=y default y if SND_SOC_CS35L41_I2C=y + default y if SND_SOC_CS35L56=y default m if SND_SOC_MADERA=m default m if SND_SOC_CS47L24=m default m if SND_SOC_WM5102=m
@@ -371,6 +375,7 @@ config SND_SOC_WM_ADSP default m if SND_SOC_WM2200=m default m if SND_SOC_CS35L41_SPI=m default m if SND_SOC_CS35L41_I2C=m + default m if SND_SOC_CS35L56=m config SND_SOC_AB8500_CODEC tristate
@@ -711,6 +716,41 @@ config SND_SOC_CS35L45_I2C Enable support for Cirrus Logic CS35L45 smart speaker amplifier with I2C control. +config SND_SOC_CS35L56 + tristate + +config SND_SOC_CS35L56_SHARED + tristate + +config SND_SOC_CS35L56_I2C + tristate "Cirrus Logic CS35L56 CODEC (I2C)" + depends on I2C + depends on SOUNDWIRE || !SOUNDWIRE + select REGMAP_I2C + select SND_SOC_CS35L56 + select SND_SOC_CS35L56_SHARED + help + Enable support for Cirrus Logic CS35L56 boosted amplifier with I2C control + +config SND_SOC_CS35L56_SPI + tristate "Cirrus Logic CS35L56 CODEC (SPI)" + depends on SPI_MASTER + depends on SOUNDWIRE || !SOUNDWIRE + select REGMAP_SPI + select SND_SOC_CS35L56 + select SND_SOC_CS35L56_SHARED + help + Enable support for Cirrus Logic CS35L56 boosted amplifier with SPI control + +config SND_SOC_CS35L56_SDW + tristate "Cirrus Logic CS35L56 CODEC (SDW)" + depends on SOUNDWIRE + select REGMAP + select SND_SOC_CS35L56 + select SND_SOC_CS35L56_SHARED + help + Enable support for Cirrus Logic CS35L56 boosted amplifier with SoundWire control + config SND_SOC_CS42L42_CORE tristate
sound/soc/codecs/Makefile +10 -0
@@ -66,6 +66,11 @@ snd-soc-cs35l41-i2c-objs := cs35l41-i2c.o snd-soc-cs35l45-objs := cs35l45.o cs35l45-tables.o snd-soc-cs35l45-spi-objs := cs35l45-spi.o snd-soc-cs35l45-i2c-objs := cs35l45-i2c.o +snd-soc-cs35l56-objs := cs35l56.o +snd-soc-cs35l56-shared-objs := cs35l56-shared.o +snd-soc-cs35l56-i2c-objs := cs35l56-i2c.o +snd-soc-cs35l56-spi-objs := cs35l56-spi.o +snd-soc-cs35l56-sdw-objs := cs35l56-sdw.o snd-soc-cs42l42-objs := cs42l42.o snd-soc-cs42l42-i2c-objs := cs42l42-i2c.o snd-soc-cs42l42-sdw-objs := cs42l42-sdw.o
@@ -433,6 +438,11 @@ obj-$(CONFIG_SND_SOC_CS35L41_I2C) += snd-soc-cs35l41-i2c.o obj-$(CONFIG_SND_SOC_CS35L45) += snd-soc-cs35l45.o obj-$(CONFIG_SND_SOC_CS35L45_SPI) += snd-soc-cs35l45-spi.o obj-$(CONFIG_SND_SOC_CS35L45_I2C) += snd-soc-cs35l45-i2c.o +obj-$(CONFIG_SND_SOC_CS35L56) += snd-soc-cs35l56.o +obj-$(CONFIG_SND_SOC_CS35L56_SHARED) += snd-soc-cs35l56-shared.o +obj-$(CONFIG_SND_SOC_CS35L56_I2C) += snd-soc-cs35l56-i2c.o +obj-$(CONFIG_SND_SOC_CS35L56_SPI) += snd-soc-cs35l56-spi.o +obj-$(CONFIG_SND_SOC_CS35L56_SDW) += snd-soc-cs35l56-sdw.o obj-$(CONFIG_SND_SOC_CS42L42_CORE) += snd-soc-cs42l42.o obj-$(CONFIG_SND_SOC_CS42L42) += snd-soc-cs42l42-i2c.o obj-$(CONFIG_SND_SOC_CS42L42_SDW) += snd-soc-cs42l42-sdw.o
sound/soc/codecs/cs35l56-i2c.c new file +83 -0
83 lines not on this page · raw message
sound/soc/codecs/cs35l56-sdw.c new file +528 -0
528 lines not on this page · raw message
sound/soc/codecs/cs35l56-shared.c new file +390 -0
390 lines not on this page · raw message
sound/soc/codecs/cs35l56-spi.c new file +81 -0
81 lines not on this page · raw message
sound/soc/codecs/cs35l56.c new file +1461 -0
1,461 lines not on this page · raw message
sound/soc/codecs/cs35l56.h new file +77 -0
77 lines not on this page · raw message
Signature · 1 line
2.30.2
Mark Brown
maintainerQuoted 11 lines · Richard Fitzgerald
The CS35L56 is a high-performance boosted mono audio amplifier. Supported control interfaces are I2C, SPI or SoundWire. Supported audio interfaces are I2S/TDM or SoundWire.
The CS35L56 has a self-booting firmware in ROM, with the ability to patch the firmware and/or apply tunings.
Patches #1 to #7 add support tocs_dspandwm_adspfor self-booting firmware and the ability to apply a .bin file without having to apply a .wmfw.[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/8] firmware: cs_dsp: Introduce no_core_startstop for self-booting DSPs
commit: 7062e1c727ec99a9c5b40586964304d60a43f240
[2/8] ASoC: wm_adsp: Use no_core_startstop to prevent creating preload control
commit: 0cd1fd571719e19bd6824a98855382a70e47d932
[3/8] firmware: cs_dsp: Support DSPs that don't require firmware download
commit: 107c167419e75213e078e4f2468c0f2f55fdd11a
[4/8] ASoC: wm_adsp: Support DSPs that don't require firmware download
commit: 65a314b7ddc09f6b1bad8decc6670e68d45ef07d
[5/8] ASoC: wm_adsp: Expose the DSP boot work actions as wm_adsp_power_up()
commit: 11520b87e2232c6e3defed69ec94f0e28fb80f84
[6/8] ASoC: wm_adsp: Add support for loading bin files without wmfw
commit: 0e7d82cbea8bc0db8ced613aea04da17ac0f0249
[7/8] ASoC: wm_adsp: Simplify the logging of requested firmware files
commit: 991b1de830f61076b7dc29bec081a4d2e50724cf
[8/8] ASoC: cs35l56: Add driver for Cirrus Logic CS35L56
commit: e496112529006ce0c2cfe67d1136186e2786d2e8All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark