Skip to content

Commit 9b1111f

Browse files
committed
Merge tag 'regulator-fix-v5.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator fixes from Mark Brown: "A collection of fixes for the regulator API that have come up since the merge window, including a big batch of fixes from Axel Lin's usual careful and detailed review. The one stand out fix here is Dmitry Baryshkov's fix for an issue where we fail to power on the parents of always on regulators during system startup if they weren't already powered on" * tag 'regulator-fix-v5.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (21 commits) regulator: rt4801: Fix NULL pointer dereference if priv->enable_gpios is NULL regulator: hi6421v600: Fix .vsel_mask setting regulator: bd718x7: Fix the BUCK7 voltage setting on BD71837 regulator: atc260x: Fix n_voltages and min_sel for pickable linear ranges regulator: rtmv20: Fix to make regcache value first reading back from HW regulator: mt6315: Fix function prototype for mt6315_map_mode regulator: rtmv20: Add Richtek to Kconfig text regulator: rtmv20: Fix .set_current_limit/.get_current_limit callbacks regulator: hisilicon: use the correct HiSilicon copyright regulator: bd71828: Fix .n_voltages settings regulator: bd70528: Fix off-by-one for buck123 .n_voltages setting regulator: max77620: Silence deferred probe error regulator: max77620: Use device_set_of_node_from_dev() regulator: scmi: Fix off-by-one for linear regulators .n_voltages setting regulator: core: resolve supply for boot-on/always-on regulators regulator: fixed: Ensure enable_counter is correct if reg_domain_disable fails regulator: Check ramp_delay_table for regulator_set_ramp_delay_regmap regulator: fan53880: Fix missing n_voltages setting regulator: da9121: Return REGULATOR_MODE_INVALID for invalid mode regulator: fan53555: fix TCS4525 voltage calulation ...
2 parents dc25573 + cb2381c commit 9b1111f

19 files changed

+104
-42
lines changed

drivers/regulator/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ config REGULATOR_RT5033
10311031
current source, LDO and Buck.
10321032

10331033
config REGULATOR_RTMV20
1034-
tristate "RTMV20 Laser Diode Regulator"
1034+
tristate "Richtek RTMV20 Laser Diode Regulator"
10351035
depends on I2C
10361036
select REGMAP_I2C
10371037
help

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

drivers/regulator/bd718x7-regulator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ BD718XX_OPS(bd71837_buck_regulator_ops, regulator_list_voltage_linear_range,
334334
NULL);
335335

336336
BD718XX_OPS(bd71837_buck_regulator_nolinear_ops, regulator_list_voltage_table,
337-
regulator_map_voltage_ascend, bd718xx_set_voltage_sel_restricted,
337+
regulator_map_voltage_ascend, bd71837_set_voltage_sel_restricted,
338338
regulator_get_voltage_sel_regmap, regulator_set_voltage_time_sel,
339339
NULL);
340340
/*

drivers/regulator/core.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,6 +1425,12 @@ static int set_machine_constraints(struct regulator_dev *rdev)
14251425
* and we have control then make sure it is enabled.
14261426
*/
14271427
if (rdev->constraints->always_on || rdev->constraints->boot_on) {
1428+
/* If we want to enable this regulator, make sure that we know
1429+
* the supplying regulator.
1430+
*/
1431+
if (rdev->supply_name && !rdev->supply)
1432+
return -EPROBE_DEFER;
1433+
14281434
if (rdev->supply) {
14291435
ret = regulator_enable(rdev->supply);
14301436
if (ret < 0) {

drivers/regulator/cros-ec-regulator.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,9 @@ static int cros_ec_regulator_probe(struct platform_device *pdev)
225225

226226
drvdata->dev = devm_regulator_register(dev, &drvdata->desc, &cfg);
227227
if (IS_ERR(drvdata->dev)) {
228+
ret = PTR_ERR(drvdata->dev);
228229
dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret);
229-
return PTR_ERR(drvdata->dev);
230+
return ret;
230231
}
231232

232233
platform_set_drvdata(pdev, drvdata);

drivers/regulator/da9121-regulator.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ static unsigned int da9121_map_mode(unsigned int mode)
280280
case DA9121_BUCK_MODE_FORCE_PFM:
281281
return REGULATOR_MODE_STANDBY;
282282
default:
283-
return -EINVAL;
283+
return REGULATOR_MODE_INVALID;
284284
}
285285
}
286286

@@ -317,7 +317,7 @@ static unsigned int da9121_buck_get_mode(struct regulator_dev *rdev)
317317
{
318318
struct da9121 *chip = rdev_get_drvdata(rdev);
319319
int id = rdev_get_id(rdev);
320-
unsigned int val;
320+
unsigned int val, mode;
321321
int ret = 0;
322322

323323
ret = regmap_read(chip->regmap, da9121_mode_field[id].reg, &val);
@@ -326,7 +326,11 @@ static unsigned int da9121_buck_get_mode(struct regulator_dev *rdev)
326326
return -EINVAL;
327327
}
328328

329-
return da9121_map_mode(val & da9121_mode_field[id].msk);
329+
mode = da9121_map_mode(val & da9121_mode_field[id].msk);
330+
if (mode == REGULATOR_MODE_INVALID)
331+
return -EINVAL;
332+
333+
return mode;
330334
}
331335

332336
static const struct regulator_ops da9121_buck_ops = {

drivers/regulator/fan53555.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555

5656
#define FAN53555_NVOLTAGES 64 /* Numbers of voltages */
5757
#define FAN53526_NVOLTAGES 128
58-
#define TCS4525_NVOLTAGES 127 /* Numbers of voltages */
5958

6059
#define TCS_VSEL_NSEL_MASK 0x7f
6160
#define TCS_VSEL0_MODE (1 << 7)
@@ -376,7 +375,7 @@ static int fan53555_voltages_setup_tcs(struct fan53555_device_info *di)
376375
/* Init voltage range and step */
377376
di->vsel_min = 600000;
378377
di->vsel_step = 6250;
379-
di->vsel_count = TCS4525_NVOLTAGES;
378+
di->vsel_count = FAN53526_NVOLTAGES;
380379

381380
return 0;
382381
}

drivers/regulator/fan53880.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ static const struct regulator_ops fan53880_ops = {
5151
REGULATOR_LINEAR_RANGE(800000, 0xf, 0x73, 25000), \
5252
}, \
5353
.n_linear_ranges = 2, \
54+
.n_voltages = 0x74, \
5455
.vsel_reg = FAN53880_LDO ## _num ## VOUT, \
5556
.vsel_mask = 0x7f, \
5657
.enable_reg = FAN53880_ENABLE, \
@@ -76,6 +77,7 @@ static const struct regulator_desc fan53880_regulators[] = {
7677
REGULATOR_LINEAR_RANGE(600000, 0x1f, 0xf7, 12500),
7778
},
7879
.n_linear_ranges = 2,
80+
.n_voltages = 0xf8,
7981
.vsel_reg = FAN53880_BUCKVOUT,
8082
.vsel_mask = 0x7f,
8183
.enable_reg = FAN53880_ENABLE,
@@ -95,6 +97,7 @@ static const struct regulator_desc fan53880_regulators[] = {
9597
REGULATOR_LINEAR_RANGE(3000000, 0x4, 0x70, 25000),
9698
},
9799
.n_linear_ranges = 2,
100+
.n_voltages = 0x71,
98101
.vsel_reg = FAN53880_BOOSTVOUT,
99102
.vsel_mask = 0x7f,
100103
.enable_reg = FAN53880_ENABLE_BOOST,

drivers/regulator/fixed.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,15 @@ static int reg_domain_disable(struct regulator_dev *rdev)
8888
{
8989
struct fixed_voltage_data *priv = rdev_get_drvdata(rdev);
9090
struct device *dev = rdev->dev.parent;
91+
int ret;
92+
93+
ret = dev_pm_genpd_set_performance_state(dev, 0);
94+
if (ret)
95+
return ret;
9196

9297
priv->enable_counter--;
9398

94-
return dev_pm_genpd_set_performance_state(dev, 0);
99+
return 0;
95100
}
96101

97102
static int reg_is_enabled(struct regulator_dev *rdev)

drivers/regulator/helpers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ int regulator_set_ramp_delay_regmap(struct regulator_dev *rdev, int ramp_delay)
948948
int ret;
949949
unsigned int sel;
950950

951-
if (!rdev->desc->n_ramp_values)
951+
if (WARN_ON(!rdev->desc->n_ramp_values || !rdev->desc->ramp_delay_table))
952952
return -EINVAL;
953953

954954
ret = find_closest_bigger(ramp_delay, rdev->desc->ramp_delay_table,

0 commit comments

Comments
 (0)