diff options
author | Axel Lin <axel.lin@gmail.com> | 2010-10-22 12:38:22 +0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2010-11-30 18:13:25 +0300 |
commit | b9e26bc804e611d879353cd953cb17db1c52d307 (patch) | |
tree | d516be6cf3f476c521ef3ed40267cc0255bf4fa8 /drivers/regulator | |
parent | 3aa713e76e8f562c0d28faf18873c4f1836b17c9 (diff) | |
download | linux-b9e26bc804e611d879353cd953cb17db1c52d307.tar.xz |
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.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Tested-by: Lesly Arackal Manuel <leslyam@ti.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | 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 7e5892efc437..a57262a4fa6c 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); } /*----------------------------------------------------------------------*/ |