linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFT] regulator: Convert ab3100 to set_voltage_sel
@ 2012-03-20  2:14 Axel Lin
  2012-03-20 12:08 ` Linus Walleij
  2012-03-20 16:04 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2012-03-20  2:14 UTC (permalink / raw)
  To: linux-kernel; +Cc: Linus Walleij, Mark Brown, Liam Girdwood

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/regulator/ab3100.c |   18 +++++-------------
 1 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/regulator/ab3100.c b/drivers/regulator/ab3100.c
index 042271a..ed56c93 100644
--- a/drivers/regulator/ab3100.c
+++ b/drivers/regulator/ab3100.c
@@ -338,20 +338,12 @@ static int ab3100_get_best_voltage_index(struct regulator_dev *reg,
 	return bestindex;
 }
 
-static int ab3100_set_voltage_regulator(struct regulator_dev *reg,
-					int min_uV, int max_uV,
-					unsigned *selector)
+static int ab3100_set_voltage_regulator_sel(struct regulator_dev *reg,
+					    unsigned selector)
 {
 	struct ab3100_regulator *abreg = reg->reg_data;
 	u8 regval;
 	int err;
-	int bestindex;
-
-	bestindex = ab3100_get_best_voltage_index(reg, min_uV, max_uV);
-	if (bestindex < 0)
-		return bestindex;
-
-	*selector = bestindex;
 
 	err = abx500_get_register_interruptible(abreg->dev, 0,
 						abreg->regreg, &regval);
@@ -364,7 +356,7 @@ static int ab3100_set_voltage_regulator(struct regulator_dev *reg,
 
 	/* The highest three bits control the variable regulators */
 	regval &= ~0xE0;
-	regval |= (bestindex << 5);
+	regval |= (selector << 5);
 
 	err = abx500_set_register_interruptible(abreg->dev, 0,
 						abreg->regreg, regval);
@@ -464,7 +456,7 @@ static struct regulator_ops regulator_ops_variable = {
 	.disable     = ab3100_disable_regulator,
 	.is_enabled  = ab3100_is_enabled_regulator,
 	.get_voltage = ab3100_get_voltage_regulator,
-	.set_voltage = ab3100_set_voltage_regulator,
+	.set_voltage_sel = ab3100_set_voltage_regulator_sel,
 	.list_voltage = ab3100_list_voltage_regulator,
 	.enable_time = ab3100_enable_time_regulator,
 };
@@ -474,7 +466,7 @@ static struct regulator_ops regulator_ops_variable_sleepable = {
 	.disable     = ab3100_disable_regulator,
 	.is_enabled  = ab3100_is_enabled_regulator,
 	.get_voltage = ab3100_get_voltage_regulator,
-	.set_voltage = ab3100_set_voltage_regulator,
+	.set_voltage_sel = ab3100_set_voltage_regulator_sel,
 	.set_suspend_voltage = ab3100_set_suspend_voltage_regulator,
 	.list_voltage = ab3100_list_voltage_regulator,
 	.enable_time = ab3100_enable_time_regulator,
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH RFT] regulator: Convert ab3100 to set_voltage_sel
  2012-03-20  2:14 [PATCH RFT] regulator: Convert ab3100 to set_voltage_sel Axel Lin
@ 2012-03-20 12:08 ` Linus Walleij
  2012-03-20 16:04 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2012-03-20 12:08 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Linus Walleij, Mark Brown, Liam Girdwood

On Tue, Mar 20, 2012 at 3:14 AM, Axel Lin <axel.lin@gmail.com> wrote:

> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
>  drivers/regulator/ab3100.c |   18 +++++-------------
>  1 files changed, 5 insertions(+), 13 deletions(-)

Works like a charm.
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 ab3100 to set_voltage_sel
  2012-03-20  2:14 [PATCH RFT] regulator: Convert ab3100 to set_voltage_sel Axel Lin
  2012-03-20 12:08 ` 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, Liam Girdwood

[-- Attachment #1: Type: text/plain, Size: 123 bytes --]

On Tue, Mar 20, 2012 at 10:14:40AM +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@gmail.com>

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  2:14 [PATCH RFT] regulator: Convert ab3100 to set_voltage_sel Axel Lin
2012-03-20 12:08 ` 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).