diff options
| author | Laxman Dewangan <ldewangan@nvidia.com> | 2012-11-19 22:14:48 -0500 |
|---|---|---|
| committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-11-21 10:07:53 -0500 |
| commit | b9c79323166530a14c1fa8c10337eeaa54e3f98d (patch) | |
| tree | 02ec6901e7407d1687a0a0826e9a440ad9fa5ca1 /include/linux | |
| parent | 3863db3e800c64e21e4effcc3de0f72cdb9b0d77 (diff) | |
mfd: tps65090: Move register access APIs to header
Since tps65090 register is accessed via regmap, moving
the register access APIs to header and making it as inline.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/mfd/tps65090.h | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/include/linux/mfd/tps65090.h b/include/linux/mfd/tps65090.h index 6c576224f637..1a5f916b7383 100644 --- a/include/linux/mfd/tps65090.h +++ b/include/linux/mfd/tps65090.h | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #define __LINUX_MFD_TPS65090_H | 23 | #define __LINUX_MFD_TPS65090_H |
| 24 | 24 | ||
| 25 | #include <linux/irq.h> | 25 | #include <linux/irq.h> |
| 26 | #include <linux/regmap.h> | ||
| 26 | 27 | ||
| 27 | struct tps65090 { | 28 | struct tps65090 { |
| 28 | struct device *dev; | 29 | struct device *dev; |
| @@ -40,9 +41,39 @@ struct tps65090_platform_data { | |||
| 40 | * NOTE: the functions below are not intended for use outside | 41 | * NOTE: the functions below are not intended for use outside |
| 41 | * of the TPS65090 sub-device drivers | 42 | * of the TPS65090 sub-device drivers |
| 42 | */ | 43 | */ |
| 43 | extern int tps65090_write(struct device *dev, int reg, uint8_t val); | 44 | static inline int tps65090_write(struct device *dev, int reg, uint8_t val) |
| 44 | extern int tps65090_read(struct device *dev, int reg, uint8_t *val); | 45 | { |
| 45 | extern int tps65090_set_bits(struct device *dev, int reg, uint8_t bit_num); | 46 | struct tps65090 *tps = dev_get_drvdata(dev); |
| 46 | extern int tps65090_clr_bits(struct device *dev, int reg, uint8_t bit_num); | 47 | |
| 48 | return regmap_write(tps->rmap, reg, val); | ||
| 49 | } | ||
| 50 | |||
| 51 | static inline int tps65090_read(struct device *dev, int reg, uint8_t *val) | ||
| 52 | { | ||
| 53 | struct tps65090 *tps = dev_get_drvdata(dev); | ||
| 54 | unsigned int temp_val; | ||
| 55 | int ret; | ||
| 56 | |||
| 57 | ret = regmap_read(tps->rmap, reg, &temp_val); | ||
| 58 | if (!ret) | ||
| 59 | *val = temp_val; | ||
| 60 | return ret; | ||
| 61 | } | ||
| 62 | |||
| 63 | static inline int tps65090_set_bits(struct device *dev, int reg, | ||
| 64 | uint8_t bit_num) | ||
| 65 | { | ||
| 66 | struct tps65090 *tps = dev_get_drvdata(dev); | ||
| 67 | |||
| 68 | return regmap_update_bits(tps->rmap, reg, BIT(bit_num), ~0u); | ||
| 69 | } | ||
| 70 | |||
| 71 | static inline int tps65090_clr_bits(struct device *dev, int reg, | ||
| 72 | uint8_t bit_num) | ||
| 73 | { | ||
| 74 | struct tps65090 *tps = dev_get_drvdata(dev); | ||
| 75 | |||
| 76 | return regmap_update_bits(tps->rmap, reg, BIT(bit_num), 0u); | ||
| 77 | } | ||
| 47 | 78 | ||
| 48 | #endif /*__LINUX_MFD_TPS65090_H */ | 79 | #endif /*__LINUX_MFD_TPS65090_H */ |
