summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/core.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2020-11-13 17:09:18 +0000
committerMark Brown <broonie@kernel.org>2020-11-13 17:09:18 +0000
commit2f595d08614691a2443987496995c24ff397abf9 (patch)
treec98d5b48efbe635dd47bc775d878fab6e4945ce2 /drivers/regulator/core.c
parent0917c9db23accb8690d8f1987ada36eb5b1a5ac9 (diff)
parentbdcd1177578cd5556f7494da86d5038db8203a16 (diff)
downloadlinux-2f595d08614691a2443987496995c24ff397abf9.tar.bz2
Merge series "regulator: mcp16502: add support for ramp delay" from Claudiu Beznea <claudiu.beznea@microchip.com>:
Hi, This series adds support for ramp delay on mcp16502. It also adds some cleanup on mcp16502. Apart from that patches 1/6 fixes the selector validation in case the regulator::desc::linear_min_sel is not zero. Thank you, Claudiu Beznea Changes in v3: - fix compilation error in patch 5/6 Reported-by: kernel test robot <lkp@intel.com> Changes in v2: - rebase on top of regulator/for-next - checked 1/6 and 3/6 applies on top of regulator/for-5.10 Claudiu Beznea (6): regulator: core: validate selector against linear_min_sel regulator: core: do not continue if selector match regulator: mcp16502: add linear_min_sel regulator: mcp16502: adapt for get/set on other registers regulator: mcp16502: add support for ramp delay regulator: mcp16502: remove void documentation of struct mcp16502 drivers/regulator/core.c | 12 +++- drivers/regulator/helpers.c | 3 +- drivers/regulator/mcp16502.c | 135 ++++++++++++++++++++++++++++++++++++------- 3 files changed, 127 insertions(+), 23 deletions(-) -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r--drivers/regulator/core.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 2aa7def7cec6..7de3df6bedbf 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2958,7 +2958,8 @@ static int _regulator_list_voltage(struct regulator_dev *rdev,
return rdev->desc->fixed_uV;
if (ops->list_voltage) {
- if (selector >= rdev->desc->n_voltages)
+ if (selector >= rdev->desc->n_voltages ||
+ selector < rdev->desc->linear_min_sel)
return -EINVAL;
if (lock)
regulator_lock(rdev);
@@ -3109,7 +3110,8 @@ int regulator_list_hardware_vsel(struct regulator *regulator,
struct regulator_dev *rdev = regulator->rdev;
const struct regulator_ops *ops = rdev->desc->ops;
- if (selector >= rdev->desc->n_voltages)
+ if (selector >= rdev->desc->n_voltages ||
+ selector < rdev->desc->linear_min_sel)
return -EINVAL;
if (ops->set_voltage_sel != regulator_set_voltage_sel_regmap)
return -EOPNOTSUPP;
@@ -4032,6 +4034,9 @@ int regulator_set_voltage_time(struct regulator *regulator,
for (i = 0; i < rdev->desc->n_voltages; i++) {
/* We only look for exact voltage matches here */
+ if (i < rdev->desc->linear_min_sel)
+ continue;
+
voltage = regulator_list_voltage(regulator, i);
if (voltage < 0)
return -EINVAL;