aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-05-13 23:25:42 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-05-14 04:11:51 -0400
commit7f225ba5850886b9834f3473c6e584a94c5fc53b (patch)
tree55e2c18a76345d19c5c0bdb2066a62eea6d07ee8 /drivers/regulator
parentccfcb1c3cf5616ebd9c61e6c834af3b87fe6b7f7 (diff)
regulator: tps62360: Convert to regulator_list_voltage_linear()
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/tps62360-regulator.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/regulator/tps62360-regulator.c b/drivers/regulator/tps62360-regulator.c
index 60765ccd25f5..dae08a8c6c79 100644
--- a/drivers/regulator/tps62360-regulator.c
+++ b/drivers/regulator/tps62360-regulator.c
@@ -185,28 +185,17 @@ static int tps62360_dcdc_set_voltage(struct regulator_dev *dev,
185 return 0; 185 return 0;
186} 186}
187 187
188static int tps62360_dcdc_list_voltage(struct regulator_dev *dev,
189 unsigned selector)
190{
191 struct tps62360_chip *tps = rdev_get_drvdata(dev);
192
193 if (selector >= tps->desc.n_voltages)
194 return -EINVAL;
195
196 return tps->voltage_base + selector * 10000;
197}
198
199static int tps62360_set_voltage_time_sel(struct regulator_dev *rdev, 188static int tps62360_set_voltage_time_sel(struct regulator_dev *rdev,
200 unsigned int old_selector, unsigned int new_selector) 189 unsigned int old_selector, unsigned int new_selector)
201{ 190{
202 struct tps62360_chip *tps = rdev_get_drvdata(rdev); 191 struct tps62360_chip *tps = rdev_get_drvdata(rdev);
203 int old_uV, new_uV; 192 int old_uV, new_uV;
204 193
205 old_uV = tps62360_dcdc_list_voltage(rdev, old_selector); 194 old_uV = regulator_list_voltage_linear(rdev, old_selector);
206 if (old_uV < 0) 195 if (old_uV < 0)
207 return old_uV; 196 return old_uV;
208 197
209 new_uV = tps62360_dcdc_list_voltage(rdev, new_selector); 198 new_uV = regulator_list_voltage_linear(rdev, new_selector);
210 if (new_uV < 0) 199 if (new_uV < 0)
211 return new_uV; 200 return new_uV;
212 201
@@ -216,7 +205,7 @@ static int tps62360_set_voltage_time_sel(struct regulator_dev *rdev,
216static struct regulator_ops tps62360_dcdc_ops = { 205static struct regulator_ops tps62360_dcdc_ops = {
217 .get_voltage_sel = tps62360_dcdc_get_voltage_sel, 206 .get_voltage_sel = tps62360_dcdc_get_voltage_sel,
218 .set_voltage = tps62360_dcdc_set_voltage, 207 .set_voltage = tps62360_dcdc_set_voltage,
219 .list_voltage = tps62360_dcdc_list_voltage, 208 .list_voltage = regulator_list_voltage_linear,
220 .set_voltage_time_sel = tps62360_set_voltage_time_sel, 209 .set_voltage_time_sel = tps62360_set_voltage_time_sel,
221}; 210};
222 211
@@ -420,6 +409,9 @@ static int __devinit tps62360_probe(struct i2c_client *client,
420 tps->desc.ops = &tps62360_dcdc_ops; 409 tps->desc.ops = &tps62360_dcdc_ops;
421 tps->desc.type = REGULATOR_VOLTAGE; 410 tps->desc.type = REGULATOR_VOLTAGE;
422 tps->desc.owner = THIS_MODULE; 411 tps->desc.owner = THIS_MODULE;
412 tps->desc.min_uV = tps->voltage_base;
413 tps->desc.uV_step = 10000;
414
423 tps->regmap = devm_regmap_init_i2c(client, &tps62360_regmap_config); 415 tps->regmap = devm_regmap_init_i2c(client, &tps62360_regmap_config);
424 if (IS_ERR(tps->regmap)) { 416 if (IS_ERR(tps->regmap)) {
425 ret = PTR_ERR(tps->regmap); 417 ret = PTR_ERR(tps->regmap);