2 * da9055 declarations for DA9055 PMICs.
4 * Copyright(c) 2012 Dialog Semiconductor Ltd.
6 * Author: David Dajun Chen <dchen@diasemi.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #ifndef __DA9055_CORE_H
25 #define __DA9055_CORE_H
27 #include <linux/interrupt.h>
28 #include <linux/regmap.h>
33 #define DA9055_IRQ_ALARM 0x01
34 #define DA9055_IRQ_TICK 0x02
35 #define DA9055_IRQ_NONKEY 0x00
36 #define DA9055_IRQ_REGULATOR 0x0B
37 #define DA9055_IRQ_HWMON 0x03
42 struct regmap *regmap;
43 struct regmap_irq_chip_data *irq_data;
45 struct i2c_client *i2c_client;
52 static inline int da9055_reg_read(struct da9055 *da9055, unsigned char reg)
56 ret = regmap_read(da9055->regmap, reg, &val);
63 static inline int da9055_reg_write(struct da9055 *da9055, unsigned char reg,
66 return regmap_write(da9055->regmap, reg, val);
69 static inline int da9055_group_read(struct da9055 *da9055, unsigned char reg,
70 unsigned reg_cnt, unsigned char *val)
72 return regmap_bulk_read(da9055->regmap, reg, val, reg_cnt);
75 static inline int da9055_group_write(struct da9055 *da9055, unsigned char reg,
76 unsigned reg_cnt, unsigned char *val)
78 return regmap_raw_write(da9055->regmap, reg, val, reg_cnt);
81 static inline int da9055_reg_update(struct da9055 *da9055, unsigned char reg,
82 unsigned char bit_mask,
83 unsigned char reg_val)
85 return regmap_update_bits(da9055->regmap, reg, bit_mask, reg_val);
88 /* Generic Device API */
89 int da9055_device_init(struct da9055 *da9055);
90 void da9055_device_exit(struct da9055 *da9055);
92 extern const struct regmap_config da9055_regmap_config;
94 #endif /* __DA9055_CORE_H */