aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/power/bq27xxx_battery.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/power/bq27xxx_battery.h')
-rw-r--r--include/linux/power/bq27xxx_battery.h57
1 files changed, 47 insertions, 10 deletions
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index 45f6a7b5b3cb..998d8f1c3c91 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -1,6 +1,16 @@
1#ifndef __LINUX_BQ27X00_BATTERY_H__ 1#ifndef __LINUX_BQ27X00_BATTERY_H__
2#define __LINUX_BQ27X00_BATTERY_H__ 2#define __LINUX_BQ27X00_BATTERY_H__
3 3
4enum bq27xxx_chip {
5 BQ27000 = 1, /* bq27000, bq27200 */
6 BQ27010, /* bq27010, bq27210 */
7 BQ27500, /* bq27500, bq27510, bq27520 */
8 BQ27530, /* bq27530, bq27531 */
9 BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
10 BQ27545, /* bq27545 */
11 BQ27421, /* bq27421, bq27425, bq27441, bq27621 */
12};
13
4/** 14/**
5 * struct bq27xxx_plaform_data - Platform data for bq27xxx devices 15 * struct bq27xxx_plaform_data - Platform data for bq27xxx devices
6 * @name: Name of the battery. 16 * @name: Name of the battery.
@@ -12,20 +22,47 @@
12 * register to be read. The return value should either be the content of 22 * register to be read. The return value should either be the content of
13 * the passed register or an error value. 23 * the passed register or an error value.
14 */ 24 */
15enum bq27xxx_chip {
16 BQ27000 = 1, /* bq27000, bq27200 */
17 BQ27010, /* bq27010, bq27210 */
18 BQ27500, /* bq27500, bq27510, bq27520 */
19 BQ27530, /* bq27530, bq27531 */
20 BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
21 BQ27545, /* bq27545 */
22 BQ27421, /* bq27421, bq27425, bq27441, bq27621 */
23};
24
25struct bq27xxx_platform_data { 25struct bq27xxx_platform_data {
26 const char *name; 26 const char *name;
27 enum bq27xxx_chip chip; 27 enum bq27xxx_chip chip;
28 int (*read)(struct device *dev, unsigned int); 28 int (*read)(struct device *dev, unsigned int);
29}; 29};
30 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 enum bq27xxx_chip chip;
53 const char *name;
54 struct bq27xxx_access_methods bus;
55 struct bq27xxx_reg_cache cache;
56 int charge_design_full;
57 unsigned long last_update;
58 struct delayed_work work;
59 struct power_supply *bat;
60 struct mutex lock;
61 u8 *regs;
62};
63
64void bq27xxx_battery_update(struct bq27xxx_device_info *di);
65int bq27xxx_battery_setup(struct bq27xxx_device_info *di);
66void bq27xxx_battery_teardown(struct bq27xxx_device_info *di);
67
31#endif 68#endif