All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: twl-regulator - fix twlreg_set_mode
@ 2010-10-22  8:38 Axel Lin
  2010-10-22 15:30 ` Mark Brown
  0 siblings, 1 reply; 7+ messages in thread
From: Axel Lin @ 2010-10-22  8:38 UTC (permalink / raw)
  To: linux-kernel; +Cc: Liam Girdwood, Mark Brown, Juha Keski-Saari, Rajendra Nayak

The Singular Message is 16 bits:
        DEV_GRP[15:13] MT[12]  RES_ID[11:4]  RES_STATE[3:0]

Current implementation return immedially after sucessfuly write MSB part.
To properly set mode, we need to write the complete message ( MSB and LSB ).

In twl.h, now we have defines for PM Master module register offsets,
use it instead of hard coded 0x15/0x16.

Use "message & 0xff" to ensure we send correct value for LSB.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---

I don't have this hardware handy, I appreciate if someone who has the
hardware can test this patch.

Regards,
Axel

 drivers/regulator/twl-regulator.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index 7e5892e..a57262a 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -219,12 +219,12 @@ static int twlreg_set_mode(struct regulator_dev *rdev, unsigned mode)
 		return -EACCES;
 
 	status = twl_i2c_write_u8(TWL_MODULE_PM_MASTER,
-			message >> 8, 0x15 /* PB_WORD_MSB */ );
-	if (status >= 0)
+			message >> 8, TWL4030_PM_MASTER_PB_WORD_MSB);
+	if (status < 0)
 		return status;
 
 	return twl_i2c_write_u8(TWL_MODULE_PM_MASTER,
-			message, 0x16 /* PB_WORD_LSB */ );
+			message & 0xff, TWL4030_PM_MASTER_PB_WORD_LSB);
 }
 
 /*----------------------------------------------------------------------*/
-- 
1.7.2




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

* Re: [PATCH] regulator: twl-regulator - fix twlreg_set_mode
  2010-10-22  8:38 [PATCH] regulator: twl-regulator - fix twlreg_set_mode Axel Lin
@ 2010-10-22 15:30 ` Mark Brown
  2010-10-23 13:47   ` Liam Girdwood
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2010-10-22 15:30 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Liam Girdwood, Juha Keski-Saari, Rajendra Nayak

On Fri, Oct 22, 2010 at 04:38:22PM +0800, Axel Lin wrote:
> The Singular Message is 16 bits:
>         DEV_GRP[15:13] MT[12]  RES_ID[11:4]  RES_STATE[3:0]
> 
> Current implementation return immedially after sucessfuly write MSB part.
> To properly set mode, we need to write the complete message ( MSB and LSB ).
> 
> In twl.h, now we have defines for PM Master module register offsets,
> use it instead of hard coded 0x15/0x16.
> 
> Use "message & 0xff" to ensure we send correct value for LSB.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

> I don't have this hardware handy, I appreciate if someone who has the
> hardware can test this patch.

I beleive Liam has appropriate hardware.

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

* Re: [PATCH] regulator: twl-regulator - fix twlreg_set_mode
  2010-10-22 15:30 ` Mark Brown
@ 2010-10-23 13:47   ` Liam Girdwood
  2010-10-26 10:10     ` Nayak, Rajendra
  0 siblings, 1 reply; 7+ messages in thread
From: Liam Girdwood @ 2010-10-23 13:47 UTC (permalink / raw)
  To: Rajendra Nayak; +Cc: Axel Lin, linux-kernel, Juha Keski-Saari, Mark Brown

On Fri, 2010-10-22 at 08:30 -0700, Mark Brown wrote:
> On Fri, Oct 22, 2010 at 04:38:22PM +0800, Axel Lin wrote:
> > The Singular Message is 16 bits:
> >         DEV_GRP[15:13] MT[12]  RES_ID[11:4]  RES_STATE[3:0]
> > 
> > Current implementation return immedially after sucessfuly write MSB part.
> > To properly set mode, we need to write the complete message ( MSB and LSB ).
> > 
> > In twl.h, now we have defines for PM Master module register offsets,
> > use it instead of hard coded 0x15/0x16.
> > 
> > Use "message & 0xff" to ensure we send correct value for LSB.
> > 
> > Signed-off-by: Axel Lin <axel.lin@gmail.com>
> 
> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> 
> > I don't have this hardware handy, I appreciate if someone who has the
> > hardware can test this patch.
> 
> I beleive Liam has appropriate hardware.

Rejendra, care to test this ?

Thanks

Liam 
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk


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

* RE: [PATCH] regulator: twl-regulator - fix twlreg_set_mode
  2010-10-23 13:47   ` Liam Girdwood
@ 2010-10-26 10:10     ` Nayak, Rajendra
  2010-11-04  9:30       ` Lesly Arackal Manuel
  2010-11-04  9:38       ` Lesly Arackal Manuel
  0 siblings, 2 replies; 7+ messages in thread
From: Nayak, Rajendra @ 2010-10-26 10:10 UTC (permalink / raw)
  To: Liam Girdwood
  Cc: Axel Lin, linux-kernel, Juha Keski-Saari, Mark Brown, Manuel,
	Lesly Arackal



> -----Original Message-----
> From: Liam Girdwood [mailto:lrg@slimlogic.co.uk]
> Sent: Saturday, October 23, 2010 7:17 PM
> To: Nayak, Rajendra
> Cc: Axel Lin; linux-kernel; Juha Keski-Saari; Mark Brown
> Subject: Re: [PATCH] regulator: twl-regulator - fix twlreg_set_mode
> 
> On Fri, 2010-10-22 at 08:30 -0700, Mark Brown wrote:
> > On Fri, Oct 22, 2010 at 04:38:22PM +0800, Axel Lin wrote:
> > > The Singular Message is 16 bits:
> > >         DEV_GRP[15:13] MT[12]  RES_ID[11:4]  RES_STATE[3:0]
> > >
> > > Current implementation return immedially after sucessfuly write MSB part.
> > > To properly set mode, we need to write the complete message ( MSB and LSB ).
> > >
> > > In twl.h, now we have defines for PM Master module register offsets,
> > > use it instead of hard coded 0x15/0x16.
> > >
> > > Use "message & 0xff" to ensure we send correct value for LSB.
> > >
> > > Signed-off-by: Axel Lin <axel.lin@gmail.com>
> >
> > Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> >
> > > I don't have this hardware handy, I appreciate if someone who has the
> > > hardware can test this patch.
> >
> > I beleive Liam has appropriate hardware.
> 
> Rejendra, care to test this ?

Sure, either me or Lesly will test this on one of the twl4030 based platforms
and update.

> 
> Thanks
> 
> Liam
> --
> Freelance Developer, SlimLogic Ltd
> ASoC and Voltage Regulator Maintainer.
> http://www.slimlogic.co.uk


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

* RE: [PATCH] regulator: twl-regulator - fix twlreg_set_mode
  2010-10-26 10:10     ` Nayak, Rajendra
@ 2010-11-04  9:30       ` Lesly Arackal Manuel
  2010-11-04  9:38       ` Lesly Arackal Manuel
  1 sibling, 0 replies; 7+ messages in thread
From: Lesly Arackal Manuel @ 2010-11-04  9:30 UTC (permalink / raw)
  To: 'Nayak, Rajendra', 'Liam Girdwood'
  Cc: 'Axel Lin', 'linux-kernel',
	'Juha Keski-Saari', 'Mark Brown'


I have tested it with MMC card inserted on OMAP3630SDP board (using OMAP3
integration tree).

The changes seem to be valid.

The i2c_transfer() returns '1' on success and the twl_i2c_write() which
calls i2c_transfer returns '0' if success and err value if it fails.

After writing the MSB if it returns with check:
if (status >= 0)
	return status;
It is not writing the LSB.

So it should be:
if (status < 0)
	return status;

Regards,
Lesly AM

> -----Original Message-----
> From: Nayak, Rajendra [mailto:rnayak@ti.com]
> Sent: Tuesday, October 26, 2010 3:40 PM
> To: Liam Girdwood
> Cc: Axel Lin; linux-kernel; Juha Keski-Saari; Mark Brown; Manuel, Lesly
> Arackal
> Subject: RE: [PATCH] regulator: twl-regulator - fix twlreg_set_mode
> 
> 
> 
> > -----Original Message-----
> > From: Liam Girdwood [mailto:lrg@slimlogic.co.uk]
> > Sent: Saturday, October 23, 2010 7:17 PM
> > To: Nayak, Rajendra
> > Cc: Axel Lin; linux-kernel; Juha Keski-Saari; Mark Brown
> > Subject: Re: [PATCH] regulator: twl-regulator - fix twlreg_set_mode
> >
> > On Fri, 2010-10-22 at 08:30 -0700, Mark Brown wrote:
> > > On Fri, Oct 22, 2010 at 04:38:22PM +0800, Axel Lin wrote:
> > > > The Singular Message is 16 bits:
> > > >         DEV_GRP[15:13] MT[12]  RES_ID[11:4]  RES_STATE[3:0]
> > > >
> > > > Current implementation return immedially after sucessfuly write MSB
> part.
> > > > To properly set mode, we need to write the complete message ( MSB
> and LSB ).
> > > >
> > > > In twl.h, now we have defines for PM Master module register offsets,
> > > > use it instead of hard coded 0x15/0x16.
> > > >
> > > > Use "message & 0xff" to ensure we send correct value for LSB.
> > > >
> > > > Signed-off-by: Axel Lin <axel.lin@gmail.com>
> > >
> > > Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> > >
> > > > I don't have this hardware handy, I appreciate if someone who has
> the
> > > > hardware can test this patch.
> > >
> > > I beleive Liam has appropriate hardware.
> >
> > Rejendra, care to test this ?
> 
> Sure, either me or Lesly will test this on one of the twl4030 based
> platforms
> and update.
> 
> >
> > Thanks
> >
> > Liam
> > --
> > Freelance Developer, SlimLogic Ltd
> > ASoC and Voltage Regulator Maintainer.
> > http://www.slimlogic.co.uk



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

* RE: [PATCH] regulator: twl-regulator - fix twlreg_set_mode
  2010-10-26 10:10     ` Nayak, Rajendra
  2010-11-04  9:30       ` Lesly Arackal Manuel
@ 2010-11-04  9:38       ` Lesly Arackal Manuel
  2010-11-06 11:54         ` Liam Girdwood
  1 sibling, 1 reply; 7+ messages in thread
From: Lesly Arackal Manuel @ 2010-11-04  9:38 UTC (permalink / raw)
  To: 'Lesly Arackal Manuel', 'Nayak, Rajendra',
	'Liam Girdwood'
  Cc: 'Axel Lin', 'linux-kernel',
	'Juha Keski-Saari', 'Mark Brown'

Forgot to mention-

Only omap hsmmc driver is using regulator_set_mode() which will call
twlreg_set_mode().

> -----Original Message-----
> From: Lesly Arackal Manuel [mailto:leslyam@ti.com]
> Sent: Thursday, November 04, 2010 3:01 PM
> To: 'Nayak, Rajendra'; 'Liam Girdwood'
> Cc: 'Axel Lin'; 'linux-kernel'; 'Juha Keski-Saari'; 'Mark Brown'
> Subject: RE: [PATCH] regulator: twl-regulator - fix twlreg_set_mode
> 
> 
> I have tested it with MMC card inserted on OMAP3630SDP board (using OMAP3
> integration tree).
> 
> The changes seem to be valid.
> 
> The i2c_transfer() returns '1' on success and the twl_i2c_write() which
> calls i2c_transfer returns '0' if success and err value if it fails.
> 
> After writing the MSB if it returns with check:
> if (status >= 0)
> 	return status;
> It is not writing the LSB.
> 
> So it should be:
> if (status < 0)
> 	return status;
> 
> Regards,
> Lesly AM
> 
> > -----Original Message-----
> > From: Nayak, Rajendra [mailto:rnayak@ti.com]
> > Sent: Tuesday, October 26, 2010 3:40 PM
> > To: Liam Girdwood
> > Cc: Axel Lin; linux-kernel; Juha Keski-Saari; Mark Brown; Manuel, Lesly
> > Arackal
> > Subject: RE: [PATCH] regulator: twl-regulator - fix twlreg_set_mode
> >
> >
> >
> > > -----Original Message-----
> > > From: Liam Girdwood [mailto:lrg@slimlogic.co.uk]
> > > Sent: Saturday, October 23, 2010 7:17 PM
> > > To: Nayak, Rajendra
> > > Cc: Axel Lin; linux-kernel; Juha Keski-Saari; Mark Brown
> > > Subject: Re: [PATCH] regulator: twl-regulator - fix twlreg_set_mode
> > >
> > > On Fri, 2010-10-22 at 08:30 -0700, Mark Brown wrote:
> > > > On Fri, Oct 22, 2010 at 04:38:22PM +0800, Axel Lin wrote:
> > > > > The Singular Message is 16 bits:
> > > > >         DEV_GRP[15:13] MT[12]  RES_ID[11:4]  RES_STATE[3:0]
> > > > >
> > > > > Current implementation return immedially after sucessfuly write
> MSB
> > part.
> > > > > To properly set mode, we need to write the complete message ( MSB
> > and LSB ).
> > > > >
> > > > > In twl.h, now we have defines for PM Master module register
> offsets,
> > > > > use it instead of hard coded 0x15/0x16.
> > > > >
> > > > > Use "message & 0xff" to ensure we send correct value for LSB.
> > > > >
> > > > > Signed-off-by: Axel Lin <axel.lin@gmail.com>
> > > >
> > > > Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> > > >
> > > > > I don't have this hardware handy, I appreciate if someone who has
> > the
> > > > > hardware can test this patch.
> > > >
> > > > I beleive Liam has appropriate hardware.
> > >
> > > Rejendra, care to test this ?
> >
> > Sure, either me or Lesly will test this on one of the twl4030 based
> > platforms
> > and update.
> >
> > >
> > > Thanks
> > >
> > > Liam
> > > --
> > > Freelance Developer, SlimLogic Ltd
> > > ASoC and Voltage Regulator Maintainer.
> > > http://www.slimlogic.co.uk



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

* RE: [PATCH] regulator: twl-regulator - fix twlreg_set_mode
  2010-11-04  9:38       ` Lesly Arackal Manuel
@ 2010-11-06 11:54         ` Liam Girdwood
  0 siblings, 0 replies; 7+ messages in thread
From: Liam Girdwood @ 2010-11-06 11:54 UTC (permalink / raw)
  To: Lesly Arackal Manuel
  Cc: 'Nayak, Rajendra', 'Axel Lin',
	'linux-kernel', 'Juha Keski-Saari',
	'Mark Brown'

On Thu, 2010-11-04 at 15:08 +0530, Lesly Arackal Manuel wrote:
> Forgot to mention-
> 
> Only omap hsmmc driver is using regulator_set_mode() which will call
> twlreg_set_mode().
> 
> > -----Original Message-----
> > From: Lesly Arackal Manuel [mailto:leslyam@ti.com]
> > Sent: Thursday, November 04, 2010 3:01 PM
> > To: 'Nayak, Rajendra'; 'Liam Girdwood'
> > Cc: 'Axel Lin'; 'linux-kernel'; 'Juha Keski-Saari'; 'Mark Brown'
> > Subject: RE: [PATCH] regulator: twl-regulator - fix twlreg_set_mode
> > 
> > 
> > I have tested it with MMC card inserted on OMAP3630SDP board (using OMAP3
> > integration tree).
> > 
> > The changes seem to be valid.
> > 
> > The i2c_transfer() returns '1' on success and the twl_i2c_write() which
> > calls i2c_transfer returns '0' if success and err value if it fails.
> > 
> > After writing the MSB if it returns with check:
> > if (status >= 0)
> > 	return status;
> > It is not writing the LSB.
> > 
> > So it should be:
> > if (status < 0)
> > 	return status;
> > 
> > Regards,
> > Lesly AM
> > 

Applied.

Thanks

Liam
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk


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

end of thread, other threads:[~2010-11-06 11:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-22  8:38 [PATCH] regulator: twl-regulator - fix twlreg_set_mode Axel Lin
2010-10-22 15:30 ` Mark Brown
2010-10-23 13:47   ` Liam Girdwood
2010-10-26 10:10     ` Nayak, Rajendra
2010-11-04  9:30       ` Lesly Arackal Manuel
2010-11-04  9:38       ` Lesly Arackal Manuel
2010-11-06 11:54         ` Liam Girdwood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.