2 * DA9150 MFD Driver - Core Data
4 * Copyright (c) 2014 Dialog Semiconductor
6 * Author: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
14 #ifndef __DA9150_CORE_H
15 #define __DA9150_CORE_H
17 #include <linux/device.h>
18 #include <linux/i2c.h>
19 #include <linux/interrupt.h>
20 #include <linux/regmap.h>
22 /* I2C address paging */
23 #define DA9150_REG_PAGE_SHIFT 8
24 #define DA9150_REG_PAGE_MASK 0xFF
27 #define DA9150_NUM_IRQ_REGS 4
28 #define DA9150_IRQ_VBUS 0
29 #define DA9150_IRQ_CHG 1
30 #define DA9150_IRQ_TCLASS 2
31 #define DA9150_IRQ_TJUNC 3
32 #define DA9150_IRQ_VFAULT 4
33 #define DA9150_IRQ_CONF 5
34 #define DA9150_IRQ_DAT 6
35 #define DA9150_IRQ_DTYPE 7
36 #define DA9150_IRQ_ID 8
37 #define DA9150_IRQ_ADP 9
38 #define DA9150_IRQ_SESS_END 10
39 #define DA9150_IRQ_SESS_VLD 11
40 #define DA9150_IRQ_FG 12
41 #define DA9150_IRQ_GP 13
42 #define DA9150_IRQ_TBAT 14
43 #define DA9150_IRQ_GPIOA 15
44 #define DA9150_IRQ_GPIOB 16
45 #define DA9150_IRQ_GPIOC 17
46 #define DA9150_IRQ_GPIOD 18
47 #define DA9150_IRQ_GPADC 19
48 #define DA9150_IRQ_WKUP 20
50 /* I2C sub-device address */
51 #define DA9150_QIF_I2C_ADDR_LSB 0x5
53 struct da9150_fg_pdata
{
54 u32 update_interval
; /* msecs */
55 u8 warn_soc_lvl
; /* % value */
56 u8 crit_soc_lvl
; /* % value */
61 struct da9150_fg_pdata
*fg_pdata
;
66 struct regmap
*regmap
;
67 struct i2c_client
*core_qif
;
69 struct regmap_irq_chip_data
*regmap_irq_data
;
74 /* Device I/O - Query Interface for FG and standard register access */
75 void da9150_read_qif(struct da9150
*da9150
, u8 addr
, int count
, u8
*buf
);
76 void da9150_write_qif(struct da9150
*da9150
, u8 addr
, int count
, const u8
*buf
);
78 u8
da9150_reg_read(struct da9150
*da9150
, u16 reg
);
79 void da9150_reg_write(struct da9150
*da9150
, u16 reg
, u8 val
);
80 void da9150_set_bits(struct da9150
*da9150
, u16 reg
, u8 mask
, u8 val
);
82 void da9150_bulk_read(struct da9150
*da9150
, u16 reg
, int count
, u8
*buf
);
83 void da9150_bulk_write(struct da9150
*da9150
, u16 reg
, int count
, const u8
*buf
);
85 #endif /* __DA9150_CORE_H */