[PATCH] Asoc dapm behavior fix

From: ning . a . zhang
Date: Thu May 09 2013 - 22:44:06 EST


in soc_dapm.c, there is a illogic behavior, when bias_level
from STANDBY -> OFF transition.
source does not follow its comment.

this patch is based on the comment

Signed-off-by: ning.a.zhang <ning.a.zhang@xxxxxxxxx>
---
sound/soc/soc-dapm.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index d6d9ba2..834ab4c 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1486,8 +1486,9 @@ static void dapm_pre_sequence_async(void *data, async_cookie_t cookie)
"ASoC: Failed to turn on bias: %d\n", ret);
}

- /* Prepare for a STADDBY->ON or ON->STANDBY transition */
- if (d->bias_level != d->target_bias_level) {
+ /* If we're on and we're not supposed to be go into PREPARE */
+ if (d->bias_level == SND_SOC_BIAS_ON &&
+ d->target_bias_level != SND_SOC_BIAS_ON) {
ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_PREPARE);
if (ret != 0)
dev_err(d->dev,
@@ -1525,6 +1526,15 @@ static void dapm_post_sequence_async(void *data, async_cookie_t cookie)
pm_runtime_put(d->dev);
}

+ if (d->bias_level == SND_SOC_BIAS_STANDBY &&
+ (d->target_bias_level == SND_SOC_BIAS_PREPARE ||
+ d->target_bias_level == SND_SOC_BIAS_ON)) {
+ ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_PREPARE);
+ if (ret != 0)
+ dev_err(d->dev, "ASoC: Failed to apply prepare bias: %d\n",
+ ret);
+ }
+
/* If we just powered up then move to active bias */
if (d->bias_level == SND_SOC_BIAS_PREPARE &&
d->target_bias_level == SND_SOC_BIAS_ON) {
--
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/