Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

Add strategy to exit rapid_soc_dec to fix 1% problem. #41

Open
wants to merge 1 commit into
base: android12-stable
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions drivers/power/supply/qcom/qpnp-fg-gen4.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ static bool fg_esr_fast_cal_en;

static int fg_gen4_validate_soc_scale_mode(struct fg_gen4_chip *chip);
static int fg_gen4_esr_fast_calib_config(struct fg_gen4_chip *chip, bool en);
static int fg_gen4_rapid_soc_config(struct fg_gen4_chip *chip, bool en);

static struct fg_sram_param pm8150b_v1_sram_params[] = {
PARAM(BATT_SOC, BATT_SOC_WORD, BATT_SOC_OFFSET, 4, 1, 1, 0, NULL,
Expand Down Expand Up @@ -1225,6 +1226,23 @@ static int fg_gen4_get_prop_soc_scale(struct fg_gen4_chip *chip)
fg_dbg(fg, FG_FVSS, "Vbatt now=%d Vbatt avg=%d Vbatt res=%d\n",
chip->vbatt_now, chip->vbatt_avg, chip->vbatt_res);

/* Exit rapid soc decrease mode when battery voltage > 3700mV to recover real soc value */
if (chip->vbatt_avg > 3700) {
if (chip->dt.rapid_soc_dec_en) {
if(chip->rapid_soc_dec_en) {
fg_dbg(fg, FG_STATUS, "Vbatt > 3700, exit rapid soc decrease\n", fg->charge_status);
rc = fg_gen4_rapid_soc_config(chip, false);
if (rc < 0)
pr_err("Error in configuring for rapid SOC reduction rc:%d\n",
rc);
chip->rapid_soc_dec_en = false;
}
} else if (chip->vbatt_low) {
fg_dbg(fg, FG_STATUS, "Vbatt > 3700, reset vbatt_low = false\n", fg->charge_status);
chip->vbatt_low = false;
}
}

return rc;
}

Expand Down