diff options
author | Hans de Goede <hdegoede@redhat.com> | 2017-04-14 14:32:56 -0400 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2017-05-01 06:37:49 -0400 |
commit | 2e015412a320e49aab4beaeb6262e93fdc0a42f2 (patch) | |
tree | e2320b0bc2d4819617e703ec7dbd1a8fac009506 | |
parent | d7d15fc67791c0e255f36345d02441c1716c2a1f (diff) |
power: supply: max17042_battery: Add support for the CHARGE_FULL_DESIGN property
The info is there, lets export it as a property.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
-rw-r--r-- | drivers/power/supply/max17042_battery.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c index 37e987f55833..3838f09e013c 100644 --- a/drivers/power/supply/max17042_battery.c +++ b/drivers/power/supply/max17042_battery.c | |||
@@ -87,6 +87,7 @@ static enum power_supply_property max17042_battery_props[] = { | |||
87 | POWER_SUPPLY_PROP_VOLTAGE_AVG, | 87 | POWER_SUPPLY_PROP_VOLTAGE_AVG, |
88 | POWER_SUPPLY_PROP_VOLTAGE_OCV, | 88 | POWER_SUPPLY_PROP_VOLTAGE_OCV, |
89 | POWER_SUPPLY_PROP_CAPACITY, | 89 | POWER_SUPPLY_PROP_CAPACITY, |
90 | POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, | ||
90 | POWER_SUPPLY_PROP_CHARGE_FULL, | 91 | POWER_SUPPLY_PROP_CHARGE_FULL, |
91 | POWER_SUPPLY_PROP_CHARGE_COUNTER, | 92 | POWER_SUPPLY_PROP_CHARGE_COUNTER, |
92 | POWER_SUPPLY_PROP_TEMP, | 93 | POWER_SUPPLY_PROP_TEMP, |
@@ -305,6 +306,15 @@ static int max17042_get_property(struct power_supply *psy, | |||
305 | 306 | ||
306 | val->intval = data >> 8; | 307 | val->intval = data >> 8; |
307 | break; | 308 | break; |
309 | case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: | ||
310 | ret = regmap_read(map, MAX17042_DesignCap, &data); | ||
311 | if (ret < 0) | ||
312 | return ret; | ||
313 | |||
314 | data64 = data * 5000000ll; | ||
315 | do_div(data64, chip->pdata->r_sns); | ||
316 | val->intval = data64; | ||
317 | break; | ||
308 | case POWER_SUPPLY_PROP_CHARGE_FULL: | 318 | case POWER_SUPPLY_PROP_CHARGE_FULL: |
309 | ret = regmap_read(map, MAX17042_FullCAP, &data); | 319 | ret = regmap_read(map, MAX17042_FullCAP, &data); |
310 | if (ret < 0) | 320 | if (ret < 0) |