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

Commit 6f2b10d6 authored by Guru Das Srinagesh's avatar Guru Das Srinagesh
Browse files

power: smb5: Don't rerun DCIN AICL if userspace changes ICL



Currently, DCIN AICL will run automatically if userspace reduces WLS
VOUT. In thermal conditions, when userspace reduces DCIN ICL, we
immediately will run into ILIM, in response to which WLS VOUT will be
reduced. The automatic re-running of DCIN AICL will push ICL back up
again, which is contrary to what userspace wants at that point.

Prevent this from happening. The only reason userspace changes DC ICL is
because of thermal conditions, and we shouldn't negate the actions it
takes as a result of those conditions.

Change-Id: Id0ec44068387bf2ba3c0a0c72f5a8f7a1a527384
Signed-off-by: default avatarGuru Das Srinagesh <gurus@codeaurora.org>
parent a265ea02
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -3028,6 +3028,7 @@ int smblib_get_prop_dc_voltage_now(struct smb_charger *chg,
int smblib_set_prop_dc_current_max(struct smb_charger *chg,
				    const union power_supply_propval *val)
{
	chg->dcin_icl_user_set = true;
	return smblib_set_charge_param(chg, &chg->param.dc_icl, val->intval);
}

@@ -3054,9 +3055,11 @@ int smblib_set_prop_voltage_wls_output(struct smb_charger *chg,

	/*
	 * When WLS VOUT goes down, the power-constrained adaptor may be able
	 * to supply more current, so allow it to do so.
	 * to supply more current, so allow it to do so - unless userspace has
	 * changed DCIN ICL value already due to thermal considerations.
	 */
	if ((val->intval > 0) && (val->intval < chg->last_wls_vout)) {
	if (!chg->dcin_icl_user_set && (val->intval > 0) &&
			(val->intval < chg->last_wls_vout)) {
		alarm_start_relative(&chg->dcin_aicl_alarm,
				ms_to_ktime(DCIN_AICL_RERUN_DELAY_MS));
	}
@@ -6362,6 +6365,7 @@ irqreturn_t dc_plugin_irq_handler(int irq, void *data)
							true, 1500000);
		chg->last_wls_vout = 0;
		chg->dcin_aicl_done = false;
		chg->dcin_icl_user_set = false;
	}

	if (chg->dc_psy)
+1 −0
Original line number Diff line number Diff line
@@ -554,6 +554,7 @@ struct smb_charger {
	int			wls_icl_ua;
	bool			dcin_aicl_done;
	bool			hvdcp3_standalone_config;
	bool			dcin_icl_user_set;

	/* workaround flag */
	u32			wa_flags;