Skip to content

Commit 63f7526

Browse files
Jarkko NikulaLiam Girdwood
authored andcommitted
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 <[email protected]> Cc: Peter Ujfalusi <[email protected]> Acked-by: Mark Brown <[email protected]> Acked-by: Peter Ujfalusi <[email protected]> Signed-off-by: Liam Girdwood <[email protected]>
1 parent 1bc13b2 commit 63f7526

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sound/soc/codecs/tpa6130a2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static int tpa6130a2_power(int power)
125125
data = i2c_get_clientdata(tpa6130a2_client);
126126

127127
mutex_lock(&data->mutex);
128-
if (power) {
128+
if (power && !data->power_state) {
129129
/* Power on */
130130
if (data->power_gpio >= 0)
131131
gpio_set_value(data->power_gpio, 1);
@@ -153,7 +153,7 @@ static int tpa6130a2_power(int power)
153153
val = tpa6130a2_read(TPA6130A2_REG_CONTROL);
154154
val &= ~TPA6130A2_SWS;
155155
tpa6130a2_i2c_write(TPA6130A2_REG_CONTROL, val);
156-
} else {
156+
} else if (!power && data->power_state) {
157157
/* set SWS */
158158
val = tpa6130a2_read(TPA6130A2_REG_CONTROL);
159159
val |= TPA6130A2_SWS;

0 commit comments

Comments
 (0)