Skip to content

Commit 4ebb9d7

Browse files
srebroonie
authored andcommitted
regulator: cpcap: Fix standby mode
The original patch from Tony uses standby mode bit inverted, which is not correct. This fixes all instances in the driver code for get & set mode. This did not yet make problems, since mode has not been changed by any mainline driver so far. Fixes: 0ad4c07 ("regulator: cpcap: Add basic regulator support") Acked-by: Tony Lindgren <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]> Signed-off-by: Mark Brown <[email protected]> Cc: [email protected]
1 parent 8d67f64 commit 4ebb9d7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/regulator/cpcap-regulator.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@
7777
#define CPCAP_BIT_VAUDIO_MODE0 BIT(1)
7878
#define CPCAP_BIT_V_AUDIO_EN BIT(0)
7979

80+
#define CPCAP_BIT_AUDIO_NORMAL_MODE 0x00
81+
8082
/*
8183
* Off mode configuration bit. Used currently only by SW5 on omap4. There's
8284
* the following comment in Motorola Linux kernel tree for it:
@@ -217,7 +219,7 @@ static unsigned int cpcap_regulator_get_mode(struct regulator_dev *rdev)
217219

218220
regmap_read(rdev->regmap, rdev->desc->enable_reg, &value);
219221

220-
if (!(value & CPCAP_BIT_AUDIO_LOW_PWR))
222+
if (value & CPCAP_BIT_AUDIO_LOW_PWR)
221223
return REGULATOR_MODE_STANDBY;
222224

223225
return REGULATOR_MODE_NORMAL;
@@ -230,10 +232,10 @@ static int cpcap_regulator_set_mode(struct regulator_dev *rdev,
230232

231233
switch (mode) {
232234
case REGULATOR_MODE_NORMAL:
233-
value = CPCAP_BIT_AUDIO_LOW_PWR;
235+
value = CPCAP_BIT_AUDIO_NORMAL_MODE;
234236
break;
235237
case REGULATOR_MODE_STANDBY:
236-
value = 0;
238+
value = CPCAP_BIT_AUDIO_LOW_PWR;
237239
break;
238240
default:
239241
return -EINVAL;

0 commit comments

Comments
 (0)