Skip to content

Commit 3aecfc7

Browse files
Tzung-Bi Shihbroonie
authored andcommitted
ASoC: dapm: don't call pm_runtime_* on card device
runtime_usage of sound card has been observed to grow without bound. For example: $ cat /sys/devices/platform/sound/power/runtime_usage 46 $ sox -n -t s16 -r 48000 -c 2 - synth 1 sine 440 vol 0.1 | \ aplay -q -D hw:0,0 -f S16_LE -r 48000 -c 2 $ cat /sys/devices/platform/sound/power/runtime_usage 52 Commit 4e872a4 ("ASoC: dapm: Don't force card bias level to be updated") stops to force update bias_level on card. If card doesn't provide set_bias_level callback, the snd_soc_dapm_set_bias_level() is equivalent to NOP for card device. As a result, dapm_pre_sequence_async() doesn't change the bias_level of card device correctly. Thus, pm_runtime_get_sync() would be called in dapm_pre_sequence_async() without symmetric pm_runtime_put() in dapm_post_sequence_async(). Don't call pm_runtime_* on card device. Signed-off-by: Tzung-Bi Shih <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent aa2d1ee commit 3aecfc7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sound/soc/soc-dapm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1798,7 +1798,7 @@ static void dapm_pre_sequence_async(void *data, async_cookie_t cookie)
17981798
/* If we're off and we're not supposed to go into STANDBY */
17991799
if (d->bias_level == SND_SOC_BIAS_OFF &&
18001800
d->target_bias_level != SND_SOC_BIAS_OFF) {
1801-
if (d->dev)
1801+
if (d->dev && cookie)
18021802
pm_runtime_get_sync(d->dev);
18031803

18041804
ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_STANDBY);
@@ -1845,7 +1845,7 @@ static void dapm_post_sequence_async(void *data, async_cookie_t cookie)
18451845
dev_err(d->dev, "ASoC: Failed to turn off bias: %d\n",
18461846
ret);
18471847

1848-
if (d->dev)
1848+
if (d->dev && cookie)
18491849
pm_runtime_put(d->dev);
18501850
}
18511851

0 commit comments

Comments
 (0)