aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-05-15 22:10:22 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-05-16 04:46:57 -0400
commita9b2899b9deeae0f83a1a1f5761ee8d2fd7824cd (patch)
tree2c61dbaba49a724bb994f9452b43da94f1d60bca /drivers/regulator
parent2b7a7a4e837269a8a157a19ac93ddb207f2bd0b6 (diff)
regulator: isl6271a: Convert to get_voltage_sel
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.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/regulator/isl6271a-regulator.c b/drivers/regulator/isl6271a-regulator.c
index 78cdc90e0a7e..00cb28816725 100644
--- a/drivers/regulator/isl6271a-regulator.c
+++ b/drivers/regulator/isl6271a-regulator.c
@@ -35,26 +35,19 @@ struct isl_pmic {
35 struct mutex mtx; 35 struct mutex mtx;
36}; 36};
37 37
38static int isl6271a_get_voltage(struct regulator_dev *dev) 38static int isl6271a_get_voltage_sel(struct regulator_dev *dev)
39{ 39{
40 struct isl_pmic *pmic = rdev_get_drvdata(dev); 40 struct isl_pmic *pmic = rdev_get_drvdata(dev);
41 int idx, data; 41 int idx;
42 42
43 mutex_lock(&pmic->mtx); 43 mutex_lock(&pmic->mtx);
44 44
45 idx = i2c_smbus_read_byte(pmic->client); 45 idx = i2c_smbus_read_byte(pmic->client);
46 if (idx < 0) { 46 if (idx < 0)
47 dev_err(&pmic->client->dev, "Error getting voltage\n"); 47 dev_err(&pmic->client->dev, "Error getting voltage\n");
48 data = idx;
49 goto out;
50 }
51
52 /* Convert the data from chip to microvolts */
53 data = ISL6271A_VOLTAGE_MIN + (ISL6271A_VOLTAGE_STEP * (idx & 0xf));
54 48
55out:
56 mutex_unlock(&pmic->mtx); 49 mutex_unlock(&pmic->mtx);
57 return data; 50 return idx;
58} 51}
59 52
60static int isl6271a_set_voltage(struct regulator_dev *dev, 53static int isl6271a_set_voltage(struct regulator_dev *dev,
@@ -84,7 +77,7 @@ static int isl6271a_set_voltage(struct regulator_dev *dev,
84} 77}
85 78
86static struct regulator_ops isl_core_ops = { 79static struct regulator_ops isl_core_ops = {
87 .get_voltage = isl6271a_get_voltage, 80 .get_voltage_sel = isl6271a_get_voltage_sel,
88 .set_voltage = isl6271a_set_voltage, 81 .set_voltage = isl6271a_set_voltage,
89 .list_voltage = regulator_list_voltage_linear, 82 .list_voltage = regulator_list_voltage_linear,
90}; 83};