Commit d6f56321 authored by Sebastian Reichel's avatar Sebastian Reichel Committed by Sebastian Reichel

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: default avatarEmil Velikov <emil.velikov@collabora.com>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
parent 0ff96915
...@@ -26,6 +26,7 @@ enum { ...@@ -26,6 +26,7 @@ enum {
REG_TEMPERATURE, REG_TEMPERATURE,
REG_VOLTAGE, REG_VOLTAGE,
REG_CURRENT, REG_CURRENT,
REG_MAX_ERR,
REG_CAPACITY, REG_CAPACITY,
REG_TIME_TO_EMPTY, REG_TIME_TO_EMPTY,
REG_TIME_TO_FULL, REG_TIME_TO_FULL,
...@@ -85,6 +86,8 @@ static const struct chip_data { ...@@ -85,6 +86,8 @@ static const struct chip_data {
SBS_DATA(POWER_SUPPLY_PROP_VOLTAGE_NOW, 0x09, 0, 20000), SBS_DATA(POWER_SUPPLY_PROP_VOLTAGE_NOW, 0x09, 0, 20000),
[REG_CURRENT] = [REG_CURRENT] =
SBS_DATA(POWER_SUPPLY_PROP_CURRENT_NOW, 0x0A, -32768, 32767), SBS_DATA(POWER_SUPPLY_PROP_CURRENT_NOW, 0x0A, -32768, 32767),
[REG_MAX_ERR] =
SBS_DATA(POWER_SUPPLY_PROP_CAPACITY_ERROR_MARGIN, 0x0c, 0, 100),
[REG_CAPACITY] = [REG_CAPACITY] =
SBS_DATA(POWER_SUPPLY_PROP_CAPACITY, 0x0D, 0, 100), SBS_DATA(POWER_SUPPLY_PROP_CAPACITY, 0x0D, 0, 100),
[REG_REMAINING_CAPACITY] = [REG_REMAINING_CAPACITY] =
...@@ -132,6 +135,7 @@ static enum power_supply_property sbs_properties[] = { ...@@ -132,6 +135,7 @@ static enum power_supply_property sbs_properties[] = {
POWER_SUPPLY_PROP_VOLTAGE_NOW, POWER_SUPPLY_PROP_VOLTAGE_NOW,
POWER_SUPPLY_PROP_CURRENT_NOW, POWER_SUPPLY_PROP_CURRENT_NOW,
POWER_SUPPLY_PROP_CAPACITY, POWER_SUPPLY_PROP_CAPACITY,
POWER_SUPPLY_PROP_CAPACITY_ERROR_MARGIN,
POWER_SUPPLY_PROP_TEMP, POWER_SUPPLY_PROP_TEMP,
POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG, POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG,
POWER_SUPPLY_PROP_TIME_TO_FULL_AVG, POWER_SUPPLY_PROP_TIME_TO_FULL_AVG,
...@@ -676,6 +680,7 @@ static int sbs_get_property(struct power_supply *psy, ...@@ -676,6 +680,7 @@ static int sbs_get_property(struct power_supply *psy,
case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN: case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
case POWER_SUPPLY_PROP_CAPACITY: case POWER_SUPPLY_PROP_CAPACITY:
case POWER_SUPPLY_PROP_CAPACITY_ERROR_MARGIN:
ret = sbs_get_property_index(client, psp); ret = sbs_get_property_index(client, psp);
if (ret < 0) if (ret < 0)
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment