[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201206032132.06209.heiko@sntech.de>
Date: Sun, 3 Jun 2012 21:32:05 +0200
From: Heiko Stübner <heiko@...ech.de>
To: Mark Brown <broonie@...nsource.wolfsonmicro.com>
Cc: Liam Girdwood <lrg@...com>, LKML <linux-kernel@...r.kernel.org>,
Axel Lin <axel.lin@...il.com>
Subject: [PATCH 3/3] 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@...ech.de>
---
drivers/regulator/gpio-regulator.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c
index 2c38bea..242851a 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)
}
static int gpio_regulator_set_value(struct regulator_dev *dev,
- int min, int max)
+ int min, int max, unsigned *selector)
{
struct gpio_regulator_data *data = rdev_get_drvdata(dev);
int ptr, target = 0, state, best_val = INT_MAX;
@@ -112,6 +112,8 @@ static int gpio_regulator_set_value(struct regulator_dev *dev,
data->states[ptr].value <= max) {
target = data->states[ptr].gpios;
best_val = data->states[ptr].value;
+ if (selector)
+ *selector = ptr;
}
if (best_val == INT_MAX)
@@ -130,7 +132,7 @@ static int gpio_regulator_set_voltage(struct regulator_dev *dev,
int min_uV, int max_uV,
unsigned *selector)
{
- return gpio_regulator_set_value(dev, min_uV, max_uV);
+ return gpio_regulator_set_value(dev, min_uV, max_uV, selector);
}
static int gpio_regulator_list_voltage(struct regulator_dev *dev,
@@ -147,7 +149,7 @@ static int gpio_regulator_list_voltage(struct regulator_dev *dev,
static int gpio_regulator_set_current_limit(struct regulator_dev *dev,
int min_uA, int max_uA)
{
- return gpio_regulator_set_value(dev, min_uA, max_uA);
+ return gpio_regulator_set_value(dev, min_uA, max_uA, NULL);
}
static struct regulator_ops gpio_regulator_voltage_ops = {
--
1.7.2.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists