aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSundar R Iyer <sundar.iyer@stericsson.com>2010-06-15 15:18:37 +0530
committerJohn Rigby <john.rigby@linaro.org>2010-09-02 22:45:46 -0600
commit0e37905c11443c532e46e77188a26ce320ec24fe (patch)
tree5f1a2b6b4eb0d7a435b22613f9d06e288bf38fe4
parentd0cc0fcaf12eb036d216fe8b7211d66e9458dbe7 (diff)
downloadlinux-2.6.34-ux500-0e37905c11443c532e46e77188a26ce320ec24fe.tar.gz
ab8500-regulator: add is_enabled helper for DCDC supplies
ST-Ericsson Change ID: 264371 Signed-off-by: Sundar R Iyer <sundar.iyer@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/1719 Reviewed-by: Mattias NILSSON <mattias.i.nilsson@stericsson.com> Signed-off-by: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com> Change-Id: Id76df50d1ad736d93cf20b1858c40fc779ef5374 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/2625 Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
-rw-r--r--drivers/regulator/ab8500-regulator.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/regulator/ab8500-regulator.c b/drivers/regulator/ab8500-regulator.c
index e0efa87404a..320a85d6350 100644
--- a/drivers/regulator/ab8500-regulator.c
+++ b/drivers/regulator/ab8500-regulator.c
@@ -649,11 +649,32 @@ static int ab8500_dcdc_disable(struct regulator_dev *rdev)
return 0;
}
+static int ab8500_dcdc_is_enabled(struct regulator_dev *rdev)
+{
+ int regulator_id, ret;
+
+ regulator_id = rdev_get_id(rdev);
+ if (regulator_id >= AB8500_NUM_REGULATORS)
+ return -EINVAL;
+
+ switch (regulator_id) {
+ case AB8500_DCDC_VBUS:
+ ret = ab8500_read(AB8500_REGU_CTRL1, AB8500_REGU_VUSB_CTRL_REG);
+ if (ret & MASK_ENABLE)
+ return true;
+ else
+ return false;
+ default:
+ dev_dbg(rdev_get_dev(rdev), "unknown regulator id\n");
+ return -EINVAL;
+ }
+}
/* operations for DC-DC convertor supplies (VBUS, VSMPS1/2) */
static struct regulator_ops ab8500_dcdc_ops = {
.enable = ab8500_dcdc_enable,
.disable = ab8500_dcdc_disable,
+ .is_enabled = ab8500_dcdc_is_enabled,
};
static struct regulator_desc ab8500_desc[AB8500_NUM_REGULATORS] = {