public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: rc5t583: Simplify RC5T583_REG macro
@ 2012-04-06  0:01 Axel Lin
  2012-04-06  5:33 ` Laxman Dewangan
  2012-04-06  8:49 ` Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Axel Lin @ 2012-04-06  0:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: Laxman Dewangan, Liam Girdwood, Mark Brown

Simplify RC5T583_REG macro by removing _vout_reg and _ds_reg parameters.

The naming for vout_reg and deepsleep_reg can be replaced by:
.vout_reg       = RC5T583_REG_##_id##DAC,
.deepsleep_reg  = RC5T583_REG_##_id##DAC_DS,

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

diff --git a/drivers/regulator/rc5t583-regulator.c b/drivers/regulator/rc5t583-regulator.c
index 578bd5d..fcb9cc7 100644
--- a/drivers/regulator/rc5t583-regulator.c
+++ b/drivers/regulator/rc5t583-regulator.c
@@ -196,16 +196,16 @@ static struct regulator_ops rc5t583_ops = {
 	.set_voltage_time_sel	= rc5t583_set_voltage_time_sel,
 };
 
-#define RC5T583_REG(_id, _en_reg, _en_bit, _disc_reg, _disc_bit, _vout_reg,  \
-		_vout_mask, _ds_reg, _min_mv, _max_mv, _step_uV, _enable_mv) \
+#define RC5T583_REG(_id, _en_reg, _en_bit, _disc_reg, _disc_bit, \
+		_vout_mask, _min_mv, _max_mv, _step_uV, _enable_mv) \
 {								\
 	.reg_en_reg	= RC5T583_REG_##_en_reg,		\
 	.en_bit		= _en_bit,				\
 	.reg_disc_reg	= RC5T583_REG_##_disc_reg,		\
 	.disc_bit	= _disc_bit,				\
-	.vout_reg	= RC5T583_REG_##_vout_reg,		\
+	.vout_reg	= RC5T583_REG_##_id##DAC,		\
 	.vout_mask	= _vout_mask,				\
-	.deepsleep_reg	= RC5T583_REG_##_ds_reg,		\
+	.deepsleep_reg	= RC5T583_REG_##_id##DAC_DS,		\
 	.min_uV		= _min_mv * 1000,			\
 	.max_uV		= _max_mv * 1000,			\
 	.step_uV	= _step_uV,				\
@@ -223,34 +223,20 @@ static struct regulator_ops rc5t583_ops = {
 }
 
 static struct rc5t583_regulator_info rc5t583_reg_info[RC5T583_REGULATOR_MAX] = {
-	RC5T583_REG(DC0, DC0CTL, 0, DC0CTL, 1, DC0DAC, 0x7F, DC0DAC_DS,
-			700, 1500, 12500, 4),
-	RC5T583_REG(DC1, DC1CTL, 0, DC1CTL, 1, DC1DAC, 0x7F, DC1DAC_DS,
-			700, 1500, 12500, 14),
-	RC5T583_REG(DC2, DC2CTL, 0, DC2CTL, 1, DC2DAC, 0x7F, DC2DAC_DS,
-			900, 2400, 12500, 14),
-	RC5T583_REG(DC3, DC3CTL, 0, DC3CTL, 1, DC3DAC, 0x7F, DC3DAC_DS,
-			900, 2400, 12500, 14),
-	RC5T583_REG(LDO0, LDOEN2, 0, LDODIS2, 0, LDO0DAC, 0x7F, LDO0DAC_DS,
-			900, 3400, 25000, 160),
-	RC5T583_REG(LDO1, LDOEN2, 1, LDODIS2, 1, LDO1DAC, 0x7F, LDO1DAC_DS,
-			900, 3400, 25000, 160),
-	RC5T583_REG(LDO2, LDOEN2, 2, LDODIS2, 2, LDO2DAC, 0x7F, LDO2DAC_DS,
-			900, 3400, 25000, 160),
-	RC5T583_REG(LDO3, LDOEN2, 3, LDODIS2, 3, LDO3DAC, 0x7F, LDO3DAC_DS,
-			900, 3400, 25000, 160),
-	RC5T583_REG(LDO4, LDOEN2, 4, LDODIS2, 4, LDO4DAC, 0x3F, LDO4DAC_DS,
-			750, 1500, 12500, 133),
-	RC5T583_REG(LDO5, LDOEN2, 5, LDODIS2, 5, LDO5DAC, 0x7F, LDO5DAC_DS,
-			900, 3400, 25000, 267),
-	RC5T583_REG(LDO6, LDOEN2, 6, LDODIS2, 6, LDO6DAC, 0x7F, LDO6DAC_DS,
-			900, 3400, 25000, 133),
-	RC5T583_REG(LDO7, LDOEN2, 7, LDODIS2, 7, LDO7DAC, 0x7F, LDO7DAC_DS,
-			900, 3400, 25000, 233),
-	RC5T583_REG(LDO8, LDOEN1, 0, LDODIS1, 0, LDO8DAC, 0x7F, LDO8DAC_DS,
-			900, 3400, 25000, 233),
-	RC5T583_REG(LDO9, LDOEN1, 1, LDODIS1, 1, LDO9DAC, 0x7F, LDO9DAC_DS,
-			900, 3400, 25000, 133),
+	RC5T583_REG(DC0, DC0CTL, 0, DC0CTL, 1, 0x7F, 700, 1500, 12500, 4),
+	RC5T583_REG(DC1, DC1CTL, 0, DC1CTL, 1, 0x7F, 700, 1500, 12500, 14),
+	RC5T583_REG(DC2, DC2CTL, 0, DC2CTL, 1, 0x7F, 900, 2400, 12500, 14),
+	RC5T583_REG(DC3, DC3CTL, 0, DC3CTL, 1, 0x7F, 900, 2400, 12500, 14),
+	RC5T583_REG(LDO0, LDOEN2, 0, LDODIS2, 0, 0x7F, 900, 3400, 25000, 160),
+	RC5T583_REG(LDO1, LDOEN2, 1, LDODIS2, 1, 0x7F, 900, 3400, 25000, 160),
+	RC5T583_REG(LDO2, LDOEN2, 2, LDODIS2, 2, 0x7F, 900, 3400, 25000, 160),
+	RC5T583_REG(LDO3, LDOEN2, 3, LDODIS2, 3, 0x7F, 900, 3400, 25000, 160),
+	RC5T583_REG(LDO4, LDOEN2, 4, LDODIS2, 4, 0x3F, 750, 1500, 12500, 133),
+	RC5T583_REG(LDO5, LDOEN2, 5, LDODIS2, 5, 0x7F, 900, 3400, 25000, 267),
+	RC5T583_REG(LDO6, LDOEN2, 6, LDODIS2, 6, 0x7F, 900, 3400, 25000, 133),
+	RC5T583_REG(LDO7, LDOEN2, 7, LDODIS2, 7, 0x7F, 900, 3400, 25000, 233),
+	RC5T583_REG(LDO8, LDOEN1, 0, LDODIS1, 0, 0x7F, 900, 3400, 25000, 233),
+	RC5T583_REG(LDO9, LDOEN1, 1, LDODIS1, 1, 0x7F, 900, 3400, 25000, 133),
 };
 
 static int __devinit rc5t583_regulator_probe(struct platform_device *pdev)
-- 
1.7.5.4




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

* Re: [PATCH] regulator: rc5t583: Simplify RC5T583_REG macro
  2012-04-06  0:01 [PATCH] regulator: rc5t583: Simplify RC5T583_REG macro Axel Lin
@ 2012-04-06  5:33 ` Laxman Dewangan
  2012-04-06  8:51   ` Mark Brown
  2012-04-06  8:49 ` Mark Brown
  1 sibling, 1 reply; 4+ messages in thread
From: Laxman Dewangan @ 2012-04-06  5:33 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel@vger.kernel.org, Liam Girdwood, Mark Brown

On Friday 06 April 2012 05:31 AM, Axel Lin wrote:
> Simplify RC5T583_REG macro by removing _vout_reg and _ds_reg parameters.
>
> The naming for vout_reg and deepsleep_reg can be replaced by:
> .vout_reg       = RC5T583_REG_##_id##DAC,
> .deepsleep_reg  = RC5T583_REG_##_id##DAC_DS,
>
> Signed-off-by: Axel Lin<axel.lin@gmail.com>
> ---

Acked-by: Laxman Dewangan <ldewangan@nvidia.com>

I thought of doing this on my first patch and then thought that table 
should have all configuration picture rather than deriving  from few 
parameters.
If this is a good way then I will take care for my next PMIC driver 
development.

Thanks,
Laxman

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

* Re: [PATCH] regulator: rc5t583: Simplify RC5T583_REG macro
  2012-04-06  0:01 [PATCH] regulator: rc5t583: Simplify RC5T583_REG macro Axel Lin
  2012-04-06  5:33 ` Laxman Dewangan
@ 2012-04-06  8:49 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2012-04-06  8:49 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Laxman Dewangan, Liam Girdwood

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

On Fri, Apr 06, 2012 at 08:01:36AM +0800, Axel Lin wrote:
> Simplify RC5T583_REG macro by removing _vout_reg and _ds_reg parameters.
> 
> The naming for vout_reg and deepsleep_reg can be replaced by:
> .vout_reg       = RC5T583_REG_##_id##DAC,
> .deepsleep_reg  = RC5T583_REG_##_id##DAC_DS,

Applied, thanks.

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

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

* Re: [PATCH] regulator: rc5t583: Simplify RC5T583_REG macro
  2012-04-06  5:33 ` Laxman Dewangan
@ 2012-04-06  8:51   ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2012-04-06  8:51 UTC (permalink / raw)
  To: Laxman Dewangan; +Cc: Axel Lin, linux-kernel@vger.kernel.org, Liam Girdwood

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

On Fri, Apr 06, 2012 at 11:03:36AM +0530, Laxman Dewangan wrote:

> I thought of doing this on my first patch and then thought that
> table should have all configuration picture rather than deriving
> from few parameters.
> If this is a good way then I will take care for my next PMIC driver
> development.

This way is good - if you look at for example the wm831x driver where
there's a bunch of regulators with the same register layout replicated
in different places in the chip all it does is specify the base for the
block when defining a regulator.

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

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

end of thread, other threads:[~2012-04-06  8:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-06  0:01 [PATCH] regulator: rc5t583: Simplify RC5T583_REG macro Axel Lin
2012-04-06  5:33 ` Laxman Dewangan
2012-04-06  8:51   ` Mark Brown
2012-04-06  8:49 ` Mark Brown

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