From 58f1562619f477af3a68009a7e05357581ab0456 Mon Sep 17 00:00:00 2001 From: Kieran Graham Date: Wed, 14 Oct 2026 23:16:08 +0100 Subject: [PATCH 5/6] usb: dwc3: apple: offer USB remote wake from a connected host port Retain the native xHCI wake IRQ and AIC skip-set-wake flags. Fixed-hub controllers remain excluded. Original assistance attribution: Claude:claude-opus-5-5. Ported from release 56 onto omacom/linux-aurora 6f6367775. Assisted-by: Codex:gpt-6.1-sol --- drivers/irqchip/irq-apple-aic.c | 2 ++ drivers/usb/dwc3/dwc3-apple.c | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/drivers/irqchip/irq-apple-aic.c b/drivers/irqchip/irq-apple-aic.c index eb3a648f2..396efe6d4 100644 --- a/drivers/irqchip/irq-apple-aic.c +++ b/drivers/irqchip/irq-apple-aic.c @@ -491,6 +491,7 @@ static struct irq_chip aic_chip = { .irq_eoi = aic_irq_eoi, .irq_set_affinity = aic_irq_set_affinity, .irq_set_type = aic_irq_set_type, + .flags = IRQCHIP_SKIP_SET_WAKE, }; static struct irq_chip aic2_chip = { @@ -499,6 +500,7 @@ static struct irq_chip aic2_chip = { .irq_unmask = aic_irq_unmask, .irq_eoi = aic_irq_eoi, .irq_set_type = aic_irq_set_type, + .flags = IRQCHIP_SKIP_SET_WAKE, }; /* diff --git a/drivers/usb/dwc3/dwc3-apple.c b/drivers/usb/dwc3/dwc3-apple.c index 232a4de95..305d8b6df 100644 --- a/drivers/usb/dwc3/dwc3-apple.c +++ b/drivers/usb/dwc3/dwc3-apple.c @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -355,6 +356,22 @@ static int dwc3_apple_init(struct dwc3_apple *appledwc, enum dwc3_apple_state st dev_err(appledwc->dev, "Failed to initialize host, ret=%d\n", ret); goto core_exit; } + /* + * The connected-role core remains powered across s2idle. Attach + * its native I/O IRQ to xHCI so the host's power/wakeup policy + * can arm USB remote wake. Controllers behind a fixed hub are left + * out until their wake path has been tested. + */ + if (!appledwc->fixed_hub) { + ret = platform_get_irq(appledwc->dwc.xhci, 0); + if (ret > 0) + ret = dev_pm_set_wake_irq(&appledwc->dwc.xhci->dev, ret); + if (ret < 0) { + dev_err(appledwc->dev, "Failed to attach USB wake IRQ: %d\n", ret); + dwc3_host_exit(&appledwc->dwc); + goto core_exit; + } + } break; case DWC3_APPLE_DEVICE: ret = dwc3_gadget_init(&appledwc->dwc); @@ -411,6 +428,7 @@ static int dwc3_apple_exit(struct dwc3_apple *appledwc) break; case DWC3_APPLE_HOST: dev_pm_syscore_device(appledwc->dev, false); + dev_pm_clear_wake_irq(&appledwc->dwc.xhci->dev); dwc3_host_exit(&appledwc->dwc); break; } -- 2.56.0