diff options
author | Rhyland Klein <rklein@nvidia.com> | 2012-05-08 11:42:38 -0700 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-06-04 14:21:05 -0700 |
commit | d167de5fef02520c5dfd924eeeb5fb9fae671729 (patch) | |
tree | 55b1bc2e362492dcd4a4e04c38d819cb1cf54764 /include/linux/mfd | |
parent | 30d1e63baee88c54c4093279b8653682a11cbaca (diff) |
mfd: Commonize tps65910 regmap access through header
This change removes the read/write callback functions in favor of common
regmap accessors inside the header file. This change also makes use of
regmap_read/write for single register access which maps better onto what this
driver actually needs.
Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
(Cherry-pick from mainline
3f7e82759c692df473675ed06fb90b20f1f225c3)
Change-Id: Ida79b196acf65ed14ff9fd2cc1f7c0048f99ba2b
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/105922
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Rhyland Klein <rklein@nvidia.com>
GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'include/linux/mfd')
-rw-r--r-- | include/linux/mfd/tps65910.h | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h index 4ead99035606..cf4b18041038 100644 --- a/include/linux/mfd/tps65910.h +++ b/include/linux/mfd/tps65910.h @@ -17,6 +17,9 @@ #ifndef __LINUX_MFD_TPS65910_H #define __LINUX_MFD_TPS65910_H +#include <linux/gpio.h> +#include <linux/regmap.h> + /* TPS chip id list */ #define TPS65910 0 #define TPS65911 1 @@ -821,8 +824,6 @@ struct tps65910 { struct regmap *regmap; struct mutex io_mutex; unsigned int id; - int (*read)(struct tps65910 *tps65910, u8 reg, int size, void *dest); - int (*write)(struct tps65910 *tps65910, u8 reg, int size, void *src); /* Client devices */ struct tps65910_pmic *pmic; @@ -845,8 +846,6 @@ struct tps65910_platform_data { int irq_base; }; -int tps65910_set_bits(struct tps65910 *tps65910, u8 reg, u8 mask); -int tps65910_clear_bits(struct tps65910 *tps65910, u8 reg, u8 mask); void tps65910_gpio_init(struct tps65910 *tps65910, int gpio_base); int tps65910_irq_init(struct tps65910 *tps65910, int irq, struct tps65910_platform_data *pdata); @@ -857,4 +856,28 @@ static inline int tps65910_chip_id(struct tps65910 *tps65910) return tps65910->id; } +static inline int tps65910_reg_read(struct tps65910 *tps65910, u8 reg, + unsigned int *val) +{ + return regmap_read(tps65910->regmap, reg, val); +} + +static inline int tps65910_reg_write(struct tps65910 *tps65910, u8 reg, + unsigned int val) +{ + return regmap_write(tps65910->regmap, reg, val); +} + +static inline int tps65910_reg_set_bits(struct tps65910 *tps65910, u8 reg, + u8 mask) +{ + return regmap_update_bits(tps65910->regmap, reg, mask, mask); +} + +static inline int tps65910_reg_clear_bits(struct tps65910 *tps65910, u8 reg, + u8 mask) +{ + return regmap_update_bits(tps65910->regmap, reg, mask, 0); +} + #endif /* __LINUX_MFD_TPS65910_H */ |