Skip to contentSkip to conversation

regulator: palmas: Clear PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK bits in palmas_set_mode_smps

PATCH Applied Axel Lin 3 participants 3 messages Jun 7, 2012 – Jun 8, 2012

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 regulator: palmas: Clear PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK bits in palmas_set_mode_smps

Current code actually clears more bits than PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK bits.

---
Hi Graeme,

I'm wandering if we need to clear the status bits.
Current code actually clears bit[7:4] and bit[1:0] and set bit[7:6] to bit[3:2]. Looks like we only need to clear PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK bit[1:0] bits here. and this change makes the intent more clear.

I don't have this hardware,
I'd appreciate if you can test this patch if you think this change ok.

Regards,
Axel

 drivers/regulator/palmas-regulator.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/regulator/palmas-regulator.c +1 -2
index 92f475c..ae0951a 100644
@@ -257,8 +257,7 @@ static int palmas_set_mode_smps(struct regulator_dev *dev, unsigned int mode)
 	unsigned int reg;
 
 	palmas_smps_read(pmic->palmas, palmas_regs_info[id].ctrl_addr, &reg);
-	reg &= ~PALMAS_SMPS12_CTRL_STATUS_MASK;
-	reg >>= PALMAS_SMPS12_CTRL_STATUS_SHIFT;
+	reg &= ~PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK;
 
 	switch (mode) {
 	case REGULATOR_MODE_NORMAL:
Signature · 1 line
1.7.9.5
Acked-by on v1 1/1
#1 lore raw

That looks like a C&P error on my part.

Thanks for noticing.

Quoted 33 lines · Axel Lin

Current code actually clears more bits than PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK bits.

---
Hi Graeme,

I'm wandering if we need to clear the status bits.
Current code actually clears bit[7:4] and bit[1:0] and set bit[7:6] to bit[3:2]. Looks like we only need to clear PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK bit[1:0] bits here. and this change makes the intent more clear.

I don't have this hardware,
I'd appreciate if you can test this patch if you think this change ok.

Regards,
Axel

 drivers/regulator/palmas-regulator.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/regulator/palmas-regulator.c +1 -2
index 92f475c..ae0951a 100644
@@ -257,8 +257,7 @@ static int palmas_set_mode_smps(struct regulator_dev *dev, unsigned int mode)
 	unsigned int reg;
 
 	palmas_smps_read(pmic->palmas, palmas_regs_info[id].ctrl_addr, &reg);
-	reg &= ~PALMAS_SMPS12_CTRL_STATUS_MASK;
-	reg >>= PALMAS_SMPS12_CTRL_STATUS_SHIFT;
+	reg &= ~PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK;
 
 	switch (mode) {
 	case REGULATOR_MODE_NORMAL:
Applied
#2 lore raw
In reply to Axel Lin
Quoted 2 lines · Axel Lin

Current code actually clears more bits than PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK bits.

Applied, thanks.