Skip to contentSkip to conversation

regulator: tps65910: fix device initialisation

PATCH In review Johan Hovold 4 participants 15 messages Aug 15, 2011 – Aug 31, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 regulator: tps65910: fix device initialisation

Fix regression introduced by commit a320e3c3d6351814afa5182159df88d2637e0f6f (regulator: tps65911: Add new chip version) which broke probe for all devices:

"Invalid tps chip version"

---
 drivers/regulator/tps65910-regulator.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/regulator/tps65910-regulator.c +2 -0
index 55dd4e6..bc5ed25 100644
@@ -898,9 +898,11 @@ static __devinit int tps65910_probe(struct platform_device *pdev)
 	case TPS65910:
 		pmic->get_ctrl_reg = &tps65910_get_ctrl_register;
 		info = tps65910_regs;
+		break;
 	case TPS65911:
 		pmic->get_ctrl_reg = &tps65911_get_ctrl_register;
 		info = tps65911_regs;
+		break;
 	default:
 		pr_err("Invalid tps chip version\n");
 		return -ENODEV;
Signature · 1 line
1.7.6
#1 lore raw

PATCH 2/3 regulator: tps65910: fix list_voltage for VDD1 and VDD2

Fix regression introduced by commit a320e3c3d6351814afa5182159df88d2637e0f6f (regulator: tps65911: Add new chip version) which broke list_voltage for VDD1 and VDD2.

---
 drivers/regulator/tps65910-regulator.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/regulator/tps65910-regulator.c +1 -0
index bc5ed25..2c61e48 100644
@@ -759,6 +759,7 @@ static int tps65910_list_voltage_dcdc(struct regulator_dev *dev,
 		mult = (selector / VDD1_2_NUM_VOLTS) + 1;
 		volt = VDD1_2_MIN_VOLT +
 				(selector % VDD1_2_NUM_VOLTS) * VDD1_2_OFFSET;
+		break;
 	case TPS65911_REG_VDDCTRL:
 		volt = VDDCTRL_MIN_VOLT + (selector * VDDCTRL_OFFSET);
 	}
Signature · 1 line
1.7.6
Acked-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] regulator: tps65910: fix list_voltage for VDD1 and VDD2

Quoted 3 lines · Johan Hovold

Fix regression introduced by commit a320e3c3d6351814afa5182159df88d2637e0f6f (regulator: tps65911: Add new chip version) which broke list_voltage for VDD1 and VDD2.

Why is this a separate patch to the previous one?

#3 lore raw

Re: [PATCH 2/3] regulator: tps65910: fix list_voltage for VDD1 and VDD2

Quoted 8 lines · Mark Brown
Quoted 3 lines · Johan Hovold

Fix regression introduced by commit a320e3c3d6351814afa5182159df88d2637e0f6f (regulator: tps65911: Add new chip version) which broke list_voltage for VDD1 and VDD2.

Why is this a separate patch to the previous one?

Because it fixes a different bug (although introduced by the same commit and the same kind of programming error).

Thanks,
Johan

#4 lore raw

Re: [PATCH 2/3] regulator: tps65910: fix list_voltage for VDD1 and VDD2

Quoted 6 lines · Johan Hovold
Quoted 1 line · Mark Brown

Why is this a separate patch to the previous one?

Because it fixes a different bug (although introduced by the same commit and the same kind of programming error).

You've got a bunch of missing break statements introduced by the same commit in the same driver causing the same runtime issue...

#5 lore raw

Re: [PATCH 2/3] regulator: tps65910: fix list_voltage for VDD1 and VDD2

Quoted 10 lines · Mark Brown
Quoted 6 lines · Johan Hovold
Quoted 1 line · Mark Brown

Why is this a separate patch to the previous one?

Because it fixes a different bug (although introduced by the same commit and the same kind of programming error).

You've got a bunch of missing break statements introduced by the same commit in the same driver causing the same runtime issue...

Well, the first bug prevents any device from being used at all (as probe always fails). The second bug makes list_voltage return the wrong value for two regulators.

I simply prefer fixing them separately as it will be more clear from the changelog what behaviours are being fixed -- especially as they are marked for stable.

Thanks,
Johan

#6 lore raw

Re: [PATCH 2/3] regulator: tps65910: fix list_voltage for VDD1 and VDD2

Quoted 5 lines · Johan Hovold
Quoted 2 lines · Mark Brown

You've got a bunch of missing break statements introduced by the same commit in the same driver causing the same runtime issue...

Quoted 7 lines

Well, the first bug prevents any device from being used at all (as probe always fails). The second bug makes list_voltage return the wrong value for two regulators.

I simply prefer fixing them separately as it will be more clear from the changelog what behaviours are being fixed -- especially as they are marked for stable.

As a reviewer I did a double take as I wasn't immediately sure if this was actually a different patch or not.

#7 lore raw

PATCH 3/3 regulator: tps65910: verify dcdc regulator ids

In reply to Johan Hovold

Add default case to switches in dcdc voltage functions.

---
 drivers/regulator/tps65910-regulator.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/regulator/tps65910-regulator.c +8 -0
index 2c61e48..991dfa4 100644
@@ -534,6 +534,8 @@ static int tps65910_get_voltage_dcdc(struct regulator_dev *dev)
 		srvsel &= VDDCTRL_SR_SEL_MASK;
 		vselmax = 64;
 		break;
+	default:
+		return -EINVAL;
 	}
 
 	/* multiplier 0 == 1 but 2,3 normal */
@@ -688,6 +690,9 @@ static int tps65910_set_voltage_dcdc(struct regulator_dev *dev,
 	case TPS65911_REG_VDDCTRL:
 		vsel = selector;
 		tps65910_reg_write(pmic, TPS65911_VDDCTRL_OP, vsel);
+		break;
+	default:
+		return -EINVAL;
 	}
 
 	return 0;
@@ -762,6 +767,9 @@ static int tps65910_list_voltage_dcdc(struct regulator_dev *dev,
 		break;
 	case TPS65911_REG_VDDCTRL:
 		volt = VDDCTRL_MIN_VOLT + (selector * VDDCTRL_OFFSET);
+		break;
+	default:
+		return -EINVAL;
 	}
 
 	return  volt * 100 * mult;
Signature · 1 line
1.7.6
#9 lore raw

PATCH v2 3/3 regulator: tps65910: verify dcdc regulator ids

In reply to Johan Hovold

Add default case to switches in dcdc voltage functions.

---
 drivers/regulator/tps65910-regulator.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/regulator/tps65910-regulator.c +5 -0
index 66d2d60..633ecd4 100644
@@ -534,6 +534,8 @@ static int tps65910_get_voltage_dcdc(struct regulator_dev *dev)
 		srvsel &= VDDCTRL_SR_SEL_MASK;
 		vselmax = 64;
 		break;
+	default:
+		return -EINVAL;
 	}
 
 	/* multiplier 0 == 1 but 2,3 normal */
@@ -688,6 +690,9 @@ static int tps65910_set_voltage_dcdc(struct regulator_dev *dev,
 	case TPS65911_REG_VDDCTRL:
 		vsel = selector;
 		tps65910_reg_write(pmic, TPS65911_VDDCTRL_OP, vsel);
+		break;
+	default:
+		return -EINVAL;
 	}
 
 	return 0;
Signature · 1 line
1.7.6
#11 lore raw

Re: [PATCH 3/3 v2] regulator: tps65910: verify dcdc regulator ids

In reply to Johan Hovold
Quoted 21 lines · Johan Hovold

Add default case to switches in dcdc voltage functions.

---
 drivers/regulator/tps65910-regulator.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/regulator/tps65910-regulator.c +2 -0
index 66d2d60..633ecd4 100644
@@ -534,6 +534,8 @@ static int tps65910_get_voltage_dcdc(struct regulator_dev *dev)
 		srvsel &= VDDCTRL_SR_SEL_MASK;
 		vselmax = 64;
 		break;
+	default:
+		return -EINVAL;
 	}
 
 	/* multiplier 0 == 1 but 2,3 normal */

drivers/regulator/tps65910-regulator.c static int tps65910_set_voltage_dcdc(struct regulator_dev *dev, · line 698

Quoted 9 lines
drivers/regulator/tps65910-regulator.c +3 -0
@@ -688,6 +690,9 @@ static int tps65910_set_voltage_dcdc(struct regulator_dev *dev,
 	case TPS65911_REG_VDDCTRL:
 		vsel = selector;
 		tps65910_reg_write(pmic, TPS65911_VDDCTRL_OP, vsel);
+		break;
+	default:
+		return -EINVAL;
 	}
 
 	return 0;

Applied.

Thanks

Liam

#13 lore raw
In reply to Johan Hovold

Hi Johan,

Quoted 18 lines · Johan Hovold

Fix regression introduced by commit a320e3c3d6351814afa5182159df88d2637e0f6f (regulator: tps65911: Add new chip version) which broke probe for all devices:

"Invalid tps chip version"

---
 drivers/regulator/tps65910-regulator.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/regulator/tps65910-regulator.c +0 -0
index 55dd4e6..bc5ed25 100644
@@ -898,9 +898,11 @@ static __devinit int tps65910_probe(struct platform_device *pdev)
 	case TPS65910:

drivers/regulator/tps65910-regulator.c static __devinit int tps65910_probe(struct platform_device *pdev) · line 908

Quoted 10 lines
drivers/regulator/tps65910-regulator.c +2 -0
 		pmic->get_ctrl_reg = &tps65910_get_ctrl_register;
 		info = tps65910_regs;
+		break;
 	case TPS65911:
 		pmic->get_ctrl_reg = &tps65911_get_ctrl_register;
 		info = tps65911_regs;
+		break;
 	default:
 		pr_err("Invalid tps chip version\n");
 		return -ENODEV;

Couldn't apply these as it seems there may already be fixes to some of the issues fixed by your patches. Could you update and resend.

Thanks !

Liam

#14 lore raw
Quoted 26 lines · Liam Girdwood

Hi Johan,

Quoted 23 lines · Johan Hovold

Fix regression introduced by commit a320e3c3d6351814afa5182159df88d2637e0f6f (regulator: tps65911: Add new chip version) which broke probe for all devices:

"Invalid tps chip version"

---
 drivers/regulator/tps65910-regulator.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/regulator/tps65910-regulator.c +1 -0
index 55dd4e6..bc5ed25 100644
@@ -898,9 +898,11 @@ static __devinit int tps65910_probe(struct platform_device *pdev)
 	case TPS65910:
 		pmic->get_ctrl_reg = &tps65910_get_ctrl_register;
 		info = tps65910_regs;
+		break;
 	case TPS65911:
 		pmic->get_ctrl_reg = &tps65911_get_ctrl_register;
Quoted 8 lines

drivers/regulator/tps65910-regulator.c static __devinit int tps65910_probe(struct platform_device *pdev) · line 908

Quoted 5 lines
drivers/regulator/tps65910-regulator.c +1 -0
 		info = tps65911_regs;
+		break;
 	default:
 		pr_err("Invalid tps chip version\n");
 		return -ENODEV;

Couldn't apply these as it seems there may already be fixes to some of the issues fixed by your patches. Could you update and resend.

It seems patches 1 and 2 are subsumed by Axel Lin's d04156bca629740a661fd0738cd69ba1f08b2b20 (regulator: tps65910: Add missing breaks in switch/case), but this one was not marked for stable even though it fixes a regression for tps65910 devices.

I'll send an updated patch 3 in a minute.

Thanks,
Johan