mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-15 01:01:56 -04:00
Revert "(CR): Ensuring monotonic variation of soc"
Revert: This reverts commit daaaf64b38c53308fba2615213bacc64bcdb8bd0. Change-Id: I8e75ac6d8753f68c0fb542df3b307f9ad77fed82 Reviewed-on: https://gerrit.mot.com/2586578 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Wentao Xu <xuwt2@motorola.com> Reviewed-by: Guobin Zhang <zhanggb@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
450bdaa547
commit
a8cb200aab
1 changed files with 21 additions and 30 deletions
|
|
@ -1813,6 +1813,27 @@ static int mmi_get_battery_health(struct mmi_charger *charger)
|
|||
return batt_health;
|
||||
}
|
||||
|
||||
static int mmi_combine_battery_soc(struct mmi_charger_chip *chip)
|
||||
{
|
||||
int soc = 0;
|
||||
int remain = 0, full = 0;
|
||||
struct mmi_battery_pack *battery = NULL;
|
||||
|
||||
list_for_each_entry(battery, &chip->battery_list, list) {
|
||||
remain += battery->info->batt_soc * battery->info->batt_full_uah;
|
||||
full += battery->info->batt_full_uah;
|
||||
}
|
||||
|
||||
if (full > 0 && remain >= 0) {
|
||||
soc = remain / full;
|
||||
if (soc > 100)
|
||||
soc = 100;
|
||||
} else
|
||||
soc = -1;
|
||||
|
||||
return soc;
|
||||
}
|
||||
|
||||
static int mmi_combine_battery_status(struct mmi_charger_chip *chip)
|
||||
{
|
||||
int status = POWER_SUPPLY_STATUS_UNKNOWN;
|
||||
|
|
@ -1839,36 +1860,6 @@ static int mmi_combine_battery_status(struct mmi_charger_chip *chip)
|
|||
return status;
|
||||
}
|
||||
|
||||
static int mmi_combine_battery_soc(struct mmi_charger_chip *chip)
|
||||
{
|
||||
int status;
|
||||
static int soc = 0;
|
||||
int soc_curr = 0;
|
||||
int remain = 0, full = 0;
|
||||
struct mmi_battery_pack *battery = NULL;
|
||||
|
||||
list_for_each_entry(battery, &chip->battery_list, list) {
|
||||
remain += battery->info->batt_soc * battery->info->batt_full_uah;
|
||||
full += battery->info->batt_full_uah;
|
||||
}
|
||||
|
||||
if (full > 0 && remain >= 0) {
|
||||
soc_curr = remain / full;
|
||||
status = mmi_combine_battery_status(chip);
|
||||
if ((soc <= 0) ||
|
||||
((status == POWER_SUPPLY_STATUS_CHARGING) && (soc_curr > soc)) ||
|
||||
((status != POWER_SUPPLY_STATUS_CHARGING) && (soc_curr < soc))) {
|
||||
soc = soc_curr;
|
||||
}
|
||||
|
||||
if (soc > 100)
|
||||
soc = 100;
|
||||
} else
|
||||
soc = -1;
|
||||
|
||||
return soc;
|
||||
}
|
||||
|
||||
static int mmi_combine_battery_cycles(struct mmi_charger_chip *chip)
|
||||
{
|
||||
int cycles = 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue