aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-06-13 08:29:17 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-06-17 16:07:19 -0400
commitb5fb77e0188dc85630b395eb0faddc4987be6ddb (patch)
treeb398a9dd914e494eb096ed0e787f7bcb1fd583d3
parentd580cb5e78763eb3d8149e0d60a0a73d355d27c5 (diff)
regulator: wm831x-dcdc: Convert wm831x_buckv_ops to set_voltage_sel and map_voltage
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--drivers/regulator/wm831x-dcdc.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c
index 91b5b0a727ef..7413885be01b 100644
--- a/drivers/regulator/wm831x-dcdc.c
+++ b/drivers/regulator/wm831x-dcdc.c
@@ -215,8 +215,8 @@ static int wm831x_buckv_list_voltage(struct regulator_dev *rdev,
215 return -EINVAL; 215 return -EINVAL;
216} 216}
217 217
218static int wm831x_buckv_select_min_voltage(struct regulator_dev *rdev, 218static int wm831x_buckv_map_voltage(struct regulator_dev *rdev,
219 int min_uV, int max_uV) 219 int min_uV, int max_uV)
220{ 220{
221 u16 vsel; 221 u16 vsel;
222 222
@@ -251,20 +251,14 @@ static int wm831x_buckv_set_dvs(struct regulator_dev *rdev, int state)
251 return 0; 251 return 0;
252} 252}
253 253
254static int wm831x_buckv_set_voltage(struct regulator_dev *rdev, 254static int wm831x_buckv_set_voltage_sel(struct regulator_dev *rdev,
255 int min_uV, int max_uV, unsigned *selector) 255 unsigned vsel)
256{ 256{
257 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev); 257 struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
258 struct wm831x *wm831x = dcdc->wm831x; 258 struct wm831x *wm831x = dcdc->wm831x;
259 int on_reg = dcdc->base + WM831X_DCDC_ON_CONFIG; 259 int on_reg = dcdc->base + WM831X_DCDC_ON_CONFIG;
260 int dvs_reg = dcdc->base + WM831X_DCDC_DVS_CONTROL; 260 int dvs_reg = dcdc->base + WM831X_DCDC_DVS_CONTROL;
261 int vsel, ret; 261 int ret;
262
263 vsel = wm831x_buckv_select_min_voltage(rdev, min_uV, max_uV);
264 if (vsel < 0)
265 return vsel;
266
267 *selector = vsel;
268 262
269 /* If this value is already set then do a GPIO update if we can */ 263 /* If this value is already set then do a GPIO update if we can */
270 if (dcdc->dvs_gpio && dcdc->on_vsel == vsel) 264 if (dcdc->dvs_gpio && dcdc->on_vsel == vsel)
@@ -315,7 +309,7 @@ static int wm831x_buckv_set_suspend_voltage(struct regulator_dev *rdev,
315 u16 reg = dcdc->base + WM831X_DCDC_SLEEP_CONTROL; 309 u16 reg = dcdc->base + WM831X_DCDC_SLEEP_CONTROL;
316 int vsel; 310 int vsel;
317 311
318 vsel = wm831x_buckv_select_min_voltage(rdev, uV, uV); 312 vsel = wm831x_buckv_map_voltage(rdev, uV, uV);
319 if (vsel < 0) 313 if (vsel < 0)
320 return vsel; 314 return vsel;
321 315
@@ -373,9 +367,10 @@ static int wm831x_buckv_get_current_limit(struct regulator_dev *rdev)
373} 367}
374 368
375static struct regulator_ops wm831x_buckv_ops = { 369static struct regulator_ops wm831x_buckv_ops = {
376 .set_voltage = wm831x_buckv_set_voltage, 370 .set_voltage_sel = wm831x_buckv_set_voltage_sel,
377 .get_voltage_sel = wm831x_buckv_get_voltage_sel, 371 .get_voltage_sel = wm831x_buckv_get_voltage_sel,
378 .list_voltage = wm831x_buckv_list_voltage, 372 .list_voltage = wm831x_buckv_list_voltage,
373 .map_voltage = wm831x_buckv_map_voltage,
379 .set_suspend_voltage = wm831x_buckv_set_suspend_voltage, 374 .set_suspend_voltage = wm831x_buckv_set_suspend_voltage,
380 .set_current_limit = wm831x_buckv_set_current_limit, 375 .set_current_limit = wm831x_buckv_set_current_limit,
381 .get_current_limit = wm831x_buckv_get_current_limit, 376 .get_current_limit = wm831x_buckv_get_current_limit,