ASoC: soc-pcm.c: Complete the active count for components without DAIs
authorChancel Liu <chancel.liu@nxp.com>
Mon, 4 Dec 2023 11:15:32 +0000 (19:15 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 18 Dec 2023 14:04:24 +0000 (14:04 +0000)
Some components like platforms don't have DAIs. If the active count of
these components is ignored pinctrl may be wrongly selected between
default and sleep state. So need to increment or decrement the active
count for components without DAIs to avoid it.

Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
Link: https://msgid.link/r/20231204111532.3165-1-chancel.liu@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-pcm.c

index c20573aeb7566923d1c13fc214c8f7228dfd4a33..16a4644eff3ab6d8169c0dd939e6d5aac3c17d62 100644 (file)
@@ -292,6 +292,7 @@ static void dpcm_set_be_update_state(struct snd_soc_pcm_runtime *be,
 void snd_soc_runtime_action(struct snd_soc_pcm_runtime *rtd,
                            int stream, int action)
 {
+       struct snd_soc_component *component;
        struct snd_soc_dai *dai;
        int i;
 
@@ -299,6 +300,13 @@ void snd_soc_runtime_action(struct snd_soc_pcm_runtime *rtd,
 
        for_each_rtd_dais(rtd, i, dai)
                snd_soc_dai_action(dai, stream, action);
+
+       /* Increments/Decrements the active count for components without DAIs */
+       for_each_rtd_components(rtd, i, component) {
+               if (component->num_dai)
+                       continue;
+               component->active += action;
+       }
 }
 EXPORT_SYMBOL_GPL(snd_soc_runtime_action);