Skip to content

Commit 0ff9691

Browse files
committed
power: supply: sbs-battery: Add TI BQ20Z65 support
Add support for BQ20Z65 manufacturer data to the sbs-battery driver. Implementation has been verified using the public TRM available from [0] and tested using a GE Flex 3S2P battery. [0] http://www.ti.com/lit/pdf/sluu386 Acked-by: Rob Herring <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
1 parent 601c2a5 commit 0ff9691

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

Documentation/devicetree/bindings/power/supply/sbs_sbs-battery.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Required properties :
66
part number compatible string might be used in order to take care of
77
vendor specific registers.
88
Known <vendor>,<part-number>:
9+
ti,bq20z65
910
ti,bq20z75
1011

1112
Optional properties :

drivers/power/supply/sbs-battery.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ static enum power_supply_property sbs_properties[] = {
149149
POWER_SUPPLY_PROP_MODEL_NAME
150150
};
151151

152-
/* Supports special manufacturer commands from TI BQ20Z75 IC. */
153-
#define SBS_FLAGS_TI_BQ20Z75 BIT(0)
152+
/* Supports special manufacturer commands from TI BQ20Z65 and BQ20Z75 IC. */
153+
#define SBS_FLAGS_TI_BQ20ZX5 BIT(0)
154154

155155
struct sbs_info {
156156
struct i2c_client *client;
@@ -626,7 +626,7 @@ static int sbs_get_property(struct power_supply *psy,
626626
switch (psp) {
627627
case POWER_SUPPLY_PROP_PRESENT:
628628
case POWER_SUPPLY_PROP_HEALTH:
629-
if (chip->flags & SBS_FLAGS_TI_BQ20Z75)
629+
if (chip->flags & SBS_FLAGS_TI_BQ20ZX5)
630630
ret = sbs_get_ti_battery_presence_and_health(client,
631631
psp, val);
632632
else
@@ -950,7 +950,7 @@ static int sbs_suspend(struct device *dev)
950950
if (chip->poll_time > 0)
951951
cancel_delayed_work_sync(&chip->work);
952952

953-
if (chip->flags & SBS_FLAGS_TI_BQ20Z75) {
953+
if (chip->flags & SBS_FLAGS_TI_BQ20ZX5) {
954954
/* Write to manufacturer access with sleep command. */
955955
ret = sbs_write_word_data(client,
956956
sbs_data[REG_MANUFACTURER_DATA].addr,
@@ -970,6 +970,7 @@ static SIMPLE_DEV_PM_OPS(sbs_pm_ops, sbs_suspend, NULL);
970970
#endif
971971

972972
static const struct i2c_device_id sbs_id[] = {
973+
{ "bq20z65", 0 },
973974
{ "bq20z75", 0 },
974975
{ "sbs-battery", 1 },
975976
{}
@@ -978,9 +979,13 @@ MODULE_DEVICE_TABLE(i2c, sbs_id);
978979

979980
static const struct of_device_id sbs_dt_ids[] = {
980981
{ .compatible = "sbs,sbs-battery" },
982+
{
983+
.compatible = "ti,bq20z65",
984+
.data = (void *)SBS_FLAGS_TI_BQ20ZX5,
985+
},
981986
{
982987
.compatible = "ti,bq20z75",
983-
.data = (void *)SBS_FLAGS_TI_BQ20Z75,
988+
.data = (void *)SBS_FLAGS_TI_BQ20ZX5,
984989
},
985990
{ }
986991
};

0 commit comments

Comments
 (0)