summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-05-16 06:11:13 +0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-05-16 12:46:58 +0400
commitdde2b724e6bd6a6ea8516345398d3b8fe06a031b (patch)
treed0697dcfafc2a03f1e6e4ac4ec5659bbb3e0fa3c /drivers/regulator
parenta9b2899b9deeae0f83a1a1f5761ee8d2fd7824cd (diff)
downloadlinux-dde2b724e6bd6a6ea8516345398d3b8fe06a031b.tar.xz
regulator: isl6271a: Convert to set_voltage_sel and regulator_map_voltage_linear
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/isl6271a-regulator.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/regulator/isl6271a-regulator.c b/drivers/regulator/isl6271a-regulator.c
index 00cb28816725..56d273f25603 100644
--- a/drivers/regulator/isl6271a-regulator.c
+++ b/drivers/regulator/isl6271a-regulator.c
@@ -50,25 +50,15 @@ static int isl6271a_get_voltage_sel(struct regulator_dev *dev)
return idx;
}
-static int isl6271a_set_voltage(struct regulator_dev *dev,
- int minuV, int maxuV,
- unsigned *selector)
+static int isl6271a_set_voltage_sel(struct regulator_dev *dev,
+ unsigned selector)
{
struct isl_pmic *pmic = rdev_get_drvdata(dev);
- int err, data;
-
- if (minuV < ISL6271A_VOLTAGE_MIN || minuV > ISL6271A_VOLTAGE_MAX)
- return -EINVAL;
- if (maxuV < ISL6271A_VOLTAGE_MIN || maxuV > ISL6271A_VOLTAGE_MAX)
- return -EINVAL;
-
- data = DIV_ROUND_UP(minuV - ISL6271A_VOLTAGE_MIN,
- ISL6271A_VOLTAGE_STEP);
- *selector = data;
+ int err;
mutex_lock(&pmic->mtx);
- err = i2c_smbus_write_byte(pmic->client, data);
+ err = i2c_smbus_write_byte(pmic->client, selector);
if (err < 0)
dev_err(&pmic->client->dev, "Error setting voltage\n");
@@ -78,8 +68,9 @@ static int isl6271a_set_voltage(struct regulator_dev *dev,
static struct regulator_ops isl_core_ops = {
.get_voltage_sel = isl6271a_get_voltage_sel,
- .set_voltage = isl6271a_set_voltage,
+ .set_voltage_sel = isl6271a_set_voltage_sel,
.list_voltage = regulator_list_voltage_linear,
+ .map_voltage = regulator_map_voltage_linear,
};
static int isl6271a_get_fixed_voltage(struct regulator_dev *dev)