[PATCH] ASoC: core: giving WARN when device starting from non-offbias with idle_bias_off

From: Chuansheng Liu
Date: Thu Dec 20 2012 - 20:10:08 EST



Just found some cases that some codec drivers set the bias to _STANDBY and
set idle_bias_off to 1 during probing.
It will cause unpaired runtime_get_sync/put() issue. Also as Mark suggested,
there is no reason to start from _STANDBY bias with idle_bias_off == 1.

So here giving one warning when detected (dapm.idle_bias_off == 1) and
(dapm.bias_level != SND_SOC_BIAS_OFF) just after driver->probe().

Signed-off-by: liu chuansheng <chuansheng.liu@xxxxxxxxx>
---
sound/soc/soc-core.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 9c768bc..d7ec007 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1107,6 +1107,10 @@ static int soc_probe_codec(struct snd_soc_card *card,
"ASoC: failed to probe CODEC %d\n", ret);
goto err_probe;
}
+ WARN(codec->dapm.idle_bias_off &&
+ codec->dapm.bias_level != SND_SOC_BIAS_OFF,
+ "codec %s can not start from non-off bias"
+ " with idle_bias_off==1\n", codec->name);
}

/* If the driver didn't set I/O up try regmap */
--
1.7.0.4



--
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/