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

Commit 6f4dec2b authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy
Browse files

qcom: qpnp-smb2: Reset switcher_power_ok irq count when USBIN_UV fires



Currently when 3 switcher_power_ok interrupts are seen within a
second, the driver thinks that the switcher is reverse boosting
and suspends USB input path.

However, switcher_power_ok could happen 3 times within a second
while AICL is run from a charger collapse, a valid usecase which
ends up in an USB suspended state.

Note that AICL run caused switcher_power_ok is accompanied by an
USBIN_UV interrupt. Use that to distinguish reverse boost Vs AICL
runs. In particular, reset the switcher_power_ok interrupt count
updated by storm_watch when an USBIN_UV interrupt is seen.

Change-Id: I6817c66319f9af03ac28324a8d863876fdadafb3
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent 2b9d6a36
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1738,7 +1738,7 @@ static struct smb_irq_info smb2_irqs[] = {
	},
	[USBIN_UV_IRQ] = {
		.name		= "usbin-uv",
		.handler	= smblib_handle_debug,
		.handler	= smblib_handle_usbin_uv,
	},
	[USBIN_OV_IRQ] = {
		.name		= "usbin-ov",
+15 −0
Original line number Diff line number Diff line
@@ -2806,6 +2806,21 @@ irqreturn_t smblib_handle_usb_psy_changed(int irq, void *data)
	return IRQ_HANDLED;
}

irqreturn_t smblib_handle_usbin_uv(int irq, void *data)
{
	struct smb_irq_data *irq_data = data;
	struct smb_charger *chg = irq_data->parent_data;
	struct storm_watch *wdata;

	smblib_dbg(chg, PR_INTERRUPT, "IRQ: %s\n", irq_data->name);
	if (!chg->irq_info[SWITCH_POWER_OK_IRQ].irq_data)
		return IRQ_HANDLED;

	wdata = &chg->irq_info[SWITCH_POWER_OK_IRQ].irq_data->storm_data;
	reset_storm_count(wdata);
	return IRQ_HANDLED;
}

irqreturn_t smblib_handle_usb_plugin(int irq, void *data)
{
	struct smb_irq_data *irq_data = data;
+1 −0
Original line number Diff line number Diff line
@@ -354,6 +354,7 @@ irqreturn_t smblib_handle_step_chg_soc_update_request(int irq, void *data);
irqreturn_t smblib_handle_batt_temp_changed(int irq, void *data);
irqreturn_t smblib_handle_batt_psy_changed(int irq, void *data);
irqreturn_t smblib_handle_usb_psy_changed(int irq, void *data);
irqreturn_t smblib_handle_usbin_uv(int irq, void *data);
irqreturn_t smblib_handle_usb_plugin(int irq, void *data);
irqreturn_t smblib_handle_usb_source_change(int irq, void *data);
irqreturn_t smblib_handle_icl_change(int irq, void *data);