summaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorSteffen Trumtrar <s.trumtrar@pengutronix.de>2014-06-30 09:51:56 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-07-11 09:56:38 +0200
commit2eb002699c7fe1650278fc28ad56bc4876817afd (patch)
tree8c3a15e383b003219d5af5a660311d9d00ccc582 /drivers/regulator
parent6acc6bc6275a3a7d648a04cede77618f7597ee5b (diff)
downloadbarebox-2eb002699c7fe1650278fc28ad56bc4876817afd.tar.gz
regulator: fixed: add always-on property
Support the "regulator-always-on" property for fixed regulators. The regulator gets enabled on probe and subsequent disable calls are ignored. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/fixed.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 7e64919..2515d3e 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -27,6 +27,7 @@
struct regulator_fixed {
int gpio;
int active_low;
+ int always_on;
struct regulator_dev rdev;
};
@@ -44,6 +45,9 @@ static int regulator_fixed_disable(struct regulator_dev *rdev)
{
struct regulator_fixed *fix = container_of(rdev, struct regulator_fixed, rdev);
+ if (fix->always_on)
+ return 0;
+
if (!gpio_is_valid(fix->gpio))
return 0;
@@ -79,6 +83,11 @@ static int regulator_fixed_probe(struct device_d *dev)
fix->rdev.ops = &fixed_ops;
+ if (of_find_property(dev->device_node, "regulator-always-on", NULL)) {
+ fix->always_on = 1;
+ regulator_fixed_enable(&fix->rdev);
+ }
+
ret = of_regulator_register(&fix->rdev, dev->device_node);
if (ret)
return ret;