* [PATCH RFT] regulator: Convert ab8500 to set_voltage_sel
@ 2012-03-20 1:51 Axel Lin
2012-03-20 12:00 ` Linus Walleij
2012-03-20 16:04 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2012-03-20 1:51 UTC (permalink / raw)
To: linux-kernel
Cc: Linus Walleij, Bengt JONSSON, Sundar R Iyer, Mark Brown, Liam Girdwood
Convert ab8500 to set_voltage_sel and then we can remove
ab8500_get_best_voltage_index function.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/regulator/ab8500.c | 35 ++++-------------------------------
1 files changed, 4 insertions(+), 31 deletions(-)
diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
index c7ee4c1..0d095b6 100644
--- a/drivers/regulator/ab8500.c
+++ b/drivers/regulator/ab8500.c
@@ -234,25 +234,8 @@ static int ab8500_regulator_get_voltage_sel(struct regulator_dev *rdev)
return val;
}
-static int ab8500_get_best_voltage_index(struct regulator_dev *rdev,
- int min_uV, int max_uV)
-{
- struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
- int i;
-
- /* check the supported voltage */
- for (i = 0; i < info->voltages_len; i++) {
- if ((info->voltages[i] >= min_uV) &&
- (info->voltages[i] <= max_uV))
- return i;
- }
-
- return -EINVAL;
-}
-
-static int ab8500_regulator_set_voltage(struct regulator_dev *rdev,
- int min_uV, int max_uV,
- unsigned *selector)
+static int ab8500_regulator_set_voltage_sel(struct regulator_dev *rdev,
+ unsigned selector)
{
int ret;
struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
@@ -263,18 +246,8 @@ static int ab8500_regulator_set_voltage(struct regulator_dev *rdev,
return -EINVAL;
}
- /* get the appropriate voltages within the range */
- ret = ab8500_get_best_voltage_index(rdev, min_uV, max_uV);
- if (ret < 0) {
- dev_err(rdev_get_dev(rdev),
- "couldn't get best voltage for regulator\n");
- return ret;
- }
-
- *selector = ret;
-
/* set the registers for the request */
- regval = (u8)ret;
+ regval = (u8)selector;
ret = abx500_mask_and_set_register_interruptible(info->dev,
info->voltage_bank, info->voltage_reg,
info->voltage_mask, regval);
@@ -319,7 +292,7 @@ static struct regulator_ops ab8500_regulator_ops = {
.disable = ab8500_regulator_disable,
.is_enabled = ab8500_regulator_is_enabled,
.get_voltage_sel = ab8500_regulator_get_voltage_sel,
- .set_voltage = ab8500_regulator_set_voltage,
+ .set_voltage_sel = ab8500_regulator_set_voltage_sel,
.list_voltage = ab8500_list_voltage,
.enable_time = ab8500_regulator_enable_time,
.set_voltage_time_sel = ab8500_regulator_set_voltage_time_sel,
--
1.7.5.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH RFT] regulator: Convert ab8500 to set_voltage_sel
2012-03-20 1:51 [PATCH RFT] regulator: Convert ab8500 to set_voltage_sel Axel Lin
@ 2012-03-20 12:00 ` Linus Walleij
2012-03-20 16:04 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2012-03-20 12:00 UTC (permalink / raw)
To: Axel Lin
Cc: linux-kernel, Linus Walleij, Bengt JONSSON, Sundar R Iyer,
Mark Brown, Liam Girdwood
On Tue, Mar 20, 2012 at 2:51 AM, Axel Lin <axel.lin@gmail.com> wrote:
> Convert ab8500 to set_voltage_sel and then we can remove
> ab8500_get_best_voltage_index function.
>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
Tested on the U8500, works like a charm AFAICT.
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Thanks Axel!
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH RFT] regulator: Convert ab8500 to set_voltage_sel
2012-03-20 1:51 [PATCH RFT] regulator: Convert ab8500 to set_voltage_sel Axel Lin
2012-03-20 12:00 ` Linus Walleij
@ 2012-03-20 16:04 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2012-03-20 16:04 UTC (permalink / raw)
To: Axel Lin
Cc: linux-kernel, Linus Walleij, Bengt JONSSON, Sundar R Iyer, Liam Girdwood
[-- Attachment #1: Type: text/plain, Size: 177 bytes --]
On Tue, Mar 20, 2012 at 09:51:08AM +0800, Axel Lin wrote:
> Convert ab8500 to set_voltage_sel and then we can remove
> ab8500_get_best_voltage_index function.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-03-20 16:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-20 1:51 [PATCH RFT] regulator: Convert ab8500 to set_voltage_sel Axel Lin
2012-03-20 12:00 ` Linus Walleij
2012-03-20 16:04 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).