forked from Minki/linux
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>
This commit is contained in:
parent
d580cb5e78
commit
b5fb77e018
@ -215,8 +215,8 @@ static int wm831x_buckv_list_voltage(struct regulator_dev *rdev,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int wm831x_buckv_select_min_voltage(struct regulator_dev *rdev,
|
static int wm831x_buckv_map_voltage(struct regulator_dev *rdev,
|
||||||
int min_uV, int max_uV)
|
int min_uV, int max_uV)
|
||||||
{
|
{
|
||||||
u16 vsel;
|
u16 vsel;
|
||||||
|
|
||||||
@ -251,20 +251,14 @@ static int wm831x_buckv_set_dvs(struct regulator_dev *rdev, int state)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int wm831x_buckv_set_voltage(struct regulator_dev *rdev,
|
static int wm831x_buckv_set_voltage_sel(struct regulator_dev *rdev,
|
||||||
int min_uV, int max_uV, unsigned *selector)
|
unsigned vsel)
|
||||||
{
|
{
|
||||||
struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
|
struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
|
||||||
struct wm831x *wm831x = dcdc->wm831x;
|
struct wm831x *wm831x = dcdc->wm831x;
|
||||||
int on_reg = dcdc->base + WM831X_DCDC_ON_CONFIG;
|
int on_reg = dcdc->base + WM831X_DCDC_ON_CONFIG;
|
||||||
int dvs_reg = dcdc->base + WM831X_DCDC_DVS_CONTROL;
|
int dvs_reg = dcdc->base + WM831X_DCDC_DVS_CONTROL;
|
||||||
int vsel, ret;
|
int ret;
|
||||||
|
|
||||||
vsel = wm831x_buckv_select_min_voltage(rdev, min_uV, max_uV);
|
|
||||||
if (vsel < 0)
|
|
||||||
return vsel;
|
|
||||||
|
|
||||||
*selector = vsel;
|
|
||||||
|
|
||||||
/* If this value is already set then do a GPIO update if we can */
|
/* If this value is already set then do a GPIO update if we can */
|
||||||
if (dcdc->dvs_gpio && dcdc->on_vsel == vsel)
|
if (dcdc->dvs_gpio && dcdc->on_vsel == vsel)
|
||||||
@ -315,7 +309,7 @@ static int wm831x_buckv_set_suspend_voltage(struct regulator_dev *rdev,
|
|||||||
u16 reg = dcdc->base + WM831X_DCDC_SLEEP_CONTROL;
|
u16 reg = dcdc->base + WM831X_DCDC_SLEEP_CONTROL;
|
||||||
int vsel;
|
int vsel;
|
||||||
|
|
||||||
vsel = wm831x_buckv_select_min_voltage(rdev, uV, uV);
|
vsel = wm831x_buckv_map_voltage(rdev, uV, uV);
|
||||||
if (vsel < 0)
|
if (vsel < 0)
|
||||||
return vsel;
|
return vsel;
|
||||||
|
|
||||||
@ -373,9 +367,10 @@ static int wm831x_buckv_get_current_limit(struct regulator_dev *rdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct regulator_ops wm831x_buckv_ops = {
|
static struct regulator_ops wm831x_buckv_ops = {
|
||||||
.set_voltage = wm831x_buckv_set_voltage,
|
.set_voltage_sel = wm831x_buckv_set_voltage_sel,
|
||||||
.get_voltage_sel = wm831x_buckv_get_voltage_sel,
|
.get_voltage_sel = wm831x_buckv_get_voltage_sel,
|
||||||
.list_voltage = wm831x_buckv_list_voltage,
|
.list_voltage = wm831x_buckv_list_voltage,
|
||||||
|
.map_voltage = wm831x_buckv_map_voltage,
|
||||||
.set_suspend_voltage = wm831x_buckv_set_suspend_voltage,
|
.set_suspend_voltage = wm831x_buckv_set_suspend_voltage,
|
||||||
.set_current_limit = wm831x_buckv_set_current_limit,
|
.set_current_limit = wm831x_buckv_set_current_limit,
|
||||||
.get_current_limit = wm831x_buckv_get_current_limit,
|
.get_current_limit = wm831x_buckv_get_current_limit,
|
||||||
|
Loading…
Reference in New Issue
Block a user