public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: da903x: add support for DA9030 BUCK2 with DVM
@ 2009-07-26  7:54 Mike Rapoport
  2009-07-26  9:40 ` Liam Girdwood
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Rapoport @ 2009-07-26  7:54 UTC (permalink / raw)
  To: broonie; +Cc: lrg, eric.y.miao, linux-kernel, Mike Rapoport

Signed-off-by: Mike Rapoport <mike@compulab.co.il>
---
 drivers/regulator/da903x.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c
index b8b89ef..fab755d 100644
--- a/drivers/regulator/da903x.c
+++ b/drivers/regulator/da903x.c
@@ -367,24 +367,24 @@ static struct regulator_ops da9034_regulator_ldo12_ops = {
 	.enable_bit	= (ebit),					\
 }
 
-#define DA9034_DVC(_id, min, max, step, vreg, nbits, ureg, ubit, ereg, ebit) \
+#define DA903x_DVC(_pmic, _id, min, max, step, vreg, nbits, ureg, ubit, ereg, ebit) \
 {									\
 	.desc	= {							\
 		.name	= #_id,						\
 		.ops	= &da9034_regulator_dvc_ops,			\
 		.type	= REGULATOR_VOLTAGE,				\
-		.id	= DA9034_ID_##_id,				\
+		.id	= _pmic##_ID_##_id,				\
 		.owner	= THIS_MODULE,					\
 	},								\
 	.min_uV		= (min) * 1000,					\
 	.max_uV		= (max) * 1000,					\
 	.step_uV	= (step) * 1000,				\
-	.vol_reg	= DA9034_##vreg,				\
+	.vol_reg	= _pmic##_##vreg,				\
 	.vol_shift	= (0),						\
 	.vol_nbits	= (nbits),					\
-	.update_reg	= DA9034_##ureg,				\
+	.update_reg	= _pmic##_##ureg,				\
 	.update_bit	= (ubit),					\
-	.enable_reg	= DA9034_##ereg,				\
+	.enable_reg	= _pmic##_##ereg,				\
 	.enable_bit	= (ebit),					\
 }
 
@@ -394,6 +394,12 @@ static struct regulator_ops da9034_regulator_ldo12_ops = {
 #define DA9030_LDO(_id, min, max, step, vreg, shift, nbits, ereg, ebit)	\
 	DA903x_LDO(DA9030, _id, min, max, step, vreg, shift, nbits, ereg, ebit)
 
+#define DA9030_DVC(_id, min, max, step, vreg, nbits, ureg, ubit, ereg, ebit) \
+	DA903x_DVC(DA9030, _id, min, max, step, vreg, nbits, ureg, ubit, ereg, ebit)
+
+#define DA9034_DVC(_id, min, max, step, vreg, nbits, ureg, ubit, ereg, ebit) \
+	DA903x_DVC(DA9034, _id, min, max, step, vreg, nbits, ureg, ubit, ereg, ebit)
+
 static struct da903x_regulator_info da903x_regulator_info[] = {
 	/* DA9030 */
 	DA9030_LDO( 1, 1200, 3200, 100,    LDO1, 0, 5, RCTL12, 1),
@@ -415,6 +421,7 @@ static struct da903x_regulator_info da903x_regulator_info[] = {
 	DA9030_LDO(18, 1800, 3200, 100, LDO1819, 0, 4, RCTL21, 2),
 	DA9030_LDO(19, 1800, 3200, 100, LDO1819, 4, 4, RCTL21, 1),
 	DA9030_LDO(13, 2100, 2100, 0, INVAL, 0, 0, RCTL11, 3), /* fixed @2.1V */
+	DA9030_DVC(BUCK2, 850, 1650, 25, BUCK2DVM1, 5, BUCK2DVM1, 7, RCTL11, 0),
 
 	/* DA9034 */
 	DA9034_DVC(BUCK1, 725, 1500, 25, ADTV1, 5, VCC1, 0, OVER1, 0),
-- 
1.6.0.6


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

* Re: [PATCH] regulator: da903x: add support for DA9030 BUCK2 with DVM
  2009-07-26  7:54 [PATCH] regulator: da903x: add support for DA9030 BUCK2 with DVM Mike Rapoport
@ 2009-07-26  9:40 ` Liam Girdwood
  2009-07-26 10:34   ` Mike Rapoport
  0 siblings, 1 reply; 5+ messages in thread
From: Liam Girdwood @ 2009-07-26  9:40 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: broonie, eric.y.miao, linux-kernel

On Sun, 2009-07-26 at 10:54 +0300, Mike Rapoport wrote:
> Signed-off-by: Mike Rapoport <mike@compulab.co.il>
> ---
>  drivers/regulator/da903x.c |   17 ++++++++++++-----
>  1 files changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c
> index b8b89ef..fab755d 100644
> --- a/drivers/regulator/da903x.c
> +++ b/drivers/regulator/da903x.c
> @@ -367,24 +367,24 @@ static struct regulator_ops da9034_regulator_ldo12_ops = {
>  	.enable_bit	= (ebit),					\
>  }
>  

Looks fine but did not apply :-

Applying: regulator: da903x: add support for DA9030 BUCK2 with DVM
error: patch failed: drivers/regulator/da903x.c:367
error: drivers/regulator/da903x.c: patch does not apply
Patch failed at 0001 regulator: da903x: add support for DA9030 BUCK2 with DVM

Could you regenerate against the regulator tree for-next branch.

git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6.git

Thanks

Liam


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

* Re: [PATCH] regulator: da903x: add support for DA9030 BUCK2 with DVM
  2009-07-26  9:40 ` Liam Girdwood
@ 2009-07-26 10:34   ` Mike Rapoport
  2009-07-27  4:16     ` Eric Miao
  2009-07-27  9:37     ` Liam Girdwood
  0 siblings, 2 replies; 5+ messages in thread
From: Mike Rapoport @ 2009-07-26 10:34 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: broonie, eric.y.miao, linux-kernel



Liam Girdwood wrote:
> On Sun, 2009-07-26 at 10:54 +0300, Mike Rapoport wrote:
>> Signed-off-by: Mike Rapoport <mike@compulab.co.il>
>> ---
>>  drivers/regulator/da903x.c |   17 ++++++++++++-----
>>  1 files changed, 12 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c
>> index b8b89ef..fab755d 100644
>> --- a/drivers/regulator/da903x.c
>> +++ b/drivers/regulator/da903x.c
>> @@ -367,24 +367,24 @@ static struct regulator_ops da9034_regulator_ldo12_ops = {
>>  	.enable_bit	= (ebit),					\
>>  }
>>  
> 
> Looks fine but did not apply :-
> 
> Applying: regulator: da903x: add support for DA9030 BUCK2 with DVM
> error: patch failed: drivers/regulator/da903x.c:367
> error: drivers/regulator/da903x.c: patch does not apply
> Patch failed at 0001 regulator: da903x: add support for DA9030 BUCK2 with DVM
> 
> Could you regenerate against the regulator tree for-next branch.
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6.git

It seems I'm getting senile. The BUCK2 is already supported, moreover I've acked
the patch.
The only thing left to do is to consolidate DA903[045]_DVC macros:

> From: Mike Rapoport <mike@compulab.co.il>
Date: Sun, 26 Jul 2009 13:33:04 +0300
Subject: [PATCH] regulator: da903x: consolidate DA903[045]_DVC macros

Signed-off-by: Mike Rapoport <mike@compulab.co.il>
---
 drivers/regulator/da903x.c |   66 +++++++++++--------------------------------
 1 files changed, 17 insertions(+), 49 deletions(-)

diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c
index 236de11..7d9c250 100644
--- a/drivers/regulator/da903x.c
+++ b/drivers/regulator/da903x.c
@@ -404,69 +404,25 @@ static struct regulator_ops da9034_regulator_ldo12_ops = {
 	.enable_bit	= (ebit),					\
 }

-#define DA9030_DVC(_id, min, max, step, vreg, nbits, ureg, ubit, ereg, ebit) \
+#define DA903x_DVC(_pmic, _id, min, max, step, vreg, nbits, ureg, ubit, ereg, ebit) \
 {									\
 	.desc	= {							\
 		.name	= #_id,						\
 		.ops	= &da9034_regulator_dvc_ops,			\
 		.type	= REGULATOR_VOLTAGE,				\
-		.id	= DA9030_ID_##_id,				\
+		.id	= _pmic##_ID_##_id,				\
 		.n_voltages = (step) ? ((max - min) / step + 1) : 1,	\
 		.owner	= THIS_MODULE,					\
 	},								\
 	.min_uV		= (min) * 1000,					\
 	.max_uV		= (max) * 1000,					\
 	.step_uV	= (step) * 1000,				\
-	.vol_reg	= DA9030_##vreg,				\
-	.vol_shift	= (0),						\
-	.vol_nbits	= (nbits),					\
-	.update_reg	= DA9030_##ureg,				\
-	.update_bit	= (ubit),					\
-	.enable_reg	= DA9030_##ereg,				\
-	.enable_bit	= (ebit),					\
-}
-
-#define DA9034_DVC(_id, min, max, step, vreg, nbits, ureg, ubit, ereg, ebit) \
-{									\
-	.desc	= {							\
-		.name	= #_id,						\
-		.ops	= &da9034_regulator_dvc_ops,			\
-		.type	= REGULATOR_VOLTAGE,				\
-		.id	= DA9034_ID_##_id,				\
-		.n_voltages = (step) ? ((max - min) / step + 1) : 1,	\
-		.owner	= THIS_MODULE,					\
-	},								\
-	.min_uV		= (min) * 1000,					\
-	.max_uV		= (max) * 1000,					\
-	.step_uV	= (step) * 1000,				\
-	.vol_reg	= DA9034_##vreg,				\
-	.vol_shift	= (0),						\
-	.vol_nbits	= (nbits),					\
-	.update_reg	= DA9034_##ureg,				\
-	.update_bit	= (ubit),					\
-	.enable_reg	= DA9034_##ereg,				\
-	.enable_bit	= (ebit),					\
-}
-
-#define DA9035_DVC(_id, min, max, step, vreg, nbits, ureg, ubit, ereg, ebit) \
-{									\
-	.desc	= {							\
-		.name	= #_id,						\
-		.ops	= &da9034_regulator_dvc_ops,			\
-		.type	= REGULATOR_VOLTAGE,				\
-		.id	= DA9035_ID_##_id,				\
-		.n_voltages = (step) ? ((max - min) / step + 1) : 1,	\
-		.owner	= THIS_MODULE,					\
-	},								\
-	.min_uV		= (min) * 1000,					\
-	.max_uV		= (max) * 1000,					\
-	.step_uV	= (step) * 1000,				\
-	.vol_reg	= DA9035_##vreg,				\
+	.vol_reg	= _pmic##_##vreg,				\
 	.vol_shift	= (0),						\
 	.vol_nbits	= (nbits),					\
-	.update_reg	= DA9035_##ureg,				\
+	.update_reg	= _pmic##_##ureg,				\
 	.update_bit	= (ubit),					\
-	.enable_reg	= DA9035_##ereg,				\
+	.enable_reg	= _pmic##_##ereg,				\
 	.enable_bit	= (ebit),					\
 }

@@ -476,6 +432,18 @@ static struct regulator_ops da9034_regulator_ldo12_ops = {
 #define DA9030_LDO(_id, min, max, step, vreg, shift, nbits, ereg, ebit)	\
 	DA903x_LDO(DA9030, _id, min, max, step, vreg, shift, nbits, ereg, ebit)

+#define DA9030_DVC(_id, min, max, step, vreg, nbits, ureg, ubit, ereg, ebit) \
+	DA903x_DVC(DA9030, _id, min, max, step, vreg, nbits, ureg, ubit, \
+		   ereg, ebit)
+
+#define DA9034_DVC(_id, min, max, step, vreg, nbits, ureg, ubit, ereg, ebit) \
+	DA903x_DVC(DA9034, _id, min, max, step, vreg, nbits, ureg, ubit, \
+		   ereg, ebit)
+
+#define DA9035_DVC(_id, min, max, step, vreg, nbits, ureg, ubit, ereg, ebit) \
+	DA903x_DVC(DA9035, _id, min, max, step, vreg, nbits, ureg, ubit, \
+		   ereg, ebit)
+
 static struct da903x_regulator_info da903x_regulator_info[] = {
 	/* DA9030 */
 	DA9030_DVC(BUCK2, 850, 1625, 25, BUCK2DVM1, 5, BUCK2DVM1, 7, RCTL11, 0),
-- 
1.6.0.6




> Thanks
> 
> Liam
> 
> 

-- 
Sincerely yours,
Mike.



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

* Re: [PATCH] regulator: da903x: add support for DA9030 BUCK2 with DVM
  2009-07-26 10:34   ` Mike Rapoport
@ 2009-07-27  4:16     ` Eric Miao
  2009-07-27  9:37     ` Liam Girdwood
  1 sibling, 0 replies; 5+ messages in thread
From: Eric Miao @ 2009-07-27  4:16 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: Liam Girdwood, broonie, linux-kernel

Mike Rapoport wrote:
> 
> Liam Girdwood wrote:
>> On Sun, 2009-07-26 at 10:54 +0300, Mike Rapoport wrote:
>>> Signed-off-by: Mike Rapoport <mike@compulab.co.il>
>>> ---
>>>  drivers/regulator/da903x.c |   17 ++++++++++++-----
>>>  1 files changed, 12 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c
>>> index b8b89ef..fab755d 100644
>>> --- a/drivers/regulator/da903x.c
>>> +++ b/drivers/regulator/da903x.c
>>> @@ -367,24 +367,24 @@ static struct regulator_ops da9034_regulator_ldo12_ops = {
>>>  	.enable_bit	= (ebit),					\
>>>  }
>>>  
>> Looks fine but did not apply :-
>>
>> Applying: regulator: da903x: add support for DA9030 BUCK2 with DVM
>> error: patch failed: drivers/regulator/da903x.c:367
>> error: drivers/regulator/da903x.c: patch does not apply
>> Patch failed at 0001 regulator: da903x: add support for DA9030 BUCK2 with DVM
>>
>> Could you regenerate against the regulator tree for-next branch.
>>
>> git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6.git
> 
> It seems I'm getting senile. The BUCK2 is already supported, moreover I've acked
> the patch.
> The only thing left to do is to consolidate DA903[045]_DVC macros:
> 

Mmm.... this looks a bit zigzag, and making the definition of DA90x_DVC()
too long (> 80 chars?), that's why it was originally written so.

DA9035 is actually very similar to DA9034 that doesn't even deserve a separate
name for (it does have a significant change in the analog frontend - but that's
out of AP control), so I basically don't bother invent a DA9035_DVC().

I have to admit that defining both DA9030_DVC() and DA9034_DVC() is a bit
redundant, but keeps the code in a little bit better shape.


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

* Re: [PATCH] regulator: da903x: add support for DA9030 BUCK2 with DVM
  2009-07-26 10:34   ` Mike Rapoport
  2009-07-27  4:16     ` Eric Miao
@ 2009-07-27  9:37     ` Liam Girdwood
  1 sibling, 0 replies; 5+ messages in thread
From: Liam Girdwood @ 2009-07-27  9:37 UTC (permalink / raw)
  To: Mike Rapoport; +Cc: broonie, eric.y.miao, linux-kernel

On Sun, 2009-07-26 at 13:34 +0300, Mike Rapoport wrote:

> 
> > From: Mike Rapoport <mike@compulab.co.il>
> Date: Sun, 26 Jul 2009 13:33:04 +0300
> Subject: [PATCH] regulator: da903x: consolidate DA903[045]_DVC macros
> 
> Signed-off-by: Mike Rapoport <mike@compulab.co.il>
> ---
>  drivers/regulator/da903x.c |   66 +++++++++++--------------------------------
>  1 files changed, 17 insertions(+), 49 deletions(-)
> 

Applied.

Thanks

Liam


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

end of thread, other threads:[~2009-07-27  9:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-26  7:54 [PATCH] regulator: da903x: add support for DA9030 BUCK2 with DVM Mike Rapoport
2009-07-26  9:40 ` Liam Girdwood
2009-07-26 10:34   ` Mike Rapoport
2009-07-27  4:16     ` Eric Miao
2009-07-27  9:37     ` Liam Girdwood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox