]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: soc-dapm: set bias_level if snd_soc_dapm_set_bias_level() was successed
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Fri, 11 Jul 2025 02:26:39 +0000 (02:26 +0000)
committerMark Brown <broonie@kernel.org>
Sun, 13 Jul 2025 21:36:45 +0000 (22:36 +0100)
ASoC has 2 functions to set bias level.
(A) snd_soc_dapm_force_bias_level()
(B) snd_soc_dapm_set_bias_level()

snd_soc_dapm_force_bias_level() (A) will set dapm->bias_level (a) if
successed.

(A) int snd_soc_dapm_force_bias_level(...)
{
...
if (ret == 0)
(a) dapm->bias_level = level;
...
}

snd_soc_dapm_set_bias_level() (B) is also a function that sets bias_level.
It will call snd_soc_dapm_force_bias_level() (A) inside, but doesn't
set dapm->bias_level by itself. One note is that (A) might not be called.

(B) static int snd_soc_dapm_set_bias_level(...)
{
...
ret = snd_soc_card_set_bias_level(...);
...
if (dapm != &card->dapm)
(A) ret = snd_soc_dapm_force_bias_level(...);
...
ret = snd_soc_card_set_bias_level_post(...);
...
}

dapm->bias_level will be set if (A) was called, but might not be set
if (B) was called, even though it calles set_bias_level() function.

We should set dapm->bias_level if we calls
snd_soc_dapm_set_bias_level() (B), too.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/87qzyn4g4h.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-dapm.c

index b8a5875378c87d7cc930e771a5a4a5267bc133f8..a37d44cd04c6736a446cf0c48dd8b54f2336885c 100644 (file)
@@ -1030,6 +1030,10 @@ static int snd_soc_dapm_set_bias_level(struct snd_soc_dapm_context *dapm,
 out:
        trace_snd_soc_bias_level_done(dapm, level);
 
+       /* success */
+       if (ret == 0)
+               snd_soc_dapm_init_bias_level(dapm, level);
+
        return ret;
 }