* [PATCH] usb: dwc3: qcom: Restore DP/DM wake IRQ trigger types on unbind
@ 2026-11-26 19:29 Felipe Infante de Castro
2026-11-26 19:37 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Felipe Infante de Castro @ 2026-11-26 19:29 UTC (permalink / raw)
To: Thinh.Nguyen, gregkh; +Cc: linux-usb, linux-arm-msm, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1575 bytes --]
Hi,
The patch is attached as a file rather than inline, because my mail
client cannot send it inline without wrapping lines and converting
tabs. Apologies for that. The commit message is repeated below for
review.
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.
The patch records the trigger type of each DP/DM interrupt when it is
requested and restores 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 the patch, a runtime suspend and resume
followed by an unbind and rebind kept all three wake handlers, with no
trigger mismatch in the log. The patch is against mainline; it was run
on 7.3 and build-tested on 7.3.6 with W=1, not on mainline itself.
Thanks,
Felipe
[-- Attachment #2: 0001-usb-dwc3-qcom-Restore-DP-DM-wake-IRQ-trigger-types-o.patch --]
[-- Type: text/x-patch, Size: 3957 bytes --]
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] 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.
Assisted-by: OpenAI Codex
Assisted-by: Claude Fable 5.2
Signed-off-by: Felipe Infante de Castro <felipe.infante.de.castro@gmail.com>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] usb: dwc3: qcom: Restore DP/DM wake IRQ trigger types on unbind
2026-11-26 19:29 [PATCH] usb: dwc3: qcom: Restore DP/DM wake IRQ trigger types on unbind Felipe Infante de Castro
@ 2026-11-26 19:37 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-26 19:37 UTC (permalink / raw)
To: Felipe Infante de Castro; +Cc: linux-usb
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] usb: dwc3: qcom: email commentary and duplicated changelog in
commit message
- [Low] usb: dwc3: qcom: missing Fixes trailer for
dwc3_qcom_enable_wakeup_irq() bug
--
commit 5db5a7b1febf102a7cdfd576795edb2f79f0c55e
Author: Felipe Infante de Castro <felipe.infante.de.castro@gmail.com>
> usb: dwc3: qcom: Restore DP/DM wake IRQ trigger types on unbind
>
> Hi,
>
> The patch is attached as a file rather than inline, because my mail
> client cannot send it inline without wrapping lines and converting
> tabs. Apologies for that. The commit message is repeated below for
> review.
>
> 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.
>
> The patch records the trigger type of each DP/DM interrupt when it is
> requested and restores 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 the patch, a runtime suspend and resume
> followed by an unbind and rebind kept all three wake handlers, with no
> trigger mismatch in the log. The patch is against mainline; it was run
> on 7.3 and build-tested on 7.3.6 with W=1, not on mainline itself.
>
> Thanks,
> Felipe
>
> 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.
>
> Assisted-by: OpenAI Codex
> Assisted-by: Claude Fable 5.2
> Signed-off-by: Felipe Infante de Castro <felipe.infante.de.castro@gmail.com>
[Severity: Low]
This isn't a bug, but the commit message includes the email preamble ("Hi,
... Thanks, Felipe") and repeats the four-paragraph changelog body twice.
Notes for reviewers that should not end up in git history belong below the
"---" separator.
[Severity: Low]
Since this fixes the wakeup IRQ trigger reconfiguration added in
6895ea55c385 ("usb: dwc3: qcom: Configure wakeup interrupts during
suspend"), should the commit message include:
Fixes: 6895ea55c385 ("usb: dwc3: qcom: Configure wakeup interrupts during suspend")
--
Sashiko AI review · https://sashiko.dev/#/patchset/CADy1qsYCggH1S=yVEQ44mj0WVr=WimiXLDMk-zyr5KZXVG8SLQ@mail.gmail.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-26 19:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 19:29 [PATCH] usb: dwc3: qcom: Restore DP/DM wake IRQ trigger types on unbind Felipe Infante de Castro
2026-11-26 19:37 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox