Merge "power: qpnp-fg-gen3: Restore recharge SOC only when not in JEITA"
This commit is contained in:
commit
c1b445a451
1 changed files with 13 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -2066,12 +2066,21 @@ static int fg_set_recharge_soc(struct fg_chip *chip, int recharge_soc)
|
|||
|
||||
static int fg_adjust_recharge_soc(struct fg_chip *chip)
|
||||
{
|
||||
union power_supply_propval prop = {0, };
|
||||
int rc, msoc, recharge_soc, new_recharge_soc = 0;
|
||||
bool recharge_soc_status;
|
||||
|
||||
if (!chip->dt.auto_recharge_soc)
|
||||
return 0;
|
||||
|
||||
rc = power_supply_get_property(chip->batt_psy, POWER_SUPPLY_PROP_HEALTH,
|
||||
&prop);
|
||||
if (rc < 0) {
|
||||
pr_err("Error in getting battery health, rc=%d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
chip->health = prop.intval;
|
||||
|
||||
recharge_soc = chip->dt.recharge_soc_thr;
|
||||
recharge_soc_status = chip->recharge_soc_adjusted;
|
||||
/*
|
||||
|
@ -2102,6 +2111,9 @@ static int fg_adjust_recharge_soc(struct fg_chip *chip)
|
|||
if (!chip->recharge_soc_adjusted)
|
||||
return 0;
|
||||
|
||||
if (chip->health != POWER_SUPPLY_HEALTH_GOOD)
|
||||
return 0;
|
||||
|
||||
/* Restore the default value */
|
||||
new_recharge_soc = recharge_soc;
|
||||
chip->recharge_soc_adjusted = false;
|
||||
|
|
Loading…
Add table
Reference in a new issue