power: Add CHARGE_FULL function
authorWen Xie <xiewen3@motorola.com>
Fri, 1 Mar 2019 14:35:56 +0000 (22:35 +0800)
committerlingsen1 <lingsen1@lenovo.com>
Sun, 7 Feb 2021 09:36:58 +0000 (17:36 +0800)
Samsung patch:
Add CHARGE_FULL function.

From 6273ea9a561ac14306d2cd7c90d2dda6494f75dd Mon Sep 17 00:00:00 2001
From: Keunho Hwang <keunho.hwang@samsung.com>
Date: Fri, 1 Mar 2019 15:47:10 +0900
Subject: [PATCH] [Only-For-Test] driver: power: fix
 POWER_SUPPLY_PROP_CHARGE_FULL property

Signed-off-by: Keunho Hwang <keunho.hwang@samsung.com>
Change-Id: I8fa3c449faf95d2cd0560732f49190e215f216cb
Signed-off-by: Wen Xie <xiewen3@motorola.com>
Reviewed-on: https://gerrit.mot.com/1316280
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Wei Xu <xuwei9@lenovo.com>
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key

drivers/power/supply/s2mu00x_battery.c
drivers/power/supply/s2mu106_fuelgauge.c

index 0ecd3f3dc4548eb0ff35adcb493cf1463be65f7d..5daccea5970382de0eac2b3feefa6b78ce8b3a51 100644 (file)
@@ -950,7 +950,15 @@ static int s2mu00x_battery_get_property(struct power_supply *psy,
                val->intval = value.intval;
                break;
        case POWER_SUPPLY_PROP_CHARGE_FULL:
-               val->intval = 3500;
+               /*Get fuelgauge psy*/
+               psy = power_supply_get_by_name(battery->pdata->fuelgauge_name);
+               if (!psy)
+                       return -EINVAL;
+               ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_CHARGE_FULL, &value);
+               if (ret < 0)
+                       pr_err("%s: Fail to execute property\n", __func__);
+
+               val->intval = value.intval;
                break;
        case POWER_SUPPLY_PROP_CALIBRATE:
                val->intval = battery->is_factory;
index 455a89d939e250bd1b67b688ebfa64ea133a06c1..4aba762dec8e2523338a248988971fb30747b550 100755 (executable)
@@ -1295,7 +1295,8 @@ static int s2mu106_fg_get_property(struct power_supply *psy,
                val->intval = fuelgauge->rmc * 1000;
                break;
        case POWER_SUPPLY_PROP_CHARGE_FULL:
-               val->intval = fuelgauge->fcc;
+               /* Full charged capacity unit is uAh */
+               val->intval = fuelgauge->fcc * 1000;
                break;
        case POWER_SUPPLY_PROP_ENERGY_NOW:
                break;