summaryrefslogtreecommitdiff
path: root/drivers/power/supply/ab8500_bmdata.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2021-11-20 16:53:16 +0100
committerSebastian Reichel <sebastian.reichel@collabora.com>2021-11-22 17:16:25 +0100
commit22be8d77c80dca59af004d4595699b2092670499 (patch)
tree42122703f35be98d99af13e79714275bb9058b5d /drivers/power/supply/ab8500_bmdata.c
parente5dff305ab5c539320f1e30db44604e9977c3504 (diff)
power: supply: ab8500: Standardize design capacity
Now that we know that we have only one battery type to deal with we can proceed to transfer properties to struct power_supply_battery_info. The designed capacity for the battery was in a custom field of the custom battery type in mAh, transfer this to the standard charge_full_design_uah property in struct power_supply_battery_info and augment the code accordingly. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power/supply/ab8500_bmdata.c')
-rw-r--r--drivers/power/supply/ab8500_bmdata.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/power/supply/ab8500_bmdata.c b/drivers/power/supply/ab8500_bmdata.c
index 5db13b026d81..2d328d3007a9 100644
--- a/drivers/power/supply/ab8500_bmdata.c
+++ b/drivers/power/supply/ab8500_bmdata.c
@@ -85,7 +85,6 @@ static struct ab8500_battery_type bat_type_thermistor_unknown = {
.resis_high = 0,
.resis_low = 0,
.battery_resistance = 300,
- .charge_full_design = 612,
.nominal_voltage = 3700,
.termination_vol = 4050,
.termination_curr = 200,
@@ -189,6 +188,10 @@ int ab8500_bm_of_probe(struct power_supply *psy,
return ret;
}
+ /* Fill in defaults for any data missing from the device tree */
+ if (bi->charge_full_design_uah < 0)
+ /* The default capacity is 612 mAh for unknown batteries */
+ bi->charge_full_design_uah = 612000;
if (bi->temp_min == INT_MIN)
bi->temp_min = AB8500_TEMP_UNDER;
if (bi->temp_max == INT_MAX)