summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorKeerthy <j-keerthy@ti.com>2016-10-26 13:42:30 +0530
committerSimon Glass <sjg@chromium.org>2016-11-25 10:00:04 -0700
commit2f5d532f3b8a7697dc1b5700000b1e350323d50c (patch)
tree07e3089822b28a37bf0f0264c273094763d778cb /drivers
parent543bd27353d2c5679057fe09aa2d02259687ff32 (diff)
downloadu-boot-imx-2f5d532f3b8a7697dc1b5700000b1e350323d50c.zip
u-boot-imx-2f5d532f3b8a7697dc1b5700000b1e350323d50c.tar.gz
u-boot-imx-2f5d532f3b8a7697dc1b5700000b1e350323d50c.tar.bz2
power: regulator: Introduce regulator_set_value_force function
In case we want to force a particular value on a regulator irrespective of the min/max constraints for testing purposes one can call regulator_set_value_force function. Signed-off-by: Keerthy <j-keerthy@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/power/regulator/regulator-uclass.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/power/regulator/regulator-uclass.c b/drivers/power/regulator/regulator-uclass.c
index 4434e36..d644009 100644
--- a/drivers/power/regulator/regulator-uclass.c
+++ b/drivers/power/regulator/regulator-uclass.c
@@ -48,6 +48,20 @@ int regulator_set_value(struct udevice *dev, int uV)
return ops->set_value(dev, uV);
}
+/*
+ * To be called with at most caution as there is no check
+ * before setting the actual voltage value.
+ */
+int regulator_set_value_force(struct udevice *dev, int uV)
+{
+ const struct dm_regulator_ops *ops = dev_get_driver_ops(dev);
+
+ if (!ops || !ops->set_value)
+ return -ENOSYS;
+
+ return ops->set_value(dev, uV);
+}
+
int regulator_get_current(struct udevice *dev)
{
const struct dm_regulator_ops *ops = dev_get_driver_ops(dev);