Skip to content

Commit d6f5632

Browse files
committed
power: supply: sbs-battery: add POWER_SUPPLY_PROP_CAPACITY_ERROR_MARGIN support
Add support for reporting the MaxError register from battery fuel gauges following the smart battery standard. Reviewed-by: Emil Velikov <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
1 parent 0ff9691 commit d6f5632

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/power/supply/sbs-battery.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ enum {
2626
REG_TEMPERATURE,
2727
REG_VOLTAGE,
2828
REG_CURRENT,
29+
REG_MAX_ERR,
2930
REG_CAPACITY,
3031
REG_TIME_TO_EMPTY,
3132
REG_TIME_TO_FULL,
@@ -85,6 +86,8 @@ static const struct chip_data {
8586
SBS_DATA(POWER_SUPPLY_PROP_VOLTAGE_NOW, 0x09, 0, 20000),
8687
[REG_CURRENT] =
8788
SBS_DATA(POWER_SUPPLY_PROP_CURRENT_NOW, 0x0A, -32768, 32767),
89+
[REG_MAX_ERR] =
90+
SBS_DATA(POWER_SUPPLY_PROP_CAPACITY_ERROR_MARGIN, 0x0c, 0, 100),
8891
[REG_CAPACITY] =
8992
SBS_DATA(POWER_SUPPLY_PROP_CAPACITY, 0x0D, 0, 100),
9093
[REG_REMAINING_CAPACITY] =
@@ -132,6 +135,7 @@ static enum power_supply_property sbs_properties[] = {
132135
POWER_SUPPLY_PROP_VOLTAGE_NOW,
133136
POWER_SUPPLY_PROP_CURRENT_NOW,
134137
POWER_SUPPLY_PROP_CAPACITY,
138+
POWER_SUPPLY_PROP_CAPACITY_ERROR_MARGIN,
135139
POWER_SUPPLY_PROP_TEMP,
136140
POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG,
137141
POWER_SUPPLY_PROP_TIME_TO_FULL_AVG,
@@ -676,6 +680,7 @@ static int sbs_get_property(struct power_supply *psy,
676680
case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
677681
case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
678682
case POWER_SUPPLY_PROP_CAPACITY:
683+
case POWER_SUPPLY_PROP_CAPACITY_ERROR_MARGIN:
679684
ret = sbs_get_property_index(client, psp);
680685
if (ret < 0)
681686
break;

0 commit comments

Comments
 (0)