diff options
Diffstat (limited to 'sound/soc/codecs/tpa6130a2.c')
-rw-r--r-- | sound/soc/codecs/tpa6130a2.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c index 329acc1a2074..d2c243095673 100644 --- a/sound/soc/codecs/tpa6130a2.c +++ b/sound/soc/codecs/tpa6130a2.c | |||
@@ -78,8 +78,10 @@ static int tpa6130a2_i2c_write(int reg, u8 value) | |||
78 | 78 | ||
79 | if (data->power_state) { | 79 | if (data->power_state) { |
80 | val = i2c_smbus_write_byte_data(tpa6130a2_client, reg, value); | 80 | val = i2c_smbus_write_byte_data(tpa6130a2_client, reg, value); |
81 | if (val < 0) | 81 | if (val < 0) { |
82 | dev_err(&tpa6130a2_client->dev, "Write failed\n"); | 82 | dev_err(&tpa6130a2_client->dev, "Write failed\n"); |
83 | return val; | ||
84 | } | ||
83 | } | 85 | } |
84 | 86 | ||
85 | /* Either powered on or off, we save the context */ | 87 | /* Either powered on or off, we save the context */ |
@@ -119,13 +121,13 @@ static int tpa6130a2_power(int power) | |||
119 | { | 121 | { |
120 | struct tpa6130a2_data *data; | 122 | struct tpa6130a2_data *data; |
121 | u8 val; | 123 | u8 val; |
122 | int ret; | 124 | int ret = 0; |
123 | 125 | ||
124 | BUG_ON(tpa6130a2_client == NULL); | 126 | BUG_ON(tpa6130a2_client == NULL); |
125 | data = i2c_get_clientdata(tpa6130a2_client); | 127 | data = i2c_get_clientdata(tpa6130a2_client); |
126 | 128 | ||
127 | mutex_lock(&data->mutex); | 129 | mutex_lock(&data->mutex); |
128 | if (power) { | 130 | if (power && !data->power_state) { |
129 | /* Power on */ | 131 | /* Power on */ |
130 | if (data->power_gpio >= 0) | 132 | if (data->power_gpio >= 0) |
131 | gpio_set_value(data->power_gpio, 1); | 133 | gpio_set_value(data->power_gpio, 1); |
@@ -153,7 +155,7 @@ static int tpa6130a2_power(int power) | |||
153 | val = tpa6130a2_read(TPA6130A2_REG_CONTROL); | 155 | val = tpa6130a2_read(TPA6130A2_REG_CONTROL); |
154 | val &= ~TPA6130A2_SWS; | 156 | val &= ~TPA6130A2_SWS; |
155 | tpa6130a2_i2c_write(TPA6130A2_REG_CONTROL, val); | 157 | tpa6130a2_i2c_write(TPA6130A2_REG_CONTROL, val); |
156 | } else { | 158 | } else if (!power && data->power_state) { |
157 | /* set SWS */ | 159 | /* set SWS */ |
158 | val = tpa6130a2_read(TPA6130A2_REG_CONTROL); | 160 | val = tpa6130a2_read(TPA6130A2_REG_CONTROL); |
159 | val |= TPA6130A2_SWS; | 161 | val |= TPA6130A2_SWS; |