linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC] regulator: Convert ab8500 to use get_voltage_sel()
@ 2012-02-24  9:15 Axel Lin
  2012-02-27  7:29 ` Linus Walleij
  2012-02-27 14:08 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2012-02-24  9:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: Linus Walleij, Bengt JONSSON, Sundar R Iyer, Mark Brown,
	Liam Girdwood

This change is required to make ab8500_regulator_get_voltage_sel work.
The regulator core will call set_voltage_time_sel only when get_voltage_sel is
implemented.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
Hi,
I don't have this hardware, I'd appreciate if someone can test this patch.

Axel
 drivers/regulator/ab8500.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
index c9b9253..c7ee4c1 100644
--- a/drivers/regulator/ab8500.c
+++ b/drivers/regulator/ab8500.c
@@ -201,7 +201,7 @@ static int ab8500_list_voltage(struct regulator_dev *rdev, unsigned selector)
 	return info->voltages[selector];
 }
 
-static int ab8500_regulator_get_voltage(struct regulator_dev *rdev)
+static int ab8500_regulator_get_voltage_sel(struct regulator_dev *rdev)
 {
 	int ret, val;
 	struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
@@ -229,11 +229,9 @@ static int ab8500_regulator_get_voltage(struct regulator_dev *rdev)
 	/* vintcore has a different layout */
 	val = regval & info->voltage_mask;
 	if (info->desc.id == AB8500_LDO_INTCORE)
-		ret = info->voltages[val >> 0x3];
+		return val >> 0x3;
 	else
-		ret = info->voltages[val];
-
-	return ret;
+		return val;
 }
 
 static int ab8500_get_best_voltage_index(struct regulator_dev *rdev,
@@ -320,7 +318,7 @@ static struct regulator_ops ab8500_regulator_ops = {
 	.enable		= ab8500_regulator_enable,
 	.disable	= ab8500_regulator_disable,
 	.is_enabled	= ab8500_regulator_is_enabled,
-	.get_voltage	= ab8500_regulator_get_voltage,
+	.get_voltage_sel = ab8500_regulator_get_voltage_sel,
 	.set_voltage	= ab8500_regulator_set_voltage,
 	.list_voltage	= ab8500_list_voltage,
 	.enable_time	= ab8500_regulator_enable_time,
-- 
1.7.5.4




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

* Re: [PATCH RFC] regulator: Convert ab8500 to use get_voltage_sel()
  2012-02-24  9:15 [PATCH RFC] regulator: Convert ab8500 to use get_voltage_sel() Axel Lin
@ 2012-02-27  7:29 ` Linus Walleij
  2012-02-27 14:08 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2012-02-27  7:29 UTC (permalink / raw)
  To: Axel Lin
  Cc: linux-kernel, Linus Walleij, Bengt JONSSON, Sundar R Iyer,
	Mark Brown, Liam Girdwood

On Fri, Feb 24, 2012 at 10:15 AM, Axel Lin <axel.lin@gmail.com> wrote:

> This change is required to make ab8500_regulator_get_voltage_sel work.
> The regulator core will call set_voltage_time_sel only when get_voltage_sel is
> implemented.
>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
> Hi,
> I don't have this hardware, I'd appreciate if someone can test this patch.

I've applied it and booted and it seems to work just fine, nice refactoring
there Axel!

Tested-by: Linus Walleij <linus.walleij@linaro.org>

Thanks,
Linus Walleij

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

* Re: [PATCH RFC] regulator: Convert ab8500 to use get_voltage_sel()
  2012-02-24  9:15 [PATCH RFC] regulator: Convert ab8500 to use get_voltage_sel() Axel Lin
  2012-02-27  7:29 ` Linus Walleij
@ 2012-02-27 14:08 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2012-02-27 14:08 UTC (permalink / raw)
  To: Axel Lin
  Cc: linux-kernel, Linus Walleij, Bengt JONSSON, Sundar R Iyer,
	Liam Girdwood

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

On Fri, Feb 24, 2012 at 05:15:45PM +0800, Axel Lin wrote:
> This change is required to make ab8500_regulator_get_voltage_sel work.
> The regulator core will call set_voltage_time_sel only when get_voltage_sel is
> implemented.

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-02-27 14:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-24  9:15 [PATCH RFC] regulator: Convert ab8500 to use get_voltage_sel() Axel Lin
2012-02-27  7:29 ` Linus Walleij
2012-02-27 14:08 ` 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).