summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorAntti P Miettinen <amiettinen@nvidia.com>2011-11-03 10:36:40 +0200
committerVarun Wadekar <vwadekar@nvidia.com>2011-12-08 18:08:44 +0530
commit4180067cd919d5258bf47b619a5c7c90a1c209cd (patch)
tree1d4ddd6e2025bf0d3437b460ffde200ef53ca149 /drivers/regulator
parent93dc60921bc85edbc2cb523220a759a9d2be1b6a (diff)
regulator: ricoh583: Add selector to set_voltage
Current set_voltage operation has additional selector argument that is used to return the index of the selected voltage. Bug 886170 Change-Id: I3e64cc91ab02cf90a2fe283258bc3c9e1aef2e1d Signed-off-by: Antti P Miettinen <amiettinen@nvidia.com> Reviewed-on: http://git-master/r/62144 Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com> Tested-by: Laxman Dewangan <ldewangan@nvidia.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/ricoh583-regulator.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/regulator/ricoh583-regulator.c b/drivers/regulator/ricoh583-regulator.c
index 2f3ef87ecda7..867ffe629ed2 100644
--- a/drivers/regulator/ricoh583-regulator.c
+++ b/drivers/regulator/ricoh583-regulator.c
@@ -148,7 +148,8 @@ static int __ricoh583_set_ds_voltage(struct device *parent,
}
static int __ricoh583_set_voltage(struct device *parent,
- struct ricoh583_regulator *ri, int min_uV, int max_uV)
+ struct ricoh583_regulator *ri, int min_uV, int max_uV,
+ unsigned *selector)
{
int vsel;
int ret;
@@ -161,6 +162,9 @@ static int __ricoh583_set_voltage(struct device *parent,
if (vsel > ri->nsteps)
return -EDOM;
+ if (selector)
+ *selector = vsel;
+
vout_val = (ri->vout_reg_cache & ~ri->vout_mask) |
(vsel & ri->vout_mask);
ret = ricoh583_write(parent, ri->vout_reg, vout_val);
@@ -173,12 +177,12 @@ static int __ricoh583_set_voltage(struct device *parent,
}
static int ricoh583_set_voltage(struct regulator_dev *rdev,
- int min_uV, int max_uV)
+ int min_uV, int max_uV, unsigned *selector)
{
struct ricoh583_regulator *ri = rdev_get_drvdata(rdev);
struct device *parent = to_ricoh583_dev(rdev);
- return __ricoh583_set_voltage(parent, ri, min_uV, max_uV);
+ return __ricoh583_set_voltage(parent, ri, min_uV, max_uV, selector);
}
static int ricoh583_get_voltage(struct regulator_dev *rdev)
@@ -303,7 +307,7 @@ static int ricoh583_regulator_preinit(struct device *parent,
if (ricoh583_pdata->init_uV >= 0) {
ret = __ricoh583_set_voltage(parent, ri,
ricoh583_pdata->init_uV,
- ricoh583_pdata->init_uV);
+ ricoh583_pdata->init_uV, 0);
if (ret < 0) {
dev_err(ri->dev, "Not able to initialize voltage %d "
"for rail %d err %d\n", ricoh583_pdata->init_uV,