summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/max8952.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-03-26 09:20:58 +0800
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-01 11:59:32 +0100
commit6ea67d04b6d4b5e2bf8d276ceb801e03d7f22910 (patch)
tree9f8fb76684aad42981d288a7c57e6406657d8534 /drivers/regulator/max8952.c
parent4b3bd55f5445648f981669758599a6172760d37d (diff)
downloadlinux-stable-6ea67d04b6d4b5e2bf8d276ceb801e03d7f22910.tar.gz
linux-stable-6ea67d04b6d4b5e2bf8d276ceb801e03d7f22910.tar.bz2
linux-stable-6ea67d04b6d4b5e2bf8d276ceb801e03d7f22910.zip
regulator: Convert max8952 to set_voltage_sel
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/max8952.c')
-rw-r--r--drivers/regulator/max8952.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c
index e9c0a0ea1528..c35236a06cbb 100644
--- a/drivers/regulator/max8952.c
+++ b/drivers/regulator/max8952.c
@@ -130,11 +130,10 @@ static int max8952_get_voltage(struct regulator_dev *rdev)
return max8952_voltage(max8952, vid);
}
-static int max8952_set_voltage(struct regulator_dev *rdev,
- int min_uV, int max_uV, unsigned *selector)
+static int max8952_set_voltage_sel(struct regulator_dev *rdev,
+ unsigned selector)
{
struct max8952_data *max8952 = rdev_get_drvdata(rdev);
- s8 vid = -1, i;
if (!gpio_is_valid(max8952->pdata->gpio_vid0) ||
!gpio_is_valid(max8952->pdata->gpio_vid1)) {
@@ -142,23 +141,10 @@ static int max8952_set_voltage(struct regulator_dev *rdev,
return -EPERM;
}
- for (i = 0; i < MAX8952_NUM_DVS_MODE; i++) {
- int volt = max8952_voltage(max8952, i);
-
- /* Set the voltage as low as possible within the range */
- if (volt <= max_uV && volt >= min_uV)
- if (vid == -1 || max8952_voltage(max8952, vid) > volt)
- vid = i;
- }
-
- if (vid >= 0 && vid < MAX8952_NUM_DVS_MODE) {
- max8952->vid0 = vid & 0x1;
- max8952->vid1 = (vid >> 1) & 0x1;
- *selector = vid;
- gpio_set_value(max8952->pdata->gpio_vid0, max8952->vid0);
- gpio_set_value(max8952->pdata->gpio_vid1, max8952->vid1);
- } else
- return -EINVAL;
+ max8952->vid0 = selector & 0x1;
+ max8952->vid1 = (selector >> 1) & 0x1;
+ gpio_set_value(max8952->pdata->gpio_vid0, max8952->vid0);
+ gpio_set_value(max8952->pdata->gpio_vid1, max8952->vid1);
return 0;
}
@@ -169,7 +155,7 @@ static struct regulator_ops max8952_ops = {
.enable = max8952_enable,
.disable = max8952_disable,
.get_voltage = max8952_get_voltage,
- .set_voltage = max8952_set_voltage,
+ .set_voltage_sel = max8952_set_voltage_sel,
.set_suspend_disable = max8952_disable,
};