Unverified Commit d85d055e authored by Mark Brown's avatar Mark Brown
Browse files

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.
parents 2056d7a7 fed0805f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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 {
	/*
+3 −3
Original line number Diff line number Diff line
@@ -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;
+3 −3
Original line number Diff line number Diff line
@@ -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;
+13 −0
Original line number Diff line number Diff line
@@ -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;