diff options
Diffstat (limited to 'drivers/regulator/wm831x-dcdc.c')
-rw-r--r-- | drivers/regulator/wm831x-dcdc.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c index dbfaf5945e48..71da6b2ad863 100644 --- a/drivers/regulator/wm831x-dcdc.c +++ b/drivers/regulator/wm831x-dcdc.c | |||
@@ -302,7 +302,7 @@ static int wm831x_buckv_set_dvs(struct regulator_dev *rdev, int state) | |||
302 | } | 302 | } |
303 | 303 | ||
304 | static int wm831x_buckv_set_voltage(struct regulator_dev *rdev, | 304 | static int wm831x_buckv_set_voltage(struct regulator_dev *rdev, |
305 | int min_uV, int max_uV) | 305 | int min_uV, int max_uV, unsigned *selector) |
306 | { | 306 | { |
307 | struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev); | 307 | struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev); |
308 | struct wm831x *wm831x = dcdc->wm831x; | 308 | struct wm831x *wm831x = dcdc->wm831x; |
@@ -314,6 +314,8 @@ static int wm831x_buckv_set_voltage(struct regulator_dev *rdev, | |||
314 | if (vsel < 0) | 314 | if (vsel < 0) |
315 | return vsel; | 315 | return vsel; |
316 | 316 | ||
317 | *selector = vsel; | ||
318 | |||
317 | /* If this value is already set then do a GPIO update if we can */ | 319 | /* If this value is already set then do a GPIO update if we can */ |
318 | if (dcdc->dvs_gpio && dcdc->on_vsel == vsel) | 320 | if (dcdc->dvs_gpio && dcdc->on_vsel == vsel) |
319 | return wm831x_buckv_set_dvs(rdev, 0); | 321 | return wm831x_buckv_set_dvs(rdev, 0); |
@@ -636,7 +638,7 @@ static int wm831x_buckp_list_voltage(struct regulator_dev *rdev, | |||
636 | } | 638 | } |
637 | 639 | ||
638 | static int wm831x_buckp_set_voltage_int(struct regulator_dev *rdev, int reg, | 640 | static int wm831x_buckp_set_voltage_int(struct regulator_dev *rdev, int reg, |
639 | int min_uV, int max_uV) | 641 | int min_uV, int max_uV, int *selector) |
640 | { | 642 | { |
641 | struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev); | 643 | struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev); |
642 | struct wm831x *wm831x = dcdc->wm831x; | 644 | struct wm831x *wm831x = dcdc->wm831x; |
@@ -650,16 +652,20 @@ static int wm831x_buckp_set_voltage_int(struct regulator_dev *rdev, int reg, | |||
650 | if (wm831x_buckp_list_voltage(rdev, vsel) > max_uV) | 652 | if (wm831x_buckp_list_voltage(rdev, vsel) > max_uV) |
651 | return -EINVAL; | 653 | return -EINVAL; |
652 | 654 | ||
655 | *selector = vsel; | ||
656 | |||
653 | return wm831x_set_bits(wm831x, reg, WM831X_DC3_ON_VSEL_MASK, vsel); | 657 | return wm831x_set_bits(wm831x, reg, WM831X_DC3_ON_VSEL_MASK, vsel); |
654 | } | 658 | } |
655 | 659 | ||
656 | static int wm831x_buckp_set_voltage(struct regulator_dev *rdev, | 660 | static int wm831x_buckp_set_voltage(struct regulator_dev *rdev, |
657 | int min_uV, int max_uV) | 661 | int min_uV, int max_uV, |
662 | unsigned *selector) | ||
658 | { | 663 | { |
659 | struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev); | 664 | struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev); |
660 | u16 reg = dcdc->base + WM831X_DCDC_ON_CONFIG; | 665 | u16 reg = dcdc->base + WM831X_DCDC_ON_CONFIG; |
661 | 666 | ||
662 | return wm831x_buckp_set_voltage_int(rdev, reg, min_uV, max_uV); | 667 | return wm831x_buckp_set_voltage_int(rdev, reg, min_uV, max_uV, |
668 | selector); | ||
663 | } | 669 | } |
664 | 670 | ||
665 | static int wm831x_buckp_set_suspend_voltage(struct regulator_dev *rdev, | 671 | static int wm831x_buckp_set_suspend_voltage(struct regulator_dev *rdev, |
@@ -667,8 +673,9 @@ static int wm831x_buckp_set_suspend_voltage(struct regulator_dev *rdev, | |||
667 | { | 673 | { |
668 | struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev); | 674 | struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev); |
669 | u16 reg = dcdc->base + WM831X_DCDC_SLEEP_CONTROL; | 675 | u16 reg = dcdc->base + WM831X_DCDC_SLEEP_CONTROL; |
676 | unsigned selector; | ||
670 | 677 | ||
671 | return wm831x_buckp_set_voltage_int(rdev, reg, uV, uV); | 678 | return wm831x_buckp_set_voltage_int(rdev, reg, uV, uV, &selector); |
672 | } | 679 | } |
673 | 680 | ||
674 | static int wm831x_buckp_get_voltage(struct regulator_dev *rdev) | 681 | static int wm831x_buckp_get_voltage(struct regulator_dev *rdev) |