[PATCH v2] usb: dwc3: qcom: Restore DP/DM wake IRQ trigger types on unbind

From: Felipe Infante de Castro

Date: Thu Nov 26 2026 - 14:41:47 EST



From ebd506a84d3c22b3ff26aa26960a463519f9b1ce Mon Sep 17 00:00:00 2001
From: Felipe Infante de Castro <felipe.infante.de.castro@gmail.com>
Date: Thu, 26 Nov 2026 13:54:01 -0500
Subject: [PATCH v2] usb: dwc3: qcom: Restore DP/DM wake IRQ trigger types on
unbind

On suspend, dwc3_qcom_enable_wakeup_irq() sets the DP and DM high-speed
PHY interrupts to a single edge, chosen from the speed of the attached
device. The IRQ mapping outlives the driver, so after an unbind the
mapping keeps that single-edge type.

On the next probe the interrupt is looked up again from the device tree,
which describes it as IRQ_TYPE_EDGE_BOTH. The lookup fails with a
trigger type mismatch against the existing mapping. Because the wake
interrupts are optional, probe still succeeds, but without the DP/DM
wake handlers, and USB wakeup is lost until the next boot.

Record the trigger type of each DP/DM interrupt when it is requested and
restore it from a devres action. The action is registered after the
interrupts, so it runs while the driver still owns them. Unmapped
interrupts, unspecified types and types that already match are left
alone.

Seen on a Microsoft Surface Laptop 7 (x1e80100-microsoft-romulus15) on a
7.3 kernel: after unbinding and rebinding a controller the dp_hs_phy_irq
and dm_hs_phy_irq handlers were absent from /proc/interrupts. With this
change they return on every rebind.

Fixes: 6895ea55c385 ("usb: dwc3: qcom: Configure wakeup interrupts during suspend")
Assisted-by: OpenAI Codex
Assisted-by: Claude Fable 5.2
Signed-off-by: Felipe Infante de Castro <felipe.infante.de.castro@gmail.com>
---
Changes in v2:
- Resent with an empty mail body. v1 carried a greeting and
a second copy of the changelog in the body, which tooling folded
into the commit message.
- Added the Fixes tag suggested by the Sashiko review. No change to the
code.

drivers/usb/dwc3/dwc3-qcom.c | 38 +++++++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index a260841..3392a5b 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -65,6 +65,8 @@ struct dwc3_qcom_port {
int dp_hs_phy_irq;
int dm_hs_phy_irq;
int ss_phy_irq;
+ unsigned int dp_hs_irq_type;
+ unsigned int dm_hs_irq_type;
enum usb_device_speed usb2_speed;
};

@@ -473,6 +475,7 @@ static int dwc3_qcom_setup_port_irq(struct dwc3_qcom *qcom,
if (ret)
return ret;
qcom->ports[port_index].dp_hs_phy_irq = irq;
+ qcom->ports[port_index].dp_hs_irq_type = irq_get_trigger_type(irq);
}

if (is_multiport)
@@ -488,6 +491,7 @@ static int dwc3_qcom_setup_port_irq(struct dwc3_qcom *qcom,
if (ret)
return ret;
qcom->ports[port_index].dm_hs_phy_irq = irq;
+ qcom->ports[port_index].dm_hs_irq_type = irq_get_trigger_type(irq);
}

if (is_multiport)
@@ -540,6 +544,38 @@ static int dwc3_qcom_find_num_ports(struct platform_device *pdev)
return DWC3_QCOM_MAX_PORTS;
}

+static void dwc3_qcom_restore_irq_type(struct device *dev, int irq, unsigned int type)
+{
+ int ret;
+
+ if (!irq || !type || irq_get_trigger_type(irq) == type)
+ return;
+
+ ret = irq_set_irq_type(irq, type);
+ if (ret)
+ dev_warn(dev, "failed to restore IRQ %d trigger type %#x: %d\n",
+ irq, type, ret);
+}
+
+static void dwc3_qcom_restore_wake_irq_types(void *data)
+{
+ struct dwc3_qcom *qcom = data;
+ int i;
+
+ /*
+ * The IRQ mappings survive unbind. Put their firmware triggers back
+ * before devres frees the handlers or the next probe can lose them.
+ */
+ for (i = 0; i < qcom->num_ports; i++) {
+ struct dwc3_qcom_port *port = &qcom->ports[i];
+
+ dwc3_qcom_restore_irq_type(qcom->dev, port->dp_hs_phy_irq,
+ port->dp_hs_irq_type);
+ dwc3_qcom_restore_irq_type(qcom->dev, port->dm_hs_phy_irq,
+ port->dm_hs_irq_type);
+ }
+}
+
static int dwc3_qcom_setup_irq(struct dwc3_qcom *qcom, struct platform_device *pdev)
{
bool is_multiport;
@@ -555,7 +591,7 @@ static int dwc3_qcom_setup_irq(struct dwc3_qcom *qcom, struct platform_device *p
return ret;
}

- return 0;
+ return devm_add_action_or_reset(qcom->dev, dwc3_qcom_restore_wake_irq_types, qcom);
}

static void dwc3_qcom_set_role_notifier(struct dwc3 *dwc, enum usb_role next_role)
--
2.56.1