Skip to content

Commit 7a27dbf

Browse files
committed
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.
2 parents aefe7a8 + 13f5826 commit 7a27dbf

6 files changed

Lines changed: 30 additions & 12 deletions

File tree

include/sound/soc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ snd_soc_link_to_platform(struct snd_soc_dai_link *link, int n) {
938938
#define COMP_PLATFORM(_name) { .name = _name }
939939
#define COMP_AUX(_name) { .name = _name }
940940
#define COMP_CODEC_CONF(_name) { .name = _name }
941-
#define COMP_DUMMY() { .name = "snd-soc-dummy", .dai_name = "snd-soc-dummy-dai", }
941+
#define COMP_DUMMY() /* see snd_soc_fill_dummy_dai() */
942942

943943
extern struct snd_soc_dai_link_component null_dailink_component[0];
944944
extern struct snd_soc_dai_link_component snd_soc_dummy_dlc;

sound/soc/fsl/fsl-asoc-card.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,7 @@ SND_SOC_DAILINK_DEFS(hifi_fe,
305305

306306
SND_SOC_DAILINK_DEFS(hifi_be,
307307
DAILINK_COMP_ARRAY(COMP_EMPTY()),
308-
DAILINK_COMP_ARRAY(COMP_EMPTY()),
309-
DAILINK_COMP_ARRAY(COMP_DUMMY()));
308+
DAILINK_COMP_ARRAY(COMP_EMPTY()));
310309

311310
static const struct snd_soc_dai_link fsl_asoc_card_dai[] = {
312311
/* Default ASoC DAI Link*/

sound/soc/intel/avs/boards/hdaudio.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,17 +155,15 @@ static int avs_probing_link_init(struct snd_soc_pcm_runtime *rtm)
155155
return 0;
156156
}
157157

158-
SND_SOC_DAILINK_DEF(dummy, DAILINK_COMP_ARRAY(COMP_DUMMY()));
159-
160158
static struct snd_soc_dai_link probing_link = {
161159
.name = "probing-LINK",
162160
.id = -1,
163161
.nonatomic = 1,
164162
.no_pcm = 1,
165163
.dpcm_playback = 1,
166164
.dpcm_capture = 1,
167-
.cpus = dummy,
168-
.num_cpus = ARRAY_SIZE(dummy),
165+
.cpus = &snd_soc_dummy_dlc,
166+
.num_cpus = 1,
169167
.init = avs_probing_link_init,
170168
};
171169

sound/soc/samsung/odroid.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@ SND_SOC_DAILINK_DEFS(primary,
157157

158158
SND_SOC_DAILINK_DEFS(mixer,
159159
DAILINK_COMP_ARRAY(COMP_DUMMY()),
160-
DAILINK_COMP_ARRAY(COMP_EMPTY()),
161-
DAILINK_COMP_ARRAY(COMP_DUMMY()));
160+
DAILINK_COMP_ARRAY(COMP_EMPTY()));
162161

163162
SND_SOC_DAILINK_DEFS(secondary,
164163
DAILINK_COMP_ARRAY(COMP_EMPTY()),

sound/soc/soc-core.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,28 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime(
576576
return NULL;
577577
}
578578

579+
static void snd_soc_fill_dummy_dai(struct snd_soc_card *card)
580+
{
581+
struct snd_soc_dai_link *dai_link;
582+
int i;
583+
584+
/*
585+
* COMP_DUMMY() creates size 0 array on dai_link.
586+
* Fill it as dummy DAI in case of CPU/Codec here.
587+
* Do nothing for Platform.
588+
*/
589+
for_each_card_prelinks(card, i, dai_link) {
590+
if (dai_link->num_cpus == 0 && dai_link->cpus) {
591+
dai_link->num_cpus = 1;
592+
dai_link->cpus = &snd_soc_dummy_dlc;
593+
}
594+
if (dai_link->num_codecs == 0 && dai_link->codecs) {
595+
dai_link->num_codecs = 1;
596+
dai_link->codecs = &snd_soc_dummy_dlc;
597+
}
598+
}
599+
}
600+
579601
static void snd_soc_flush_all_delayed_work(struct snd_soc_card *card)
580602
{
581603
struct snd_soc_pcm_runtime *rtd;
@@ -2131,6 +2153,8 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
21312153
mutex_lock(&client_mutex);
21322154
snd_soc_card_mutex_lock_root(card);
21332155

2156+
snd_soc_fill_dummy_dai(card);
2157+
21342158
snd_soc_dapm_init(&card->dapm, card, NULL);
21352159

21362160
/* check whether any platform is ignore machine FE and using topology */

sound/soc/sof/sof-client-probes.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,6 @@ static const struct snd_soc_component_driver sof_probes_component = {
381381
.legacy_dai_naming = 1,
382382
};
383383

384-
SND_SOC_DAILINK_DEF(dummy, DAILINK_COMP_ARRAY(COMP_DUMMY()));
385-
386384
static int sof_probes_client_probe(struct auxiliary_device *auxdev,
387385
const struct auxiliary_device_id *id)
388386
{
@@ -475,7 +473,7 @@ static int sof_probes_client_probe(struct auxiliary_device *auxdev,
475473
links[0].cpus = &cpus[0];
476474
links[0].num_cpus = 1;
477475
links[0].cpus->dai_name = "Probe Extraction CPU DAI";
478-
links[0].codecs = dummy;
476+
links[0].codecs = &snd_soc_dummy_dlc;
479477
links[0].num_codecs = 1;
480478
links[0].platforms = platform_component;
481479
links[0].num_platforms = ARRAY_SIZE(platform_component);

0 commit comments

Comments
 (0)