Commit 7f225ba5850886b9834f3473c6e584a94c5fc53b

Authored by Axel Lin
Committed by Mark Brown
1 parent ccfcb1c3cf

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>

Showing 1 changed file with 6 additions and 14 deletions Side-by-side Diff

drivers/regulator/tps62360-regulator.c
... ... @@ -185,28 +185,17 @@
185 185 return 0;
186 186 }
187 187  
188   -static 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   -
199 188 static int tps62360_set_voltage_time_sel(struct regulator_dev *rdev,
200 189 unsigned int old_selector, unsigned int new_selector)
201 190 {
202 191 struct tps62360_chip *tps = rdev_get_drvdata(rdev);
203 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 195 if (old_uV < 0)
207 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 199 if (new_uV < 0)
211 200 return new_uV;
212 201  
... ... @@ -216,7 +205,7 @@
216 205 static struct regulator_ops tps62360_dcdc_ops = {
217 206 .get_voltage_sel = tps62360_dcdc_get_voltage_sel,
218 207 .set_voltage = tps62360_dcdc_set_voltage,
219   - .list_voltage = tps62360_dcdc_list_voltage,
  208 + .list_voltage = regulator_list_voltage_linear,
220 209 .set_voltage_time_sel = tps62360_set_voltage_time_sel,
221 210 };
222 211  
... ... @@ -420,6 +409,9 @@
420 409 tps->desc.ops = &tps62360_dcdc_ops;
421 410 tps->desc.type = REGULATOR_VOLTAGE;
422 411 tps->desc.owner = THIS_MODULE;
  412 + tps->desc.min_uV = tps->voltage_base;
  413 + tps->desc.uV_step = 10000;
  414 +
423 415 tps->regmap = devm_regmap_init_i2c(client, &tps62360_regmap_config);
424 416 if (IS_ERR(tps->regmap)) {
425 417 ret = PTR_ERR(tps->regmap);