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 up to
100 times as high 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 100 times
too high leading to the consumed power of
AGGREGATE_BATTERY_CONSUMER_SCOPE_DEVICE becoming very high
so that the relative consumption of all consumers got very
low. Due to [4] AOSP does not show consumers with less than
0.5% consumption so that the section was always empty.

[1]: d42ec4c0e5/services/core/java/com/android/server/BatteryService.java (L579)
[2]: d42ec4c0e5/services/core/java/com/android/server/am/BatteryStatsService.java (L2079)
[3]: 9f08c607f8
[4]: 36c727a1d0/src/com/android/settings/fuelgauge/BatteryAppListPreferenceController.java (L228)

Change-Id: I64dff6478588d991971b60bad61652f5c9f581b0
This commit is contained in:
Arian 2022-09-25 02:20:21 +02:00 committed by Giovanni Ricca
parent a2ac6b286d
commit b8944e288a
No known key found for this signature in database

View File

@ -1129,6 +1129,9 @@ static int battery_psy_get_prop(struct power_supply *psy,
case POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX: case POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX:
pval->intval = bcdev->num_thermal_levels; pval->intval = bcdev->num_thermal_levels;
break; break;
case POWER_SUPPLY_PROP_CHARGE_COUNTER:
pval->intval = DIV_ROUND_CLOSEST(pst->prop[prop_id], 100);
break;
default: default:
pval->intval = pst->prop[prop_id]; pval->intval = pst->prop[prop_id];
break; break;