Skip to contentSkip to conversation

cs35l56: Log tuning unique identifiers during firmware load

PATCH In review Simon Trimmer 3 participants 6 messages May 13, 2025 – May 15, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover cs35l56: Log tuning unique identifiers during firmware load

These two patches introduce a log message when provisioning the cs35l56 family of devices that uniquely identifies the firmware tuning.

Simon Trimmer (2):
ASoC: cs35l56: Log tuning unique identifiers during firmware load
ALSA: hda: cs35l56: Log tuning unique identifiers during firmware load

 include/sound/cs35l56.h           |  1 +
 sound/pci/hda/cs35l56_hda.c       |  2 ++
 sound/soc/codecs/cs35l56-shared.c | 28 ++++++++++++++++++++++++++++
 sound/soc/codecs/cs35l56.c        |  1 +
 4 files changed, 32 insertions(+)
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/2 ALSA: hda: cs35l56: Log tuning unique identifiers during firmware load

The cs35l56 smart amplifier has some informational firmware controls that are populated by a tuning bin file to unique values - logging these during firmware load identifies the specific configuration being used on that device instance.

---
 sound/pci/hda/cs35l56_hda.c | 2 ++
 1 file changed, 2 insertions(+)
sound/pci/hda/cs35l56_hda.c +2 -0
index b6fecf119261..aed7d7284231 100644
@@ -676,6 +676,8 @@ static void cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56)
 	if (ret)
 		cs_dsp_stop(&cs35l56->cs_dsp);
 
+	cs35l56_log_tuning(&cs35l56->base, &cs35l56->cs_dsp);
+
 err_powered_up:
 	if (!cs35l56->base.fw_patched)
 		cs_dsp_power_down(&cs35l56->cs_dsp);
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/2 ASoC: cs35l56: Log tuning unique identifiers during firmware load

In reply to Simon Trimmer

The cs35l56 smart amplifier has some informational firmware controls that are populated by a tuning bin file to unique values - logging these during firmware load identifies the specific configuration being used on that device instance.

---
 include/sound/cs35l56.h           |  1 +
 sound/soc/codecs/cs35l56-shared.c | 28 ++++++++++++++++++++++++++++
 sound/soc/codecs/cs35l56.c        |  1 +
 3 files changed, 30 insertions(+)
include/sound/cs35l56.h +1 -0
index 63f2c63f7c59..e17c4cadd04d 100644
@@ -360,6 +360,7 @@ void cs35l56_init_cs_dsp(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_ds
 int cs35l56_get_calibration(struct cs35l56_base *cs35l56_base);
 int cs35l56_read_prot_status(struct cs35l56_base *cs35l56_base,
 			     bool *fw_missing, unsigned int *fw_version);
+void cs35l56_log_tuning(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp);
 int cs35l56_hw_init(struct cs35l56_base *cs35l56_base);
 int cs35l56_get_speaker_id(struct cs35l56_base *cs35l56_base);
 int cs35l56_get_bclk_freq_id(unsigned int freq);
sound/soc/codecs/cs35l56-shared.c +28 -0
index 7f768718b69b..d0831d609584 100644
@@ -909,6 +909,33 @@ int cs35l56_read_prot_status(struct cs35l56_base *cs35l56_base,
 }
 EXPORT_SYMBOL_NS_GPL(cs35l56_read_prot_status, "SND_SOC_CS35L56_SHARED");
 
+void cs35l56_log_tuning(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp)
+{
+	__be32 pid, sid, tid;
+	int ret;
+
+	scoped_guard(mutex, &cs_dsp->pwr_lock) {
+		ret = cs_dsp_coeff_read_ctrl(cs_dsp_get_ctl(cs_dsp, "AS_PRJCT_ID",
+							    WMFW_ADSP2_XM, 0x9f212),
+					     0, &pid, sizeof(pid));
+		if (!ret)
+			ret = cs_dsp_coeff_read_ctrl(cs_dsp_get_ctl(cs_dsp, "AS_CHNNL_ID",
+								    WMFW_ADSP2_XM, 0x9f212),
+						     0, &sid, sizeof(sid));
+		if (!ret)
+			ret = cs_dsp_coeff_read_ctrl(cs_dsp_get_ctl(cs_dsp, "AS_SNPSHT_ID",
+								    WMFW_ADSP2_XM, 0x9f212),
+						     0, &tid, sizeof(tid));
+	}
+
+	if (ret)
+		dev_warn(cs35l56_base->dev, "Can't read tuning IDs");
+	else
+		dev_info(cs35l56_base->dev, "Tuning PID: %#x, SID: %#x, TID: %#x\n",
+			 be32_to_cpu(pid), be32_to_cpu(sid), be32_to_cpu(tid));
+}
+EXPORT_SYMBOL_NS_GPL(cs35l56_log_tuning, "SND_SOC_CS35L56_SHARED");
+
 int cs35l56_hw_init(struct cs35l56_base *cs35l56_base)
 {
 	int ret;
@@ -1249,3 +1276,4 @@ MODULE_AUTHOR("Richard Fitzgerald <[email protected]>");
 MODULE_AUTHOR("Simon Trimmer <[email protected]>");
 MODULE_LICENSE("GPL");
 MODULE_IMPORT_NS("SND_SOC_CS_AMP_LIB");
+MODULE_IMPORT_NS("FW_CS_DSP");
sound/soc/codecs/cs35l56.c +1 -0
index cdb283ed938c..c78e4746e428 100644
@@ -847,6 +847,7 @@ static void cs35l56_dsp_work(struct work_struct *work)
 	else
 		cs35l56_patch(cs35l56, firmware_missing);
 
+	cs35l56_log_tuning(&cs35l56->base, &cs35l56->dsp.cs_dsp);
 err:
 	pm_runtime_mark_last_busy(cs35l56->base.dev);
 	pm_runtime_put_autosuspend(cs35l56->base.dev);
Signature · 1 line
2.43.0
maintainer
#3 lore raw

Re: [PATCH 2/2] ALSA: hda: cs35l56: Log tuning unique identifiers during firmware load

In reply to Simon Trimmer
Quoted 4 lines · Simon Trimmer

The cs35l56 smart amplifier has some informational firmware controls that are populated by a tuning bin file to unique values - logging these during firmware load identifies the specific configuration being used on that device instance.

Adding Takashi since this is an ALSA patch (and not deleting context for him), Takashi is this OK to go via ASoC?

As documented in submitting-patches.rst please send patches to the maintainers for the code you would like to change. The normal kernel workflow is that people apply patches from their inboxes, if they aren't copied they are likely to not see the patch at all and it is much more difficult to apply patches.

Quoted 22 lines
---
 sound/pci/hda/cs35l56_hda.c | 2 ++
 1 file changed, 2 insertions(+)
sound/pci/hda/cs35l56_hda.c +2 -0
index b6fecf119261..aed7d7284231 100644
@@ -676,6 +676,8 @@ static void cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56)
 	if (ret)
 		cs_dsp_stop(&cs35l56->cs_dsp);
 
+	cs35l56_log_tuning(&cs35l56->base, &cs35l56->cs_dsp);
+
 err_powered_up:
 	if (!cs35l56->base.fw_patched)
 		cs_dsp_power_down(&cs35l56->cs_dsp);
Signature · 1 line
2.43.0
Acked-by
#4 lore raw

Re: [PATCH 2/2] ALSA: hda: cs35l56: Log tuning unique identifiers during firmware load

Quoted 9 lines · Mark Brown
Quoted 4 lines · Simon Trimmer

The cs35l56 smart amplifier has some informational firmware controls that are populated by a tuning bin file to unique values - logging these during firmware load identifies the specific configuration being used on that device instance.

Adding Takashi since this is an ALSA patch (and not deleting context for him), Takashi is this OK to go via ASoC?

Sure, it's a simple logging, feel free to pick it up.

thanks,

Takashi

Quoted 29 lines

As documented in submitting-patches.rst please send patches to the maintainers for the code you would like to change. The normal kernel workflow is that people apply patches from their inboxes, if they aren't copied they are likely to not see the patch at all and it is much more difficult to apply patches.

Quoted 22 lines
---
 sound/pci/hda/cs35l56_hda.c | 2 ++
 1 file changed, 2 insertions(+)
sound/pci/hda/cs35l56_hda.c +2 -0
index b6fecf119261..aed7d7284231 100644
@@ -676,6 +676,8 @@ static void cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56)
 	if (ret)
 		cs_dsp_stop(&cs35l56->cs_dsp);
 
+	cs35l56_log_tuning(&cs35l56->base, &cs35l56->cs_dsp);
+
 err_powered_up:
 	if (!cs35l56->base.fw_patched)
 		cs_dsp_power_down(&cs35l56->cs_dsp);
Signature · 1 line
2.43.0

Verifying...

maintainer
#5 lore raw
In reply to Simon Trimmer
Quoted 8 lines · Simon Trimmer

These two patches introduce a log message when provisioning the cs35l56 family of devices that uniquely identifies the firmware tuning.

Simon Trimmer (2):
ASoC: cs35l56: Log tuning unique identifiers during firmware load
ALSA: hda: cs35l56: Log tuning unique identifiers during firmware load

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/2] ASoC: cs35l56: Log tuning unique identifiers during firmware load

      commit: 823a036f049f5ea4afc55a2bc2e7f80a1acdef4a
[2/2] ALSA: hda: cs35l56: Log tuning unique identifiers during firmware load
      commit: db13e3d58c682e0bfc08410e4961b23f4bdbc2e5

All 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