Skip to content

Commit d85d055

Browse files
committed
ASoC: soc-utils: add snd_soc_dlc_is_dummy()
Merge series from Kuninori Morimoto <[email protected]>: We are using dummy component/dlc, but didn't have its check funciton. This patch adds it.
2 parents 2056d7a + fed0805 commit d85d055

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

include/sound/soc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ snd_soc_link_to_platform(struct snd_soc_dai_link *link, int n) {
936936

937937
extern struct snd_soc_dai_link_component null_dailink_component[0];
938938
extern struct snd_soc_dai_link_component snd_soc_dummy_dlc;
939-
939+
int snd_soc_dlc_is_dummy(struct snd_soc_dai_link_component *dlc);
940940

941941
struct snd_soc_codec_conf {
942942
/*

sound/soc/mediatek/mt8188/mt8188-mt6359.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,11 +1333,11 @@ static int mt8188_mt6359_soc_card_probe(struct mtk_soc_card_data *soc_card_data,
13331333
for_each_card_prelinks(card, i, dai_link) {
13341334
if (strcmp(dai_link->name, "DPTX_BE") == 0) {
13351335
if (dai_link->num_codecs &&
1336-
strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai"))
1336+
!snd_soc_dlc_is_dummy(dai_link->codecs))
13371337
dai_link->init = mt8188_dptx_codec_init;
13381338
} else if (strcmp(dai_link->name, "ETDM3_OUT_BE") == 0) {
13391339
if (dai_link->num_codecs &&
1340-
strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai"))
1340+
!snd_soc_dlc_is_dummy(dai_link->codecs))
13411341
dai_link->init = mt8188_hdmi_codec_init;
13421342
} else if (strcmp(dai_link->name, "DL_SRC_BE") == 0 ||
13431343
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,
13871387
init_es8326 = true;
13881388
}
13891389
} else {
1390-
if (strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai")) {
1390+
if (!snd_soc_dlc_is_dummy(dai_link->codecs)) {
13911391
if (!init_dumb) {
13921392
dai_link->init = mt8188_dumb_amp_init;
13931393
init_dumb = true;

sound/soc/mediatek/mt8195/mt8195-mt6359.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,11 +1388,11 @@ static int mt8195_mt6359_soc_card_probe(struct mtk_soc_card_data *soc_card_data,
13881388
for_each_card_prelinks(card, i, dai_link) {
13891389
if (strcmp(dai_link->name, "DPTX_BE") == 0) {
13901390
if (dai_link->num_codecs &&
1391-
strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai"))
1391+
!snd_soc_dlc_is_dummy(dai_link->codecs))
13921392
dai_link->init = mt8195_dptx_codec_init;
13931393
} else if (strcmp(dai_link->name, "ETDM3_OUT_BE") == 0) {
13941394
if (dai_link->num_codecs &&
1395-
strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai"))
1395+
!snd_soc_dlc_is_dummy(dai_link->codecs))
13961396
dai_link->init = mt8195_hdmi_codec_init;
13971397
} else if (strcmp(dai_link->name, "DL_SRC_BE") == 0 ||
13981398
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,
14321432
codec_init |= RT5682_CODEC_INIT;
14331433
}
14341434
} else {
1435-
if (strcmp(dai_link->codecs->dai_name, "snd-soc-dummy-dai")) {
1435+
if (!snd_soc_dlc_is_dummy(dai_link->codecs)) {
14361436
if (!(codec_init & DUMB_CODEC_INIT)) {
14371437
dai_link->init = mt8195_dumb_amp_init;
14381438
codec_init |= DUMB_CODEC_INIT;

sound/soc/soc-utils.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,19 @@ struct snd_soc_dai_link_component snd_soc_dummy_dlc = {
262262
};
263263
EXPORT_SYMBOL_GPL(snd_soc_dummy_dlc);
264264

265+
int snd_soc_dlc_is_dummy(struct snd_soc_dai_link_component *dlc)
266+
{
267+
if (dlc == &snd_soc_dummy_dlc)
268+
return true;
269+
270+
if (strcmp(dlc->name, snd_soc_dummy_dlc.name) == 0 ||
271+
strcmp(dlc->dai_name, snd_soc_dummy_dlc.dai_name) == 0)
272+
return true;
273+
274+
return false;
275+
}
276+
EXPORT_SYMBOL_GPL(snd_soc_dlc_is_dummy);
277+
265278
static int snd_soc_dummy_probe(struct faux_device *fdev)
266279
{
267280
int ret;

0 commit comments

Comments
 (0)