diff options
author | Nishanth Menon <nm@ti.com> | 2011-06-22 12:15:56 -0500 |
---|---|---|
committer | Nishanth Menon <nm@ti.com> | 2011-06-29 03:52:39 -0700 |
commit | aaf27f232634dfbb8ddbcbccb4df6c25bb1e684d (patch) | |
tree | ba4403888e597fcbdab8cd121b6d2b34abe0fd8b /arch/arm | |
parent | b03012db4df147d762410b051266bad0ca909368 (diff) | |
download | kernel_samsung_tuna-aaf27f232634dfbb8ddbcbccb4df6c25bb1e684d.zip kernel_samsung_tuna-aaf27f232634dfbb8ddbcbccb4df6c25bb1e684d.tar.gz kernel_samsung_tuna-aaf27f232634dfbb8ddbcbccb4df6c25bb1e684d.tar.bz2 |
OMAP4: PM: TPS: provide a read-modify-write for TWL6030
We will be flipping a few bits to enable/disable groups in later
patches, so, we provide a helper to do a read modify write function
which wraps around the standard TWL6030 read/write functions.
Acked-by: Ambresh K <ambresh@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-omap2/omap_tps6236x.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/arch/arm/mach-omap2/omap_tps6236x.c b/arch/arm/mach-omap2/omap_tps6236x.c index 808d05c..24aa6cd 100644 --- a/arch/arm/mach-omap2/omap_tps6236x.c +++ b/arch/arm/mach-omap2/omap_tps6236x.c @@ -194,6 +194,30 @@ static struct omap_voltdm_pmic omap4_mpu_pmic = { }; /** + * _twl_i2c_rmw_u8() - Tiny helper function to do a read modify write for twl + * @mod_no: module number + * @mask: mask for the val + * @value: value to write + * @reg: register to write to + */ +static int __init _twl_i2c_rmw_u8(u8 mod_no, u8 mask, u8 value, u8 reg) +{ + int ret; + u8 val; + + ret = twl_i2c_read_u8(mod_no, &val, reg); + if (ret) + goto out; + + val &= ~mask; + val |= (value & mask); + + ret = twl_i2c_write_u8(mod_no, val, reg); +out: + return ret; +} + +/** * omap4_twl_tps62361_enable() - Enable tps chip * * This function enables TPS chip by associating SYSEN signal @@ -245,14 +269,9 @@ static int __init omap4_twl_tps62361_enable(struct voltagedomain *voltdm) /* if we have to work with TWL */ #ifdef CONFIG_TWL4030_CORE - ret = twl_i2c_read_u8(TWL6030_MODULE_ID0, &val, - TWL6030_REG_SYSEN_CFG_GRP); - if (ret) - goto out; - - val |= TWL6030_BIT_APE_GRP; - ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, val, - TWL6030_REG_SYSEN_CFG_GRP); + /* Map up SYSEN on TWL core to control TPS */ + ret = _twl_i2c_rmw_u8(TWL6030_MODULE_ID0, TWL6030_BIT_APE_GRP, + TWL6030_BIT_APE_GRP, TWL6030_REG_SYSEN_CFG_GRP); #endif out: |