summaryrefslogtreecommitdiff
path: root/drivers/power/supply/ab8500_fg.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2021-11-20 18:53:16 +0300
committerSebastian Reichel <sebastian.reichel@collabora.com>2021-11-22 19:16:25 +0300
commit22be8d77c80dca59af004d4595699b2092670499 (patch)
tree42122703f35be98d99af13e79714275bb9058b5d /drivers/power/supply/ab8500_fg.c
parente5dff305ab5c539320f1e30db44604e9977c3504 (diff)
downloadlinux-22be8d77c80dca59af004d4595699b2092670499.tar.xz
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_fg.c')
-rw-r--r--drivers/power/supply/ab8500_fg.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c
index 2013db0118ee..4f8b3a76c565 100644
--- a/drivers/power/supply/ab8500_fg.c
+++ b/drivers/power/supply/ab8500_fg.c
@@ -38,7 +38,6 @@
#include "ab8500-bm.h"
-#define MILLI_TO_MICRO 1000
#define FG_LSB_IN_MA 1627
#define QLSB_NANO_AMP_HOURS_X10 1071
#define INS_CURR_TIMEOUT (3 * HZ)
@@ -2243,8 +2242,7 @@ static int ab8500_fg_get_ext_psy_data(struct device *dev, void *data)
di->flags.batt_id_received = true;
di->bat_cap.max_mah_design =
- MILLI_TO_MICRO *
- b->charge_full_design;
+ di->bm->bi.charge_full_design_uah;
di->bat_cap.max_mah =
di->bat_cap.max_mah_design;
@@ -3078,9 +3076,7 @@ static int ab8500_fg_probe(struct platform_device *pdev)
psy_cfg.num_supplicants = ARRAY_SIZE(supply_interface);
psy_cfg.drv_data = di;
- di->bat_cap.max_mah_design = MILLI_TO_MICRO *
- di->bm->bat_type->charge_full_design;
-
+ di->bat_cap.max_mah_design = di->bm->bi.charge_full_design_uah;
di->bat_cap.max_mah = di->bat_cap.max_mah_design;
di->vbat_nom = di->bm->bat_type->nominal_voltage;