2010-05-25 01:55:27 +08:00
|
|
|
#ifndef __LINUX_BQ27X00_BATTERY_H__
|
|
|
|
#define __LINUX_BQ27X00_BATTERY_H__
|
|
|
|
|
2015-11-24 00:53:51 +08:00
|
|
|
enum bq27xxx_chip {
|
|
|
|
BQ27000 = 1, /* bq27000, bq27200 */
|
|
|
|
BQ27010, /* bq27010, bq27210 */
|
2017-01-11 09:44:38 +08:00
|
|
|
BQ2750X, /* bq27500 deprecated alias */
|
2017-01-11 09:44:39 +08:00
|
|
|
BQ2751X, /* bq27510, bq27520 deprecated alias */
|
power: supply: bq27xxx: Add chip IDs for previously shadowed chips
For the existing features, these chips act like others already ID'd,
so they had false but functional IDs. We will be adding features
which require correct IDs, so the following IDs are added:
BQ2752X, 531, 542, 546, 742, 425, 441, 621
Chip-specific features are now tracked by BQ27XXX_O_* flags in di->opts.
No functional changes to the driver.
Signed-off-by: Liam Breck <kernel@networkimprov.net>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2017-08-24 11:36:14 +08:00
|
|
|
BQ2752X,
|
2017-01-11 09:44:40 +08:00
|
|
|
BQ27500, /* bq27500/1 */
|
2017-01-11 09:44:41 +08:00
|
|
|
BQ27510G1, /* bq27510G1 */
|
2017-01-11 09:44:42 +08:00
|
|
|
BQ27510G2, /* bq27510G2 */
|
2017-01-11 09:44:43 +08:00
|
|
|
BQ27510G3, /* bq27510G3 */
|
2017-01-11 09:44:44 +08:00
|
|
|
BQ27520G1, /* bq27520G1 */
|
2017-01-11 09:44:45 +08:00
|
|
|
BQ27520G2, /* bq27520G2 */
|
2017-01-11 09:44:46 +08:00
|
|
|
BQ27520G3, /* bq27520G3 */
|
2017-01-11 09:44:47 +08:00
|
|
|
BQ27520G4, /* bq27520G4 */
|
2015-11-24 00:53:51 +08:00
|
|
|
BQ27530, /* bq27530, bq27531 */
|
power: supply: bq27xxx: Add chip IDs for previously shadowed chips
For the existing features, these chips act like others already ID'd,
so they had false but functional IDs. We will be adding features
which require correct IDs, so the following IDs are added:
BQ2752X, 531, 542, 546, 742, 425, 441, 621
Chip-specific features are now tracked by BQ27XXX_O_* flags in di->opts.
No functional changes to the driver.
Signed-off-by: Liam Breck <kernel@networkimprov.net>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2017-08-24 11:36:14 +08:00
|
|
|
BQ27531,
|
2015-11-24 00:53:51 +08:00
|
|
|
BQ27541, /* bq27541, bq27542, bq27546, bq27742 */
|
power: supply: bq27xxx: Add chip IDs for previously shadowed chips
For the existing features, these chips act like others already ID'd,
so they had false but functional IDs. We will be adding features
which require correct IDs, so the following IDs are added:
BQ2752X, 531, 542, 546, 742, 425, 441, 621
Chip-specific features are now tracked by BQ27XXX_O_* flags in di->opts.
No functional changes to the driver.
Signed-off-by: Liam Breck <kernel@networkimprov.net>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2017-08-24 11:36:14 +08:00
|
|
|
BQ27542,
|
|
|
|
BQ27546,
|
|
|
|
BQ27742,
|
2015-11-24 00:53:51 +08:00
|
|
|
BQ27545, /* bq27545 */
|
|
|
|
BQ27421, /* bq27421, bq27425, bq27441, bq27621 */
|
power: supply: bq27xxx: Add chip IDs for previously shadowed chips
For the existing features, these chips act like others already ID'd,
so they had false but functional IDs. We will be adding features
which require correct IDs, so the following IDs are added:
BQ2752X, 531, 542, 546, 742, 425, 441, 621
Chip-specific features are now tracked by BQ27XXX_O_* flags in di->opts.
No functional changes to the driver.
Signed-off-by: Liam Breck <kernel@networkimprov.net>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2017-08-24 11:36:14 +08:00
|
|
|
BQ27425,
|
|
|
|
BQ27441,
|
|
|
|
BQ27621,
|
2015-11-24 00:53:51 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct bq27xxx_device_info;
|
|
|
|
struct bq27xxx_access_methods {
|
|
|
|
int (*read)(struct bq27xxx_device_info *di, u8 reg, bool single);
|
2017-06-08 02:37:54 +08:00
|
|
|
int (*write)(struct bq27xxx_device_info *di, u8 reg, int value, bool single);
|
|
|
|
int (*read_bulk)(struct bq27xxx_device_info *di, u8 reg, u8 *data, int len);
|
|
|
|
int (*write_bulk)(struct bq27xxx_device_info *di, u8 reg, u8 *data, int len);
|
2015-11-24 00:53:51 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct bq27xxx_reg_cache {
|
|
|
|
int temperature;
|
|
|
|
int time_to_empty;
|
|
|
|
int time_to_empty_avg;
|
|
|
|
int time_to_full;
|
|
|
|
int charge_full;
|
|
|
|
int cycle_count;
|
|
|
|
int capacity;
|
|
|
|
int energy;
|
|
|
|
int flags;
|
|
|
|
int power_avg;
|
|
|
|
int health;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct bq27xxx_device_info {
|
|
|
|
struct device *dev;
|
2016-02-02 20:47:37 +08:00
|
|
|
int id;
|
2015-11-24 00:53:51 +08:00
|
|
|
enum bq27xxx_chip chip;
|
power: supply: bq27xxx: Add chip IDs for previously shadowed chips
For the existing features, these chips act like others already ID'd,
so they had false but functional IDs. We will be adding features
which require correct IDs, so the following IDs are added:
BQ2752X, 531, 542, 546, 742, 425, 441, 621
Chip-specific features are now tracked by BQ27XXX_O_* flags in di->opts.
No functional changes to the driver.
Signed-off-by: Liam Breck <kernel@networkimprov.net>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2017-08-24 11:36:14 +08:00
|
|
|
u32 opts;
|
2015-11-24 00:53:51 +08:00
|
|
|
const char *name;
|
2017-06-08 02:37:56 +08:00
|
|
|
struct bq27xxx_dm_reg *dm_regs;
|
2017-06-08 02:37:55 +08:00
|
|
|
u32 unseal_key;
|
2015-11-24 00:53:51 +08:00
|
|
|
struct bq27xxx_access_methods bus;
|
|
|
|
struct bq27xxx_reg_cache cache;
|
|
|
|
int charge_design_full;
|
|
|
|
unsigned long last_update;
|
|
|
|
struct delayed_work work;
|
|
|
|
struct power_supply *bat;
|
2016-09-20 11:43:02 +08:00
|
|
|
struct list_head list;
|
2015-11-24 00:53:51 +08:00
|
|
|
struct mutex lock;
|
|
|
|
u8 *regs;
|
|
|
|
};
|
|
|
|
|
|
|
|
void bq27xxx_battery_update(struct bq27xxx_device_info *di);
|
|
|
|
int bq27xxx_battery_setup(struct bq27xxx_device_info *di);
|
|
|
|
void bq27xxx_battery_teardown(struct bq27xxx_device_info *di);
|
|
|
|
|
2010-05-25 01:55:27 +08:00
|
|
|
#endif
|