Closed bardliao closed 6 months ago
Argh, conflict! @bardliao can you rebase?
@plbossart @ujfalusi On the second thought, I would like to address @ujfalusi's comment in this PR.
@ujfalusi @plbossart rebased and updated.
@bardliao, I think there is a potential to simplify things further with something like this?
diff --git a/sound/soc/intel/boards/sof_sdw_rt711.c b/sound/soc/intel/boards/sof_sdw_rt711.c index 7e54fc5cbe09..763be6d42bd6 100644 --- a/sound/soc/intel/boards/sof_sdw_rt711.c +++ b/sound/soc/intel/boards/sof_sdw_rt711.c @@ -69,24 +69,15 @@ static struct snd_soc_jack_pin rt711_jack_pins[] = { }, }; -static const char * const jack_codecs[] = { - "rt711" -}; - -int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd) +int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai) { struct snd_soc_card *card = rtd->card; struct mc_private *ctx = snd_soc_card_get_drvdata(card); - struct snd_soc_dai *codec_dai; struct snd_soc_component *component; struct snd_soc_jack *jack; int ret; - codec_dai = get_codec_dai_by_name(rtd, jack_codecs, ARRAY_SIZE(jack_codecs)); - if (!codec_dai) - return -EINVAL; - - component = codec_dai->component; + component = dai->component; card->components = devm_kasprintf(card->dev, GFP_KERNEL, "%s hs:rt711", card->components);
or perhaps this to the mix:
card->components = devm_kasprintf(card->dev, GFP_KERNEL, "%s hs:%s", card->components, dai->name);
but I'm not sure if that is correct...
Yes, we don't need get_codec_dai_by_name() anymore. I plan to remove get_codec_dai_by_name() in another PR.
Currently, we add card controls and dapm widgets one by one in the codec_info->dais->rtd_init callback. Duplicated controls and dapm widgets will be added if there are more than one types of amps in the dai link. Moving it to sof_sdw_rtd_init() and only add the controls/widgets of the first codec dai can avoid the duplications. And add "spk:" tag to components string for each amp dai type.