* [PATCH 1/4] ASoC: cs35l56: Remove SDW1 TX source controls and widgets
2026-11-20 11:04 [PATCH 0/4] ASoC: cs35l56: Prepare for SDCA Companion Amp Richard Fitzgerald
@ 2026-11-20 11:04 ` Richard Fitzgerald
2026-11-20 11:04 ` [PATCH 2/4] ASoC: cs35l56: Rename the DP3 DAI to cs35l56-ot127 Richard Fitzgerald
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Richard Fitzgerald @ 2026-11-20 11:04 UTC (permalink / raw)
To: broonie; +Cc: linux-sound, linux-kernel, patches
Remove the ALSA controls and mux widgets for the SDW1 capture DAI.
Connect this DAI to a dummy siggen source like the OT25 DAI. This is to
allow DP3 to be used for its intended purpose as the SDCA companion amp
output.
The implementation of this DAI was incorrect. It provided a capture DAI
for the SoundWire DP3 port. But DP4 (OT25 DAI) is the port for feedback
to the host.
The DP3 port is used for SDCA companion amp (OT127) and the mixer source
registers are owned by the firmware. The driver should not be writing to
them.
Nothing has ever used these ALSA controls so they can safely be removed.
The incorrect use of DP3 as the feedback to the host has already been
fixed in these commits:
commit 86c8360c97f6 ("ASoC: cs35l56: Add DAI for SDCA OT25 stream")
commit 4b7f393a01f8 ("ASoC: sdw_utils: Switch CS35L56/57/62/63 to use
OT25 DAI")
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
sound/soc/codecs/cs35l56-shared.c | 16 ----------
sound/soc/codecs/cs35l56.c | 51 ++-----------------------------
2 files changed, 2 insertions(+), 65 deletions(-)
diff --git a/sound/soc/codecs/cs35l56-shared.c b/sound/soc/codecs/cs35l56-shared.c
index 4d76f1777927..073f7bdd3b0d 100644
--- a/sound/soc/codecs/cs35l56-shared.c
+++ b/sound/soc/codecs/cs35l56-shared.c
@@ -49,14 +49,6 @@ int cs35l56_set_asp_defaults(struct cs35l56_base *cs35l56_base)
EXPORT_SYMBOL_NS_GPL(cs35l56_set_asp_defaults, "SND_SOC_CS35L56_SHARED");
static const struct reg_sequence cs35l56_patch[] = {
- /*
- * Firmware can change these to non-defaults to satisfy SDCA.
- * Ensure that they are at known defaults.
- */
- { CS35L56_SWIRE_DP3_CH1_INPUT, 0x00000018 },
- { CS35L56_SWIRE_DP3_CH2_INPUT, 0x00000019 },
- { CS35L56_SWIRE_DP3_CH3_INPUT, 0x00000029 },
- { CS35L56_SWIRE_DP3_CH4_INPUT, 0x00000028 },
{ CS35L56_IRQ1_MASK_18, 0x1f7df0ff },
};
@@ -105,10 +97,6 @@ int cs35l56_set_patch(struct cs35l56_base *cs35l56_base)
EXPORT_SYMBOL_NS_GPL(cs35l56_set_patch, "SND_SOC_CS35L56_SHARED");
static const struct reg_default cs35l56_reg_defaults[] = {
- { CS35L56_SWIRE_DP3_CH1_INPUT, 0x00000018 },
- { CS35L56_SWIRE_DP3_CH2_INPUT, 0x00000019 },
- { CS35L56_SWIRE_DP3_CH3_INPUT, 0x00000029 },
- { CS35L56_SWIRE_DP3_CH4_INPUT, 0x00000028 },
{ CS35L56_IRQ1_MASK_1, 0x83ffffff },
{ CS35L56_IRQ1_MASK_2, 0xffff7fff },
{ CS35L56_IRQ1_MASK_4, 0xe0ffffff },
@@ -121,10 +109,6 @@ static const struct reg_default cs35l56_reg_defaults[] = {
};
static const struct reg_default cs35l63_reg_defaults[] = {
- { CS35L56_SWIRE_DP3_CH1_INPUT, 0x00000018 },
- { CS35L56_SWIRE_DP3_CH2_INPUT, 0x00000019 },
- { CS35L56_SWIRE_DP3_CH3_INPUT, 0x00000029 },
- { CS35L56_SWIRE_DP3_CH4_INPUT, 0x00000028 },
{ CS35L56_IRQ1_MASK_1, 0x8003ffff },
{ CS35L56_IRQ1_MASK_2, 0xffff7fff },
{ CS35L56_IRQ1_MASK_4, 0xe0ffffff },
diff --git a/sound/soc/codecs/cs35l56.c b/sound/soc/codecs/cs35l56.c
index 30835dc56006..acb202559dff 100644
--- a/sound/soc/codecs/cs35l56.c
+++ b/sound/soc/codecs/cs35l56.c
@@ -267,42 +267,6 @@ static const struct snd_kcontrol_new asp1_tx4_mux =
SOC_DAPM_ENUM_EXT("ASP1TX4 SRC", cs35l56_asp1tx4_enum,
cs35l56_asp_tx_get, cs35l56_asp_tx_put);
-static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_sdw1tx1_enum,
- CS35L56_SWIRE_DP3_CH1_INPUT,
- 0, CS35L56_SWIRETXn_SRC_MASK,
- cs35l56_tx_input_texts,
- cs35l56_tx_input_values);
-
-static const struct snd_kcontrol_new sdw1_tx1_mux =
- SOC_DAPM_ENUM("SDW1TX1 SRC", cs35l56_sdw1tx1_enum);
-
-static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_sdw1tx2_enum,
- CS35L56_SWIRE_DP3_CH2_INPUT,
- 0, CS35L56_SWIRETXn_SRC_MASK,
- cs35l56_tx_input_texts,
- cs35l56_tx_input_values);
-
-static const struct snd_kcontrol_new sdw1_tx2_mux =
- SOC_DAPM_ENUM("SDW1TX2 SRC", cs35l56_sdw1tx2_enum);
-
-static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_sdw1tx3_enum,
- CS35L56_SWIRE_DP3_CH3_INPUT,
- 0, CS35L56_SWIRETXn_SRC_MASK,
- cs35l56_tx_input_texts,
- cs35l56_tx_input_values);
-
-static const struct snd_kcontrol_new sdw1_tx3_mux =
- SOC_DAPM_ENUM("SDW1TX3 SRC", cs35l56_sdw1tx3_enum);
-
-static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_sdw1tx4_enum,
- CS35L56_SWIRE_DP3_CH4_INPUT,
- 0, CS35L56_SWIRETXn_SRC_MASK,
- cs35l56_tx_input_texts,
- cs35l56_tx_input_values);
-
-static const struct snd_kcontrol_new sdw1_tx4_mux =
- SOC_DAPM_ENUM("SDW1TX4 SRC", cs35l56_sdw1tx4_enum);
-
static int cs35l56_play_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
@@ -407,11 +371,6 @@ static const struct snd_soc_dapm_widget cs35l56_dapm_widgets[] = {
SND_SOC_DAPM_MUX("ASP1 TX3 Source", SND_SOC_NOPM, 0, 0, &asp1_tx3_mux),
SND_SOC_DAPM_MUX("ASP1 TX4 Source", SND_SOC_NOPM, 0, 0, &asp1_tx4_mux),
- SND_SOC_DAPM_MUX("SDW1 TX1 Source", SND_SOC_NOPM, 0, 0, &sdw1_tx1_mux),
- SND_SOC_DAPM_MUX("SDW1 TX2 Source", SND_SOC_NOPM, 0, 0, &sdw1_tx2_mux),
- SND_SOC_DAPM_MUX("SDW1 TX3 Source", SND_SOC_NOPM, 0, 0, &sdw1_tx3_mux),
- SND_SOC_DAPM_MUX("SDW1 TX4 Source", SND_SOC_NOPM, 0, 0, &sdw1_tx4_mux),
-
SND_SOC_DAPM_SIGGEN("VMON ADC"),
SND_SOC_DAPM_SIGGEN("IMON ADC"),
SND_SOC_DAPM_SIGGEN("ERRVOL ADC"),
@@ -420,6 +379,7 @@ static const struct snd_soc_dapm_widget cs35l56_dapm_widgets[] = {
SND_SOC_DAPM_SIGGEN("VBSTMON ADC"),
SND_SOC_DAPM_SIGGEN("TEMPMON ADC"),
SND_SOC_DAPM_SIGGEN("OT25 Reference"),
+ SND_SOC_DAPM_SIGGEN("OT127 Source"),
SND_SOC_DAPM_INPUT("Calibrate"),
};
@@ -476,14 +436,7 @@ static const struct snd_soc_dapm_route cs35l56_audio_map[] = {
{ "ASP1 Capture", NULL, "ASP1TX3" },
{ "ASP1 Capture", NULL, "ASP1TX4" },
- CS35L56_SRC_ROUTE("SDW1 TX1")
- CS35L56_SRC_ROUTE("SDW1 TX2")
- CS35L56_SRC_ROUTE("SDW1 TX3")
- CS35L56_SRC_ROUTE("SDW1 TX4")
- { "SDW1 Capture", NULL, "SDW1 TX1 Source" },
- { "SDW1 Capture", NULL, "SDW1 TX2 Source" },
- { "SDW1 Capture", NULL, "SDW1 TX3 Source" },
- { "SDW1 Capture", NULL, "SDW1 TX4 Source" },
+ { "SDW1 Capture", NULL, "OT127 Source" },
{ "OT25", NULL, "OT25 Reference" },
};
--
2.47.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/4] ASoC: cs35l56: Rename the DP3 DAI to cs35l56-ot127
2026-11-20 11:04 [PATCH 0/4] ASoC: cs35l56: Prepare for SDCA Companion Amp Richard Fitzgerald
2026-11-20 11:04 ` [PATCH 1/4] ASoC: cs35l56: Remove SDW1 TX source controls and widgets Richard Fitzgerald
@ 2026-11-20 11:04 ` Richard Fitzgerald
2026-11-20 11:04 ` [PATCH 3/4] ASoC: cs35l56: Eliminate trivial regmap patch Richard Fitzgerald
2026-11-20 11:04 ` [PATCH 4/4] ASoC: cs35l56: Add test that probe() doesn't write SDW mux registers Richard Fitzgerald
3 siblings, 0 replies; 5+ messages in thread
From: Richard Fitzgerald @ 2026-11-20 11:04 UTC (permalink / raw)
To: broonie; +Cc: linux-sound, linux-kernel, patches
Rename the DAI for DP3 to cs35l56-ot127 to match its actual function as
the SDCA OT127 Companion Amp output (a type of codec-codec link).
The previous designation as "SDW1 Capture" was incorrect. It is not for
host capture and never has been (this function is on DP4).
The use of the old DAI name was already removed in previous
commit 4b7f393a01f8 ("ASoC: sdw_utils: Switch CS35L56/57/62/63 to use
OT25 DAI"), so there are no users of the old DAI name in the kernel.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
sound/soc/codecs/cs35l56.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/cs35l56.c b/sound/soc/codecs/cs35l56.c
index acb202559dff..439063084d4b 100644
--- a/sound/soc/codecs/cs35l56.c
+++ b/sound/soc/codecs/cs35l56.c
@@ -436,7 +436,7 @@ static const struct snd_soc_dapm_route cs35l56_audio_map[] = {
{ "ASP1 Capture", NULL, "ASP1TX3" },
{ "ASP1 Capture", NULL, "ASP1TX4" },
- { "SDW1 Capture", NULL, "OT127 Source" },
+ { "OT127", NULL, "OT127 Source" },
{ "OT25", NULL, "OT25 Reference" },
};
@@ -855,10 +855,10 @@ static struct snd_soc_dai_driver cs35l56_dai[] = {
.ops = &cs35l56_sdw_dai_ops,
},
{
- .name = "cs35l56-sdw1c",
+ .name = "cs35l56-ot127",
.id = 2,
.capture = {
- .stream_name = "SDW1 Capture",
+ .stream_name = "OT127",
.channels_min = 1,
.channels_max = 4,
.rates = CS35L56_RATES,
--
2.47.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/4] ASoC: cs35l56: Eliminate trivial regmap patch
2026-11-20 11:04 [PATCH 0/4] ASoC: cs35l56: Prepare for SDCA Companion Amp Richard Fitzgerald
2026-11-20 11:04 ` [PATCH 1/4] ASoC: cs35l56: Remove SDW1 TX source controls and widgets Richard Fitzgerald
2026-11-20 11:04 ` [PATCH 2/4] ASoC: cs35l56: Rename the DP3 DAI to cs35l56-ot127 Richard Fitzgerald
@ 2026-11-20 11:04 ` Richard Fitzgerald
2026-11-20 11:04 ` [PATCH 4/4] ASoC: cs35l56: Add test that probe() doesn't write SDW mux registers Richard Fitzgerald
3 siblings, 0 replies; 5+ messages in thread
From: Richard Fitzgerald @ 2026-11-20 11:04 UTC (permalink / raw)
To: broonie; +Cc: linux-sound, linux-kernel, patches
Previous commits removed most of the registers from the common
cs35l56_patch, leaving only one register in this patch. Move that single
register patch into the separate cs35l56 and cs35l63 patches and remove
the trivial common patch.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
sound/soc/codecs/cs35l56-shared.c | 28 +++++++---------------------
1 file changed, 7 insertions(+), 21 deletions(-)
diff --git a/sound/soc/codecs/cs35l56-shared.c b/sound/soc/codecs/cs35l56-shared.c
index 073f7bdd3b0d..34aebf81f4a4 100644
--- a/sound/soc/codecs/cs35l56-shared.c
+++ b/sound/soc/codecs/cs35l56-shared.c
@@ -50,16 +50,14 @@ EXPORT_SYMBOL_NS_GPL(cs35l56_set_asp_defaults, "SND_SOC_CS35L56_SHARED");
static const struct reg_sequence cs35l56_patch[] = {
{ CS35L56_IRQ1_MASK_18, 0x1f7df0ff },
-};
-
-static const struct reg_sequence cs35l56_patch_fw[] = {
/* These are not reset by a soft-reset, so patch to defaults. */
{ CS35L56_MAIN_RENDER_USER_MUTE, 0x00000000 },
{ CS35L56_MAIN_RENDER_USER_VOLUME, 0x00000000 },
{ CS35L56_MAIN_POSTURE_NUMBER, 0x00000000 },
};
-static const struct reg_sequence cs35l63_patch_fw[] = {
+static const struct reg_sequence cs35l63_patch[] = {
+ { CS35L56_IRQ1_MASK_18, 0x1f7df0ff },
/* These are not reset by a soft-reset, so patch to defaults. */
{ CS35L63_MAIN_RENDER_USER_MUTE, 0x00000000 },
{ CS35L63_MAIN_RENDER_USER_VOLUME, 0x00000000 },
@@ -68,31 +66,19 @@ static const struct reg_sequence cs35l63_patch_fw[] = {
int cs35l56_set_patch(struct cs35l56_base *cs35l56_base)
{
- int ret;
-
- ret = regmap_register_patch(cs35l56_base->regmap, cs35l56_patch,
- ARRAY_SIZE(cs35l56_patch));
- if (ret)
- return ret;
-
-
switch (cs35l56_base->type) {
case 0x54:
case 0x56:
case 0x57:
- ret = regmap_register_patch(cs35l56_base->regmap, cs35l56_patch_fw,
- ARRAY_SIZE(cs35l56_patch_fw));
- break;
+ return regmap_register_patch(cs35l56_base->regmap, cs35l56_patch,
+ ARRAY_SIZE(cs35l56_patch));
case 0x63:
case 0x62:
- ret = regmap_register_patch(cs35l56_base->regmap, cs35l63_patch_fw,
- ARRAY_SIZE(cs35l63_patch_fw));
- break;
+ return regmap_register_patch(cs35l56_base->regmap, cs35l63_patch,
+ ARRAY_SIZE(cs35l63_patch));
default:
- break;
+ return 0;
}
-
- return ret;
}
EXPORT_SYMBOL_NS_GPL(cs35l56_set_patch, "SND_SOC_CS35L56_SHARED");
--
2.47.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 4/4] ASoC: cs35l56: Add test that probe() doesn't write SDW mux registers
2026-11-20 11:04 [PATCH 0/4] ASoC: cs35l56: Prepare for SDCA Companion Amp Richard Fitzgerald
` (2 preceding siblings ...)
2026-11-20 11:04 ` [PATCH 3/4] ASoC: cs35l56: Eliminate trivial regmap patch Richard Fitzgerald
@ 2026-11-20 11:04 ` Richard Fitzgerald
3 siblings, 0 replies; 5+ messages in thread
From: Richard Fitzgerald @ 2026-11-20 11:04 UTC (permalink / raw)
To: broonie; +Cc: linux-sound, linux-kernel, patches
The driver cannot assume that it owns control of the
CS35L56_SWIRE_DP3_CH?_INPUT registers so it must not do anything
during probe() or component_probe() that could result in a write
to these registers. Add a test case for this.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
sound/soc/codecs/cs35l56-test.c | 84 +++++++++++++++++++++++++++++++++
1 file changed, 84 insertions(+)
diff --git a/sound/soc/codecs/cs35l56-test.c b/sound/soc/codecs/cs35l56-test.c
index b422d19ba0b2..362da30b949e 100644
--- a/sound/soc/codecs/cs35l56-test.c
+++ b/sound/soc/codecs/cs35l56-test.c
@@ -63,6 +63,7 @@ struct cs35l56_test_priv {
bool asp_config_regs_written;
bool asp_mixer_regs_written;
+ bool sdw_mux_regs_written;
};
struct cs35l56_test_param {
@@ -124,6 +125,11 @@ static const struct range cs35l56_test_asp_mixer_registers_range = {
.end = CS35L56_ASP1TX4_INPUT,
};
+static const struct range cs35l56_test_sdw_mux_registers_range = {
+ .start = CS35L56_SWIRE_DP3_CH1_INPUT,
+ .end = CS35L56_SWIRE_DP3_CH4_INPUT,
+};
+
static int cs35l56_test_mock_registers_read(void *context,
const void *reg_buf, size_t reg_size,
void *val_buf, size_t val_size)
@@ -200,6 +206,9 @@ static int cs35l56_test_mock_registers_write(void *context, const void *data, si
if (range_overlaps(&addr_range, &cs35l56_test_asp_mixer_registers_range))
priv->asp_mixer_regs_written = true;
+ if (range_overlaps(&addr_range, &cs35l56_test_sdw_mux_registers_range))
+ priv->sdw_mux_regs_written = true;
+
for (i = 0; i < count; i += sizeof(u32)) {
val = get_unaligned_be32(buf + i);
ret = regmap_write(priv->registers, reg + i, val);
@@ -929,6 +938,79 @@ static void cs35l56_test_component_probe_omits_asp(struct kunit *test)
KUNIT_EXPECT_FALSE(test, priv->asp_mixer_regs_written);
}
+/*
+ * Probing the component must not write the SoundWire TX mux registers,
+ * either directly or through a subsequent regcache_sync().
+ */
+static void cs35l56_test_component_probe_omits_sdw_mux(struct kunit *test)
+{
+ struct cs35l56_test_priv *priv = test->priv;
+ struct cs35l56_private *cs35l56 = priv->cs35l56_priv;
+ struct snd_soc_card *card = cs35l56->component->card;
+ struct snd_soc_aux_dev *aux;
+ struct faux_device *card_dev;
+
+ cs35l56_test_create_mock_supplies(test);
+ cs35l56_test_create_mock_device_registers(test);
+
+ KUNIT_ASSERT_NOT_NULL(test, priv->regmap_config);
+ cs35l56->base.regmap = devm_regmap_init(cs35l56->base.dev,
+ &cs35l56_test_mock_registers_client_regmap_bus,
+ test, priv->regmap_config);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, cs35l56->base.regmap);
+
+ KUNIT_ASSERT_EQ(test, 0, cs35l56_common_probe(cs35l56, 0));
+ KUNIT_ASSERT_EQ(test, 0,
+ kunit_add_action_or_reset(test, cs35l56_remove_wrapper, cs35l56));
+
+ /* Prevent real dsp_work */
+ INIT_WORK(&cs35l56->dsp_work, cs35l56_test_dummy_dsp_work);
+
+ /* Simulate first attachment and re-attachment after the soft reset. */
+ regcache_cache_only(cs35l56->base.regmap, false);
+ KUNIT_ASSERT_EQ(test, 0, cs35l56_init(cs35l56));
+ KUNIT_ASSERT_EQ(test, 0, cs35l56_init(cs35l56));
+ KUNIT_ASSERT_TRUE(test, cs35l56->base.init_done);
+ flush_work(&cs35l56->component_register_work);
+ KUNIT_ASSERT_TRUE(test, cs35l56->component_registered);
+
+ card_dev = faux_device_create("cs35l56_test_card", NULL, NULL);
+ KUNIT_ASSERT_NOT_NULL(test, card_dev);
+ KUNIT_ASSERT_EQ(test, 0,
+ kunit_add_action_or_reset(test, faux_device_destroy_wrapper, card_dev));
+
+ /* Bind as an auxiliary component so the ASP DAI is never probed. */
+ aux = kunit_kzalloc(test, sizeof(*aux), GFP_KERNEL);
+ KUNIT_ASSERT_NOT_NULL(test, aux);
+ aux->dlc.name = dev_name(cs35l56->base.dev);
+ card->name = "cs35l56-test";
+ card->dev = &card_dev->dev;
+ card->owner = THIS_MODULE;
+ card->aux_dev = aux;
+ card->num_aux_devs = 1;
+ KUNIT_ASSERT_EQ(test, 0, snd_soc_register_card(card));
+ KUNIT_ASSERT_EQ(test, 0,
+ kunit_add_action_or_reset(test, snd_soc_unregister_card_wrapper, card));
+ KUNIT_ASSERT_TRUE(test, card->instantiated);
+ KUNIT_EXPECT_FALSE(test, priv->sdw_mux_regs_written);
+
+ /*
+ * Flush cache to ensure there aren't cached values for the SoundWire muxes.
+ * The first case without regcache_mark_dirty() tests flushing when
+ * hardware registers have not reset, and requires a dummy write to
+ * the cache to make it dirty.
+ */
+ regcache_cache_only(cs35l56->base.regmap, true);
+ KUNIT_ASSERT_EQ(test, 0, regmap_write(cs35l56->base.regmap,
+ CS35L56_DSP_VIRTUAL1_MBOX_1, 0));
+ regcache_cache_only(cs35l56->base.regmap, false);
+ KUNIT_ASSERT_EQ(test, 0, regcache_sync(cs35l56->base.regmap));
+ regcache_mark_dirty(cs35l56->base.regmap);
+ KUNIT_ASSERT_EQ(test, 0, regcache_sync(cs35l56->base.regmap));
+
+ KUNIT_EXPECT_FALSE(test, priv->sdw_mux_regs_written);
+}
+
static int cs35l56_test_case_init_common(struct kunit *test)
{
struct cs35l56_test_priv *priv;
@@ -1233,6 +1315,8 @@ static struct kunit_case cs35l56_test_cases_soundwire[] = {
KUNIT_CASE(cs35l56_test_set_fw_name_preserves_spkid_without_onchip_gpios),
KUNIT_CASE_PARAM(cs35l56_test_component_probe_omits_asp,
cs35l56_test_type_rev_all_gen_params),
+ KUNIT_CASE_PARAM(cs35l56_test_component_probe_omits_sdw_mux,
+ cs35l56_test_type_rev_all_gen_params),
{ } /* terminator */
};
--
2.47.3
^ permalink raw reply related [flat|nested] 5+ messages in thread