Skip to content

Commit b5fb77e

Browse files
AxelLinbroonie
authored andcommitted
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>
1 parent d580cb5 commit b5fb77e

1 file changed

Lines changed: 8 additions & 13 deletions

File tree

‎drivers/regulator/wm831x-dcdc.c‎

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ static int wm831x_buckv_list_voltage(struct regulator_dev *rdev,
215215
return -EINVAL;
216216
}
217217

218-
static int wm831x_buckv_select_min_voltage(struct regulator_dev *rdev,
219-
int min_uV, int max_uV)
218+
static int wm831x_buckv_map_voltage(struct regulator_dev *rdev,
219+
int min_uV, int max_uV)
220220
{
221221
u16 vsel;
222222

@@ -251,20 +251,14 @@ static int wm831x_buckv_set_dvs(struct regulator_dev *rdev, int state)
251251
return 0;
252252
}
253253

254-
static int wm831x_buckv_set_voltage(struct regulator_dev *rdev,
255-
int min_uV, int max_uV, unsigned *selector)
254+
static int wm831x_buckv_set_voltage_sel(struct regulator_dev *rdev,
255+
unsigned vsel)
256256
{
257257
struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
258258
struct wm831x *wm831x = dcdc->wm831x;
259259
int on_reg = dcdc->base + WM831X_DCDC_ON_CONFIG;
260260
int dvs_reg = dcdc->base + WM831X_DCDC_DVS_CONTROL;
261-
int vsel, 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;
261+
int ret;
268262

269263
/* If this value is already set then do a GPIO update if we can */
270264
if (dcdc->dvs_gpio && dcdc->on_vsel == vsel)
@@ -315,7 +309,7 @@ static int wm831x_buckv_set_suspend_voltage(struct regulator_dev *rdev,
315309
u16 reg = dcdc->base + WM831X_DCDC_SLEEP_CONTROL;
316310
int vsel;
317311

318-
vsel = wm831x_buckv_select_min_voltage(rdev, uV, uV);
312+
vsel = wm831x_buckv_map_voltage(rdev, uV, uV);
319313
if (vsel < 0)
320314
return vsel;
321315

@@ -373,9 +367,10 @@ static int wm831x_buckv_get_current_limit(struct regulator_dev *rdev)
373367
}
374368

375369
static struct regulator_ops wm831x_buckv_ops = {
376-
.set_voltage = wm831x_buckv_set_voltage,
370+
.set_voltage_sel = wm831x_buckv_set_voltage_sel,
377371
.get_voltage_sel = wm831x_buckv_get_voltage_sel,
378372
.list_voltage = wm831x_buckv_list_voltage,
373+
.map_voltage = wm831x_buckv_map_voltage,
379374
.set_suspend_voltage = wm831x_buckv_set_suspend_voltage,
380375
.set_current_limit = wm831x_buckv_set_current_limit,
381376
.get_current_limit = wm831x_buckv_get_current_limit,

0 commit comments

Comments
 (0)