linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFT 1/2] regulator: ab8500: Use regulator_list_voltage_linear for ab8500_regulator_fixed_ops
@ 2012-06-08  2:27 Axel Lin
  2012-06-08  2:29 ` [PATCH RFT 2/2] regulator: ab8500: Remove min_uV and max_uV from struct ab8500_regulator_info Axel Lin
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Axel Lin @ 2012-06-08  2:27 UTC (permalink / raw)
  To: linux-kernel; +Cc: Lee Jones, Linus Walleij, Mark Brown, Liam Girdwood

Also removes set_voltage_time_sel callback from ab8500_regulator_fixed_ops
because the voltage won't change. ( And ab8500_regulator_fixed_ops does not
implement get_voltage_sel so set_voltage_time_sel won't be called )

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/regulator/ab8500.c |   41 +++++++++--------------------------------
 1 file changed, 9 insertions(+), 32 deletions(-)

diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
index 290c289..c931c7c 100644
--- a/drivers/regulator/ab8500.c
+++ b/drivers/regulator/ab8500.c
@@ -32,7 +32,6 @@
  * @regulator_dev: regulator device
  * @max_uV: maximum voltage (for variable voltage supplies)
  * @min_uV: minimum voltage (for variable voltage supplies)
- * @fixed_uV: typical voltage (for fixed voltage supplies)
  * @update_bank: bank to control on/off
  * @update_reg: register to control on/off
  * @update_mask: mask to enable/disable regulator
@@ -48,7 +47,6 @@ struct ab8500_regulator_info {
 	struct regulator_dev	*regulator;
 	int max_uV;
 	int min_uV;
-	int fixed_uV;
 	u8 update_bank;
 	u8 update_reg;
 	u8 update_mask;
@@ -271,29 +269,9 @@ static struct regulator_ops ab8500_regulator_ops = {
 	.set_voltage_time_sel = ab8500_regulator_set_voltage_time_sel,
 };
 
-static int ab8500_fixed_list_voltage(struct regulator_dev *rdev,
-				     unsigned selector)
-{
-	struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
-
-	if (info == NULL) {
-		dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
-		return -EINVAL;
-	}
-
-	return info->fixed_uV;
-}
-
 static int ab8500_fixed_get_voltage(struct regulator_dev *rdev)
 {
-	struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
-
-	if (info == NULL) {
-		dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
-		return -EINVAL;
-	}
-
-	return info->fixed_uV;
+	return rdev->desc->min_uV;
 }
 
 static struct regulator_ops ab8500_regulator_fixed_ops = {
@@ -301,9 +279,8 @@ static struct regulator_ops ab8500_regulator_fixed_ops = {
 	.disable	= ab8500_regulator_disable,
 	.is_enabled	= ab8500_regulator_is_enabled,
 	.get_voltage	= ab8500_fixed_get_voltage,
-	.list_voltage	= ab8500_fixed_list_voltage,
+	.list_voltage	= regulator_list_voltage_linear,
 	.enable_time	= ab8500_regulator_enable_time,
-	.set_voltage_time_sel = ab8500_regulator_set_voltage_time_sel,
 };
 
 static struct ab8500_regulator_info
@@ -408,9 +385,9 @@ static struct ab8500_regulator_info
 			.id		= AB8500_LDO_TVOUT,
 			.owner		= THIS_MODULE,
 			.n_voltages	= 1,
+			.min_uV		= 2000000,
 		},
 		.delay			= 10000,
-		.fixed_uV		= 2000000,
 		.update_bank		= 0x03,
 		.update_reg		= 0x80,
 		.update_mask		= 0x82,
@@ -424,8 +401,8 @@ static struct ab8500_regulator_info
 			.id             = AB8500_LDO_USB,
 			.owner          = THIS_MODULE,
 			.n_voltages     = 1,
+			.min_uV		= 3300000,
 		},
-		.fixed_uV               = 3300000,
 		.update_bank            = 0x03,
 		.update_reg             = 0x82,
 		.update_mask            = 0x03,
@@ -439,8 +416,8 @@ static struct ab8500_regulator_info
 			.id		= AB8500_LDO_AUDIO,
 			.owner		= THIS_MODULE,
 			.n_voltages	= 1,
+			.min_uV		= 2000000,
 		},
-		.fixed_uV		= 2000000,
 		.update_bank		= 0x03,
 		.update_reg		= 0x83,
 		.update_mask		= 0x02,
@@ -454,8 +431,8 @@ static struct ab8500_regulator_info
 			.id		= AB8500_LDO_ANAMIC1,
 			.owner		= THIS_MODULE,
 			.n_voltages	= 1,
+			.min_uV		= 2050000,
 		},
-		.fixed_uV		= 2050000,
 		.update_bank		= 0x03,
 		.update_reg		= 0x83,
 		.update_mask		= 0x08,
@@ -469,8 +446,8 @@ static struct ab8500_regulator_info
 			.id		= AB8500_LDO_ANAMIC2,
 			.owner		= THIS_MODULE,
 			.n_voltages	= 1,
+			.min_uV		= 2050000,
 		},
-		.fixed_uV		= 2050000,
 		.update_bank		= 0x03,
 		.update_reg		= 0x83,
 		.update_mask		= 0x10,
@@ -484,8 +461,8 @@ static struct ab8500_regulator_info
 			.id		= AB8500_LDO_DMIC,
 			.owner		= THIS_MODULE,
 			.n_voltages	= 1,
+			.min_uV		= 1800000,
 		},
-		.fixed_uV		= 1800000,
 		.update_bank		= 0x03,
 		.update_reg		= 0x83,
 		.update_mask		= 0x04,
@@ -499,8 +476,8 @@ static struct ab8500_regulator_info
 			.id		= AB8500_LDO_ANA,
 			.owner		= THIS_MODULE,
 			.n_voltages	= 1,
+			.min_uV		= 1200000,
 		},
-		.fixed_uV		= 1200000,
 		.update_bank		= 0x04,
 		.update_reg		= 0x06,
 		.update_mask		= 0x0c,
-- 
1.7.9.5




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

* [PATCH RFT 2/2] regulator: ab8500: Remove min_uV and max_uV from struct ab8500_regulator_info
  2012-06-08  2:27 [PATCH RFT 1/2] regulator: ab8500: Use regulator_list_voltage_linear for ab8500_regulator_fixed_ops Axel Lin
@ 2012-06-08  2:29 ` Axel Lin
  2012-06-17 14:24 ` [PATCH RFT 1/2] regulator: ab8500: Use regulator_list_voltage_linear for ab8500_regulator_fixed_ops Linus Walleij
  2012-06-17 20:05 ` Mark Brown
  2 siblings, 0 replies; 7+ messages in thread
From: Axel Lin @ 2012-06-08  2:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Lee Jones, Linus Walleij, Mark Brown, Liam Girdwood

The min_uV and max_uV are not really used in the code and misleading because
the min_uV and max_uV settings does not match the value in the voltage table.

For example, we have
static const unsigned int ldo_vaux3_voltages[] = {
        1200000,
        1500000,
        1800000,
        2100000,
        2500000,
        2750000,
        2790000,
        2910000,
};

With below min_uV/max_uV settings for AB8500_LDO_AUX3.
.min_uV                 = 1100000,
.max_uV                 = 3300000,

The min_uV/max_uV for AB8500_LDO_AUX3 seems copy-paste from AB8500_LDO_AUX2
and is wrong.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/regulator/ab8500.c |   12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
index c931c7c..13d424f 100644
--- a/drivers/regulator/ab8500.c
+++ b/drivers/regulator/ab8500.c
@@ -30,8 +30,6 @@
  * @dev: device pointer
  * @desc: regulator description
  * @regulator_dev: regulator device
- * @max_uV: maximum voltage (for variable voltage supplies)
- * @min_uV: minimum voltage (for variable voltage supplies)
  * @update_bank: bank to control on/off
  * @update_reg: register to control on/off
  * @update_mask: mask to enable/disable regulator
@@ -45,8 +43,6 @@ struct ab8500_regulator_info {
 	struct device		*dev;
 	struct regulator_desc	desc;
 	struct regulator_dev	*regulator;
-	int max_uV;
-	int min_uV;
 	u8 update_bank;
 	u8 update_reg;
 	u8 update_mask;
@@ -301,8 +297,6 @@ static struct ab8500_regulator_info
 			.n_voltages	= ARRAY_SIZE(ldo_vauxn_voltages),
 			.volt_table	= ldo_vauxn_voltages,
 		},
-		.min_uV			= 1100000,
-		.max_uV			= 3300000,
 		.update_bank		= 0x04,
 		.update_reg		= 0x09,
 		.update_mask		= 0x03,
@@ -321,8 +315,6 @@ static struct ab8500_regulator_info
 			.n_voltages	= ARRAY_SIZE(ldo_vauxn_voltages),
 			.volt_table	= ldo_vauxn_voltages,
 		},
-		.min_uV			= 1100000,
-		.max_uV			= 3300000,
 		.update_bank		= 0x04,
 		.update_reg		= 0x09,
 		.update_mask		= 0x0c,
@@ -341,8 +333,6 @@ static struct ab8500_regulator_info
 			.n_voltages	= ARRAY_SIZE(ldo_vaux3_voltages),
 			.volt_table	= ldo_vaux3_voltages,
 		},
-		.min_uV			= 1100000,
-		.max_uV			= 3300000,
 		.update_bank		= 0x04,
 		.update_reg		= 0x0a,
 		.update_mask		= 0x03,
@@ -361,8 +351,6 @@ static struct ab8500_regulator_info
 			.n_voltages	= ARRAY_SIZE(ldo_vintcore_voltages),
 			.volt_table	= ldo_vintcore_voltages,
 		},
-		.min_uV			= 1100000,
-		.max_uV			= 3300000,
 		.update_bank		= 0x03,
 		.update_reg		= 0x80,
 		.update_mask		= 0x44,
-- 
1.7.9.5




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

* Re: [PATCH RFT 1/2] regulator: ab8500: Use regulator_list_voltage_linear for ab8500_regulator_fixed_ops
  2012-06-08  2:27 [PATCH RFT 1/2] regulator: ab8500: Use regulator_list_voltage_linear for ab8500_regulator_fixed_ops Axel Lin
  2012-06-08  2:29 ` [PATCH RFT 2/2] regulator: ab8500: Remove min_uV and max_uV from struct ab8500_regulator_info Axel Lin
@ 2012-06-17 14:24 ` Linus Walleij
  2012-06-17 16:55   ` Mark Brown
  2012-06-17 20:05 ` Mark Brown
  2 siblings, 1 reply; 7+ messages in thread
From: Linus Walleij @ 2012-06-17 14:24 UTC (permalink / raw)
  To: Axel Lin
  Cc: linux-kernel, Lee Jones, Linus Walleij, Mark Brown, Liam Girdwood

On Fri, Jun 8, 2012 at 4:27 AM, Axel Lin <axel.lin@gmail.com> wrote:

> Also removes set_voltage_time_sel callback from ab8500_regulator_fixed_ops
> because the voltage won't change. ( And ab8500_regulator_fixed_ops does not
> implement get_voltage_sel so set_voltage_time_sel won't be called )
>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>

I cannot test this either, it does not apply cleanly on v3.5-rc3.

Care to respin?

Yours,
Linus Walleij

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

* Re: [PATCH RFT 1/2] regulator: ab8500: Use regulator_list_voltage_linear for ab8500_regulator_fixed_ops
  2012-06-17 14:24 ` [PATCH RFT 1/2] regulator: ab8500: Use regulator_list_voltage_linear for ab8500_regulator_fixed_ops Linus Walleij
@ 2012-06-17 16:55   ` Mark Brown
  2012-06-18  6:15     ` Linus Walleij
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2012-06-17 16:55 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Axel Lin, linux-kernel, Lee Jones, Linus Walleij, Liam Girdwood

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

On Sun, Jun 17, 2012 at 04:24:52PM +0200, Linus Walleij wrote:
> On Fri, Jun 8, 2012 at 4:27 AM, Axel Lin <axel.lin@gmail.com> wrote:

> > Also removes set_voltage_time_sel callback from ab8500_regulator_fixed_ops
> > because the voltage won't change. ( And ab8500_regulator_fixed_ops does not
> > implement get_voltage_sel so set_voltage_time_sel won't be called )
> >
> > Signed-off-by: Axel Lin <axel.lin@gmail.com>

> I cannot test this either, it does not apply cleanly on v3.5-rc3.

> Care to respin?

This is a random development patch which means it'll get applied against
the regulator tree as it stands so that's what the patch should be
submitted against - if you're going to test then grabbing my for-next
branch is the way forward.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH RFT 1/2] regulator: ab8500: Use regulator_list_voltage_linear for ab8500_regulator_fixed_ops
  2012-06-08  2:27 [PATCH RFT 1/2] regulator: ab8500: Use regulator_list_voltage_linear for ab8500_regulator_fixed_ops Axel Lin
  2012-06-08  2:29 ` [PATCH RFT 2/2] regulator: ab8500: Remove min_uV and max_uV from struct ab8500_regulator_info Axel Lin
  2012-06-17 14:24 ` [PATCH RFT 1/2] regulator: ab8500: Use regulator_list_voltage_linear for ab8500_regulator_fixed_ops Linus Walleij
@ 2012-06-17 20:05 ` Mark Brown
  2 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2012-06-17 20:05 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Lee Jones, Linus Walleij, Liam Girdwood

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

On Fri, Jun 08, 2012 at 10:27:49AM +0800, Axel Lin wrote:
> Also removes set_voltage_time_sel callback from ab8500_regulator_fixed_ops
> because the voltage won't change. ( And ab8500_regulator_fixed_ops does not
> implement get_voltage_sel so set_voltage_time_sel won't be called )

Applied both, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH RFT 1/2] regulator: ab8500: Use regulator_list_voltage_linear for ab8500_regulator_fixed_ops
  2012-06-17 16:55   ` Mark Brown
@ 2012-06-18  6:15     ` Linus Walleij
  2012-06-18  9:38       ` Mark Brown
  0 siblings, 1 reply; 7+ messages in thread
From: Linus Walleij @ 2012-06-18  6:15 UTC (permalink / raw)
  To: Mark Brown
  Cc: Axel Lin, linux-kernel, Lee Jones, Linus Walleij, Liam Girdwood

On Sun, Jun 17, 2012 at 6:55 PM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> On Sun, Jun 17, 2012 at 04:24:52PM +0200, Linus Walleij wrote:
>> On Fri, Jun 8, 2012 at 4:27 AM, Axel Lin <axel.lin@gmail.com> wrote:
>
>> > Also removes set_voltage_time_sel callback from ab8500_regulator_fixed_ops
>> > because the voltage won't change. ( And ab8500_regulator_fixed_ops does not
>> > implement get_voltage_sel so set_voltage_time_sel won't be called )
>> >
>> > Signed-off-by: Axel Lin <axel.lin@gmail.com>
>
>> I cannot test this either, it does not apply cleanly on v3.5-rc3.
>
>> Care to respin?
>
> This is a random development patch which means it'll get applied against
> the regulator tree as it stands so that's what the patch should be
> submitted against - if you're going to test then grabbing my for-next
> branch is the way forward.

I was mostly reacting to the "RFT" keyword in the subject, so I tried to
test rather than just ACK it, but it's applied now anyway so whatever.
Acked-by.

Yours,
Linus Walleij

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

* Re: [PATCH RFT 1/2] regulator: ab8500: Use regulator_list_voltage_linear for ab8500_regulator_fixed_ops
  2012-06-18  6:15     ` Linus Walleij
@ 2012-06-18  9:38       ` Mark Brown
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2012-06-18  9:38 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Axel Lin, linux-kernel, Lee Jones, Linus Walleij, Liam Girdwood

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

On Mon, Jun 18, 2012 at 08:15:42AM +0200, Linus Walleij wrote:

> I was mostly reacting to the "RFT" keyword in the subject, so I tried to
> test rather than just ACK it, but it's applied now anyway so whatever.
> Acked-by.

Given the fact that lots of regulator drivers have no regular maintainer
and that Axel so rarely gets things wrong I'm usually OK with applying
things from him if I don't see a review within about a week (with things
where I just don't expect a response at all I tend to apply immediately).

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2012-06-18  9:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-08  2:27 [PATCH RFT 1/2] regulator: ab8500: Use regulator_list_voltage_linear for ab8500_regulator_fixed_ops Axel Lin
2012-06-08  2:29 ` [PATCH RFT 2/2] regulator: ab8500: Remove min_uV and max_uV from struct ab8500_regulator_info Axel Lin
2012-06-17 14:24 ` [PATCH RFT 1/2] regulator: ab8500: Use regulator_list_voltage_linear for ab8500_regulator_fixed_ops Linus Walleij
2012-06-17 16:55   ` Mark Brown
2012-06-18  6:15     ` Linus Walleij
2012-06-18  9:38       ` Mark Brown
2012-06-17 20:05 ` 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).