1#ifndef __LINUX_BQ27X00_BATTERY_H__
2#define __LINUX_BQ27X00_BATTERY_H__
3
4enum bq27xxx_chip {
5 BQ27000 = 1,
6 BQ27010,
7 BQ27500,
8 BQ27530,
9 BQ27541,
10 BQ27545,
11 BQ27421,
12};
13
14
15
16
17
18
19
20
21
22
23
24
25struct bq27xxx_platform_data {
26 const char *name;
27 enum bq27xxx_chip chip;
28 int (*read)(struct device *dev, unsigned int);
29};
30
31struct bq27xxx_device_info;
32struct bq27xxx_access_methods {
33 int (*read)(struct bq27xxx_device_info *di, u8 reg, bool single);
34};
35
36struct bq27xxx_reg_cache {
37 int temperature;
38 int time_to_empty;
39 int time_to_empty_avg;
40 int time_to_full;
41 int charge_full;
42 int cycle_count;
43 int capacity;
44 int energy;
45 int flags;
46 int power_avg;
47 int health;
48};
49
50struct bq27xxx_device_info {
51 struct device *dev;
52 int id;
53 enum bq27xxx_chip chip;
54 const char *name;
55 struct bq27xxx_access_methods bus;
56 struct bq27xxx_reg_cache cache;
57 int charge_design_full;
58 unsigned long last_update;
59 struct delayed_work work;
60 struct power_supply *bat;
61 struct list_head list;
62 struct mutex lock;
63 u8 *regs;
64};
65
66void bq27xxx_battery_update(struct bq27xxx_device_info *di);
67int bq27xxx_battery_setup(struct bq27xxx_device_info *di);
68void bq27xxx_battery_teardown(struct bq27xxx_device_info *di);
69
70#endif
71