Skip to contentSkip to conversation

ASoC: Initial support for Cirrus Logic CS35L56

PATCH Superseded Richard Fitzgerald 3 participants 23 messages Mar 13, 2023 – Mar 17, 2023

Subsystems (5)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Richard Fitzgerald

author maintainer
#0 lore raw

v2 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 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               |   34 +
 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, 2999 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
author maintainer
#1 lore raw

PATCH v2 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
index f558b390fbfe..97b73a254380 100644
@@ -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
index cad828e21c72..29cd11d5a3cf 100644
@@ -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
author maintainer
#2 lore raw

PATCH v2 2/8 ASoC: wm_adsp: Use no_core_startstop to prevent creating preload control

In reply to Richard Fitzgerald

From: 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
index ea0dbc634ecf..854d9366a745 100644
@@ -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
author maintainer
#3 lore raw

PATCH v2 3/8 firmware: cs_dsp: Support DSPs that don't require firmware download

In reply to Richard Fitzgerald

From: 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
index 97b73a254380..513136a924cf 100644
@@ -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
author maintainer
#4 lore raw

PATCH v2 4/8 ASoC: wm_adsp: Support DSPs that don't require firmware download

In reply to Richard Fitzgerald

From: 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
index 854d9366a745..8176b6173de9 100644
@@ -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
index dc2f7a096e26..173dcae2c260 100644
@@ -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
author maintainer
#5 lore raw

PATCH v2 5/8 ASoC: wm_adsp: Expose the DSP boot work actions as wm_adsp_power_up()

In reply to Richard Fitzgerald

From: 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
index 8176b6173de9..d4bffa2f7005 100644
@@ -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
index 173dcae2c260..769904d34a87 100644
@@ -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
author maintainer
#6 lore raw

PATCH v2 6/8 ASoC: wm_adsp: Add support for loading bin files without wmfw

In reply to Richard Fitzgerald

From: 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
index d4bffa2f7005..c23c306dc38d 100644
@@ -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
author maintainer
#7 lore raw

PATCH v2 7/8 ASoC: wm_adsp: Simplify the logging of requested firmware files

In reply to Richard Fitzgerald

From: 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
index c23c306dc38d..216120b68b64 100644
@@ -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
author maintainer
#8 lore raw

PATCH v2 8/8 ASoC: cs35l56: Add driver for Cirrus Logic CS35L56

In reply to Richard Fitzgerald

The 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          |   34 +
 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, 2931 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
index 02fe90adf0af..e52938f962b5 100644
@@ -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 +34 -0
index 07747565c3b5..c1d4418788f9 100644
@@ -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,35 @@ 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
+	select SERIAL_MULTI_INSTANTIATE
+	select REGMAP_I2C
+	select SND_SOC_CS35L56
+	select SND_SOC_CS35L56_SHARED
+
+config SND_SOC_CS35L56_SPI
+	tristate "Cirrus Logic CS35L56 CODEC (SPI)"
+	depends on SPI_MASTER
+	select SERIAL_MULTI_INSTANTIATE
+	select REGMAP_SPI
+	select SND_SOC_CS35L56
+	select SND_SOC_CS35L56_SHARED
+
+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
+
 config SND_SOC_CS42L42_CORE
 	tristate
 
sound/soc/codecs/Makefile +10 -0
index f1ca18f7946c..25ebce58a0ba 100644
@@ -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
#9 lore raw

PATCH v2 1/8 firmware: cs_dsp: Introduce no_core_startstop for self-booting DSPs

In reply to Richard Fitzgerald

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
index f558b390fbfe..97b73a254380 100644
@@ -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
index cad828e21c72..29cd11d5a3cf 100644
@@ -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
#10 lore raw

PATCH v2 2/8 ASoC: wm_adsp: Use no_core_startstop to prevent creating preload control

In reply to Richard Fitzgerald

From: 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
index ea0dbc634ecf..854d9366a745 100644
@@ -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
#11 lore raw

PATCH v2 3/8 firmware: cs_dsp: Support DSPs that don't require firmware download

In reply to Richard Fitzgerald

From: 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
index 97b73a254380..513136a924cf 100644
@@ -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
#12 lore raw

PATCH v2 4/8 ASoC: wm_adsp: Support DSPs that don't require firmware download

In reply to Richard Fitzgerald

From: 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
index 854d9366a745..8176b6173de9 100644
@@ -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
index dc2f7a096e26..173dcae2c260 100644
@@ -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
#13 lore raw

PATCH v2 5/8 ASoC: wm_adsp: Expose the DSP boot work actions as wm_adsp_power_up()

In reply to Richard Fitzgerald

From: 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
index 8176b6173de9..d4bffa2f7005 100644
@@ -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
index 173dcae2c260..769904d34a87 100644
@@ -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
#14 lore raw

PATCH v2 6/8 ASoC: wm_adsp: Add support for loading bin files without wmfw

In reply to Richard Fitzgerald

From: 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
index d4bffa2f7005..c23c306dc38d 100644
@@ -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
#15 lore raw

PATCH v2 7/8 ASoC: wm_adsp: Simplify the logging of requested firmware files

In reply to Richard Fitzgerald

From: 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
index c23c306dc38d..216120b68b64 100644
@@ -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
#16 lore raw

PATCH v2 8/8 ASoC: cs35l56: Add driver for Cirrus Logic CS35L56

In reply to Richard Fitzgerald

The 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          |   34 +
 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, 2931 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
index 02fe90adf0af..e52938f962b5 100644
@@ -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 +34 -0
index 07747565c3b5..c1d4418788f9 100644
@@ -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,35 @@ 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
+	select SERIAL_MULTI_INSTANTIATE
+	select REGMAP_I2C
+	select SND_SOC_CS35L56
+	select SND_SOC_CS35L56_SHARED
+
+config SND_SOC_CS35L56_SPI
+	tristate "Cirrus Logic CS35L56 CODEC (SPI)"
+	depends on SPI_MASTER
+	select SERIAL_MULTI_INSTANTIATE
+	select REGMAP_SPI
+	select SND_SOC_CS35L56
+	select SND_SOC_CS35L56_SHARED
+
+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
+
 config SND_SOC_CS42L42_CORE
 	tristate
 
sound/soc/codecs/Makefile +10 -0
index f1ca18f7946c..25ebce58a0ba 100644
@@ -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
#17 lore raw

Re: [PATCH v2 8/8] ASoC: cs35l56: Add driver for Cirrus Logic CS35L56

Thank you for the patch! Yet something to improve:

Hi Richard,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on broonie-sound/for-next]
[also build test ERROR on linus/master v6.3-rc2 next-20230316] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Richard-Fitzgerald-via-Alsa-devel/ASoC-wm_adsp-Use-no_core_startstop-to-prevent-creating-preload-control/20230313-235605
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
patch link:    https://lore.kernel.org/r/167872265923.26.336497278776737619%40mailman-core.alsa-project.org
patch subject: [PATCH v2 8/8] ASoC: cs35l56: Add driver for Cirrus Logic CS35L56
config: s390-randconfig-r044-20230313 (https://download.01.org/0day-ci/archive/20230317/[email protected]/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install s390 cross compiling tool for clang build
# apt-get install binutils-s390x-linux-gnu
# https://github.com/intel-lab-lkp/linux/commit/5856c94d659f9c9963f5c37762cf201e1f1765e9
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Richard-Fitzgerald-via-Alsa-devel/ASoC-wm_adsp-Use-no_core_startstop-to-prevent-creating-preload-control/20230313-235605 git checkout 5856c94d659f9c9963f5c37762cf201e1f1765e9
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

s390x-linux-ld: sound/soc/codecs/cs35l56.o: in function `cs35l56_dsp_work':

>> sound/soc/codecs/cs35l56.c:887: undefined reference to `sdw_write_no_pm'
>> s390x-linux-ld: sound/soc/codecs/cs35l56.c:888: undefined reference to `sdw_read_no_pm'
>> s390x-linux-ld: sound/soc/codecs/cs35l56.c:889: undefined reference to `sdw_write_no_pm'
   s390x-linux-ld: sound/soc/codecs/cs35l56.c:953: undefined reference to `sdw_write_no_pm'
   s390x-linux-ld: sound/soc/codecs/cs35l56.o: in function `cs35l56_sdw_dai_hw_params':
>> sound/soc/codecs/cs35l56.c:710: undefined reference to `sdw_stream_add_slave'
   s390x-linux-ld: sound/soc/codecs/cs35l56.o: in function `cs35l56_sdw_dai_hw_free':
>> sound/soc/codecs/cs35l56.c:729: undefined reference to `sdw_stream_remove_slave'

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for SERIAL_MULTI_INSTANTIATE Depends on [n]: X86_PLATFORM_DEVICES [=n] && I2C [=y] && SPI [=y] && ACPI Selected by [y]:
- SND_SOC_CS35L56_I2C [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && I2C [=y]
- SND_SOC_CS35L56_SPI [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && SPI_MASTER [=y]

vim +887 sound/soc/codecs/cs35l56.c

668
669 static int cs35l56_sdw_dai_hw_params(struct snd_pcm_substream *substream,
670 struct snd_pcm_hw_params *params,
671 struct snd_soc_dai *dai)
672 {
673 struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(dai->component);
674 struct sdw_stream_runtime *sdw_stream = snd_soc_dai_get_dma_data(dai, substream);
675 struct sdw_stream_config sconfig;
676 struct sdw_port_config pconfig;
677 int ret;
678
679 dev_dbg(cs35l56->dev, "%s: rate %d\n", __func__, params_rate(params));
680
681 if (!cs35l56->init_done)
682 return -ENODEV;
683
684 if (!sdw_stream)
685 return -EINVAL;
686
687 memset(&sconfig, 0, sizeof(sconfig));
688 memset(&pconfig, 0, sizeof(pconfig));
689
690 sconfig.frame_rate = params_rate(params);
691 sconfig.bps = snd_pcm_format_width(params_format(params));
692
693 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
694 sconfig.direction = SDW_DATA_DIR_RX;
695 pconfig.num = CS35L56_SDW1_PLAYBACK_PORT;
696 pconfig.ch_mask = cs35l56->rx_mask;
697 } else {
698 sconfig.direction = SDW_DATA_DIR_TX;
699 pconfig.num = CS35L56_SDW1_CAPTURE_PORT;
700 pconfig.ch_mask = cs35l56->tx_mask;
701 }
702
703 if (pconfig.ch_mask == 0) {
704 sconfig.ch_count = params_channels(params);
705 pconfig.ch_mask = GENMASK(sconfig.ch_count - 1, 0);
706 } else {
707 sconfig.ch_count = hweight32(pconfig.ch_mask);
708 }
709

 > 710		ret = sdw_stream_add_slave(cs35l56->sdw_peripheral, &sconfig, &pconfig,
   711					   1, sdw_stream);
   712		if (ret) {
   713			dev_err(dai->dev, "Failed to add sdw stream: %d\n", ret);
   714			return ret;
   715		}
   716	
   717		return 0;
   718	}
   719	
   720	static int cs35l56_sdw_dai_hw_free(struct snd_pcm_substream *substream,
   721					   struct snd_soc_dai *dai)
   722	{
   723		struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(dai->component);
   724		struct sdw_stream_runtime *sdw_stream = snd_soc_dai_get_dma_data(dai, substream);
   725	
   726		if (!cs35l56->sdw_peripheral)
   727			return -EINVAL;
   728	
 > 729		sdw_stream_remove_slave(cs35l56->sdw_peripheral, sdw_stream);
   730	
   731		return 0;
   732	}
   733	
   734	static int cs35l56_sdw_dai_set_stream(struct snd_soc_dai *dai,
   735					      void *sdw_stream, int direction)
   736	{
   737		if (!sdw_stream)
   738			return 0;
   739	
   740		snd_soc_dai_dma_data_set(dai, direction, sdw_stream);
   741	
   742		return 0;
   743	}
   744	
   745	static const struct snd_soc_dai_ops cs35l56_sdw_dai_ops = {
   746		.set_tdm_slot = cs35l56_sdw_dai_set_tdm_slot,
   747		.shutdown = cs35l56_sdw_dai_shutdown,
   748		.hw_params = cs35l56_sdw_dai_hw_params,
   749		.hw_free = cs35l56_sdw_dai_hw_free,
   750		.mute_stream = cs35l56_mute_stream,
   751		.set_stream = cs35l56_sdw_dai_set_stream,
   752	};
   753	
   754	static struct snd_soc_dai_driver cs35l56_dai[] = {
   755		{
   756			.name = "cs35l56-asp1",
   757			.id = 0,
   758			.playback = {
   759				.stream_name = "ASP1 Playback",
   760				.channels_min = 1,
   761				.channels_max = 2,
   762				.rates = CS35L56_RATES,
   763				.formats = CS35L56_RX_FORMATS,
   764			},
   765			.capture = {
   766				.stream_name = "ASP1 Capture",
   767				.channels_min = 1,
   768				.channels_max = 4,
   769				.rates = CS35L56_RATES,
   770				.formats = CS35L56_TX_FORMATS,
   771			},
   772			.ops = &cs35l56_ops,
   773			.symmetric_rate = 1,
   774			.symmetric_sample_bits = 1,
   775		},
   776		{
   777			.name = "cs35l56-sdw1",
   778			.id = 1,
   779			.playback = {
   780				.stream_name = "SDW1 Playback",
   781				.channels_min = 1,
   782				.channels_max = 2,
   783				.rates = CS35L56_RATES,
   784				.formats = CS35L56_RX_FORMATS,
   785			},
   786			.capture = {
   787				.stream_name = "SDW1 Capture",
   788				.channels_min = 1,
   789				.channels_max = 6,
   790				.rates = CS35L56_RATES,
   791				.formats = CS35L56_TX_FORMATS,
   792			},
   793			.symmetric_rate = 1,
   794			.ops = &cs35l56_sdw_dai_ops,
   795		}
   796	};
   797	
   798	static int cs35l56_wait_for_firmware_boot(struct cs35l56_private *cs35l56)
   799	{
   800		unsigned int reg;
   801		unsigned int val;
   802		int ret;
   803	
   804		if (cs35l56->rev < CS35L56_REVID_B0)
   805			reg = CS35L56_DSP1_HALO_STATE_A1;
   806		else
   807			reg = CS35L56_DSP1_HALO_STATE;
   808	
   809		ret = regmap_read_poll_timeout(cs35l56->regmap, reg,
   810					       val,
   811					       (val < 0xFFFF) && (val >= CS35L56_HALO_STATE_BOOT_DONE),
   812					       CS35L56_HALO_STATE_POLL_US,
   813					       CS35L56_HALO_STATE_TIMEOUT_US);
   814	
   815		if ((ret < 0) && (ret != -ETIMEDOUT)) {
   816			dev_err(cs35l56->dev, "Failed to read HALO_STATE: %d\n", ret);
   817			return ret;
   818		}
   819	
   820		if ((ret == -ETIMEDOUT) || (val != CS35L56_HALO_STATE_BOOT_DONE)) {
   821			dev_err(cs35l56->dev, "Firmware boot fail: HALO_STATE=%#x\n", val);
   822			return -EIO;
   823		}
   824	
   825		return 0;
   826	}
   827	
   828	static const struct reg_sequence cs35l56_system_reset_seq[] = {
   829		REG_SEQ0(CS35L56_DSP_VIRTUAL1_MBOX_1, CS35L56_MBOX_CMD_SYSTEM_RESET),
   830	};
   831	
   832	static void cs35l56_system_reset(struct cs35l56_private *cs35l56)
   833	{
   834		cs35l56->soft_resetting = true;
   835	
   836		/*
   837		 * Must enter cache-only first so there can't be any more register
   838		 * accesses other than the controlled system reset sequence below.
   839		 */
   840		regcache_cache_only(cs35l56->regmap, true);
   841		regmap_multi_reg_write_bypassed(cs35l56->regmap,
   842						cs35l56_system_reset_seq,
   843						ARRAY_SIZE(cs35l56_system_reset_seq));
   844	
   845		/* On SoundWire the registers won't be accessible until it re-enumerates. */
   846		if (cs35l56->sdw_peripheral)
   847			return;
   848	
   849		usleep_range(CS35L56_CONTROL_PORT_READY_US, CS35L56_CONTROL_PORT_READY_US + 400);
   850		regcache_cache_only(cs35l56->regmap, false);
   851	}
   852	
   853	static void cs35l56_dsp_work(struct work_struct *work)
   854	{
   855		struct cs35l56_private *cs35l56 = container_of(work,
   856							       struct cs35l56_private,
   857							       dsp_work);
   858		unsigned int reg;
   859		unsigned int val;
   860		int ret = 0;
   861	
   862		if (!wait_for_completion_timeout(&cs35l56->init_completion,
   863						 msecs_to_jiffies(5000))) {
   864			dev_err(cs35l56->dev, "%s: init_completion timed out\n", __func__);
   865			goto complete;
   866		}
   867	
   868		if (!cs35l56->init_done || cs35l56->removing)
   869			goto complete;
   870	
   871		cs35l56->dsp.part = devm_kasprintf(cs35l56->dev, GFP_KERNEL, "cs35l56%s-%02x",
   872						   cs35l56->secured ? "s" : "", cs35l56->rev);
   873	
   874		if (!cs35l56->dsp.part)
   875			goto complete;
   876	
   877		pm_runtime_get_sync(cs35l56->dev);
   878	
   879		/*
   880		 * Disable SoundWire interrupts to prevent race with IRQ work.
   881		 * Setting sdw_irq_no_unmask prevents the handler re-enabling
   882		 * the SoundWire interrupt.
   883		 */
   884		if (cs35l56->sdw_peripheral) {
   885			cs35l56->sdw_irq_no_unmask = true;
   886			cancel_work_sync(&cs35l56->sdw_irq_work);
 > 887			sdw_write_no_pm(cs35l56->sdw_peripheral, CS35L56_SDW_GEN_INT_MASK_1, 0);
 > 888			sdw_read_no_pm(cs35l56->sdw_peripheral, CS35L56_SDW_GEN_INT_STAT_1);
 > 889			sdw_write_no_pm(cs35l56->sdw_peripheral, CS35L56_SDW_GEN_INT_STAT_1, 0xFF);
   890		}
   891	
   892		ret = cs35l56_mbox_send(cs35l56, CS35L56_MBOX_CMD_SHUTDOWN);
   893		if (ret) {
   894			dev_dbg(cs35l56->dev, "%s: CS35L56_MBOX_CMD_SHUTDOWN ret %d\n", __func__, ret);
   895			goto err;
   896		}
   897	
   898		if (cs35l56->rev < CS35L56_REVID_B0)
   899			reg = CS35L56_DSP1_PM_CUR_STATE_A1;
   900		else
   901			reg = CS35L56_DSP1_PM_CUR_STATE;
   902	
   903		ret = regmap_read_poll_timeout(cs35l56->regmap, reg,
   904					       val, (val == CS35L56_HALO_STATE_SHUTDOWN),
   905					       CS35L56_HALO_STATE_POLL_US,
   906					       CS35L56_HALO_STATE_TIMEOUT_US);

907 if (ret < 0)
908 dev_err(cs35l56->dev, "Failed to poll PM_CUR_STATE to 1 is %d (ret %d)\n",
909 val, ret);
910
911 /* Use wm_adsp to load and apply the firmware patch and coefficient files */
912 ret = wm_adsp_power_up(&cs35l56->dsp);
913 if (ret) {
914 dev_dbg(cs35l56->dev, "%s: wm_adsp_power_up ret %d\n", __func__, ret);
915 goto err;
916 }
917
918 if (cs35l56->removing)
919 goto err;
920
921 mutex_lock(&cs35l56->irq_lock);
922
923 init_completion(&cs35l56->init_completion);
924
925 cs35l56_system_reset(cs35l56);
926
927 if (cs35l56->sdw_peripheral) {
928 /*
929 * The system-reset causes the CS35L56 to detach from the bus.
930 * Wait for the manager to re-enumerate the CS35L56 and
931 * cs35l56_init() to run again.
932 */
933 if (!wait_for_completion_timeout(&cs35l56->init_completion,
934 msecs_to_jiffies(5000))) {
935 dev_err(cs35l56->dev, "%s: init_completion timed out (SDW)\n", __func__);
936 goto err_unlock;
937 }
938 } else if (cs35l56_init(cs35l56)) {
939 goto err_unlock;
940 }
941
942 cs35l56->fw_patched = true;
943
944 err_unlock:
945 mutex_unlock(&cs35l56->irq_lock);
946 err:
947 pm_runtime_mark_last_busy(cs35l56->dev);
948 pm_runtime_put_autosuspend(cs35l56->dev);
949
950 /* Re-enable SoundWire interrupts */
951 if (cs35l56->sdw_peripheral) {
952 cs35l56->sdw_irq_no_unmask = false;
953 sdw_write_no_pm(cs35l56->sdw_peripheral, CS35L56_SDW_GEN_INT_MASK_1,
954 CS35L56_SDW_INT_MASK_CODEC_IRQ);
955 }
956
957 complete:
958 complete_all(&cs35l56->dsp_ready_completion);
959 }
960

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
author maintainer
#18 lore raw

Re: [PATCH v2 8/8] ASoC: cs35l56: Add driver for Cirrus Logic CS35L56

Quoted 36 lines · kernel test robot

Hi Richard,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on broonie-sound/for-next]
[also build test ERROR on linus/master v6.3-rc2 next-20230316] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Richard-Fitzgerald-via-Alsa-devel/ASoC-wm_adsp-Use-no_core_startstop-to-prevent-creating-preload-control/20230313-235605
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
patch link:    https://lore.kernel.org/r/167872265923.26.336497278776737619%40mailman-core.alsa-project.org
patch subject: [PATCH v2 8/8] ASoC: cs35l56: Add driver for Cirrus Logic CS35L56
config: s390-randconfig-r044-20230313 (https://download.01.org/0day-ci/archive/20230317/[email protected]/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install s390 cross compiling tool for clang build
# apt-get install binutils-s390x-linux-gnu
# https://github.com/intel-lab-lkp/linux/commit/5856c94d659f9c9963f5c37762cf201e1f1765e9
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Richard-Fitzgerald-via-Alsa-devel/ASoC-wm_adsp-Use-no_core_startstop-to-prevent-creating-preload-control/20230313-235605 git checkout 5856c94d659f9c9963f5c37762cf201e1f1765e9
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

Quoted 10 lines
    s390x-linux-ld: sound/soc/codecs/cs35l56.o: in function `cs35l56_dsp_work':
Quoted 3 lines
Quoted 3 lines

sound/soc/codecs/cs35l56.c:887: undefined reference to `sdw_write_no_pm'
s390x-linux-ld: sound/soc/codecs/cs35l56.c:888: undefined reference to `sdw_read_no_pm'
s390x-linux-ld: sound/soc/codecs/cs35l56.c:889: undefined reference to `sdw_write_no_pm'

    s390x-linux-ld: sound/soc/codecs/cs35l56.c:953: undefined reference to `sdw_write_no_pm'
    s390x-linux-ld: sound/soc/codecs/cs35l56.o: in function `cs35l56_sdw_dai_hw_params':
Quoted 1 line
Quoted 1 line

sound/soc/codecs/cs35l56.c:710: undefined reference to `sdw_stream_add_slave'

    s390x-linux-ld: sound/soc/codecs/cs35l56.o: in function `cs35l56_sdw_dai_hw_free':
Quoted 1 line
Quoted 1 line

sound/soc/codecs/cs35l56.c:729: undefined reference to `sdw_stream_remove_slave'

I don't understand what's happened here. include/linux/soundwire/sdw.h provides inline dummy versions of these functions if !IS_ENABLED(CONFIG_SOUNDWIRE) so how can they be undefined reference?

#19 lore raw

Re: [PATCH v2 8/8] ASoC: cs35l56: Add driver for Cirrus Logic CS35L56

Quoted 44 lines · Richard Fitzgerald
Quoted 43 lines · kernel test robot

Hi Richard,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on broonie-sound/for-next]
[also build test ERROR on linus/master v6.3-rc2 next-20230316] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Richard-Fitzgerald-via-Alsa-devel/ASoC-wm_adsp-Use-no_core_startstop-to-prevent-creating-preload-control/20230313-235605
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
patch link:    https://lore.kernel.org/r/167872265923.26.336497278776737619%40mailman-core.alsa-project.org
patch subject: [PATCH v2 8/8] ASoC: cs35l56: Add driver for Cirrus Logic CS35L56
config: s390-randconfig-r044-20230313 (https://download.01.org/0day-ci/archive/20230317/[email protected]/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
reproduce (this is a W=1 build):
         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
         chmod +x ~/bin/make.cross
         # install s390 cross compiling tool for clang build
         # apt-get install binutils-s390x-linux-gnu
         # https://github.com/intel-lab-lkp/linux/commit/5856c94d659f9c9963f5c37762cf201e1f1765e9
         git remote add linux-review https://github.com/intel-lab-lkp/linux
         git fetch --no-tags linux-review Richard-Fitzgerald-via-Alsa-devel/ASoC-wm_adsp-Use-no_core_startstop-to-prevent-creating-preload-control/20230313-235605
         git checkout 5856c94d659f9c9963f5c37762cf201e1f1765e9
         # save the config file
         mkdir build_dir && cp config build_dir/.config
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 olddefconfig
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

    s390x-linux-ld: sound/soc/codecs/cs35l56.o: in function `cs35l56_dsp_work':

Quoted 3 lines
Quoted 3 lines

sound/soc/codecs/cs35l56.c:887: undefined reference to `sdw_write_no_pm'
s390x-linux-ld: sound/soc/codecs/cs35l56.c:888: undefined reference to `sdw_read_no_pm'
s390x-linux-ld: sound/soc/codecs/cs35l56.c:889: undefined reference to `sdw_write_no_pm'

    s390x-linux-ld: sound/soc/codecs/cs35l56.c:953: undefined reference to `sdw_write_no_pm'
    s390x-linux-ld: sound/soc/codecs/cs35l56.o: in function `cs35l56_sdw_dai_hw_params':

Quoted 1 line
Quoted 1 line

sound/soc/codecs/cs35l56.c:710: undefined reference to `sdw_stream_add_slave'

Quoted 8 lines
Quoted 3 lines

    s390x-linux-ld: sound/soc/codecs/cs35l56.o: in function `cs35l56_sdw_dai_hw_free':

Quoted 1 line
Quoted 1 line

sound/soc/codecs/cs35l56.c:729: undefined reference to `sdw_stream_remove_slave'

I don't understand what's happened here. include/linux/soundwire/sdw.h provides inline dummy versions of these functions if !IS_ENABLED(CONFIG_SOUNDWIRE) so how can they be undefined reference?

Oh, I see it now.
CONFIG_SOUNDWIRE=m but CONFIG_SND_SOC_CS35L56=y so it can't link.

author maintainer
#20 lore raw

Re: [PATCH v2 8/8] ASoC: cs35l56: Add driver for Cirrus Logic CS35L56

In reply to Richard Fitzgerald
Quoted 44 lines · Richard Fitzgerald
Quoted 43 lines · kernel test robot

Hi Richard,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on broonie-sound/for-next]
[also build test ERROR on linus/master v6.3-rc2 next-20230316] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Richard-Fitzgerald-via-Alsa-devel/ASoC-wm_adsp-Use-no_core_startstop-to-prevent-creating-preload-control/20230313-235605
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
patch link:    https://lore.kernel.org/r/167872265923.26.336497278776737619%40mailman-core.alsa-project.org
patch subject: [PATCH v2 8/8] ASoC: cs35l56: Add driver for Cirrus Logic CS35L56
config: s390-randconfig-r044-20230313 (https://download.01.org/0day-ci/archive/20230317/[email protected]/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
reproduce (this is a W=1 build):
         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
         chmod +x ~/bin/make.cross
         # install s390 cross compiling tool for clang build
         # apt-get install binutils-s390x-linux-gnu
         # https://github.com/intel-lab-lkp/linux/commit/5856c94d659f9c9963f5c37762cf201e1f1765e9
         git remote add linux-review https://github.com/intel-lab-lkp/linux
         git fetch --no-tags linux-review Richard-Fitzgerald-via-Alsa-devel/ASoC-wm_adsp-Use-no_core_startstop-to-prevent-creating-preload-control/20230313-235605
         git checkout 5856c94d659f9c9963f5c37762cf201e1f1765e9
         # save the config file
         mkdir build_dir && cp config build_dir/.config
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 olddefconfig
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

    s390x-linux-ld: sound/soc/codecs/cs35l56.o: in function `cs35l56_dsp_work':

Quoted 3 lines
Quoted 3 lines

sound/soc/codecs/cs35l56.c:887: undefined reference to `sdw_write_no_pm'
s390x-linux-ld: sound/soc/codecs/cs35l56.c:888: undefined reference to `sdw_read_no_pm'
s390x-linux-ld: sound/soc/codecs/cs35l56.c:889: undefined reference to `sdw_write_no_pm'

    s390x-linux-ld: sound/soc/codecs/cs35l56.c:953: undefined reference to `sdw_write_no_pm'
    s390x-linux-ld: sound/soc/codecs/cs35l56.o: in function `cs35l56_sdw_dai_hw_params':

Quoted 1 line
Quoted 1 line

sound/soc/codecs/cs35l56.c:710: undefined reference to `sdw_stream_add_slave'

Quoted 8 lines
Quoted 3 lines

    s390x-linux-ld: sound/soc/codecs/cs35l56.o: in function `cs35l56_sdw_dai_hw_free':

Quoted 1 line
Quoted 1 line

sound/soc/codecs/cs35l56.c:729: undefined reference to `sdw_stream_remove_slave'

I don't understand what's happened here. include/linux/soundwire/sdw.h provides inline dummy versions of these functions if !IS_ENABLED(CONFIG_SOUNDWIRE) so how can they be undefined reference?

Oh, I see it now.
CONFIG_SOUNDWIRE=m but CONFIG_SND_SOC_CS35L56=y so it can't link.

#21 lore raw

Re: [PATCH v2 8/8] ASoC: cs35l56: Add driver for Cirrus Logic CS35L56

In reply to kernel test robot
Quoted 36 lines · kernel test robot

Hi Richard,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on broonie-sound/for-next]
[also build test ERROR on linus/master v6.3-rc2 next-20230316] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Richard-Fitzgerald-via-Alsa-devel/ASoC-wm_adsp-Use-no_core_startstop-to-prevent-creating-preload-control/20230313-235605
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
patch link:    https://lore.kernel.org/r/167872265923.26.336497278776737619%40mailman-core.alsa-project.org
patch subject: [PATCH v2 8/8] ASoC: cs35l56: Add driver for Cirrus Logic CS35L56
config: s390-randconfig-r044-20230313 (https://download.01.org/0day-ci/archive/20230317/[email protected]/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install s390 cross compiling tool for clang build
# apt-get install binutils-s390x-linux-gnu
# https://github.com/intel-lab-lkp/linux/commit/5856c94d659f9c9963f5c37762cf201e1f1765e9
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Richard-Fitzgerald-via-Alsa-devel/ASoC-wm_adsp-Use-no_core_startstop-to-prevent-creating-preload-control/20230313-235605 git checkout 5856c94d659f9c9963f5c37762cf201e1f1765e9
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

Quoted 10 lines
    s390x-linux-ld: sound/soc/codecs/cs35l56.o: in function `cs35l56_dsp_work':
Quoted 3 lines
Quoted 3 lines

sound/soc/codecs/cs35l56.c:887: undefined reference to `sdw_write_no_pm'
s390x-linux-ld: sound/soc/codecs/cs35l56.c:888: undefined reference to `sdw_read_no_pm'
s390x-linux-ld: sound/soc/codecs/cs35l56.c:889: undefined reference to `sdw_write_no_pm'

    s390x-linux-ld: sound/soc/codecs/cs35l56.c:953: undefined reference to `sdw_write_no_pm'
    s390x-linux-ld: sound/soc/codecs/cs35l56.o: in function `cs35l56_sdw_dai_hw_params':
Quoted 1 line
Quoted 1 line

sound/soc/codecs/cs35l56.c:710: undefined reference to `sdw_stream_add_slave'

    s390x-linux-ld: sound/soc/codecs/cs35l56.o: in function `cs35l56_sdw_dai_hw_free':
Quoted 1 line
Quoted 1 line

sound/soc/codecs/cs35l56.c:729: undefined reference to `sdw_stream_remove_slave'

I don't understand what's happened here. include/linux/soundwire/sdw.h provides inline dummy versions of these functions if !IS_ENABLED(CONFIG_SOUNDWIRE) so how can they be undefined reference?

#22 lore raw

Re: [PATCH v2 8/8] ASoC: cs35l56: Add driver for Cirrus Logic CS35L56

In reply to Richard Fitzgerald via Alsa-devel
Thank you for the patch! Yet something to improve:

Hi Richard,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on broonie-sound/for-next]
[also build test ERROR on linus/master v6.3-rc2 next-20230316] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Richard-Fitzgerald-via-Alsa-devel/ASoC-wm_adsp-Use-no_core_startstop-to-prevent-creating-preload-control/20230313-235605
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
patch link:    https://lore.kernel.org/r/167872265923.26.336497278776737619%40mailman-core.alsa-project.org
patch subject: [PATCH v2 8/8] ASoC: cs35l56: Add driver for Cirrus Logic CS35L56
config: x86_64-buildonly-randconfig-r004-20230313 (https://download.01.org/0day-ci/archive/20230317/[email protected]/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/5856c94d659f9c9963f5c37762cf201e1f1765e9
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Richard-Fitzgerald-via-Alsa-devel/ASoC-wm_adsp-Use-no_core_startstop-to-prevent-creating-preload-control/20230313-235605
        git checkout 5856c94d659f9c9963f5c37762cf201e1f1765e9
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 olddefconfig
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/platform/x86/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All error/warnings (new ones prefixed by >>):

drivers/platform/x86/serial-multi-instantiate.c: In function 'smi_spi_probe':

>> drivers/platform/x86/serial-multi-instantiate.c:98:15: error: implicit declaration of function 'acpi_spi_count_resources'; did you mean 'acpi_set_current_resources'? [-Werror=implicit-function-declaration]
      98 |         ret = acpi_spi_count_resources(adev);
         |               ^~~~~~~~~~~~~~~~~~~~~~~~
         |               acpi_set_current_resources
>> drivers/platform/x86/serial-multi-instantiate.c:112:27: error: implicit declaration of function 'acpi_spi_device_alloc' [-Werror=implicit-function-declaration]
     112 |                 spi_dev = acpi_spi_device_alloc(NULL, adev, i);
         |                           ^~~~~~~~~~~~~~~~~~~~~
>> drivers/platform/x86/serial-multi-instantiate.c:112:25: warning: assignment to 'struct spi_device *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     112 |                 spi_dev = acpi_spi_device_alloc(NULL, adev, i);
         |                         ^
>> drivers/platform/x86/serial-multi-instantiate.c:115:59: error: invalid use of undefined type 'struct acpi_device'
     115 |                                             dev_name(&adev->dev));
         |                                                           ^~
   drivers/platform/x86/serial-multi-instantiate.c:137:53: error: invalid use of undefined type 'struct acpi_device'
     137 |                                       dev_name(&adev->dev));
         |                                                     ^~

cc1: some warnings being treated as errors

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for SERIAL_MULTI_INSTANTIATE Depends on [n]: X86_PLATFORM_DEVICES [=n] && I2C [=y] && SPI [=y] && ACPI [=n] Selected by [y]:
- SND_SOC_CS35L56_I2C [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && I2C [=y]
- SND_SOC_CS35L56_SPI [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && SPI_MASTER [=y]

vim +112 drivers/platform/x86/serial-multi-instantiate.c

68f201f9061c000 Stefan Binding  2022-01-21   79  
68f201f9061c000 Stefan Binding  2022-01-21   80  /**
68f201f9061c000 Stefan Binding  2022-01-21   81   * smi_spi_probe - Instantiate multiple SPI devices from inst array
68f201f9061c000 Stefan Binding  2022-01-21   82   * @pdev:	Platform device
68f201f9061c000 Stefan Binding  2022-01-21   83   * @smi:	Internal struct for Serial multi instantiate driver
68f201f9061c000 Stefan Binding  2022-01-21   84   * @inst_array:	Array of instances to probe
68f201f9061c000 Stefan Binding  2022-01-21   85   *
68f201f9061c000 Stefan Binding  2022-01-21   86   * Returns the number of SPI devices instantiate, Zero if none is found or a negative error code.
68f201f9061c000 Stefan Binding  2022-01-21   87   */
8b50c48d59a9cd0 Andy Shevchenko 2022-07-10   88  static int smi_spi_probe(struct platform_device *pdev, struct smi *smi,
68f201f9061c000 Stefan Binding  2022-01-21   89  			 const struct smi_instance *inst_array)
68f201f9061c000 Stefan Binding  2022-01-21   90  {
68f201f9061c000 Stefan Binding  2022-01-21   91  	struct device *dev = &pdev->dev;
8b50c48d59a9cd0 Andy Shevchenko 2022-07-10   92  	struct acpi_device *adev = ACPI_COMPANION(dev);
68f201f9061c000 Stefan Binding  2022-01-21   93  	struct spi_controller *ctlr;
68f201f9061c000 Stefan Binding  2022-01-21   94  	struct spi_device *spi_dev;
68f201f9061c000 Stefan Binding  2022-01-21   95  	char name[50];
68f201f9061c000 Stefan Binding  2022-01-21   96  	int i, ret, count;
68f201f9061c000 Stefan Binding  2022-01-21   97  
68f201f9061c000 Stefan Binding  2022-01-21  @98  	ret = acpi_spi_count_resources(adev);
68f201f9061c000 Stefan Binding  2022-01-21   99  	if (ret < 0)
68f201f9061c000 Stefan Binding  2022-01-21  100  		return ret;
f3e13bbc6f5a84f Andy Shevchenko 2022-07-10  101  	if (!ret)
2b5b27826a48eea Andy Shevchenko 2022-07-10  102  		return -ENOENT;
68f201f9061c000 Stefan Binding  2022-01-21  103  
68f201f9061c000 Stefan Binding  2022-01-21  104  	count = ret;
68f201f9061c000 Stefan Binding  2022-01-21  105  
68f201f9061c000 Stefan Binding  2022-01-21  106  	smi->spi_devs = devm_kcalloc(dev, count, sizeof(*smi->spi_devs), GFP_KERNEL);
68f201f9061c000 Stefan Binding  2022-01-21  107  	if (!smi->spi_devs)
68f201f9061c000 Stefan Binding  2022-01-21  108  		return -ENOMEM;
68f201f9061c000 Stefan Binding  2022-01-21  109  
68f201f9061c000 Stefan Binding  2022-01-21  110  	for (i = 0; i < count && inst_array[i].type; i++) {
68f201f9061c000 Stefan Binding  2022-01-21  111  
68f201f9061c000 Stefan Binding  2022-01-21 @112  		spi_dev = acpi_spi_device_alloc(NULL, adev, i);
68f201f9061c000 Stefan Binding  2022-01-21  113  		if (IS_ERR(spi_dev)) {
14a9aa99aca6c28 Andy Shevchenko 2022-07-10  114  			ret = dev_err_probe(dev, PTR_ERR(spi_dev), "failed to allocate SPI device %s from ACPI\n",
14a9aa99aca6c28 Andy Shevchenko 2022-07-10 @115  					    dev_name(&adev->dev));
68f201f9061c000 Stefan Binding  2022-01-21  116  			goto error;
68f201f9061c000 Stefan Binding  2022-01-21  117  		}
68f201f9061c000 Stefan Binding  2022-01-21  118  
68f201f9061c000 Stefan Binding  2022-01-21  119  		ctlr = spi_dev->controller;
68f201f9061c000 Stefan Binding  2022-01-21  120  
68f201f9061c000 Stefan Binding  2022-01-21  121  		strscpy(spi_dev->modalias, inst_array[i].type, sizeof(spi_dev->modalias));
68f201f9061c000 Stefan Binding  2022-01-21  122  
68f201f9061c000 Stefan Binding  2022-01-21  123  		ret = smi_get_irq(pdev, adev, &inst_array[i]);
68f201f9061c000 Stefan Binding  2022-01-21  124  		if (ret < 0) {
68f201f9061c000 Stefan Binding  2022-01-21  125  			spi_dev_put(spi_dev);
68f201f9061c000 Stefan Binding  2022-01-21  126  			goto error;
68f201f9061c000 Stefan Binding  2022-01-21  127  		}
68f201f9061c000 Stefan Binding  2022-01-21  128  		spi_dev->irq = ret;
68f201f9061c000 Stefan Binding  2022-01-21  129  
68f201f9061c000 Stefan Binding  2022-01-21  130  		snprintf(name, sizeof(name), "%s-%s-%s.%d", dev_name(&ctlr->dev), dev_name(dev),
68f201f9061c000 Stefan Binding  2022-01-21  131  			 inst_array[i].type, i);
68f201f9061c000 Stefan Binding  2022-01-21  132  		spi_dev->dev.init_name = name;
68f201f9061c000 Stefan Binding  2022-01-21  133  
68f201f9061c000 Stefan Binding  2022-01-21  134  		ret = spi_add_device(spi_dev);
68f201f9061c000 Stefan Binding  2022-01-21  135  		if (ret) {
14a9aa99aca6c28 Andy Shevchenko 2022-07-10  136  			dev_err_probe(&ctlr->dev, ret, "failed to add SPI device %s from ACPI\n",
14a9aa99aca6c28 Andy Shevchenko 2022-07-10  137  				      dev_name(&adev->dev));
68f201f9061c000 Stefan Binding  2022-01-21  138  			spi_dev_put(spi_dev);
68f201f9061c000 Stefan Binding  2022-01-21  139  			goto error;
68f201f9061c000 Stefan Binding  2022-01-21  140  		}
68f201f9061c000 Stefan Binding  2022-01-21  141  
68f201f9061c000 Stefan Binding  2022-01-21  142  		dev_dbg(dev, "SPI device %s using chip select %u", name, spi_dev->chip_select);
68f201f9061c000 Stefan Binding  2022-01-21  143  
68f201f9061c000 Stefan Binding  2022-01-21  144  		smi->spi_devs[i] = spi_dev;
68f201f9061c000 Stefan Binding  2022-01-21  145  		smi->spi_num++;
68f201f9061c000 Stefan Binding  2022-01-21  146  	}
68f201f9061c000 Stefan Binding  2022-01-21  147  
68f201f9061c000 Stefan Binding  2022-01-21  148  	if (smi->spi_num < count) {
68f201f9061c000 Stefan Binding  2022-01-21  149  		dev_dbg(dev, "Error finding driver, idx %d\n", i);
68f201f9061c000 Stefan Binding  2022-01-21  150  		ret = -ENODEV;
68f201f9061c000 Stefan Binding  2022-01-21  151  		goto error;
68f201f9061c000 Stefan Binding  2022-01-21  152  	}
68f201f9061c000 Stefan Binding  2022-01-21  153  
68f201f9061c000 Stefan Binding  2022-01-21  154  	dev_info(dev, "Instantiated %d SPI devices.\n", smi->spi_num);
68f201f9061c000 Stefan Binding  2022-01-21  155  
68f201f9061c000 Stefan Binding  2022-01-21  156  	return 0;
68f201f9061c000 Stefan Binding  2022-01-21  157  error:
68f201f9061c000 Stefan Binding  2022-01-21  158  	smi_devs_unregister(smi);
68f201f9061c000 Stefan Binding  2022-01-21  159  
68f201f9061c000 Stefan Binding  2022-01-21  160  	return ret;
35a36cbb7b1ce75 Lucas Tanure    2022-01-21  161  }
35a36cbb7b1ce75 Lucas Tanure    2022-01-21  162  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests