]> asedeno.scripts.mit.edu Git - linux.git/blob - include/linux/power/bq27xxx_battery.h
power: supply: bq27xxx: adds specific support for bq27520-g3 revision.
[linux.git] / include / linux / power / bq27xxx_battery.h
1 #ifndef __LINUX_BQ27X00_BATTERY_H__
2 #define __LINUX_BQ27X00_BATTERY_H__
3
4 enum bq27xxx_chip {
5         BQ27000 = 1, /* bq27000, bq27200 */
6         BQ27010, /* bq27010, bq27210 */
7         BQ2750X, /* bq27500 deprecated alias */
8         BQ2751X, /* bq27510, bq27520 deprecated alias */
9         BQ27500, /* bq27500/1 */
10         BQ27510G1, /* bq27510G1 */
11         BQ27510G2, /* bq27510G2 */
12         BQ27510G3, /* bq27510G3 */
13         BQ27520G1, /* bq27520G1 */
14         BQ27520G2, /* bq27520G2 */
15         BQ27520G3, /* bq27520G3 */
16         BQ27530, /* bq27530, bq27531 */
17         BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
18         BQ27545, /* bq27545 */
19         BQ27421, /* bq27421, bq27425, bq27441, bq27621 */
20 };
21
22 /**
23  * struct bq27xxx_plaform_data - Platform data for bq27xxx devices
24  * @name: Name of the battery.
25  * @chip: Chip class number of this device.
26  * @read: HDQ read callback.
27  *      This function should provide access to the HDQ bus the battery is
28  *      connected to.
29  *      The first parameter is a pointer to the battery device, the second the
30  *      register to be read. The return value should either be the content of
31  *      the passed register or an error value.
32  */
33 struct bq27xxx_platform_data {
34         const char *name;
35         enum bq27xxx_chip chip;
36         int (*read)(struct device *dev, unsigned int);
37 };
38
39 struct bq27xxx_device_info;
40 struct bq27xxx_access_methods {
41         int (*read)(struct bq27xxx_device_info *di, u8 reg, bool single);
42 };
43
44 struct bq27xxx_reg_cache {
45         int temperature;
46         int time_to_empty;
47         int time_to_empty_avg;
48         int time_to_full;
49         int charge_full;
50         int cycle_count;
51         int capacity;
52         int energy;
53         int flags;
54         int power_avg;
55         int health;
56 };
57
58 struct bq27xxx_device_info {
59         struct device *dev;
60         int id;
61         enum bq27xxx_chip chip;
62         const char *name;
63         struct bq27xxx_access_methods bus;
64         struct bq27xxx_reg_cache cache;
65         int charge_design_full;
66         unsigned long last_update;
67         struct delayed_work work;
68         struct power_supply *bat;
69         struct list_head list;
70         struct mutex lock;
71         u8 *regs;
72 };
73
74 void bq27xxx_battery_update(struct bq27xxx_device_info *di);
75 int bq27xxx_battery_setup(struct bq27xxx_device_info *di);
76 void bq27xxx_battery_teardown(struct bq27xxx_device_info *di);
77
78 #endif