aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorJarkko Nikula <jhnikula@gmail.com>2010-10-28 07:05:40 -0400
committerLiam Girdwood <lrg@slimlogic.co.uk>2010-10-30 12:33:38 -0400
commit63f7526f26f0a9291ac3f7a986aa18ebfb61ec19 (patch)
tree64a8dc4234432cfc064e3ae81e86d7bc8498c0d2 /sound
parent1bc13b2e3518ff7856924d7c2bdf06196f605260 (diff)
ASoC: tpa6130a2: Fix unbalanced regulator disables
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@gmail.com> Cc: Peter Ujfalusi <peter.ujfalusi@nokia.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/tpa6130a2.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
index 329acc1a2074..83b5631b13a8 100644
--- a/sound/soc/codecs/tpa6130a2.c
+++ b/sound/soc/codecs/tpa6130a2.c
@@ -125,7 +125,7 @@ static int tpa6130a2_power(int power)
125 data = i2c_get_clientdata(tpa6130a2_client); 125 data = i2c_get_clientdata(tpa6130a2_client);
126 126
127 mutex_lock(&data->mutex); 127 mutex_lock(&data->mutex);
128 if (power) { 128 if (power && !data->power_state) {
129 /* Power on */ 129 /* Power on */
130 if (data->power_gpio >= 0) 130 if (data->power_gpio >= 0)
131 gpio_set_value(data->power_gpio, 1); 131 gpio_set_value(data->power_gpio, 1);
@@ -153,7 +153,7 @@ static int tpa6130a2_power(int power)
153 val = tpa6130a2_read(TPA6130A2_REG_CONTROL); 153 val = tpa6130a2_read(TPA6130A2_REG_CONTROL);
154 val &= ~TPA6130A2_SWS; 154 val &= ~TPA6130A2_SWS;
155 tpa6130a2_i2c_write(TPA6130A2_REG_CONTROL, val); 155 tpa6130a2_i2c_write(TPA6130A2_REG_CONTROL, val);
156 } else { 156 } else if (!power && data->power_state) {
157 /* set SWS */ 157 /* set SWS */
158 val = tpa6130a2_read(TPA6130A2_REG_CONTROL); 158 val = tpa6130a2_read(TPA6130A2_REG_CONTROL);
159 val |= TPA6130A2_SWS; 159 val |= TPA6130A2_SWS;