Skip to content

Commit 707d678

Browse files
Dan Murphysre
authored andcommitted
power: supply: bq27xxx_battery: Add the BQ28z610 Battery monitor
Add the Texas Instruments BQ28z610 battery monitor. The register address map is laid out the same as compared to other devices within the file. The battery status register bits are similar to the bq27z561 but they are different compared to other fuel gauge devices within this file. Signed-off-by: Dan Murphy <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
1 parent 0827425 commit 707d678

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

drivers/power/supply/bq27xxx_battery.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
* https://www.ti.com/product/bq27441-g1
4545
* https://www.ti.com/product/bq27621-g1
4646
* https://www.ti.com/product/bq27z561
47+
* https://www.ti.com/product/bq28z610
4748
*/
4849

4950
#include <linux/device.h>
@@ -462,6 +463,26 @@ static u8
462463
[BQ27XXX_REG_DCAP] = 0x3c,
463464
[BQ27XXX_REG_AP] = 0x22,
464465
BQ27XXX_DM_REG_ROWS,
466+
},
467+
bq28z610_regs[BQ27XXX_REG_MAX] = {
468+
[BQ27XXX_REG_CTRL] = 0x00,
469+
[BQ27XXX_REG_TEMP] = 0x06,
470+
[BQ27XXX_REG_INT_TEMP] = INVALID_REG_ADDR,
471+
[BQ27XXX_REG_VOLT] = 0x08,
472+
[BQ27XXX_REG_AI] = 0x14,
473+
[BQ27XXX_REG_FLAGS] = 0x0a,
474+
[BQ27XXX_REG_TTE] = 0x16,
475+
[BQ27XXX_REG_TTF] = 0x18,
476+
[BQ27XXX_REG_TTES] = INVALID_REG_ADDR,
477+
[BQ27XXX_REG_TTECP] = INVALID_REG_ADDR,
478+
[BQ27XXX_REG_NAC] = INVALID_REG_ADDR,
479+
[BQ27XXX_REG_FCC] = 0x12,
480+
[BQ27XXX_REG_CYCT] = 0x2a,
481+
[BQ27XXX_REG_AE] = 0x22,
482+
[BQ27XXX_REG_SOC] = 0x2c,
483+
[BQ27XXX_REG_DCAP] = 0x3c,
484+
[BQ27XXX_REG_AP] = 0x22,
485+
BQ27XXX_DM_REG_ROWS,
465486
};
466487

467488
static enum power_supply_property bq27000_props[] = {
@@ -717,6 +738,25 @@ static enum power_supply_property bq27z561_props[] = {
717738
POWER_SUPPLY_PROP_MANUFACTURER,
718739
};
719740

741+
static enum power_supply_property bq28z610_props[] = {
742+
POWER_SUPPLY_PROP_STATUS,
743+
POWER_SUPPLY_PROP_PRESENT,
744+
POWER_SUPPLY_PROP_VOLTAGE_NOW,
745+
POWER_SUPPLY_PROP_CURRENT_NOW,
746+
POWER_SUPPLY_PROP_CAPACITY,
747+
POWER_SUPPLY_PROP_CAPACITY_LEVEL,
748+
POWER_SUPPLY_PROP_TEMP,
749+
POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
750+
POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
751+
POWER_SUPPLY_PROP_TECHNOLOGY,
752+
POWER_SUPPLY_PROP_CHARGE_FULL,
753+
POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
754+
POWER_SUPPLY_PROP_CYCLE_COUNT,
755+
POWER_SUPPLY_PROP_POWER_AVG,
756+
POWER_SUPPLY_PROP_HEALTH,
757+
POWER_SUPPLY_PROP_MANUFACTURER,
758+
};
759+
720760
struct bq27xxx_dm_reg {
721761
u8 subclass_id;
722762
u8 offset;
@@ -813,6 +853,7 @@ static struct bq27xxx_dm_reg bq27621_dm_regs[] = {
813853
#endif
814854

815855
#define bq27z561_dm_regs 0
856+
#define bq28z610_dm_regs 0
816857

817858
#define BQ27XXX_O_ZERO 0x00000001
818859
#define BQ27XXX_O_OTDC 0x00000002 /* has OTC/OTD overtemperature flags */
@@ -865,6 +906,7 @@ static struct {
865906
[BQ27441] = BQ27XXX_DATA(bq27441, 0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM),
866907
[BQ27621] = BQ27XXX_DATA(bq27621, 0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM),
867908
[BQ27Z561] = BQ27XXX_DATA(bq27z561, 0 , BQ27Z561_O_BITS),
909+
[BQ28Z610] = BQ27XXX_DATA(bq28z610, 0 , BQ27Z561_O_BITS),
868910
};
869911

870912
static DEFINE_MUTEX(bq27xxx_list_lock);

drivers/power/supply/bq27xxx_battery_i2c.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
254254
{ "bq27441", BQ27441 },
255255
{ "bq27621", BQ27621 },
256256
{ "bq27z561", BQ27Z561 },
257+
{ "bq28z610", BQ28Z610 },
257258
{},
258259
};
259260
MODULE_DEVICE_TABLE(i2c, bq27xxx_i2c_id_table);
@@ -288,6 +289,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
288289
{ .compatible = "ti,bq27441" },
289290
{ .compatible = "ti,bq27621" },
290291
{ .compatible = "ti,bq27z561" },
292+
{ .compatible = "ti,bq28z610" },
291293
{},
292294
};
293295
MODULE_DEVICE_TABLE(of, bq27xxx_battery_i2c_of_match_table);

include/linux/power/bq27xxx_battery.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ enum bq27xxx_chip {
3131
BQ27441,
3232
BQ27621,
3333
BQ27Z561,
34+
BQ28Z610,
3435
};
3536

3637
struct bq27xxx_device_info;

0 commit comments

Comments
 (0)