Commit fd5d1005 authored by Felix Riemann's avatar Felix Riemann Committed by Mark Brown

regulator: da9061/62: Adjust LDO voltage selection minimum value

According to the DA9061 and DA9062 datasheets the LDO voltage selection
registers have a lower value of 0x02. This applies to voltage registers
VLDO1_A, VLDO2_A, VLDO3_A and VLDO4_A. This linear offset of 0x02 was
previously not observed by the driver, causing the LDO output voltage to
be systematically lower by two steps (= 0.1V).

This patch fixes the minimum linear selector offset by setting it to a
value of 2 and increases the n_voltages by the same amount allowing
voltages in the range 0x02 -> 0.9V to 0x38 -> 3.6V to be correctly
selected. Also fixes an incorrect calculaton for the n_voltages value in
the regulator LDO2.

These fixes effect all LDO regulators for DA9061 and DA9062.
Acked-by: default avatarSteve Twiss <stwiss.opensource@diasemi.com>
Tested-by: default avatarSteve Twiss <stwiss.opensource@diasemi.com>
Signed-off-by: default avatarFelix Riemann <felix.riemann@sma.de>
Signed-off-by: default avatarSteve Twiss <stwiss.opensource@diasemi.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 0211f68e
...@@ -493,12 +493,13 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = { ...@@ -493,12 +493,13 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = {
.desc.ops = &da9062_ldo_ops, .desc.ops = &da9062_ldo_ops,
.desc.min_uV = (900) * 1000, .desc.min_uV = (900) * 1000,
.desc.uV_step = (50) * 1000, .desc.uV_step = (50) * 1000,
.desc.n_voltages = ((3600) - (900))/(50) + 1, .desc.n_voltages = ((3600) - (900))/(50) + 1
+ DA9062AA_VLDO_A_MIN_SEL,
.desc.enable_reg = DA9062AA_LDO1_CONT, .desc.enable_reg = DA9062AA_LDO1_CONT,
.desc.enable_mask = DA9062AA_LDO1_EN_MASK, .desc.enable_mask = DA9062AA_LDO1_EN_MASK,
.desc.vsel_reg = DA9062AA_VLDO1_A, .desc.vsel_reg = DA9062AA_VLDO1_A,
.desc.vsel_mask = DA9062AA_VLDO1_A_MASK, .desc.vsel_mask = DA9062AA_VLDO1_A_MASK,
.desc.linear_min_sel = 0, .desc.linear_min_sel = DA9062AA_VLDO_A_MIN_SEL,
.sleep = REG_FIELD(DA9062AA_VLDO1_A, .sleep = REG_FIELD(DA9062AA_VLDO1_A,
__builtin_ffs((int)DA9062AA_LDO1_SL_A_MASK) - 1, __builtin_ffs((int)DA9062AA_LDO1_SL_A_MASK) - 1,
sizeof(unsigned int) * 8 - sizeof(unsigned int) * 8 -
...@@ -525,12 +526,13 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = { ...@@ -525,12 +526,13 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = {
.desc.ops = &da9062_ldo_ops, .desc.ops = &da9062_ldo_ops,
.desc.min_uV = (900) * 1000, .desc.min_uV = (900) * 1000,
.desc.uV_step = (50) * 1000, .desc.uV_step = (50) * 1000,
.desc.n_voltages = ((3600) - (600))/(50) + 1, .desc.n_voltages = ((3600) - (900))/(50) + 1
+ DA9062AA_VLDO_A_MIN_SEL,
.desc.enable_reg = DA9062AA_LDO2_CONT, .desc.enable_reg = DA9062AA_LDO2_CONT,
.desc.enable_mask = DA9062AA_LDO2_EN_MASK, .desc.enable_mask = DA9062AA_LDO2_EN_MASK,
.desc.vsel_reg = DA9062AA_VLDO2_A, .desc.vsel_reg = DA9062AA_VLDO2_A,
.desc.vsel_mask = DA9062AA_VLDO2_A_MASK, .desc.vsel_mask = DA9062AA_VLDO2_A_MASK,
.desc.linear_min_sel = 0, .desc.linear_min_sel = DA9062AA_VLDO_A_MIN_SEL,
.sleep = REG_FIELD(DA9062AA_VLDO2_A, .sleep = REG_FIELD(DA9062AA_VLDO2_A,
__builtin_ffs((int)DA9062AA_LDO2_SL_A_MASK) - 1, __builtin_ffs((int)DA9062AA_LDO2_SL_A_MASK) - 1,
sizeof(unsigned int) * 8 - sizeof(unsigned int) * 8 -
...@@ -557,12 +559,13 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = { ...@@ -557,12 +559,13 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = {
.desc.ops = &da9062_ldo_ops, .desc.ops = &da9062_ldo_ops,
.desc.min_uV = (900) * 1000, .desc.min_uV = (900) * 1000,
.desc.uV_step = (50) * 1000, .desc.uV_step = (50) * 1000,
.desc.n_voltages = ((3600) - (900))/(50) + 1, .desc.n_voltages = ((3600) - (900))/(50) + 1
+ DA9062AA_VLDO_A_MIN_SEL,
.desc.enable_reg = DA9062AA_LDO3_CONT, .desc.enable_reg = DA9062AA_LDO3_CONT,
.desc.enable_mask = DA9062AA_LDO3_EN_MASK, .desc.enable_mask = DA9062AA_LDO3_EN_MASK,
.desc.vsel_reg = DA9062AA_VLDO3_A, .desc.vsel_reg = DA9062AA_VLDO3_A,
.desc.vsel_mask = DA9062AA_VLDO3_A_MASK, .desc.vsel_mask = DA9062AA_VLDO3_A_MASK,
.desc.linear_min_sel = 0, .desc.linear_min_sel = DA9062AA_VLDO_A_MIN_SEL,
.sleep = REG_FIELD(DA9062AA_VLDO3_A, .sleep = REG_FIELD(DA9062AA_VLDO3_A,
__builtin_ffs((int)DA9062AA_LDO3_SL_A_MASK) - 1, __builtin_ffs((int)DA9062AA_LDO3_SL_A_MASK) - 1,
sizeof(unsigned int) * 8 - sizeof(unsigned int) * 8 -
...@@ -589,12 +592,13 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = { ...@@ -589,12 +592,13 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = {
.desc.ops = &da9062_ldo_ops, .desc.ops = &da9062_ldo_ops,
.desc.min_uV = (900) * 1000, .desc.min_uV = (900) * 1000,
.desc.uV_step = (50) * 1000, .desc.uV_step = (50) * 1000,
.desc.n_voltages = ((3600) - (900))/(50) + 1, .desc.n_voltages = ((3600) - (900))/(50) + 1
+ DA9062AA_VLDO_A_MIN_SEL,
.desc.enable_reg = DA9062AA_LDO4_CONT, .desc.enable_reg = DA9062AA_LDO4_CONT,
.desc.enable_mask = DA9062AA_LDO4_EN_MASK, .desc.enable_mask = DA9062AA_LDO4_EN_MASK,
.desc.vsel_reg = DA9062AA_VLDO4_A, .desc.vsel_reg = DA9062AA_VLDO4_A,
.desc.vsel_mask = DA9062AA_VLDO4_A_MASK, .desc.vsel_mask = DA9062AA_VLDO4_A_MASK,
.desc.linear_min_sel = 0, .desc.linear_min_sel = DA9062AA_VLDO_A_MIN_SEL,
.sleep = REG_FIELD(DA9062AA_VLDO4_A, .sleep = REG_FIELD(DA9062AA_VLDO4_A,
__builtin_ffs((int)DA9062AA_LDO4_SL_A_MASK) - 1, __builtin_ffs((int)DA9062AA_LDO4_SL_A_MASK) - 1,
sizeof(unsigned int) * 8 - sizeof(unsigned int) * 8 -
...@@ -769,12 +773,13 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = { ...@@ -769,12 +773,13 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = {
.desc.ops = &da9062_ldo_ops, .desc.ops = &da9062_ldo_ops,
.desc.min_uV = (900) * 1000, .desc.min_uV = (900) * 1000,
.desc.uV_step = (50) * 1000, .desc.uV_step = (50) * 1000,
.desc.n_voltages = ((3600) - (900))/(50) + 1, .desc.n_voltages = ((3600) - (900))/(50) + 1
+ DA9062AA_VLDO_A_MIN_SEL,
.desc.enable_reg = DA9062AA_LDO1_CONT, .desc.enable_reg = DA9062AA_LDO1_CONT,
.desc.enable_mask = DA9062AA_LDO1_EN_MASK, .desc.enable_mask = DA9062AA_LDO1_EN_MASK,
.desc.vsel_reg = DA9062AA_VLDO1_A, .desc.vsel_reg = DA9062AA_VLDO1_A,
.desc.vsel_mask = DA9062AA_VLDO1_A_MASK, .desc.vsel_mask = DA9062AA_VLDO1_A_MASK,
.desc.linear_min_sel = 0, .desc.linear_min_sel = DA9062AA_VLDO_A_MIN_SEL,
.sleep = REG_FIELD(DA9062AA_VLDO1_A, .sleep = REG_FIELD(DA9062AA_VLDO1_A,
__builtin_ffs((int)DA9062AA_LDO1_SL_A_MASK) - 1, __builtin_ffs((int)DA9062AA_LDO1_SL_A_MASK) - 1,
sizeof(unsigned int) * 8 - sizeof(unsigned int) * 8 -
...@@ -801,12 +806,13 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = { ...@@ -801,12 +806,13 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = {
.desc.ops = &da9062_ldo_ops, .desc.ops = &da9062_ldo_ops,
.desc.min_uV = (900) * 1000, .desc.min_uV = (900) * 1000,
.desc.uV_step = (50) * 1000, .desc.uV_step = (50) * 1000,
.desc.n_voltages = ((3600) - (600))/(50) + 1, .desc.n_voltages = ((3600) - (900))/(50) + 1
+ DA9062AA_VLDO_A_MIN_SEL,
.desc.enable_reg = DA9062AA_LDO2_CONT, .desc.enable_reg = DA9062AA_LDO2_CONT,
.desc.enable_mask = DA9062AA_LDO2_EN_MASK, .desc.enable_mask = DA9062AA_LDO2_EN_MASK,
.desc.vsel_reg = DA9062AA_VLDO2_A, .desc.vsel_reg = DA9062AA_VLDO2_A,
.desc.vsel_mask = DA9062AA_VLDO2_A_MASK, .desc.vsel_mask = DA9062AA_VLDO2_A_MASK,
.desc.linear_min_sel = 0, .desc.linear_min_sel = DA9062AA_VLDO_A_MIN_SEL,
.sleep = REG_FIELD(DA9062AA_VLDO2_A, .sleep = REG_FIELD(DA9062AA_VLDO2_A,
__builtin_ffs((int)DA9062AA_LDO2_SL_A_MASK) - 1, __builtin_ffs((int)DA9062AA_LDO2_SL_A_MASK) - 1,
sizeof(unsigned int) * 8 - sizeof(unsigned int) * 8 -
...@@ -833,12 +839,13 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = { ...@@ -833,12 +839,13 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = {
.desc.ops = &da9062_ldo_ops, .desc.ops = &da9062_ldo_ops,
.desc.min_uV = (900) * 1000, .desc.min_uV = (900) * 1000,
.desc.uV_step = (50) * 1000, .desc.uV_step = (50) * 1000,
.desc.n_voltages = ((3600) - (900))/(50) + 1, .desc.n_voltages = ((3600) - (900))/(50) + 1
+ DA9062AA_VLDO_A_MIN_SEL,
.desc.enable_reg = DA9062AA_LDO3_CONT, .desc.enable_reg = DA9062AA_LDO3_CONT,
.desc.enable_mask = DA9062AA_LDO3_EN_MASK, .desc.enable_mask = DA9062AA_LDO3_EN_MASK,
.desc.vsel_reg = DA9062AA_VLDO3_A, .desc.vsel_reg = DA9062AA_VLDO3_A,
.desc.vsel_mask = DA9062AA_VLDO3_A_MASK, .desc.vsel_mask = DA9062AA_VLDO3_A_MASK,
.desc.linear_min_sel = 0, .desc.linear_min_sel = DA9062AA_VLDO_A_MIN_SEL,
.sleep = REG_FIELD(DA9062AA_VLDO3_A, .sleep = REG_FIELD(DA9062AA_VLDO3_A,
__builtin_ffs((int)DA9062AA_LDO3_SL_A_MASK) - 1, __builtin_ffs((int)DA9062AA_LDO3_SL_A_MASK) - 1,
sizeof(unsigned int) * 8 - sizeof(unsigned int) * 8 -
...@@ -865,12 +872,13 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = { ...@@ -865,12 +872,13 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = {
.desc.ops = &da9062_ldo_ops, .desc.ops = &da9062_ldo_ops,
.desc.min_uV = (900) * 1000, .desc.min_uV = (900) * 1000,
.desc.uV_step = (50) * 1000, .desc.uV_step = (50) * 1000,
.desc.n_voltages = ((3600) - (900))/(50) + 1, .desc.n_voltages = ((3600) - (900))/(50) + 1
+ DA9062AA_VLDO_A_MIN_SEL,
.desc.enable_reg = DA9062AA_LDO4_CONT, .desc.enable_reg = DA9062AA_LDO4_CONT,
.desc.enable_mask = DA9062AA_LDO4_EN_MASK, .desc.enable_mask = DA9062AA_LDO4_EN_MASK,
.desc.vsel_reg = DA9062AA_VLDO4_A, .desc.vsel_reg = DA9062AA_VLDO4_A,
.desc.vsel_mask = DA9062AA_VLDO4_A_MASK, .desc.vsel_mask = DA9062AA_VLDO4_A_MASK,
.desc.linear_min_sel = 0, .desc.linear_min_sel = DA9062AA_VLDO_A_MIN_SEL,
.sleep = REG_FIELD(DA9062AA_VLDO4_A, .sleep = REG_FIELD(DA9062AA_VLDO4_A,
__builtin_ffs((int)DA9062AA_LDO4_SL_A_MASK) - 1, __builtin_ffs((int)DA9062AA_LDO4_SL_A_MASK) - 1,
sizeof(unsigned int) * 8 - sizeof(unsigned int) * 8 -
......
...@@ -797,6 +797,9 @@ ...@@ -797,6 +797,9 @@
#define DA9062AA_BUCK3_SL_A_SHIFT 7 #define DA9062AA_BUCK3_SL_A_SHIFT 7
#define DA9062AA_BUCK3_SL_A_MASK BIT(7) #define DA9062AA_BUCK3_SL_A_MASK BIT(7)
/* DA9062AA_VLDO[1-4]_A common */
#define DA9062AA_VLDO_A_MIN_SEL 2
/* DA9062AA_VLDO1_A = 0x0A9 */ /* DA9062AA_VLDO1_A = 0x0A9 */
#define DA9062AA_VLDO1_A_SHIFT 0 #define DA9062AA_VLDO1_A_SHIFT 0
#define DA9062AA_VLDO1_A_MASK 0x3f #define DA9062AA_VLDO1_A_MASK 0x3f
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment