Skip to content

Commit ad26aa6

Browse files
batcheubroonie
authored andcommitted
regulator: s2mps11: Fix wrong calculation of register offset
This patch adds missing registers('BUCK7_SW' & 'LDO29_CTRL'). Since BUCK7 has 1 more register (BUCK7_SW) than others, register offset should be added one more for which has bigger address than BUCK7 registers. Fixes: 76b9840(regulator: s2mps11: Add support S2MPS13 regulator device) Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: <stable@vger.kernel.org>
1 parent 97bf6af commit ad26aa6

File tree

2 files changed

+40
-4
lines changed

2 files changed

+40
-4
lines changed

drivers/regulator/s2mps11.c

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,40 @@ static struct regulator_ops s2mps14_reg_ops;
405405
.enable_mask = S2MPS14_ENABLE_MASK \
406406
}
407407

408+
#define regulator_desc_s2mps13_buck7(num, min, step, min_sel) { \
409+
.name = "BUCK"#num, \
410+
.id = S2MPS13_BUCK##num, \
411+
.ops = &s2mps14_reg_ops, \
412+
.type = REGULATOR_VOLTAGE, \
413+
.owner = THIS_MODULE, \
414+
.min_uV = min, \
415+
.uV_step = step, \
416+
.linear_min_sel = min_sel, \
417+
.n_voltages = S2MPS14_BUCK_N_VOLTAGES, \
418+
.ramp_delay = S2MPS13_BUCK_RAMP_DELAY, \
419+
.vsel_reg = S2MPS13_REG_B1OUT + (num) * 2 - 1, \
420+
.vsel_mask = S2MPS14_BUCK_VSEL_MASK, \
421+
.enable_reg = S2MPS13_REG_B1CTRL + (num - 1) * 2, \
422+
.enable_mask = S2MPS14_ENABLE_MASK \
423+
}
424+
425+
#define regulator_desc_s2mps13_buck8_10(num, min, step, min_sel) { \
426+
.name = "BUCK"#num, \
427+
.id = S2MPS13_BUCK##num, \
428+
.ops = &s2mps14_reg_ops, \
429+
.type = REGULATOR_VOLTAGE, \
430+
.owner = THIS_MODULE, \
431+
.min_uV = min, \
432+
.uV_step = step, \
433+
.linear_min_sel = min_sel, \
434+
.n_voltages = S2MPS14_BUCK_N_VOLTAGES, \
435+
.ramp_delay = S2MPS13_BUCK_RAMP_DELAY, \
436+
.vsel_reg = S2MPS13_REG_B1OUT + (num) * 2 - 1, \
437+
.vsel_mask = S2MPS14_BUCK_VSEL_MASK, \
438+
.enable_reg = S2MPS13_REG_B1CTRL + (num) * 2 - 1, \
439+
.enable_mask = S2MPS14_ENABLE_MASK \
440+
}
441+
408442
static const struct regulator_desc s2mps13_regulators[] = {
409443
regulator_desc_s2mps13_ldo(1, MIN_800_MV, STEP_12_5_MV, 0x00),
410444
regulator_desc_s2mps13_ldo(2, MIN_1400_MV, STEP_50_MV, 0x0C),
@@ -452,10 +486,10 @@ static const struct regulator_desc s2mps13_regulators[] = {
452486
regulator_desc_s2mps13_buck(4, MIN_500_MV, STEP_6_25_MV, 0x10),
453487
regulator_desc_s2mps13_buck(5, MIN_500_MV, STEP_6_25_MV, 0x10),
454488
regulator_desc_s2mps13_buck(6, MIN_500_MV, STEP_6_25_MV, 0x10),
455-
regulator_desc_s2mps13_buck(7, MIN_500_MV, STEP_6_25_MV, 0x10),
456-
regulator_desc_s2mps13_buck(8, MIN_1000_MV, STEP_12_5_MV, 0x20),
457-
regulator_desc_s2mps13_buck(9, MIN_1000_MV, STEP_12_5_MV, 0x20),
458-
regulator_desc_s2mps13_buck(10, MIN_500_MV, STEP_6_25_MV, 0x10),
489+
regulator_desc_s2mps13_buck7(7, MIN_500_MV, STEP_6_25_MV, 0x10),
490+
regulator_desc_s2mps13_buck8_10(8, MIN_1000_MV, STEP_12_5_MV, 0x20),
491+
regulator_desc_s2mps13_buck8_10(9, MIN_1000_MV, STEP_12_5_MV, 0x20),
492+
regulator_desc_s2mps13_buck8_10(10, MIN_500_MV, STEP_6_25_MV, 0x10),
459493
};
460494

461495
static int s2mps14_regulator_enable(struct regulator_dev *rdev)

include/linux/mfd/samsung/s2mps13.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ enum s2mps13_reg {
5959
S2MPS13_REG_B6CTRL,
6060
S2MPS13_REG_B6OUT,
6161
S2MPS13_REG_B7CTRL,
62+
S2MPS13_REG_B7SW,
6263
S2MPS13_REG_B7OUT,
6364
S2MPS13_REG_B8CTRL,
6465
S2MPS13_REG_B8OUT,
@@ -102,6 +103,7 @@ enum s2mps13_reg {
102103
S2MPS13_REG_L26CTRL,
103104
S2MPS13_REG_L27CTRL,
104105
S2MPS13_REG_L28CTRL,
106+
S2MPS13_REG_L29CTRL,
105107
S2MPS13_REG_L30CTRL,
106108
S2MPS13_REG_L31CTRL,
107109
S2MPS13_REG_L32CTRL,

0 commit comments

Comments
 (0)