@@ -406,13 +406,16 @@ static int cpcap_battery_cc_get_avg_current(struct cpcap_battery_ddata *ddata)
static bool cpcap_battery_full(struct cpcap_battery_ddata *ddata)
{
struct cpcap_battery_state_data *state = cpcap_battery_latest(ddata);
+ static bool is_full;
if (state->voltage >=
(ddata->config.bat.constant_charge_voltage_max_uv - 18000) &&
- state->current_ua > -100000)
- return true;
+ state->current_ua > (is_full ? -150000 : -100000))
+ is_full = true;
+ else
+ is_full = false;
- return false;
+ return is_full;
}
static bool cpcap_battery_low(struct cpcap_battery_ddata *ddata)
If the battery status is detected as full for the charging current that doesn't exceed 100 mA, it will then be reported as full for charging currents in the range of 100-150 mA. This is needed because charge_current value has a spread. We don't use avg_current here because it can trigger wrong battery full status on charger connected event. Signed-off-by: Arthur Demchenkov <spinal.by@gmail.com> --- drivers/power/supply/cpcap-battery.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)