[alsa-devel] [PATCH] ASoC: tpa6130a2: Fix unbalanced regulator disables
Jarkko Nikula
jhnikula at gmail.com
Thu Oct 28 13:05:40 CEST 2010
This driver has unbalanced regulator_disable when doing module loading and
unloading. This is because tpa6130a2_probe followed by tpa6130a2_remove
calls twice tpa6130a2_power(0). Fix this by implementing a state checking
in tpa6130a2_power.
Signed-off-by: Jarkko Nikula <jhnikula at gmail.com>
Cc: Peter Ujfalusi <peter.ujfalusi at nokia.com>
---
sound/soc/codecs/tpa6130a2.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
index 329acc1..83b5631 100644
--- a/sound/soc/codecs/tpa6130a2.c
+++ b/sound/soc/codecs/tpa6130a2.c
@@ -125,7 +125,7 @@ static int tpa6130a2_power(int power)
data = i2c_get_clientdata(tpa6130a2_client);
mutex_lock(&data->mutex);
- if (power) {
+ if (power && !data->power_state) {
/* Power on */
if (data->power_gpio >= 0)
gpio_set_value(data->power_gpio, 1);
@@ -153,7 +153,7 @@ static int tpa6130a2_power(int power)
val = tpa6130a2_read(TPA6130A2_REG_CONTROL);
val &= ~TPA6130A2_SWS;
tpa6130a2_i2c_write(TPA6130A2_REG_CONTROL, val);
- } else {
+ } else if (!power && data->power_state) {
/* set SWS */
val = tpa6130a2_read(TPA6130A2_REG_CONTROL);
val |= TPA6130A2_SWS;
--
1.7.1
More information about the Alsa-devel
mailing list