aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/gpio-regulator.c
diff options
context:
space:
mode:
authorHeiko Stübner <heiko@sntech.de>2012-06-03 15:32:05 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-06-04 05:44:30 -0400
commitb0e4d7bf8b5704904a5d138d81a8ec8b7145767f (patch)
tree5e845dbdc0211a2c5008171b374346f0bd85dda3 /drivers/regulator/gpio-regulator.c
parent00926369b745fb0c1e5c27cec35f6adc9752f2c4 (diff)
regulator: gpio-regulator: populate selector from set_voltage
This was missing until now and the underlying _regulator_do_set_voltage is using this value when calling list_voltage. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Acked-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/gpio-regulator.c')
-rw-r--r--drivers/regulator/gpio-regulator.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c
index 2c38bea5065e..242851a4c1a6 100644
--- a/drivers/regulator/gpio-regulator.c
+++ b/drivers/regulator/gpio-regulator.c
@@ -101,7 +101,7 @@ static int gpio_regulator_get_value(struct regulator_dev *dev)
101} 101}
102 102
103static int gpio_regulator_set_value(struct regulator_dev *dev, 103static int gpio_regulator_set_value(struct regulator_dev *dev,
104 int min, int max) 104 int min, int max, unsigned *selector)
105{ 105{
106 struct gpio_regulator_data *data = rdev_get_drvdata(dev); 106 struct gpio_regulator_data *data = rdev_get_drvdata(dev);
107 int ptr, target = 0, state, best_val = INT_MAX; 107 int ptr, target = 0, state, best_val = INT_MAX;
@@ -112,6 +112,8 @@ static int gpio_regulator_set_value(struct regulator_dev *dev,
112 data->states[ptr].value <= max) { 112 data->states[ptr].value <= max) {
113 target = data->states[ptr].gpios; 113 target = data->states[ptr].gpios;
114 best_val = data->states[ptr].value; 114 best_val = data->states[ptr].value;
115 if (selector)
116 *selector = ptr;
115 } 117 }
116 118
117 if (best_val == INT_MAX) 119 if (best_val == INT_MAX)
@@ -130,7 +132,7 @@ static int gpio_regulator_set_voltage(struct regulator_dev *dev,
130 int min_uV, int max_uV, 132 int min_uV, int max_uV,
131 unsigned *selector) 133 unsigned *selector)
132{ 134{
133 return gpio_regulator_set_value(dev, min_uV, max_uV); 135 return gpio_regulator_set_value(dev, min_uV, max_uV, selector);
134} 136}
135 137
136static int gpio_regulator_list_voltage(struct regulator_dev *dev, 138static int gpio_regulator_list_voltage(struct regulator_dev *dev,
@@ -147,7 +149,7 @@ static int gpio_regulator_list_voltage(struct regulator_dev *dev,
147static int gpio_regulator_set_current_limit(struct regulator_dev *dev, 149static int gpio_regulator_set_current_limit(struct regulator_dev *dev,
148 int min_uA, int max_uA) 150 int min_uA, int max_uA)
149{ 151{
150 return gpio_regulator_set_value(dev, min_uA, max_uA); 152 return gpio_regulator_set_value(dev, min_uA, max_uA, NULL);
151} 153}
152 154
153static struct regulator_ops gpio_regulator_voltage_ops = { 155static struct regulator_ops gpio_regulator_voltage_ops = {