Skip to contentSkip to conversation

regulator: twl-regulator - fix twlreg_set_mode

PATCH Applied Axel Lin 5 participants 7 messages Oct 22, 2010 – Nov 6, 2010

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 regulator: twl-regulator - fix twlreg_set_mode

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.

---

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(-)
drivers/regulator/twl-regulator.c +3 -3
index 7e5892e..a57262a 100644
@@ -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);
 }
 
 /*----------------------------------------------------------------------*/
Signature · 1 line
1.7.2
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Axel Lin

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 ).

Quoted 6 lines

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.

Quoted 2 lines

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.

#2 lore raw
Quoted 12 lines · Mark Brown
Quoted 11 lines · Axel Lin

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.

Quoted 8 lines
Quoted 1 line
Quoted 2 lines

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

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
#3 lore raw
Quoted 24 lines

-----Original Message-----
From: Liam Girdwood [mailto:[email protected]]
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

Quoted 14 lines · Mark Brown
Quoted 12 lines · Axel Lin

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.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

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.

Quoted 8 lines

Thanks

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

#4 lore raw

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

Quoted 56 lines

-----Original Message-----
From: Nayak, Rajendra [mailto:[email protected]]
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

Quoted 7 lines

-----Original Message-----
From: Liam Girdwood [mailto:[email protected]]
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

Quoted 6 lines
Quoted 5 lines · Mark Brown
Quoted 4 lines · Axel Lin

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.

Quoted 1 line
Quoted 1 line
Quoted 1 line

To properly set mode, we need to write the complete message ( MSB

and LSB ).

Quoted 11 lines
Quoted 11 lines
Quoted 7 lines

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.

Quoted 1 line

I don't have this hardware handy, I appreciate if someone who has

the

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

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.

Quoted 8 lines

Thanks

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

#5 lore raw
In reply to Nayak, Rajendra

Forgot to mention-

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

Quoted 86 lines

-----Original Message-----
From: Lesly Arackal Manuel [mailto:[email protected]]
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

Quoted 23 lines

-----Original Message-----
From: Nayak, Rajendra [mailto:[email protected]]
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

Quoted 13 lines

-----Original Message-----
From: Liam Girdwood [mailto:[email protected]]
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

Quoted 5 lines · Mark Brown
Quoted 4 lines · Axel Lin

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

Quoted 5 lines

part.

Quoted 1 line
Quoted 1 line
Quoted 1 line

To properly set mode, we need to write the complete message ( MSB

and LSB ).

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

In twl.h, now we have defines for PM Master module register

offsets,

Quoted 28 lines
Quoted 9 lines
Quoted 9 lines
Quoted 5 lines

use it instead of hard coded 0x15/0x16.

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

Quoted 1 line

I don't have this hardware handy, I appreciate if someone who has

the

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

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.

Quoted 8 lines

Thanks

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

#6 lore raw
Quoted 33 lines · Lesly Arackal Manuel

Forgot to mention-

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

Quoted 28 lines

-----Original Message-----
From: Lesly Arackal Manuel [mailto:[email protected]]
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

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk