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

Commit e4ef9471 authored by Nicholas Troast's avatar Nicholas Troast
Browse files

qcom-charger: qpnp-smb2: enable some irqs as a wakeup source



Parallel charging requires the device to wake up when entering taper
charging state in order to reduce the parallel charger's FCC. Enable
the chg-state-change irq as a wakeup source.

Parallel charging requires the device to wake up when the USB ICL
changes in order to enable or disable. Enable the usbin-icl-change
irq as a wakeup source.

When a change is detected on the Type-C CC pins the device should wake
up to handle the change. Enable the type-c-change irq as a wakeup
source.

When VBUS is detected the device should wake up to adjust the state of
DP/DM to allow for proper APSD. Enable the usbin-plugin irq as a wakeup
source.

When APSD finishes the device should wake up to notify the USB, and PD
drivers. Enable the usbin-src-change irq as a wakeup source.

CRs-Fixed: 1030478
Change-Id: I7cdc08d973b5ea711c877f7f2eabbe0fdbbf6fa0
Signed-off-by: default avatarNicholas Troast <ntroast@codeaurora.org>
parent 400520a6
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -607,12 +607,14 @@ static int smb2_determine_initial_status(struct smb2 *chip)
struct smb2_irq_info {
	const char		*name;
	const irq_handler_t	handler;
	const bool		wake;
	int			irq;
};

static const struct smb2_irq_info smb2_irqs[] = {
static struct smb2_irq_info smb2_irqs[] = {
/* CHARGER IRQs */
	{ "chg-error",                  smblib_handle_debug },
	{ "chg-state-change",           smblib_handle_chg_state_change },
	{ "chg-state-change",           smblib_handle_chg_state_change,	true },
	{ "step-chg-state-change",      smblib_handle_debug },
	{ "step-chg-soc-update-fail",   smblib_handle_debug },
	{ "step-chg-soc-update-request", smblib_handle_debug },
@@ -633,10 +635,10 @@ static const struct smb2_irq_info smb2_irqs[] = {
	{ "usbin-lt-3p6v",              smblib_handle_debug },
	{ "usbin-uv",                   smblib_handle_debug },
	{ "usbin-ov",                   smblib_handle_debug },
	{ "usbin-plugin",               smblib_handle_usb_plugin },
	{ "usbin-src-change",           smblib_handle_usb_source_change },
	{ "usbin-icl-change",           smblib_handle_icl_change },
	{ "type-c-change",		smblib_handle_usb_typec_change },
	{ "usbin-plugin",               smblib_handle_usb_plugin,	true },
	{ "usbin-src-change",           smblib_handle_usb_source_change, true },
	{ "usbin-icl-change",           smblib_handle_icl_change,	true },
	{ "type-c-change",		smblib_handle_usb_typec_change,	true },
/* DC INPUT IRQs */
	{ "dcin-collapse",              smblib_handle_debug },
	{ "dcin-lt-3p6v",               smblib_handle_debug },
@@ -705,6 +707,10 @@ static int smb2_request_interrupt(struct smb2 *chip,
		return rc;
	}

	smb2_irqs[irq_index].irq = irq;
	if (smb2_irqs[irq_index].wake)
		enable_irq_wake(irq);

	return rc;
}