Skip to content

Commit fc2d8c9

Browse files
krzkgregkh
authored andcommitted
regulator: s2mps11: Fix invalid selector mask and voltages for buck9
commit 3b672623079bb3e5685b8549e514f2dfaa564406 upstream. The buck9 regulator of S2MPS11 PMIC had incorrect vsel_mask (0xff instead of 0x1f) thus reading entire register as buck9's voltage. This effectively caused regulator core to interpret values as higher voltages than they were and then to set real voltage much lower than intended. The buck9 provides power to other regulators, including LDO13 and LDO19 which supply the MMC2 (SD card). On Odroid XU3/XU4 the lower voltage caused SD card detection errors on Odroid XU3/XU4: mmc1: card never left busy state mmc1: error -110 whilst initialising SD card During driver probe the regulator core was checking whether initial voltage matches the constraints. With incorrect vsel_mask of 0xff and default value of 0x50, the core interpreted this as 5 V which is outside of constraints (3-3.775 V). Then the regulator core was adjusting the voltage to match the constraints. With incorrect vsel_mask this new voltage mapped to a vere low voltage in the driver. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com> Tested-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent cf73d8a commit fc2d8c9

2 files changed

Lines changed: 24 additions & 6 deletions

File tree

drivers/regulator/s2mps11.c

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ static struct regulator_ops s2mps11_buck_ops = {
305305
.enable_mask = S2MPS11_ENABLE_MASK \
306306
}
307307

308-
#define regulator_desc_s2mps11_buck6_10(num, min, step) { \
308+
#define regulator_desc_s2mps11_buck67810(num, min, step) { \
309309
.name = "BUCK"#num, \
310310
.id = S2MPS11_BUCK##num, \
311311
.ops = &s2mps11_buck_ops, \
@@ -321,6 +321,22 @@ static struct regulator_ops s2mps11_buck_ops = {
321321
.enable_mask = S2MPS11_ENABLE_MASK \
322322
}
323323

324+
#define regulator_desc_s2mps11_buck9 { \
325+
.name = "BUCK9", \
326+
.id = S2MPS11_BUCK9, \
327+
.ops = &s2mps11_buck_ops, \
328+
.type = REGULATOR_VOLTAGE, \
329+
.owner = THIS_MODULE, \
330+
.min_uV = MIN_3000_MV, \
331+
.uV_step = STEP_25_MV, \
332+
.n_voltages = S2MPS11_BUCK9_N_VOLTAGES, \
333+
.ramp_delay = S2MPS11_RAMP_DELAY, \
334+
.vsel_reg = S2MPS11_REG_B9CTRL2, \
335+
.vsel_mask = S2MPS11_BUCK9_VSEL_MASK, \
336+
.enable_reg = S2MPS11_REG_B9CTRL1, \
337+
.enable_mask = S2MPS11_ENABLE_MASK \
338+
}
339+
324340
static const struct regulator_desc s2mps11_regulators[] = {
325341
regulator_desc_s2mps11_ldo(1, STEP_25_MV),
326342
regulator_desc_s2mps11_ldo(2, STEP_50_MV),
@@ -365,11 +381,11 @@ static const struct regulator_desc s2mps11_regulators[] = {
365381
regulator_desc_s2mps11_buck1_4(3),
366382
regulator_desc_s2mps11_buck1_4(4),
367383
regulator_desc_s2mps11_buck5,
368-
regulator_desc_s2mps11_buck6_10(6, MIN_600_MV, STEP_6_25_MV),
369-
regulator_desc_s2mps11_buck6_10(7, MIN_600_MV, STEP_6_25_MV),
370-
regulator_desc_s2mps11_buck6_10(8, MIN_600_MV, STEP_6_25_MV),
371-
regulator_desc_s2mps11_buck6_10(9, MIN_3000_MV, STEP_25_MV),
372-
regulator_desc_s2mps11_buck6_10(10, MIN_750_MV, STEP_12_5_MV),
384+
regulator_desc_s2mps11_buck67810(6, MIN_600_MV, STEP_6_25_MV),
385+
regulator_desc_s2mps11_buck67810(7, MIN_600_MV, STEP_6_25_MV),
386+
regulator_desc_s2mps11_buck67810(8, MIN_600_MV, STEP_6_25_MV),
387+
regulator_desc_s2mps11_buck9,
388+
regulator_desc_s2mps11_buck67810(10, MIN_750_MV, STEP_12_5_MV),
373389
};
374390

375391
static struct regulator_ops s2mps14_reg_ops;

include/linux/mfd/samsung/s2mps11.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,12 @@ enum s2mps11_regulators {
173173

174174
#define S2MPS11_LDO_VSEL_MASK 0x3F
175175
#define S2MPS11_BUCK_VSEL_MASK 0xFF
176+
#define S2MPS11_BUCK9_VSEL_MASK 0x1F
176177
#define S2MPS11_ENABLE_MASK (0x03 << S2MPS11_ENABLE_SHIFT)
177178
#define S2MPS11_ENABLE_SHIFT 0x06
178179
#define S2MPS11_LDO_N_VOLTAGES (S2MPS11_LDO_VSEL_MASK + 1)
179180
#define S2MPS11_BUCK_N_VOLTAGES (S2MPS11_BUCK_VSEL_MASK + 1)
181+
#define S2MPS11_BUCK9_N_VOLTAGES (S2MPS11_BUCK9_VSEL_MASK + 1)
180182
#define S2MPS11_RAMP_DELAY 25000 /* uV/us */
181183

182184
#define S2MPS11_CTRL1_PWRHOLD_MASK BIT(4)

0 commit comments

Comments
 (0)