ASoC: Intel: sof_sdw_rt_sdca_jack_common: remove -sdca for new codecs

Realtek new SoundWire codecs are all -sdca version. No need to add
-sdca to distinguish the non-sdca version. To be consistent with "spk:"
and "mic:" components string, remove "-sdca" suffix from "hs:"
components string.

Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240509163418.67746-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Bard Liao 2024-05-09 11:34:01 -05:00 committed by Mark Brown
parent dd5cb1b42a
commit 9a9d31b149
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -88,6 +88,15 @@ static const char * const jack_codecs[] = {
"rt711", "rt712", "rt713", "rt722"
};
/*
* The sdca suffix is required for rt711 since there are two generations of the same chip.
* RT713 is an SDCA device but the sdca suffix is required for backwards-compatibility with
* previous UCM definitions.
*/
static const char * const need_sdca_suffix[] = {
"rt711", "rt713"
};
int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_card *card = rtd->card;
@ -96,6 +105,7 @@ int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd)
struct snd_soc_component *component;
struct snd_soc_jack *jack;
int ret;
int i;
codec_dai = get_codec_dai_by_name(rtd, jack_codecs, ARRAY_SIZE(jack_codecs));
if (!codec_dai)
@ -103,11 +113,22 @@ int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd)
component = codec_dai->component;
card->components = devm_kasprintf(card->dev, GFP_KERNEL,
"%s hs:%s-sdca",
"%s hs:%s",
card->components, component->name_prefix);
if (!card->components)
return -ENOMEM;
for (i = 0; i < ARRAY_SIZE(need_sdca_suffix); i++) {
if (strstr(codec_dai->name, need_sdca_suffix[i])) {
/* Add -sdca suffix for existing UCMs */
card->components = devm_kasprintf(card->dev, GFP_KERNEL,
"%s-sdca", card->components);
if (!card->components)
return -ENOMEM;
break;
}
}
ret = snd_soc_add_card_controls(card, rt_sdca_jack_controls,
ARRAY_SIZE(rt_sdca_jack_controls));
if (ret) {