power: supply: qti_battery_charger: Return charge counter in uAh

Previously the charge counter was not reported in uAh while the
charge full capacity was. The charge counter used to go down to
1000 times as low as the max battery capacity is in uAh.
Frameworks use this property to set the battery state and
expects it to be in uAh. Refer to [1] and [2].

Since commit "Use getUahDischarge when available" [3] AOSP
uses the getUahDischarge method to determine the amount of
discharge. Without this patch the value used to be 1000 times
too low leading to the consumed power of
AGGREGATE_BATTERY_CONSUMER_SCOPE_DEVICE becoming very low
so that the relative consumption of all consumers got very
high.

[1]: d42ec4c0e5/services/core/java/com/android/server/BatteryService.java (L579)
[2]: d42ec4c0e5/services/core/java/com/android/server/am/BatteryStatsService.java (L2079)
[3]: LineageOS/android_frameworks_base@9f08c60

Change-Id: I64dff6478588d991971b60bad61652f5c9f581b0
This commit is contained in:
ArianK16a 2023-07-15 21:00:25 +01:00 committed by Jens Reidel
parent 3bbe08972e
commit 956e37ba3b
No known key found for this signature in database
GPG Key ID: 23C1E5F512C12303

View File

@ -1361,6 +1361,9 @@ static int battery_psy_get_prop(struct power_supply *psy,
bcdev->report_power_absent)
pval->intval = POWER_SUPPLY_STATUS_DISCHARGING;
break;
case POWER_SUPPLY_PROP_CHARGE_COUNTER:
pval->intval = pst->prop[prop_id] * 1000;
break;
default:
pval->intval = pst->prop[prop_id];
break;