Skip to content

Commit 5ef6a16

Browse files
glneosre
authored andcommitted
power: supply: bq27xxx: Add support for BQ27426
This device is software similar to the BQ27426 except it has different data memory offsets. Add support here. Signed-off-by: Andrew F. Davis <afd@ti.com> Acked-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
1 parent 77142a6 commit 5ef6a16

4 files changed

Lines changed: 14 additions & 1 deletion

File tree

‎Documentation/devicetree/bindings/power/supply/bq27xxx.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Required properties:
2525
* "ti,bq27545" - BQ27545
2626
* "ti,bq27421" - BQ27421
2727
* "ti,bq27425" - BQ27425
28+
* "ti,bq27426" - BQ27426
2829
* "ti,bq27441" - BQ27441
2930
* "ti,bq27621" - BQ27621
3031
- reg: integer, I2C address of the fuel gauge.

‎drivers/power/supply/bq27xxx_battery.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ static u8
432432
BQ27XXX_DM_REG_ROWS,
433433
};
434434
#define bq27425_regs bq27421_regs
435+
#define bq27426_regs bq27421_regs
435436
#define bq27441_regs bq27421_regs
436437
#define bq27621_regs bq27421_regs
437438

@@ -664,6 +665,7 @@ static enum power_supply_property bq27421_props[] = {
664665
POWER_SUPPLY_PROP_MANUFACTURER,
665666
};
666667
#define bq27425_props bq27421_props
668+
#define bq27426_props bq27421_props
667669
#define bq27441_props bq27421_props
668670
#define bq27621_props bq27421_props
669671

@@ -734,6 +736,12 @@ static struct bq27xxx_dm_reg bq27425_dm_regs[] = {
734736
[BQ27XXX_DM_TERMINATE_VOLTAGE] = { 82, 18, 2, 2800, 3700 },
735737
};
736738

739+
static struct bq27xxx_dm_reg bq27426_dm_regs[] = {
740+
[BQ27XXX_DM_DESIGN_CAPACITY] = { 82, 6, 2, 0, 8000 },
741+
[BQ27XXX_DM_DESIGN_ENERGY] = { 82, 8, 2, 0, 32767 },
742+
[BQ27XXX_DM_TERMINATE_VOLTAGE] = { 82, 10, 2, 2500, 3700 },
743+
};
744+
737745
#if 0 /* not yet tested */
738746
#define bq27441_dm_regs bq27421_dm_regs
739747
#else
@@ -795,6 +803,7 @@ static struct {
795803
[BQ27545] = BQ27XXX_DATA(bq27545, 0x04143672, BQ27XXX_O_OTDC),
796804
[BQ27421] = BQ27XXX_DATA(bq27421, 0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM),
797805
[BQ27425] = BQ27XXX_DATA(bq27425, 0x04143672, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP),
806+
[BQ27426] = BQ27XXX_DATA(bq27426, 0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM),
798807
[BQ27441] = BQ27XXX_DATA(bq27441, 0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM),
799808
[BQ27621] = BQ27XXX_DATA(bq27621, 0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM),
800809
};

‎drivers/power/supply/bq27xxx_battery_i2c.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
249249
{ "bq27545", BQ27545 },
250250
{ "bq27421", BQ27421 },
251251
{ "bq27425", BQ27425 },
252+
{ "bq27426", BQ27426 },
252253
{ "bq27441", BQ27441 },
253254
{ "bq27621", BQ27621 },
254255
{},
@@ -280,6 +281,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
280281
{ .compatible = "ti,bq27545" },
281282
{ .compatible = "ti,bq27421" },
282283
{ .compatible = "ti,bq27425" },
284+
{ .compatible = "ti,bq27426" },
283285
{ .compatible = "ti,bq27441" },
284286
{ .compatible = "ti,bq27621" },
285287
{},

‎include/linux/power/bq27xxx_battery.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ enum bq27xxx_chip {
2424
BQ27546,
2525
BQ27742,
2626
BQ27545, /* bq27545 */
27-
BQ27421, /* bq27421, bq27425, bq27441, bq27621 */
27+
BQ27421, /* bq27421, bq27441, bq27621 */
2828
BQ27425,
29+
BQ27426,
2930
BQ27441,
3031
BQ27621,
3132
};

0 commit comments

Comments
 (0)