diff options
Diffstat (limited to 'drivers/regulator/wm831x-ldo.c')
-rw-r--r-- | drivers/regulator/wm831x-ldo.c | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c index 9edf8f692341..9594e7161b4d 100644 --- a/drivers/regulator/wm831x-ldo.c +++ b/drivers/regulator/wm831x-ldo.c | |||
@@ -113,7 +113,8 @@ static int wm831x_gp_ldo_list_voltage(struct regulator_dev *rdev, | |||
113 | } | 113 | } |
114 | 114 | ||
115 | static int wm831x_gp_ldo_set_voltage_int(struct regulator_dev *rdev, int reg, | 115 | static int wm831x_gp_ldo_set_voltage_int(struct regulator_dev *rdev, int reg, |
116 | int min_uV, int max_uV) | 116 | int min_uV, int max_uV, |
117 | unsigned *selector) | ||
117 | { | 118 | { |
118 | struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); | 119 | struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); |
119 | struct wm831x *wm831x = ldo->wm831x; | 120 | struct wm831x *wm831x = ldo->wm831x; |
@@ -133,16 +134,20 @@ static int wm831x_gp_ldo_set_voltage_int(struct regulator_dev *rdev, int reg, | |||
133 | if (ret < min_uV || ret > max_uV) | 134 | if (ret < min_uV || ret > max_uV) |
134 | return -EINVAL; | 135 | return -EINVAL; |
135 | 136 | ||
137 | *selector = vsel; | ||
138 | |||
136 | return wm831x_set_bits(wm831x, reg, WM831X_LDO1_ON_VSEL_MASK, vsel); | 139 | return wm831x_set_bits(wm831x, reg, WM831X_LDO1_ON_VSEL_MASK, vsel); |
137 | } | 140 | } |
138 | 141 | ||
139 | static int wm831x_gp_ldo_set_voltage(struct regulator_dev *rdev, | 142 | static int wm831x_gp_ldo_set_voltage(struct regulator_dev *rdev, |
140 | int min_uV, int max_uV) | 143 | int min_uV, int max_uV, |
144 | unsigned *selector) | ||
141 | { | 145 | { |
142 | struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); | 146 | struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); |
143 | int reg = ldo->base + WM831X_LDO_ON_CONTROL; | 147 | int reg = ldo->base + WM831X_LDO_ON_CONTROL; |
144 | 148 | ||
145 | return wm831x_gp_ldo_set_voltage_int(rdev, reg, min_uV, max_uV); | 149 | return wm831x_gp_ldo_set_voltage_int(rdev, reg, min_uV, max_uV, |
150 | selector); | ||
146 | } | 151 | } |
147 | 152 | ||
148 | static int wm831x_gp_ldo_set_suspend_voltage(struct regulator_dev *rdev, | 153 | static int wm831x_gp_ldo_set_suspend_voltage(struct regulator_dev *rdev, |
@@ -150,8 +155,9 @@ static int wm831x_gp_ldo_set_suspend_voltage(struct regulator_dev *rdev, | |||
150 | { | 155 | { |
151 | struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); | 156 | struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); |
152 | int reg = ldo->base + WM831X_LDO_SLEEP_CONTROL; | 157 | int reg = ldo->base + WM831X_LDO_SLEEP_CONTROL; |
158 | unsigned int selector; | ||
153 | 159 | ||
154 | return wm831x_gp_ldo_set_voltage_int(rdev, reg, uV, uV); | 160 | return wm831x_gp_ldo_set_voltage_int(rdev, reg, uV, uV, &selector); |
155 | } | 161 | } |
156 | 162 | ||
157 | static int wm831x_gp_ldo_get_voltage(struct regulator_dev *rdev) | 163 | static int wm831x_gp_ldo_get_voltage(struct regulator_dev *rdev) |
@@ -413,7 +419,8 @@ static int wm831x_aldo_list_voltage(struct regulator_dev *rdev, | |||
413 | } | 419 | } |
414 | 420 | ||
415 | static int wm831x_aldo_set_voltage_int(struct regulator_dev *rdev, int reg, | 421 | static int wm831x_aldo_set_voltage_int(struct regulator_dev *rdev, int reg, |
416 | int min_uV, int max_uV) | 422 | int min_uV, int max_uV, |
423 | unsigned *selector) | ||
417 | { | 424 | { |
418 | struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); | 425 | struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); |
419 | struct wm831x *wm831x = ldo->wm831x; | 426 | struct wm831x *wm831x = ldo->wm831x; |
@@ -433,16 +440,19 @@ static int wm831x_aldo_set_voltage_int(struct regulator_dev *rdev, int reg, | |||
433 | if (ret < min_uV || ret > max_uV) | 440 | if (ret < min_uV || ret > max_uV) |
434 | return -EINVAL; | 441 | return -EINVAL; |
435 | 442 | ||
443 | *selector = vsel; | ||
444 | |||
436 | return wm831x_set_bits(wm831x, reg, WM831X_LDO7_ON_VSEL_MASK, vsel); | 445 | return wm831x_set_bits(wm831x, reg, WM831X_LDO7_ON_VSEL_MASK, vsel); |
437 | } | 446 | } |
438 | 447 | ||
439 | static int wm831x_aldo_set_voltage(struct regulator_dev *rdev, | 448 | static int wm831x_aldo_set_voltage(struct regulator_dev *rdev, |
440 | int min_uV, int max_uV) | 449 | int min_uV, int max_uV, unsigned *selector) |
441 | { | 450 | { |
442 | struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); | 451 | struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); |
443 | int reg = ldo->base + WM831X_LDO_ON_CONTROL; | 452 | int reg = ldo->base + WM831X_LDO_ON_CONTROL; |
444 | 453 | ||
445 | return wm831x_aldo_set_voltage_int(rdev, reg, min_uV, max_uV); | 454 | return wm831x_aldo_set_voltage_int(rdev, reg, min_uV, max_uV, |
455 | selector); | ||
446 | } | 456 | } |
447 | 457 | ||
448 | static int wm831x_aldo_set_suspend_voltage(struct regulator_dev *rdev, | 458 | static int wm831x_aldo_set_suspend_voltage(struct regulator_dev *rdev, |
@@ -450,8 +460,9 @@ static int wm831x_aldo_set_suspend_voltage(struct regulator_dev *rdev, | |||
450 | { | 460 | { |
451 | struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); | 461 | struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); |
452 | int reg = ldo->base + WM831X_LDO_SLEEP_CONTROL; | 462 | int reg = ldo->base + WM831X_LDO_SLEEP_CONTROL; |
463 | unsigned int selector; | ||
453 | 464 | ||
454 | return wm831x_aldo_set_voltage_int(rdev, reg, uV, uV); | 465 | return wm831x_aldo_set_voltage_int(rdev, reg, uV, uV, &selector); |
455 | } | 466 | } |
456 | 467 | ||
457 | static int wm831x_aldo_get_voltage(struct regulator_dev *rdev) | 468 | static int wm831x_aldo_get_voltage(struct regulator_dev *rdev) |
@@ -666,7 +677,8 @@ static int wm831x_alive_ldo_list_voltage(struct regulator_dev *rdev, | |||
666 | 677 | ||
667 | static int wm831x_alive_ldo_set_voltage_int(struct regulator_dev *rdev, | 678 | static int wm831x_alive_ldo_set_voltage_int(struct regulator_dev *rdev, |
668 | int reg, | 679 | int reg, |
669 | int min_uV, int max_uV) | 680 | int min_uV, int max_uV, |
681 | unsigned *selector) | ||
670 | { | 682 | { |
671 | struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); | 683 | struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); |
672 | struct wm831x *wm831x = ldo->wm831x; | 684 | struct wm831x *wm831x = ldo->wm831x; |
@@ -680,16 +692,20 @@ static int wm831x_alive_ldo_set_voltage_int(struct regulator_dev *rdev, | |||
680 | if (ret < min_uV || ret > max_uV) | 692 | if (ret < min_uV || ret > max_uV) |
681 | return -EINVAL; | 693 | return -EINVAL; |
682 | 694 | ||
695 | *selector = vsel; | ||
696 | |||
683 | return wm831x_set_bits(wm831x, reg, WM831X_LDO11_ON_VSEL_MASK, vsel); | 697 | return wm831x_set_bits(wm831x, reg, WM831X_LDO11_ON_VSEL_MASK, vsel); |
684 | } | 698 | } |
685 | 699 | ||
686 | static int wm831x_alive_ldo_set_voltage(struct regulator_dev *rdev, | 700 | static int wm831x_alive_ldo_set_voltage(struct regulator_dev *rdev, |
687 | int min_uV, int max_uV) | 701 | int min_uV, int max_uV, |
702 | unsigned *selector) | ||
688 | { | 703 | { |
689 | struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); | 704 | struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); |
690 | int reg = ldo->base + WM831X_ALIVE_LDO_ON_CONTROL; | 705 | int reg = ldo->base + WM831X_ALIVE_LDO_ON_CONTROL; |
691 | 706 | ||
692 | return wm831x_alive_ldo_set_voltage_int(rdev, reg, min_uV, max_uV); | 707 | return wm831x_alive_ldo_set_voltage_int(rdev, reg, min_uV, max_uV, |
708 | selector); | ||
693 | } | 709 | } |
694 | 710 | ||
695 | static int wm831x_alive_ldo_set_suspend_voltage(struct regulator_dev *rdev, | 711 | static int wm831x_alive_ldo_set_suspend_voltage(struct regulator_dev *rdev, |
@@ -697,8 +713,9 @@ static int wm831x_alive_ldo_set_suspend_voltage(struct regulator_dev *rdev, | |||
697 | { | 713 | { |
698 | struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); | 714 | struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); |
699 | int reg = ldo->base + WM831X_ALIVE_LDO_SLEEP_CONTROL; | 715 | int reg = ldo->base + WM831X_ALIVE_LDO_SLEEP_CONTROL; |
716 | unsigned selector; | ||
700 | 717 | ||
701 | return wm831x_alive_ldo_set_voltage_int(rdev, reg, uV, uV); | 718 | return wm831x_alive_ldo_set_voltage_int(rdev, reg, uV, uV, &selector); |
702 | } | 719 | } |
703 | 720 | ||
704 | static int wm831x_alive_ldo_get_voltage(struct regulator_dev *rdev) | 721 | static int wm831x_alive_ldo_get_voltage(struct regulator_dev *rdev) |