Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83f1bbef authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy
Browse files

power: qpnp-fg-gen4: Disable ESR fast calibration for debug battery



Disable ESR fast calibration for debug battery so that ESR
charging timer won't be configured with fast timer and also ESR
delta interrupt can be disabled. This helps in reducing wakeups.

Change-Id: Ib407f5b78c042b5c62c8a4c3f573441c43a9df1d
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent cd59acaf
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -330,6 +330,7 @@ static bool fg_sram_dump;
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 struct fg_sram_param pm8150b_v1_sram_params[] = {
	PARAM(BATT_SOC, BATT_SOC_WORD, BATT_SOC_OFFSET, 4, 1, 1, 0, NULL,
@@ -2271,6 +2272,12 @@ static void profile_load_work(struct work_struct *work)
	schedule_delayed_work(&chip->ttf->ttf_work, msecs_to_jiffies(10000));
	fg_dbg(fg, FG_STATUS, "profile loaded successfully");
out:
	if (!chip->esr_fast_calib || is_debug_batt_id(fg)) {
		/* If it is debug battery, then disable ESR fast calibration */
		chip->esr_fast_calib = false;
		fg_gen4_esr_fast_calib_config(chip, false);
	}

	if (chip->dt.multi_profile_load && rc < 0)
		chip->batt_age_level = chip->last_batt_age_level;
	fg->soc_reporting_ready = true;
@@ -2905,6 +2912,13 @@ static int fg_gen4_esr_fast_calib_config(struct fg_gen4_chip *chip, bool en)
		return rc;
	}

	/*
	 * esr_fast_cal_timer won't be initialized if esr_fast_calib is
	 * not enabled. Hence don't start/cancel the timer.
	 */
	if (!chip->esr_fast_calib)
		goto out;

	if (en) {
		/* Set ESR fast calibration timer to 50 seconds as default */
		esr_fast_cal_ms = 50000;
@@ -2919,6 +2933,7 @@ static int fg_gen4_esr_fast_calib_config(struct fg_gen4_chip *chip, bool en)
		alarm_cancel(&chip->esr_fast_cal_timer);
	}

out:
	fg_dbg(fg, FG_STATUS, "%sabling ESR fast calibration\n",
		en ? "En" : "Dis");
	return 0;