aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorTzung-Bi Shih <tzungbi@google.com>2020-07-24 15:07:31 +0800
committerMark Brown <broonie@kernel.org>2020-07-24 17:27:53 +0100
commit3aecfc72d7ad73330e7a6ebd0005738a8fd417ab (patch)
tree77fa08689dd3f928b796102fbe3ecd8a9a1a5a43 /sound/soc/soc-dapm.c
parentMerge series "ASoC: qcom: Use qcom_snd_parse_of() for apq8016_sbc" from Stephan Gerhold <stephan@gerhold.net>: (diff)
downloadlinux-dev-3aecfc72d7ad73330e7a6ebd0005738a8fd417ab.tar.xz
linux-dev-3aecfc72d7ad73330e7a6ebd0005738a8fd417ab.zip
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 4e872a46823c ("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 <tzungbi@google.com> Link: https://lore.kernel.org/r/20200724070731.451377-1-tzungbi@google.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 5076299abf37..3273161e2787 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1798,7 +1798,7 @@ static void dapm_pre_sequence_async(void *data, async_cookie_t cookie)
/* If we're off and we're not supposed to go into STANDBY */
if (d->bias_level == SND_SOC_BIAS_OFF &&
d->target_bias_level != SND_SOC_BIAS_OFF) {
- if (d->dev)
+ if (d->dev && cookie)
pm_runtime_get_sync(d->dev);
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)
dev_err(d->dev, "ASoC: Failed to turn off bias: %d\n",
ret);
- if (d->dev)
+ if (d->dev && cookie)
pm_runtime_put(d->dev);
}