ASoC: soc-utils: add snd_soc_dlc_is_dummy()

Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

We are using dummy component/dlc, but didn't have its check funciton.
This patch adds it.
This commit is contained in:
Mark Brown 2025-05-03 07:21:43 +09:00
commit d85d055e20
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
4 changed files with 20 additions and 7 deletions

View File

@ -936,7 +936,7 @@ snd_soc_link_to_platform(struct snd_soc_dai_link *link, int n) {
extern struct snd_soc_dai_link_component null_dailink_component[0];
extern struct snd_soc_dai_link_component snd_soc_dummy_dlc;
int snd_soc_dlc_is_dummy(struct snd_soc_dai_link_component *dlc);
struct snd_soc_codec_conf {
/*

View File

@ -1333,11 +1333,11 @@ static int mt8188_mt6359_soc_card_probe(struct mtk_soc_card_data *soc_card_data,
for_each_card_prelinks(card, i, dai_link) {
if (strcmp(dai_link->name, "DPTX_BE") == 0) {
if (dai_link->num_codecs &&
strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai"))
!snd_soc_dlc_is_dummy(dai_link->codecs))
dai_link->init = mt8188_dptx_codec_init;
} else if (strcmp(dai_link->name, "ETDM3_OUT_BE") == 0) {
if (dai_link->num_codecs &&
strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai"))
!snd_soc_dlc_is_dummy(dai_link->codecs))
dai_link->init = mt8188_hdmi_codec_init;
} else if (strcmp(dai_link->name, "DL_SRC_BE") == 0 ||
strcmp(dai_link->name, "UL_SRC_BE") == 0) {
@ -1387,7 +1387,7 @@ static int mt8188_mt6359_soc_card_probe(struct mtk_soc_card_data *soc_card_data,
init_es8326 = true;
}
} else {
if (strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai")) {
if (!snd_soc_dlc_is_dummy(dai_link->codecs)) {
if (!init_dumb) {
dai_link->init = mt8188_dumb_amp_init;
init_dumb = true;

View File

@ -1388,11 +1388,11 @@ static int mt8195_mt6359_soc_card_probe(struct mtk_soc_card_data *soc_card_data,
for_each_card_prelinks(card, i, dai_link) {
if (strcmp(dai_link->name, "DPTX_BE") == 0) {
if (dai_link->num_codecs &&
strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai"))
!snd_soc_dlc_is_dummy(dai_link->codecs))
dai_link->init = mt8195_dptx_codec_init;
} else if (strcmp(dai_link->name, "ETDM3_OUT_BE") == 0) {
if (dai_link->num_codecs &&
strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai"))
!snd_soc_dlc_is_dummy(dai_link->codecs))
dai_link->init = mt8195_hdmi_codec_init;
} else if (strcmp(dai_link->name, "DL_SRC_BE") == 0 ||
strcmp(dai_link->name, "UL_SRC1_BE") == 0 ||
@ -1432,7 +1432,7 @@ static int mt8195_mt6359_soc_card_probe(struct mtk_soc_card_data *soc_card_data,
codec_init |= RT5682_CODEC_INIT;
}
} else {
if (strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai")) {
if (!snd_soc_dlc_is_dummy(dai_link->codecs)) {
if (!(codec_init & DUMB_CODEC_INIT)) {
dai_link->init = mt8195_dumb_amp_init;
codec_init |= DUMB_CODEC_INIT;

View File

@ -262,6 +262,19 @@ struct snd_soc_dai_link_component snd_soc_dummy_dlc = {
};
EXPORT_SYMBOL_GPL(snd_soc_dummy_dlc);
int snd_soc_dlc_is_dummy(struct snd_soc_dai_link_component *dlc)
{
if (dlc == &snd_soc_dummy_dlc)
return true;
if (strcmp(dlc->name, snd_soc_dummy_dlc.name) == 0 ||
strcmp(dlc->dai_name, snd_soc_dummy_dlc.dai_name) == 0)
return true;
return false;
}
EXPORT_SYMBOL_GPL(snd_soc_dlc_is_dummy);
static int snd_soc_dummy_probe(struct faux_device *fdev)
{
int ret;