ASoC: soc-core.c: setup rtd->pmdown_time at soc_new_pcm_runtime()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Fri, 9 Sep 2022 01:19:18 +0000 (01:19 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 19 Sep 2022 16:52:41 +0000 (17:52 +0100)
Almost all default rtd->xxx are setup at soc_new_pcm_runtime()
which is sub-function of snd_soc_add_pcm_runtime() (A).
But "rtd->pmdown_time" is setup at soc_init_pcm_runtime() (B).
It is very random timing setup. This patch setup it at (A),
same as other rtd->xxx.

static int snd_soc_bind_card(...)
{
...
for_each_card_prelinks(...) {
(A) ret = snd_soc_add_pcm_runtime(...);
...
}
...
for_each_card_rtds(...) {
(B) ret = soc_init_pcm_runtime(...);
...
}
...
}

One note is that current topology/intel are directly calling
snd_soc_add_pcm_runtime() (A) without calling soc_init_pcm_runtime() (B).
This means, its "rtd->pmdown_time settings" was 0, but will have default
value by this patch.

"rtd->pmdown_time settings" will be used at
snd_soc_runtime_ignore_pmdown_time(). This patch adds
"ignore_pmdown_time" to these driver to keep compatibility.

bool snd_soc_runtime_ignore_pmdown_time(...)
{
...
=> if (!rtd->pmdown_time || rtd->dai_link->ignore_pmdown_time)
return true;
...
}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/875yhxmjjd.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/avs/boards/hdaudio.c
sound/soc/soc-core.c
sound/soc/soc-topology.c

index d2fc41d39448d4c5e85b9ba163bd440f0a592e19..073663ba140d0fe358255de8b5b06b4ef0032a6d 100644 (file)
@@ -42,6 +42,7 @@ static int avs_create_dai_links(struct device *dev, struct hda_codec *codec, int
                dl[i].dpcm_capture = 1;
                dl[i].platforms = platform;
                dl[i].num_platforms = 1;
+               dl[i].ignore_pmdown_time = 1;
 
                dl[i].codecs = devm_kzalloc(dev, sizeof(*dl->codecs), GFP_KERNEL);
                dl[i].cpus = devm_kzalloc(dev, sizeof(*dl->cpus), GFP_KERNEL);
index e020ab49cfb1233fb2b258c2fe728f352062c408..df2bd8098c63313c4e047d1f1101c8e9fde64044 100644 (file)
@@ -487,6 +487,7 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime(
        rtd->card       = card;
        rtd->dai_link   = dai_link;
        rtd->num        = card->num_rtd++;
+       rtd->pmdown_time = pmdown_time;                 /* default power off timeout */
 
        /* see for_each_card_rtds */
        list_add_tail(&rtd->list, &card->rtd_list);
@@ -1247,9 +1248,6 @@ static int soc_init_pcm_runtime(struct snd_soc_card *card,
        struct snd_soc_component *component;
        int ret, num, i;
 
-       /* set default power off timeout */
-       rtd->pmdown_time = pmdown_time;
-
        /* do machine specific initialization */
        ret = snd_soc_link_init(rtd);
        if (ret < 0)
index b101db85446ff02a9fca8c4c322dc8924618485f..c3be24b2fac5560a94293ef4f83872b0704b64ff 100644 (file)
@@ -1755,6 +1755,7 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg,
 
        /* enable DPCM */
        link->dynamic = 1;
+       link->ignore_pmdown_time = 1;
        link->dpcm_playback = le32_to_cpu(pcm->playback);
        link->dpcm_capture = le32_to_cpu(pcm->capture);
        if (pcm->flag_mask)