ASoC: sdw_utils: cs42l43: allow spk component names to be combined
PATCH 1/1 ASoC: sdw_utils: cs42l43: allow spk component names to be combined
Move handling of cs42l43-spk component string into SOF mechanism [1] which will allow it to be aggregated with other speakers. Likewise handle the cs35l56-bridge special case which should not be combined to keep compatibility with UCM.
---
Changes in v2: use dai->component instead of snd_soc_rtd_to_codec(rtd, 0)->component
--- sound/soc/sdw_utils/soc_sdw_bridge_cs35l56.c | 6 ------ sound/soc/sdw_utils/soc_sdw_cs42l43.c | 12 +----------- sound/soc/sdw_utils/soc_sdw_utils.c | 20 ++++++++++++++++---- 3 files changed, 17 insertions(+), 21 deletions(-)
sound/soc/sdw_utils/soc_sdw_bridge_cs35l56.c +0 -6
@@ -40,12 +40,6 @@ static int asoc_sdw_bridge_cs35l56_asp_init(struct snd_soc_pcm_runtime *rtd)struct snd_soc_dai *codec_dai;struct snd_soc_dai *cpu_dai; - card->components =devm_kasprintf (card->dev,GFP_KERNEL , -"%s spk:cs35l56-bridge" , - card->components); -if (!card->components) -return -ENOMEM ; - ret =snd_soc_dapm_new_controls (dapm, bridge_widgets,ARRAY_SIZE (bridge_widgets));if (ret) {
sound/soc/sdw_utils/soc_sdw_cs42l43.c +1 -11
@@ -107,21 +107,11 @@ EXPORT_SYMBOL_NS(asoc_sdw_cs42l43_hs_rtd_init, "SND_SOC_SDW_UTILS");int asoc_sdw_cs42l43_spk_rtd_init (struct snd_soc_pcm_runtime *rtd,struct snd_soc_dai *dai) { -struct snd_soc_component *component =snd_soc_rtd_to_codec (rtd,0 )->component; +struct snd_soc_component *component = dai->component;struct snd_soc_card *card = rtd->card;struct snd_soc_dapm_context *dapm =snd_soc_card_to_dapm (card); -struct asoc_sdw_mc_private *ctx =snd_soc_card_get_drvdata (card);int ret; -if (!(ctx->mc_quirk &SOC_SDW_SIDECAR_AMPS )) { -/* Will be set by the bridge code in this case */ - card->components =devm_kasprintf (card->dev,GFP_KERNEL , -"%s spk:cs42l43-spk" , - card->components); -if (!card->components) -return -ENOMEM ; - } - ret =snd_soc_limit_volume (card,"cs42l43 Speaker Digital Volume" ,CS42L43_SPK_VOLUME_0DB );if (ret)
sound/soc/sdw_utils/soc_sdw_utils.c +16 -4
@@ -758,6 +758,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { { .direction = {true, false}, .codec_name = "cs42l43-codec", + .component_name = "cs42l43-spk", .dai_name = "cs42l43-dp6", .dai_type = SOC_SDW_DAI_TYPE_AMP, .dailink = {SOC_SDW_AMP_OUT_DAI_ID, SOC_SDW_UNUSED_DAI_ID},
@@ -1104,6 +1105,7 @@ static int asoc_sdw_find_codec_info_dai_index(const struct asoc_sdw_codec_info *int asoc_sdw_rtd_init (struct snd_soc_pcm_runtime *rtd) {struct snd_soc_card *card = rtd->card; +struct asoc_sdw_mc_private *ctx =snd_soc_card_get_drvdata (card);struct snd_soc_dapm_context *dapm =snd_soc_card_to_dapm (card);struct asoc_sdw_codec_info *codec_info;struct snd_soc_dai *dai;
@@ -1179,16 +1181,26 @@ int asoc_sdw_rtd_init(struct snd_soc_pcm_runtime *rtd)/* Generate the spk component string for card->components string */ if (codec_info->dais[dai_index].dai_type ==SOC_SDW_DAI_TYPE_AMP && codec_info->dais[dai_index].component_name) { +const char *component; + +/* +* For the special case of cs42l43 with sidecar amps, use only +* "cs35l56-bridge" as the component name in card->components +*/ +if (ctx->mc_quirk &SOC_SDW_SIDECAR_AMPS && + !strcmp (codec_info->dais[dai_index].component_name,"cs42l43-spk" )) + component ="cs35l56-bridge" ; +else + component = codec_info->dais[dai_index].component_name; +if (strlen (spk_components) ==0 ) spk_components = -devm_kasprintf (card->dev,GFP_KERNEL ,"%s" , - codec_info->dais[dai_index].component_name); +devm_kasprintf (card->dev,GFP_KERNEL ,"%s" , component);else /* Append component name to spk_components */ spk_components =devm_kasprintf (card->dev,GFP_KERNEL , -"%s+%s" , spk_components, - codec_info->dais[dai_index].component_name); +"%s+%s" , spk_components, component); } codec_info->dais[dai_index].rtd_init_done = true;
--
2.47.3
Mark Brown
maintainerQuoted 3 lines · Maciej Strozek
---
Changes in v2: usedai->componentinstead ofsnd_soc_rtd_to_codec(rtd, 0)->component
---
You say this is v2 but didn't actually send it as a v2 :(
W dniu pon, 20.04.2026 o godzinie 12∶20 +0100, użytkownik Mark Brown
Quoted 7 lines · napisał:
Quoted 4 lines · Maciej Strozek
---
Changes in v2: usedai->componentinstead ofsnd_soc_rtd_to_codec(rtd, 0)->component
---You say this is v2 but didn't actually send it as a v2 :(
Ahh sorry, missed the subject line, let me resend
Signature · 2 lines
Regards, Maciej