]> asedeno.scripts.mit.edu Git - linux.git/blob - include/linux/power/bq27xxx_battery.h
power: supply: bq27xxx: adds specific support for bq27510-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         BQ27530, /* bq27530, bq27531 */
14         BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
15         BQ27545, /* bq27545 */
16         BQ27421, /* bq27421, bq27425, bq27441, bq27621 */
17 };
18
19 /**
20  * struct bq27xxx_plaform_data - Platform data for bq27xxx devices
21  * @name: Name of the battery.
22  * @chip: Chip class number of this device.
23  * @read: HDQ read callback.
24  *      This function should provide access to the HDQ bus the battery is
25  *      connected to.
26  *      The first parameter is a pointer to the battery device, the second the
27  *      register to be read. The return value should either be the content of
28  *      the passed register or an error value.
29  */
30 struct bq27xxx_platform_data {
31         const char *name;
32         enum bq27xxx_chip chip;
33         int (*read)(struct device *dev, unsigned int);
34 };
35
36 struct bq27xxx_device_info;
37 struct bq27xxx_access_methods {
38         int (*read)(struct bq27xxx_device_info *di, u8 reg, bool single);
39 };
40
41 struct bq27xxx_reg_cache {
42         int temperature;
43         int time_to_empty;
44         int time_to_empty_avg;
45         int time_to_full;
46         int charge_full;
47         int cycle_count;
48         int capacity;
49         int energy;
50         int flags;
51         int power_avg;
52         int health;
53 };
54
55 struct bq27xxx_device_info {
56         struct device *dev;
57         int id;
58         enum bq27xxx_chip chip;
59         const char *name;
60         struct bq27xxx_access_methods bus;
61         struct bq27xxx_reg_cache cache;
62         int charge_design_full;
63         unsigned long last_update;
64         struct delayed_work work;
65         struct power_supply *bat;
66         struct list_head list;
67         struct mutex lock;
68         u8 *regs;
69 };
70
71 void bq27xxx_battery_update(struct bq27xxx_device_info *di);
72 int bq27xxx_battery_setup(struct bq27xxx_device_info *di);
73 void bq27xxx_battery_teardown(struct bq27xxx_device_info *di);
74
75 #endif