summaryrefslogtreecommitdiff
path: root/drivers/regulator/mp8859.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2024-02-25 17:59:33 +0300
committerMark Brown <broonie@kernel.org>2024-02-26 16:46:54 +0300
commit6df0921e9013622091c283aa2a5be8c5d1ca3642 (patch)
tree29b2dc422b8fe27f6f7a3bdba80d89f88aca68a4 /drivers/regulator/mp8859.c
parent4317ecadbeeab5464a8c34b27b73e2d2f81ef718 (diff)
downloadlinux-6df0921e9013622091c283aa2a5be8c5d1ca3642.tar.xz
regulator: mp8859: Report slew rate
The MP8859 implements voltage changes at the rate of 1mV/us, tell the core about this so that it can provide appropriate delays on voltage changes. Tested-by: Markus Reichl <m.reichl@fivetechno.de> Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://msgid.link/r/20240225-regulator-mp8859-v1-7-68ee2c839ded@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/mp8859.c')
-rw-r--r--drivers/regulator/mp8859.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/regulator/mp8859.c b/drivers/regulator/mp8859.c
index fc1636d69bca..3e849e1a172f 100644
--- a/drivers/regulator/mp8859.c
+++ b/drivers/regulator/mp8859.c
@@ -81,6 +81,20 @@ static int mp8859_get_voltage_sel(struct regulator_dev *rdev)
return val;
}
+static int mp8859_set_voltage_time_sel(struct regulator_dev *rdev,
+ unsigned int from, unsigned int to)
+{
+ int change;
+
+ /* The voltage ramps at 1mV/uS, selectors are 10mV */
+ if (from > to)
+ change = from - to;
+ else
+ change = to - from;
+
+ return change * 10 * 1000;
+}
+
static unsigned int mp8859_get_mode(struct regulator_dev *rdev)
{
unsigned int val;
@@ -220,6 +234,7 @@ static const struct regulator_ops mp8859_ops = {
.set_voltage_sel = mp8859_set_voltage_sel,
.get_voltage_sel = mp8859_get_voltage_sel,
.list_voltage = regulator_list_voltage_linear_range,
+ .set_voltage_time_sel = mp8859_set_voltage_time_sel,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,