aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew F. Davis <afd@ti.com>2018-04-21 19:12:49 -0400
committerSebastian Reichel <sre@kernel.org>2018-04-25 17:11:47 -0400
commit5ef6a16033b47afbc578c7ef8754da5ae7b198d7 (patch)
tree420924905d704dbd2518e2ed9880b5f8e57604b8
parent77142a611252de84ac533842438d19e7b2f494e7 (diff)
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>
-rw-r--r--Documentation/devicetree/bindings/power/supply/bq27xxx.txt1
-rw-r--r--drivers/power/supply/bq27xxx_battery.c9
-rw-r--r--drivers/power/supply/bq27xxx_battery_i2c.c2
-rw-r--r--include/linux/power/bq27xxx_battery.h3
4 files changed, 14 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/power/supply/bq27xxx.txt b/Documentation/devicetree/bindings/power/supply/bq27xxx.txt
index 615c1cb6889f..37994fdb18ca 100644
--- a/Documentation/devicetree/bindings/power/supply/bq27xxx.txt
+++ b/Documentation/devicetree/bindings/power/supply/bq27xxx.txt
@@ -25,6 +25,7 @@ Required properties:
25 * "ti,bq27545" - BQ27545 25 * "ti,bq27545" - BQ27545
26 * "ti,bq27421" - BQ27421 26 * "ti,bq27421" - BQ27421
27 * "ti,bq27425" - BQ27425 27 * "ti,bq27425" - BQ27425
28 * "ti,bq27426" - BQ27426
28 * "ti,bq27441" - BQ27441 29 * "ti,bq27441" - BQ27441
29 * "ti,bq27621" - BQ27621 30 * "ti,bq27621" - BQ27621
30- reg: integer, I2C address of the fuel gauge. 31- reg: integer, I2C address of the fuel gauge.
diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 7ce60519b1bc..d44ed8e17c47 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -432,6 +432,7 @@ static u8
432 BQ27XXX_DM_REG_ROWS, 432 BQ27XXX_DM_REG_ROWS,
433 }; 433 };
434#define bq27425_regs bq27421_regs 434#define bq27425_regs bq27421_regs
435#define bq27426_regs bq27421_regs
435#define bq27441_regs bq27421_regs 436#define bq27441_regs bq27421_regs
436#define bq27621_regs bq27421_regs 437#define bq27621_regs bq27421_regs
437 438
@@ -664,6 +665,7 @@ static enum power_supply_property bq27421_props[] = {
664 POWER_SUPPLY_PROP_MANUFACTURER, 665 POWER_SUPPLY_PROP_MANUFACTURER,
665}; 666};
666#define bq27425_props bq27421_props 667#define bq27425_props bq27421_props
668#define bq27426_props bq27421_props
667#define bq27441_props bq27421_props 669#define bq27441_props bq27421_props
668#define bq27621_props bq27421_props 670#define bq27621_props bq27421_props
669 671
@@ -734,6 +736,12 @@ static struct bq27xxx_dm_reg bq27425_dm_regs[] = {
734 [BQ27XXX_DM_TERMINATE_VOLTAGE] = { 82, 18, 2, 2800, 3700 }, 736 [BQ27XXX_DM_TERMINATE_VOLTAGE] = { 82, 18, 2, 2800, 3700 },
735}; 737};
736 738
739static 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
737#if 0 /* not yet tested */ 745#if 0 /* not yet tested */
738#define bq27441_dm_regs bq27421_dm_regs 746#define bq27441_dm_regs bq27421_dm_regs
739#else 747#else
@@ -795,6 +803,7 @@ static struct {
795 [BQ27545] = BQ27XXX_DATA(bq27545, 0x04143672, BQ27XXX_O_OTDC), 803 [BQ27545] = BQ27XXX_DATA(bq27545, 0x04143672, BQ27XXX_O_OTDC),
796 [BQ27421] = BQ27XXX_DATA(bq27421, 0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM), 804 [BQ27421] = BQ27XXX_DATA(bq27421, 0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM),
797 [BQ27425] = BQ27XXX_DATA(bq27425, 0x04143672, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP), 805 [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),
798 [BQ27441] = BQ27XXX_DATA(bq27441, 0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM), 807 [BQ27441] = BQ27XXX_DATA(bq27441, 0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM),
799 [BQ27621] = BQ27XXX_DATA(bq27621, 0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM), 808 [BQ27621] = BQ27XXX_DATA(bq27621, 0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM),
800}; 809};
diff --git a/drivers/power/supply/bq27xxx_battery_i2c.c b/drivers/power/supply/bq27xxx_battery_i2c.c
index 6b25e5f2337e..40069128ad44 100644
--- a/drivers/power/supply/bq27xxx_battery_i2c.c
+++ b/drivers/power/supply/bq27xxx_battery_i2c.c
@@ -249,6 +249,7 @@ static const struct i2c_device_id bq27xxx_i2c_id_table[] = {
249 { "bq27545", BQ27545 }, 249 { "bq27545", BQ27545 },
250 { "bq27421", BQ27421 }, 250 { "bq27421", BQ27421 },
251 { "bq27425", BQ27425 }, 251 { "bq27425", BQ27425 },
252 { "bq27426", BQ27426 },
252 { "bq27441", BQ27441 }, 253 { "bq27441", BQ27441 },
253 { "bq27621", BQ27621 }, 254 { "bq27621", BQ27621 },
254 {}, 255 {},
@@ -280,6 +281,7 @@ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
280 { .compatible = "ti,bq27545" }, 281 { .compatible = "ti,bq27545" },
281 { .compatible = "ti,bq27421" }, 282 { .compatible = "ti,bq27421" },
282 { .compatible = "ti,bq27425" }, 283 { .compatible = "ti,bq27425" },
284 { .compatible = "ti,bq27426" },
283 { .compatible = "ti,bq27441" }, 285 { .compatible = "ti,bq27441" },
284 { .compatible = "ti,bq27621" }, 286 { .compatible = "ti,bq27621" },
285 {}, 287 {},
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index 01fbf1b16258..d6355f49fbae 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -24,8 +24,9 @@ enum bq27xxx_chip {
24 BQ27546, 24 BQ27546,
25 BQ27742, 25 BQ27742,
26 BQ27545, /* bq27545 */ 26 BQ27545, /* bq27545 */
27 BQ27421, /* bq27421, bq27425, bq27441, bq27621 */ 27 BQ27421, /* bq27421, bq27441, bq27621 */
28 BQ27425, 28 BQ27425,
29 BQ27426,
29 BQ27441, 30 BQ27441,
30 BQ27621, 31 BQ27621,
31}; 32};