ASoC: don't use original dummy dlc

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

"Empty" dlc might be used on Platform, but "dummy" dlc is not needed
for it. [PATCH 1/5][PATCH 2/5] removes "dummy" dlc from Platform.

Now ASoC have common dummy dlc (= snd_soc_dummy_dlc).
[PATCH 3/5][PATCH 4/5] will use it instead of original dummy dlc.

Many drivers are using below macro

	SND_SOC_DAILINK_DEFS(link,
		     DAILINK_COMP_ARRAY(COMP_CPU(...)),
(X)		     DAILINK_COMP_ARRAY(COMP_DUMMY()),
		     DAILINK_COMP_ARRAY(COMP_EMPTY()));

But (X) part will create original dummy dlc.
[PATCH 5/5] will try not to create original dummy dlc, and replace
it to common dummy dlc.
This commit is contained in:
Mark Brown 2023-12-19 16:45:51 +00:00
commit 7a27dbf7b1
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
6 changed files with 30 additions and 12 deletions

View File

@ -938,7 +938,7 @@ snd_soc_link_to_platform(struct snd_soc_dai_link *link, int n) {
#define COMP_PLATFORM(_name) { .name = _name }
#define COMP_AUX(_name) { .name = _name }
#define COMP_CODEC_CONF(_name) { .name = _name }
#define COMP_DUMMY() { .name = "snd-soc-dummy", .dai_name = "snd-soc-dummy-dai", }
#define COMP_DUMMY() /* see snd_soc_fill_dummy_dai() */
extern struct snd_soc_dai_link_component null_dailink_component[0];
extern struct snd_soc_dai_link_component snd_soc_dummy_dlc;

View File

@ -305,8 +305,7 @@ SND_SOC_DAILINK_DEFS(hifi_fe,
SND_SOC_DAILINK_DEFS(hifi_be,
DAILINK_COMP_ARRAY(COMP_EMPTY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()),
DAILINK_COMP_ARRAY(COMP_DUMMY()));
DAILINK_COMP_ARRAY(COMP_EMPTY()));
static const struct snd_soc_dai_link fsl_asoc_card_dai[] = {
/* Default ASoC DAI Link*/

View File

@ -155,8 +155,6 @@ static int avs_probing_link_init(struct snd_soc_pcm_runtime *rtm)
return 0;
}
SND_SOC_DAILINK_DEF(dummy, DAILINK_COMP_ARRAY(COMP_DUMMY()));
static struct snd_soc_dai_link probing_link = {
.name = "probing-LINK",
.id = -1,
@ -164,8 +162,8 @@ static struct snd_soc_dai_link probing_link = {
.no_pcm = 1,
.dpcm_playback = 1,
.dpcm_capture = 1,
.cpus = dummy,
.num_cpus = ARRAY_SIZE(dummy),
.cpus = &snd_soc_dummy_dlc,
.num_cpus = 1,
.init = avs_probing_link_init,
};

View File

@ -157,8 +157,7 @@ SND_SOC_DAILINK_DEFS(primary,
SND_SOC_DAILINK_DEFS(mixer,
DAILINK_COMP_ARRAY(COMP_DUMMY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()),
DAILINK_COMP_ARRAY(COMP_DUMMY()));
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(secondary,
DAILINK_COMP_ARRAY(COMP_EMPTY()),

View File

@ -576,6 +576,28 @@ free_rtd:
return NULL;
}
static void snd_soc_fill_dummy_dai(struct snd_soc_card *card)
{
struct snd_soc_dai_link *dai_link;
int i;
/*
* COMP_DUMMY() creates size 0 array on dai_link.
* Fill it as dummy DAI in case of CPU/Codec here.
* Do nothing for Platform.
*/
for_each_card_prelinks(card, i, dai_link) {
if (dai_link->num_cpus == 0 && dai_link->cpus) {
dai_link->num_cpus = 1;
dai_link->cpus = &snd_soc_dummy_dlc;
}
if (dai_link->num_codecs == 0 && dai_link->codecs) {
dai_link->num_codecs = 1;
dai_link->codecs = &snd_soc_dummy_dlc;
}
}
}
static void snd_soc_flush_all_delayed_work(struct snd_soc_card *card)
{
struct snd_soc_pcm_runtime *rtd;
@ -2131,6 +2153,8 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
mutex_lock(&client_mutex);
snd_soc_card_mutex_lock_root(card);
snd_soc_fill_dummy_dai(card);
snd_soc_dapm_init(&card->dapm, card, NULL);
/* check whether any platform is ignore machine FE and using topology */

View File

@ -381,8 +381,6 @@ static const struct snd_soc_component_driver sof_probes_component = {
.legacy_dai_naming = 1,
};
SND_SOC_DAILINK_DEF(dummy, DAILINK_COMP_ARRAY(COMP_DUMMY()));
static int sof_probes_client_probe(struct auxiliary_device *auxdev,
const struct auxiliary_device_id *id)
{
@ -475,7 +473,7 @@ static int sof_probes_client_probe(struct auxiliary_device *auxdev,
links[0].cpus = &cpus[0];
links[0].num_cpus = 1;
links[0].cpus->dai_name = "Probe Extraction CPU DAI";
links[0].codecs = dummy;
links[0].codecs = &snd_soc_dummy_dlc;
links[0].num_codecs = 1;
links[0].platforms = platform_component;
links[0].num_platforms = ARRAY_SIZE(platform_component);