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

Commit b329ab1f authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: qpnp-fg-gen4: cancel soc_scale_work conditionally"

parents fd23698f 3b2ac271
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -3333,13 +3333,16 @@ static void fg_gen4_exit_soc_scale(struct fg_gen4_chip *chip)

	if (chip->soc_scale_mode) {
		alarm_cancel(&chip->soc_scale_alarm_timer);
		if (work_busy(&chip->soc_scale_work) != WORK_BUSY_RUNNING)
			cancel_work_sync(&chip->soc_scale_work);

		/* While exiting soc_scale_mode, Update MSOC register */
		fg_gen4_write_scale_msoc(chip);
	}

	chip->soc_scale_mode = false;
	fg_dbg(fg, FG_FVSS, "Exit FVSS mode\n");
	fg_dbg(fg, FG_FVSS, "Exit FVSS mode, work_status=%d\n",
				work_busy(&chip->soc_scale_work));
}

static int fg_gen4_validate_soc_scale_mode(struct fg_gen4_chip *chip)
@@ -4055,6 +4058,12 @@ static void soc_scale_work(struct work_struct *work)
	if (rc < 0)
		pr_err("Failed to validate SOC scale mode, rc=%d\n", rc);

	/* re-validate soc scale mode as we may have exited FVSS */
	if (!chip->soc_scale_mode) {
		fg_dbg(fg, FG_FVSS, "exit soc scale mode\n");
		return;
	}

	if (chip->vbatt_res <= 0)
		chip->vbatt_res = 0;