ASoC: sdw_utils: cs42l43: allow spk component names to be combined
PATCH RESEND v2 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
With alsa-ucm-conf PR #748,
after applying this patch, the kernel correctly produces the combined component string:
spk:cs35l56+cs42l43-spk hs:cs42l43 mic:cs42l43-dmic
Speaker playback, mute LED, mic LED, and remap all work correctly.
Quoted 116 lines · Maciej Strozek
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.
Reviewed-by Bard Liao <[email protected]>Signed-off-by Maciej Strozek <[email protected]>---
Changes in v2: usedai->componentinstead ofsnd_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
-5@@ -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 1 line · Maciej Strozek
ASoC:
sdw_utils: cs42l43: allow spk component names to be combined
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.1
Thanks!
[1/1] ASoC: sdw_utils: cs42l43: allow spk component names to be combined
https://git.kernel.org/broonie/sound/c/87a3f5c8ac20
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