aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mfd/rc5t583.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mfd/rc5t583.h')
-rw-r--r--include/linux/mfd/rc5t583.h47
1 files changed, 39 insertions, 8 deletions
diff --git a/include/linux/mfd/rc5t583.h b/include/linux/mfd/rc5t583.h
index a2c61609d21d..0b64b19d81ab 100644
--- a/include/linux/mfd/rc5t583.h
+++ b/include/linux/mfd/rc5t583.h
@@ -26,6 +26,7 @@
26 26
27#include <linux/mutex.h> 27#include <linux/mutex.h>
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/regmap.h>
29 30
30#define RC5T583_MAX_REGS 0xF8 31#define RC5T583_MAX_REGS 0xF8
31 32
@@ -279,14 +280,44 @@ struct rc5t583_platform_data {
279 bool enable_shutdown; 280 bool enable_shutdown;
280}; 281};
281 282
282int rc5t583_write(struct device *dev, u8 reg, uint8_t val); 283static inline int rc5t583_write(struct device *dev, uint8_t reg, uint8_t val)
283int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val); 284{
284int rc5t583_set_bits(struct device *dev, unsigned int reg, 285 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
285 unsigned int bit_mask); 286 return regmap_write(rc5t583->regmap, reg, val);
286int rc5t583_clear_bits(struct device *dev, unsigned int reg, 287}
287 unsigned int bit_mask); 288
288int rc5t583_update(struct device *dev, unsigned int reg, 289static inline int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val)
289 unsigned int val, unsigned int mask); 290{
291 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
292 unsigned int ival;
293 int ret;
294 ret = regmap_read(rc5t583->regmap, reg, &ival);
295 if (!ret)
296 *val = (uint8_t)ival;
297 return ret;
298}
299
300static inline int rc5t583_set_bits(struct device *dev, unsigned int reg,
301 unsigned int bit_mask)
302{
303 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
304 return regmap_update_bits(rc5t583->regmap, reg, bit_mask, bit_mask);
305}
306
307static inline int rc5t583_clear_bits(struct device *dev, unsigned int reg,
308 unsigned int bit_mask)
309{
310 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
311 return regmap_update_bits(rc5t583->regmap, reg, bit_mask, 0);
312}
313
314static inline int rc5t583_update(struct device *dev, unsigned int reg,
315 unsigned int val, unsigned int mask)
316{
317 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
318 return regmap_update_bits(rc5t583->regmap, reg, mask, val);
319}
320
290int rc5t583_ext_power_req_config(struct device *dev, int deepsleep_id, 321int rc5t583_ext_power_req_config(struct device *dev, int deepsleep_id,
291 int ext_pwr_req, int deepsleep_slot_nr); 322 int ext_pwr_req, int deepsleep_slot_nr);
292int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base); 323int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base);