Skip to content

Commit 1963fa6

Browse files
AxelLinbroonie
authored andcommitted
regulator: atc260x: Fix n_voltages and min_sel for pickable linear ranges
The .n_voltages was missed for pickable linear ranges, fix it. The min_sel for each pickable range should be starting from 0. Also fix atc260x_ldo_voltage_range_sel setting (bit 5 - LDO<N>_VOL_SEL in datasheet). Fixes: 3b15cca ("regulator: Add regulator driver for ATC260x PMICs") Signed-off-by: Axel Lin <axel.lin@ingics.com> Reviewed-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com> Link: https://lore.kernel.org/r/20210528230147.363974-1-axel.lin@ingics.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 46639a5 commit 1963fa6

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

‎drivers/regulator/atc260x-regulator.c‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ static const struct linear_range atc2609a_dcdc_voltage_ranges[] = {
2828

2929
static const struct linear_range atc2609a_ldo_voltage_ranges0[] = {
3030
REGULATOR_LINEAR_RANGE(700000, 0, 15, 100000),
31-
REGULATOR_LINEAR_RANGE(2100000, 16, 28, 100000),
31+
REGULATOR_LINEAR_RANGE(2100000, 0, 12, 100000),
3232
};
3333

3434
static const struct linear_range atc2609a_ldo_voltage_ranges1[] = {
3535
REGULATOR_LINEAR_RANGE(850000, 0, 15, 100000),
36-
REGULATOR_LINEAR_RANGE(2100000, 16, 27, 100000),
36+
REGULATOR_LINEAR_RANGE(2100000, 0, 11, 100000),
3737
};
3838

3939
static const unsigned int atc260x_ldo_voltage_range_sel[] = {
40-
0x0, 0x1,
40+
0x0, 0x20,
4141
};
4242

4343
static int atc260x_dcdc_set_voltage_time_sel(struct regulator_dev *rdev,
@@ -411,7 +411,7 @@ enum atc2609a_reg_ids {
411411
.owner = THIS_MODULE, \
412412
}
413413

414-
#define atc2609a_reg_desc_ldo_range_pick(num, n_range) { \
414+
#define atc2609a_reg_desc_ldo_range_pick(num, n_range, n_volt) { \
415415
.name = "LDO"#num, \
416416
.supply_name = "ldo"#num, \
417417
.of_match = of_match_ptr("ldo"#num), \
@@ -421,6 +421,7 @@ enum atc2609a_reg_ids {
421421
.type = REGULATOR_VOLTAGE, \
422422
.linear_ranges = atc2609a_ldo_voltage_ranges##n_range, \
423423
.n_linear_ranges = ARRAY_SIZE(atc2609a_ldo_voltage_ranges##n_range), \
424+
.n_voltages = n_volt, \
424425
.vsel_reg = ATC2609A_PMU_LDO##num##_CTL0, \
425426
.vsel_mask = GENMASK(4, 1), \
426427
.vsel_range_reg = ATC2609A_PMU_LDO##num##_CTL0, \
@@ -458,12 +459,12 @@ static const struct regulator_desc atc2609a_reg[] = {
458459
atc2609a_reg_desc_ldo_bypass(0),
459460
atc2609a_reg_desc_ldo_bypass(1),
460461
atc2609a_reg_desc_ldo_bypass(2),
461-
atc2609a_reg_desc_ldo_range_pick(3, 0),
462-
atc2609a_reg_desc_ldo_range_pick(4, 0),
462+
atc2609a_reg_desc_ldo_range_pick(3, 0, 29),
463+
atc2609a_reg_desc_ldo_range_pick(4, 0, 29),
463464
atc2609a_reg_desc_ldo(5),
464-
atc2609a_reg_desc_ldo_range_pick(6, 1),
465-
atc2609a_reg_desc_ldo_range_pick(7, 0),
466-
atc2609a_reg_desc_ldo_range_pick(8, 0),
465+
atc2609a_reg_desc_ldo_range_pick(6, 1, 28),
466+
atc2609a_reg_desc_ldo_range_pick(7, 0, 29),
467+
atc2609a_reg_desc_ldo_range_pick(8, 0, 29),
467468
atc2609a_reg_desc_ldo_fixed(9),
468469
};
469470

0 commit comments

Comments
 (0)