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

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

Merge "power: smblite: Fix restoring the ICL in the thermal-regulation-loop"

parents ebcedae6 cff71486
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -2892,23 +2892,23 @@ static void smblite_lib_thermal_regulation_work(struct work_struct *work)
	}

	if (stat & DIE_TEMP_UB_BIT) {
		icl_ua = get_effective_result(chg->usb_icl_votable)
				- THERM_REGULATION_STEP_UA;

		/* Decrement ICL by one step */
		vote(chg->usb_icl_votable, SW_THERM_REGULATION_VOTER,
				true, icl_ua - THERM_REGULATION_STEP_UA);

		/* Check if we reached minimum ICL limit */
		if (icl_ua < USBIN_500UA + THERM_REGULATION_STEP_UA)
			goto exit;

		/* Decrement ICL by one step */
		icl_ua -= THERM_REGULATION_STEP_UA;
		vote(chg->usb_icl_votable, SW_THERM_REGULATION_VOTER,
				true, icl_ua);

		goto reschedule;
	}

	if (stat & DIE_TEMP_LB_BIT) {
	/* check if DIE_TEMP is below LB */
	if (!(stat & DIE_TEMP_MASK)) {
		icl_ua += THERM_REGULATION_STEP_UA;
		vote(chg->usb_icl_votable, SW_THERM_REGULATION_VOTER,
				true, icl_ua + THERM_REGULATION_STEP_UA);
				true, icl_ua);

		/*
		 * Check if we need further increments:
+1 −0
Original line number Diff line number Diff line
@@ -266,6 +266,7 @@ enum {
#define THERMREG_DISABLED_BIT			BIT(0)

#define DIE_TEMP_STATUS_REG			(MISC_BASE + 0x09)
#define DIE_TEMP_MASK				GENMASK(3, 0)
#define DIE_TEMP_SHDN_BIT			BIT(3)
#define DIE_TEMP_RST_BIT			BIT(2)
#define DIE_TEMP_UB_BIT				BIT(1)