Skip to contentSkip to conversation

regulator: twl-regulator: fix n_voltages for twl6030 variable LDOs

PATCH Applied Colin Cross 3 participants 3 messages May 27, 2011 – May 30, 2011

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

PATCH 1/1 regulator: twl-regulator: fix n_voltages for twl6030 variable LDOs

The n_voltages initializer for the TWL6030_ADJUSTABLE_LDO macro is off by one, causing the the highest supported voltage to be unreachable. Setting the machine constraints to only allow the highest voltage causes errors:

machine_constraints_voltage: VAUX3_6030: unsupportable voltage constraints twl_reg twl_reg.39: can't register VAUX3_6030, -22
twl_reg: probe of twl_reg.39 failed with error -22

This patch fixes the off by one error. Tested by setting VAUX3_6030 to 3.3V.

---
 drivers/regulator/twl-regulator.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/regulator/twl-regulator.c +1 -1
index 6a29285..afd9c7e 100644
@@ -520,7 +520,7 @@ static struct regulator_ops twl6030_fixed_resource = {
 	.desc = { \
 		.name = #label, \
 		.id = TWL6030_REG_##label, \
-		.n_voltages = (max_mVolts - min_mVolts)/100, \
+		.n_voltages = (max_mVolts - min_mVolts)/100 + 1, \
 		.ops = &twl6030ldo_ops, \
 		.type = REGULATOR_VOLTAGE, \
 		.owner = THIS_MODULE, \
Signature · 1 line
1.7.4.1
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Colin Cross

The n_voltages initializer for the TWL6030_ADJUSTABLE_LDO macro is off by one, causing the the highest supported voltage to be unreachable. Setting the machine constraints to only allow the highest voltage causes errors:

#2 lore raw
In reply to Colin Cross
Quoted 22 lines · Colin Cross

The n_voltages initializer for the TWL6030_ADJUSTABLE_LDO macro is off by one, causing the the highest supported voltage to be unreachable. Setting the machine constraints to only allow the highest voltage causes errors:

machine_constraints_voltage: VAUX3_6030: unsupportable voltage constraints twl_reg twl_reg.39: can't register VAUX3_6030, -22
twl_reg: probe of twl_reg.39 failed with error -22

This patch fixes the off by one error. Tested by setting VAUX3_6030 to 3.3V.

---
 drivers/regulator/twl-regulator.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/regulator/twl-regulator.c +0 -0
index 6a29285..afd9c7e 100644

drivers/regulator/twl-regulator.c static struct regulator_ops twl6030_fixed_resource = { · line 526

Quoted 8 lines
drivers/regulator/twl-regulator.c +1 -1
@@ -520,7 +520,7 @@ static struct regulator_ops twl6030_fixed_resource = {
 	.desc = { \
 		.name = #label, \
 		.id = TWL6030_REG_##label, \
-		.n_voltages = (max_mVolts - min_mVolts)/100, \
+		.n_voltages = (max_mVolts - min_mVolts)/100 + 1, \
 		.ops = &twl6030ldo_ops, \
 		.type = REGULATOR_VOLTAGE, \
 		.owner = THIS_MODULE, \

Applied.

Thanks

Liam