aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mfd/wm8994/core.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mfd/wm8994/core.h')
-rw-r--r--include/linux/mfd/wm8994/core.h47
1 files changed, 36 insertions, 11 deletions
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index 40854ac0ba3d..eefafa62d304 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -56,8 +56,6 @@ struct irq_domain;
56#define WM8994_IRQ_GPIO(x) (x + WM8994_IRQ_TEMP_WARN) 56#define WM8994_IRQ_GPIO(x) (x + WM8994_IRQ_TEMP_WARN)
57 57
58struct wm8994 { 58struct wm8994 {
59 struct mutex irq_lock;
60
61 struct wm8994_pdata pdata; 59 struct wm8994_pdata pdata;
62 60
63 enum wm8994_type type; 61 enum wm8994_type type;
@@ -85,16 +83,43 @@ struct wm8994 {
85}; 83};
86 84
87/* Device I/O API */ 85/* Device I/O API */
88int wm8994_reg_read(struct wm8994 *wm8994, unsigned short reg);
89int wm8994_reg_write(struct wm8994 *wm8994, unsigned short reg,
90 unsigned short val);
91int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg,
92 unsigned short mask, unsigned short val);
93int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg,
94 int count, u16 *buf);
95int wm8994_bulk_write(struct wm8994 *wm8994, unsigned short reg,
96 int count, const u16 *buf);
97 86
87static inline int wm8994_reg_read(struct wm8994 *wm8994, unsigned short reg)
88{
89 unsigned int val;
90 int ret;
91
92 ret = regmap_read(wm8994->regmap, reg, &val);
93
94 if (ret < 0)
95 return ret;
96 else
97 return val;
98}
99
100static inline int wm8994_reg_write(struct wm8994 *wm8994, unsigned short reg,
101 unsigned short val)
102{
103 return regmap_write(wm8994->regmap, reg, val);
104}
105
106static inline int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg,
107 int count, u16 *buf)
108{
109 return regmap_bulk_read(wm8994->regmap, reg, buf, count);
110}
111
112static inline int wm8994_bulk_write(struct wm8994 *wm8994, unsigned short reg,
113 int count, const u16 *buf)
114{
115 return regmap_raw_write(wm8994->regmap, reg, buf, count * sizeof(u16));
116}
117
118static inline int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg,
119 unsigned short mask, unsigned short val)
120{
121 return regmap_update_bits(wm8994->regmap, reg, mask, val);
122}
98 123
99/* Helper to save on boilerplate */ 124/* Helper to save on boilerplate */
100static inline int wm8994_request_irq(struct wm8994 *wm8994, int irq, 125static inline int wm8994_request_irq(struct wm8994 *wm8994, int irq,