diff options
Diffstat (limited to 'include/linux/mfd/tps65090.h')
-rw-r--r-- | include/linux/mfd/tps65090.h | 73 |
1 files changed, 55 insertions, 18 deletions
diff --git a/include/linux/mfd/tps65090.h b/include/linux/mfd/tps65090.h index 804e280c1e1..6694cf43e8b 100644 --- a/include/linux/mfd/tps65090.h +++ b/include/linux/mfd/tps65090.h | |||
@@ -23,6 +23,26 @@ | |||
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> | ||
27 | |||
28 | /* TPS65090 IRQs */ | ||
29 | enum { | ||
30 | TPS65090_IRQ_VAC_STATUS_CHANGE, | ||
31 | TPS65090_IRQ_VSYS_STATUS_CHANGE, | ||
32 | TPS65090_IRQ_BAT_STATUS_CHANGE, | ||
33 | TPS65090_IRQ_CHARGING_STATUS_CHANGE, | ||
34 | TPS65090_IRQ_CHARGING_COMPLETE, | ||
35 | TPS65090_IRQ_OVERLOAD_DCDC1, | ||
36 | TPS65090_IRQ_OVERLOAD_DCDC2, | ||
37 | TPS65090_IRQ_OVERLOAD_DCDC3, | ||
38 | TPS65090_IRQ_OVERLOAD_FET1, | ||
39 | TPS65090_IRQ_OVERLOAD_FET2, | ||
40 | TPS65090_IRQ_OVERLOAD_FET3, | ||
41 | TPS65090_IRQ_OVERLOAD_FET4, | ||
42 | TPS65090_IRQ_OVERLOAD_FET5, | ||
43 | TPS65090_IRQ_OVERLOAD_FET6, | ||
44 | TPS65090_IRQ_OVERLOAD_FET7, | ||
45 | }; | ||
26 | 46 | ||
27 | /* TPS65090 Regulator ID */ | 47 | /* TPS65090 Regulator ID */ |
28 | enum { | 48 | enum { |
@@ -44,20 +64,9 @@ enum { | |||
44 | }; | 64 | }; |
45 | 65 | ||
46 | struct tps65090 { | 66 | struct tps65090 { |
47 | struct mutex lock; | ||
48 | struct device *dev; | 67 | struct device *dev; |
49 | struct i2c_client *client; | ||
50 | struct regmap *rmap; | 68 | struct regmap *rmap; |
51 | struct irq_chip irq_chip; | 69 | struct regmap_irq_chip_data *irq_data; |
52 | struct mutex irq_lock; | ||
53 | int irq_base; | ||
54 | unsigned int id; | ||
55 | }; | ||
56 | |||
57 | struct tps65090_subdev_info { | ||
58 | int id; | ||
59 | const char *name; | ||
60 | void *platform_data; | ||
61 | }; | 70 | }; |
62 | 71 | ||
63 | /* | 72 | /* |
@@ -77,8 +86,6 @@ struct tps65090_regulator_plat_data { | |||
77 | 86 | ||
78 | struct tps65090_platform_data { | 87 | struct tps65090_platform_data { |
79 | int irq_base; | 88 | int irq_base; |
80 | int num_subdevs; | ||
81 | struct tps65090_subdev_info *subdevs; | ||
82 | struct tps65090_regulator_plat_data *reg_pdata[TPS65090_REGULATOR_MAX]; | 89 | struct tps65090_regulator_plat_data *reg_pdata[TPS65090_REGULATOR_MAX]; |
83 | }; | 90 | }; |
84 | 91 | ||
@@ -86,9 +93,39 @@ struct tps65090_platform_data { | |||
86 | * NOTE: the functions below are not intended for use outside | 93 | * NOTE: the functions below are not intended for use outside |
87 | * of the TPS65090 sub-device drivers | 94 | * of the TPS65090 sub-device drivers |
88 | */ | 95 | */ |
89 | extern int tps65090_write(struct device *dev, int reg, uint8_t val); | 96 | static inline int tps65090_write(struct device *dev, int reg, uint8_t val) |
90 | extern int tps65090_read(struct device *dev, int reg, uint8_t *val); | 97 | { |
91 | extern int tps65090_set_bits(struct device *dev, int reg, uint8_t bit_num); | 98 | struct tps65090 *tps = dev_get_drvdata(dev); |
92 | extern int tps65090_clr_bits(struct device *dev, int reg, uint8_t bit_num); | 99 | |
100 | return regmap_write(tps->rmap, reg, val); | ||
101 | } | ||
102 | |||
103 | static inline int tps65090_read(struct device *dev, int reg, uint8_t *val) | ||
104 | { | ||
105 | struct tps65090 *tps = dev_get_drvdata(dev); | ||
106 | unsigned int temp_val; | ||
107 | int ret; | ||
108 | |||
109 | ret = regmap_read(tps->rmap, reg, &temp_val); | ||
110 | if (!ret) | ||
111 | *val = temp_val; | ||
112 | return ret; | ||
113 | } | ||
114 | |||
115 | static inline int tps65090_set_bits(struct device *dev, int reg, | ||
116 | uint8_t bit_num) | ||
117 | { | ||
118 | struct tps65090 *tps = dev_get_drvdata(dev); | ||
119 | |||
120 | return regmap_update_bits(tps->rmap, reg, BIT(bit_num), ~0u); | ||
121 | } | ||
122 | |||
123 | static inline int tps65090_clr_bits(struct device *dev, int reg, | ||
124 | uint8_t bit_num) | ||
125 | { | ||
126 | struct tps65090 *tps = dev_get_drvdata(dev); | ||
127 | |||
128 | return regmap_update_bits(tps->rmap, reg, BIT(bit_num), 0u); | ||
129 | } | ||
93 | 130 | ||
94 | #endif /*__LINUX_MFD_TPS65090_H */ | 131 | #endif /*__LINUX_MFD_TPS65090_H */ |