Skip to content

Commit 9a9d31b

Browse files
bardliaobroonie
authored andcommitted
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 <[email protected]> Signed-off-by: Bard Liao <[email protected]> Signed-off-by: Pierre-Louis Bossart <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent dd5cb1b commit 9a9d31b

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

sound/soc/intel/boards/sof_sdw_rt_sdca_jack_common.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,15 @@ static const char * const jack_codecs[] = {
8888
"rt711", "rt712", "rt713", "rt722"
8989
};
9090

91+
/*
92+
* The sdca suffix is required for rt711 since there are two generations of the same chip.
93+
* RT713 is an SDCA device but the sdca suffix is required for backwards-compatibility with
94+
* previous UCM definitions.
95+
*/
96+
static const char * const need_sdca_suffix[] = {
97+
"rt711", "rt713"
98+
};
99+
91100
int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd)
92101
{
93102
struct snd_soc_card *card = rtd->card;
@@ -96,18 +105,30 @@ int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd)
96105
struct snd_soc_component *component;
97106
struct snd_soc_jack *jack;
98107
int ret;
108+
int i;
99109

100110
codec_dai = get_codec_dai_by_name(rtd, jack_codecs, ARRAY_SIZE(jack_codecs));
101111
if (!codec_dai)
102112
return -EINVAL;
103113

104114
component = codec_dai->component;
105115
card->components = devm_kasprintf(card->dev, GFP_KERNEL,
106-
"%s hs:%s-sdca",
116+
"%s hs:%s",
107117
card->components, component->name_prefix);
108118
if (!card->components)
109119
return -ENOMEM;
110120

121+
for (i = 0; i < ARRAY_SIZE(need_sdca_suffix); i++) {
122+
if (strstr(codec_dai->name, need_sdca_suffix[i])) {
123+
/* Add -sdca suffix for existing UCMs */
124+
card->components = devm_kasprintf(card->dev, GFP_KERNEL,
125+
"%s-sdca", card->components);
126+
if (!card->components)
127+
return -ENOMEM;
128+
break;
129+
}
130+
}
131+
111132
ret = snd_soc_add_card_controls(card, rt_sdca_jack_controls,
112133
ARRAY_SIZE(rt_sdca_jack_controls));
113134
if (ret) {

0 commit comments

Comments
 (0)