regulator: s2mps11: Fix buck7 and buck8 wrong voltages
Subsystems (5)
Krzysztof Kozlowski
maintainerPATCH 1/2 regulator: s2mps11: Fix buck7 and buck8 wrong voltages
On S2MPS11 device, the buck7 and buck8 regulator voltages start at 750 mV, not 600 mV. Using wrong minimal value caused shifting of these regulator values by 150 mV (e.g. buck7 usually configured to v1.35 V was reported as 1.2 V).
On most of the boards these regulators are left in default state so this was only affecting reported voltage. However if any driver wanted to change them, then effectively it would set voltage 150 mV higher than intended.
--- drivers/regulator/s2mps11.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/regulator/s2mps11.c +2 -2
@@ -479,8 +479,8 @@ static const struct regulator_desc s2mps11_regulators[] = {regulator_desc_s2mps11_buck1_4 (4 ), regulator_desc_s2mps11_buck5,regulator_desc_s2mps11_buck67810 (6 ,MIN_600_MV ,STEP_6_25_MV ), -regulator_desc_s2mps11_buck67810 (7 ,MIN_600_MV ,STEP_12_5_MV ), -regulator_desc_s2mps11_buck67810 (8 ,MIN_600_MV ,STEP_12_5_MV ), +regulator_desc_s2mps11_buck67810 (7 ,MIN_750_MV ,STEP_12_5_MV ), +regulator_desc_s2mps11_buck67810 (8 ,MIN_750_MV ,STEP_12_5_MV ), regulator_desc_s2mps11_buck9, regulator_desc_s2mps11_buck67810(10, MIN_750_MV, STEP_12_5_MV), };
Signature · 1 line
2.17.1
Krzysztof Kozlowski
maintainerPATCH 2/2 regulator: s2mps11: Adjust supported buck voltages to real values
The driver was registering buck regulators with unsupported range of voltages for S2MPS11 devices. Basically it assumed that all 256 values are possible for a single 8-bit I2C register controlling buck's voltage. This is not true, as datasheet describes subset of these which can be used.
For example for buck[12346] the minimum voltage is 650 mV which corresponds to register value of 0x8. The driver was however registering regulator starting at 600 mV, so for a step of 6.25 mV this gave the same result. However this allowed to try to configure regulators to unsupported values.
--- drivers/regulator/s2mps11.c | 27 +++++++++++++++++---------- include/linux/mfd/samsung/core.h | 1 + include/linux/mfd/samsung/s2mps11.h | 4 +++- 3 files changed, 21 insertions(+), 11 deletions(-)
drivers/regulator/s2mps11.c +17 -10
@@ -376,9 +376,10 @@ static const struct regulator_ops s2mps11_buck_ops = { .ops = &s2mps11_buck_ops, \ .type = REGULATOR_VOLTAGE, \ .owner = THIS_MODULE, \ - .min_uV = MIN_600_MV, \ + .min_uV = MIN_650_MV, \ .uV_step = STEP_6_25_MV, \ - .n_voltages = S2MPS11_BUCK_N_VOLTAGES, \ + .linear_min_sel = 8, \ + .n_voltages = S2MPS11_BUCK12346_N_VOLTAGES, \ .ramp_delay = S2MPS11_RAMP_DELAY, \ .vsel_reg = S2MPS11_REG_B1CTRL2 + (num - 1) * 2, \ .vsel_mask = S2MPS11_BUCK_VSEL_MASK, \
@@ -392,9 +393,10 @@ static const struct regulator_ops s2mps11_buck_ops = { .ops = &s2mps11_buck_ops, \ .type = REGULATOR_VOLTAGE, \ .owner = THIS_MODULE, \ - .min_uV = MIN_600_MV, \ + .min_uV = MIN_650_MV, \ .uV_step = STEP_6_25_MV, \ - .n_voltages = S2MPS11_BUCK_N_VOLTAGES, \ + .linear_min_sel = 8, \ + .n_voltages = S2MPS11_BUCK5_N_VOLTAGES, \ .ramp_delay = S2MPS11_RAMP_DELAY, \ .vsel_reg = S2MPS11_REG_B5CTRL2, \ .vsel_mask = S2MPS11_BUCK_VSEL_MASK, \
@@ -402,7 +404,7 @@ static const struct regulator_ops s2mps11_buck_ops = { .enable_mask = S2MPS11_ENABLE_MASK \ } -#define regulator_desc_s2mps11_buck67810 (num, min, step) { \ +#define regulator_desc_s2mps11_buck67810 (num, min, step, min_sel, voltages) { \ .name = "BUCK"#num, \ .id = S2MPS11_BUCK##num, \ .ops = &s2mps11_buck_ops, \
@@ -410,7 +412,8 @@ static const struct regulator_ops s2mps11_buck_ops = { .owner = THIS_MODULE, \ .min_uV = min, \ .uV_step = step, \ - .n_voltages = S2MPS11_BUCK_N_VOLTAGES, \ + .linear_min_sel = min_sel, \ + .n_voltages = voltages, \ .ramp_delay = S2MPS11_RAMP_DELAY, \ .vsel_reg = S2MPS11_REG_B6CTRL2 + (num - 6) * 2, \ .vsel_mask = S2MPS11_BUCK_VSEL_MASK, \
@@ -478,11 +481,15 @@ static const struct regulator_desc s2mps11_regulators[] = {regulator_desc_s2mps11_buck1_4 (3 ),regulator_desc_s2mps11_buck1_4 (4 ), regulator_desc_s2mps11_buck5, -regulator_desc_s2mps11_buck67810 (6 ,MIN_600_MV ,STEP_6_25_MV ), -regulator_desc_s2mps11_buck67810 (7 ,MIN_750_MV ,STEP_12_5_MV ), -regulator_desc_s2mps11_buck67810 (8 ,MIN_750_MV ,STEP_12_5_MV ), +regulator_desc_s2mps11_buck67810 (6 ,MIN_650_MV ,STEP_6_25_MV ,8 , +S2MPS11_BUCK12346_N_VOLTAGES ), +regulator_desc_s2mps11_buck67810 (7 ,MIN_750_MV ,STEP_12_5_MV ,0 , +S2MPS11_BUCK7810_N_VOLTAGES ), +regulator_desc_s2mps11_buck67810 (8 ,MIN_750_MV ,STEP_12_5_MV ,0 , +S2MPS11_BUCK7810_N_VOLTAGES ), regulator_desc_s2mps11_buck9, - regulator_desc_s2mps11_buck67810(10, MIN_750_MV, STEP_12_5_MV), +regulator_desc_s2mps11_buck67810 (10 ,MIN_750_MV ,STEP_12_5_MV ,0 , + S2MPS11_BUCK7810_N_VOLTAGES), };static const struct regulator_ops s2mps14_reg_ops;
include/linux/mfd/samsung/core.h +1 -0
@@ -20,6 +20,7 @@#define MIN_850_MV 850000#define MIN_800_MV 800000#define MIN_750_MV 750000 +#define MIN_650_MV 650000#define MIN_600_MV 600000#define MIN_500_MV 500000
include/linux/mfd/samsung/s2mps11.h +3 -1
@@ -170,7 +170,9 @@ enum s2mps11_regulators {#define S2MPS11_ENABLE_MASK (0x03 << S2MPS11_ENABLE_SHIFT)#define S2MPS11_ENABLE_SHIFT 0x06#define S2MPS11_LDO_N_VOLTAGES (S2MPS11_LDO_VSEL_MASK + 1) -#define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1) +#define S2MPS11_BUCK12346_N_VOLTAGES 153 +#define S2MPS11_BUCK5_N_VOLTAGES 216 +#define S2MPS11_BUCK7810_N_VOLTAGES 225#define S2MPS11_BUCK9_N_VOLTAGES (S2MPS11_BUCK9_VSEL_MASK + 1)#define S2MPS11_RAMP_DELAY 25000/* uV/us */
Signature · 1 line
2.17.1
Mark Brown
maintainerApplied "regulator: s2mps11: Adjust supported buck voltages to real values" to the regulator tree
The patch
regulator: s2mps11: Adjust supported buck voltages to real values
has been applied to the regulator tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-5.2
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
9d83dcb3e4553f34ee1c4f09d65173159f9eb7a7Mon Sep 17 00:00:00 2001
From: Krzysztof Kozlowski <[email protected]>
Date: Sat, 29 Jun 2019 13:44:46 +0200
Subject: [PATCH] regulator: s2mps11: Adjust supported buck voltages to real
values
The driver was registering buck regulators with unsupported range of voltages for S2MPS11 devices. Basically it assumed that all 256 values are possible for a single 8-bit I2C register controlling buck's voltage. This is not true, as datasheet describes subset of these which can be used.
For example for buck[12346] the minimum voltage is 650 mV which corresponds to register value of 0x8. The driver was however registering regulator starting at 600 mV, so for a step of 6.25 mV this gave the same result. However this allowed to try to configure regulators to unsupported values.
--- drivers/regulator/s2mps11.c | 27 +++++++++++++++++---------- include/linux/mfd/samsung/core.h | 1 + include/linux/mfd/samsung/s2mps11.h | 4 +++- 3 files changed, 21 insertions(+), 11 deletions(-)
drivers/regulator/s2mps11.c +17 -10
@@ -269,9 +269,10 @@ static const struct regulator_ops s2mps11_buck_ops = { .ops = &s2mps11_buck_ops, \ .type = REGULATOR_VOLTAGE, \ .owner = THIS_MODULE, \ - .min_uV = MIN_600_MV, \ + .min_uV = MIN_650_MV, \ .uV_step = STEP_6_25_MV, \ - .n_voltages = S2MPS11_BUCK_N_VOLTAGES, \ + .linear_min_sel = 8, \ + .n_voltages = S2MPS11_BUCK12346_N_VOLTAGES, \ .ramp_delay = S2MPS11_RAMP_DELAY, \ .vsel_reg = S2MPS11_REG_B1CTRL2 + (num - 1) * 2, \ .vsel_mask = S2MPS11_BUCK_VSEL_MASK, \
@@ -285,9 +286,10 @@ static const struct regulator_ops s2mps11_buck_ops = { .ops = &s2mps11_buck_ops, \ .type = REGULATOR_VOLTAGE, \ .owner = THIS_MODULE, \ - .min_uV = MIN_600_MV, \ + .min_uV = MIN_650_MV, \ .uV_step = STEP_6_25_MV, \ - .n_voltages = S2MPS11_BUCK_N_VOLTAGES, \ + .linear_min_sel = 8, \ + .n_voltages = S2MPS11_BUCK5_N_VOLTAGES, \ .ramp_delay = S2MPS11_RAMP_DELAY, \ .vsel_reg = S2MPS11_REG_B5CTRL2, \ .vsel_mask = S2MPS11_BUCK_VSEL_MASK, \
@@ -295,7 +297,7 @@ static const struct regulator_ops s2mps11_buck_ops = { .enable_mask = S2MPS11_ENABLE_MASK \ } -#define regulator_desc_s2mps11_buck67810 (num, min, step) { \ +#define regulator_desc_s2mps11_buck67810 (num, min, step, min_sel, voltages) { \ .name = "BUCK"#num, \ .id = S2MPS11_BUCK##num, \ .ops = &s2mps11_buck_ops, \
@@ -303,7 +305,8 @@ static const struct regulator_ops s2mps11_buck_ops = { .owner = THIS_MODULE, \ .min_uV = min, \ .uV_step = step, \ - .n_voltages = S2MPS11_BUCK_N_VOLTAGES, \ + .linear_min_sel = min_sel, \ + .n_voltages = voltages, \ .ramp_delay = S2MPS11_RAMP_DELAY, \ .vsel_reg = S2MPS11_REG_B6CTRL2 + (num - 6) * 2, \ .vsel_mask = S2MPS11_BUCK_VSEL_MASK, \
@@ -371,11 +374,15 @@ static const struct regulator_desc s2mps11_regulators[] = {regulator_desc_s2mps11_buck1_4 (3 ),regulator_desc_s2mps11_buck1_4 (4 ), regulator_desc_s2mps11_buck5, -regulator_desc_s2mps11_buck67810 (6 ,MIN_600_MV ,STEP_6_25_MV ), -regulator_desc_s2mps11_buck67810 (7 ,MIN_750_MV ,STEP_12_5_MV ), -regulator_desc_s2mps11_buck67810 (8 ,MIN_750_MV ,STEP_12_5_MV ), +regulator_desc_s2mps11_buck67810 (6 ,MIN_650_MV ,STEP_6_25_MV ,8 , +S2MPS11_BUCK12346_N_VOLTAGES ), +regulator_desc_s2mps11_buck67810 (7 ,MIN_750_MV ,STEP_12_5_MV ,0 , +S2MPS11_BUCK7810_N_VOLTAGES ), +regulator_desc_s2mps11_buck67810 (8 ,MIN_750_MV ,STEP_12_5_MV ,0 , +S2MPS11_BUCK7810_N_VOLTAGES ), regulator_desc_s2mps11_buck9, - regulator_desc_s2mps11_buck67810(10, MIN_750_MV, STEP_12_5_MV), +regulator_desc_s2mps11_buck67810 (10 ,MIN_750_MV ,STEP_12_5_MV ,0 , + S2MPS11_BUCK7810_N_VOLTAGES), };static const struct regulator_ops s2mps14_reg_ops;
include/linux/mfd/samsung/core.h +1 -0
@@ -20,6 +20,7 @@#define MIN_850_MV 850000#define MIN_800_MV 800000#define MIN_750_MV 750000 +#define MIN_650_MV 650000#define MIN_600_MV 600000#define MIN_500_MV 500000
include/linux/mfd/samsung/s2mps11.h +3 -1
@@ -170,7 +170,9 @@ enum s2mps11_regulators {#define S2MPS11_ENABLE_MASK (0x03 << S2MPS11_ENABLE_SHIFT)#define S2MPS11_ENABLE_SHIFT 0x06#define S2MPS11_LDO_N_VOLTAGES (S2MPS11_LDO_VSEL_MASK + 1) -#define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1) +#define S2MPS11_BUCK12346_N_VOLTAGES 153 +#define S2MPS11_BUCK5_N_VOLTAGES 216 +#define S2MPS11_BUCK7810_N_VOLTAGES 225#define S2MPS11_BUCK9_N_VOLTAGES (S2MPS11_BUCK9_VSEL_MASK + 1)#define S2MPS11_RAMP_DELAY 25000/* uV/us */
Signature · 1 line
2.20.1
Mark Brown
maintainerApplied "regulator: s2mps11: Fix buck7 and buck8 wrong voltages" to the regulator tree
In reply to Krzysztof KozlowskiThe patch
regulator: s2mps11: Fix buck7 and buck8 wrong voltages
has been applied to the regulator tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-5.2
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
16da0eb5ab6ef2dd1d33431199126e63db9997ccMon Sep 17 00:00:00 2001
From: Krzysztof Kozlowski <[email protected]>
Date: Sat, 29 Jun 2019 13:44:45 +0200
Subject: [PATCH] regulator: s2mps11: Fix buck7 and buck8 wrong voltages
On S2MPS11 device, the buck7 and buck8 regulator voltages start at 750 mV, not 600 mV. Using wrong minimal value caused shifting of these regulator values by 150 mV (e.g. buck7 usually configured to v1.35 V was reported as 1.2 V).
On most of the boards these regulators are left in default state so this was only affecting reported voltage. However if any driver wanted to change them, then effectively it would set voltage 150 mV higher than intended.
--- drivers/regulator/s2mps11.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/regulator/s2mps11.c +2 -2
@@ -372,8 +372,8 @@ static const struct regulator_desc s2mps11_regulators[] = {regulator_desc_s2mps11_buck1_4 (4 ), regulator_desc_s2mps11_buck5,regulator_desc_s2mps11_buck67810 (6 ,MIN_600_MV ,STEP_6_25_MV ), -regulator_desc_s2mps11_buck67810 (7 ,MIN_600_MV ,STEP_12_5_MV ), -regulator_desc_s2mps11_buck67810 (8 ,MIN_600_MV ,STEP_12_5_MV ), +regulator_desc_s2mps11_buck67810 (7 ,MIN_750_MV ,STEP_12_5_MV ), +regulator_desc_s2mps11_buck67810 (8 ,MIN_750_MV ,STEP_12_5_MV ), regulator_desc_s2mps11_buck9, regulator_desc_s2mps11_buck67810(10, MIN_750_MV, STEP_12_5_MV), };
Signature · 1 line
2.20.1