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