diff mbox series

[1/3] arm64: dts: qcom: sdm670: fix USB DP/DM HS PHY interrupts

Message ID 20231214074319.11023-2-johan+linaro@kernel.org (mailing list archive)
State Accepted
Commit c42d12ea105f67b0f137f1e52d5c59d13fe12b1f
Headers show
Series arm64: dts: qcom: fix USB wakeup interrupts again (pt 2) | expand

Commit Message

Johan Hovold Dec. 14, 2023, 7:43 a.m. UTC
The USB DP/DM HS PHY interrupts need to be provided by the PDC interrupt
controller in order to be able to wake the system up from low-power
states and to be able to detect disconnect events, which requires
triggering on falling edges.

A recent commit updated the trigger type but failed to change the
interrupt provider as required. This leads to the current Linux driver
failing to probe instead of printing an error during suspend and USB
wakeup not working as intended.

Fixes: de3b3de30999 ("arm64: dts: qcom: sdm670: fix USB wakeup interrupt types")
Fixes: 07c8ded6e373 ("arm64: dts: qcom: add sdm670 and pixel 3a device trees")
Cc: stable@vger.kernel.org      # 6.2
Cc: Richard Acayan <mailingradian@gmail.com>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
 arch/arm64/boot/dts/qcom/sdm670.dtsi | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Konrad Dybcio Dec. 14, 2023, 12:27 p.m. UTC | #1
On 12/14/23 08:43, Johan Hovold wrote:
> The USB DP/DM HS PHY interrupts need to be provided by the PDC interrupt
> controller in order to be able to wake the system up from low-power
> states and to be able to detect disconnect events, which requires
> triggering on falling edges.
> 
> A recent commit updated the trigger type but failed to change the
> interrupt provider as required. This leads to the current Linux driver
> failing to probe instead of printing an error during suspend and USB
> wakeup not working as intended.
> 
> Fixes: de3b3de30999 ("arm64: dts: qcom: sdm670: fix USB wakeup interrupt types")
> Fixes: 07c8ded6e373 ("arm64: dts: qcom: add sdm670 and pixel 3a device trees")
> Cc: stable@vger.kernel.org      # 6.2
> Cc: Richard Acayan <mailingradian@gmail.com>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
Richard Acayan Dec. 15, 2023, 1:46 a.m. UTC | #2
On Thu, Dec 14, 2023 at 08:43:17AM +0100, Johan Hovold wrote:
> The USB DP/DM HS PHY interrupts need to be provided by the PDC interrupt
> controller in order to be able to wake the system up from low-power
> states and to be able to detect disconnect events, which requires
> triggering on falling edges.
>
> A recent commit updated the trigger type but failed to change the
> interrupt provider as required. This leads to the current Linux driver
> failing to probe instead of printing an error during suspend and USB
> wakeup not working as intended.
>
> Fixes: de3b3de30999 ("arm64: dts: qcom: sdm670: fix USB wakeup interrupt types")
> Fixes: 07c8ded6e373 ("arm64: dts: qcom: add sdm670 and pixel 3a device trees")
> Cc: stable@vger.kernel.org      # 6.2
> Cc: Richard Acayan <mailingradian@gmail.com>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> ---

Tested-by: Richard Acayan <mailingradian@gmail.com>

On a Pixel 3a, plugging in a USB cable doesn't wake up the device
(presumably because there is no wakeup-source property) but this gets
USB working again on linux-next.
Johan Hovold Dec. 15, 2023, 7:34 a.m. UTC | #3
On Thu, Dec 14, 2023 at 08:46:27PM -0500, Richard Acayan wrote:
> On Thu, Dec 14, 2023 at 08:43:17AM +0100, Johan Hovold wrote:
> > The USB DP/DM HS PHY interrupts need to be provided by the PDC interrupt
> > controller in order to be able to wake the system up from low-power
> > states and to be able to detect disconnect events, which requires
> > triggering on falling edges.
> >
> > A recent commit updated the trigger type but failed to change the
> > interrupt provider as required. This leads to the current Linux driver
> > failing to probe instead of printing an error during suspend and USB
> > wakeup not working as intended.
> >
> > Fixes: de3b3de30999 ("arm64: dts: qcom: sdm670: fix USB wakeup interrupt types")
> > Fixes: 07c8ded6e373 ("arm64: dts: qcom: add sdm670 and pixel 3a device trees")
> > Cc: stable@vger.kernel.org      # 6.2
> > Cc: Richard Acayan <mailingradian@gmail.com>
> > Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> > ---
> 
> Tested-by: Richard Acayan <mailingradian@gmail.com>
> 
> On a Pixel 3a, plugging in a USB cable doesn't wake up the device
> (presumably because there is no wakeup-source property) but this gets
> USB working again on linux-next.

Thanks for testing. And yes, the wakeup interrupts will indeed not be
enabled at system suspend unless the wakeup-source property is there.
Did you try adding it?

Johan
Richard Acayan Dec. 16, 2023, 12:04 a.m. UTC | #4
On Fri, Dec 15, 2023 at 08:34:39AM +0100, Johan Hovold wrote:
> On Thu, Dec 14, 2023 at 08:46:27PM -0500, Richard Acayan wrote:
> > On Thu, Dec 14, 2023 at 08:43:17AM +0100, Johan Hovold wrote:
> > > The USB DP/DM HS PHY interrupts need to be provided by the PDC interrupt
> > > controller in order to be able to wake the system up from low-power
> > > states and to be able to detect disconnect events, which requires
> > > triggering on falling edges.
> > >
> > > A recent commit updated the trigger type but failed to change the
> > > interrupt provider as required. This leads to the current Linux driver
> > > failing to probe instead of printing an error during suspend and USB
> > > wakeup not working as intended.
> > >
> > > Fixes: de3b3de30999 ("arm64: dts: qcom: sdm670: fix USB wakeup interrupt types")
> > > Fixes: 07c8ded6e373 ("arm64: dts: qcom: add sdm670 and pixel 3a device trees")
> > > Cc: stable@vger.kernel.org      # 6.2
> > > Cc: Richard Acayan <mailingradian@gmail.com>
> > > Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> > > ---
> > 
> > Tested-by: Richard Acayan <mailingradian@gmail.com>
> > 
> > On a Pixel 3a, plugging in a USB cable doesn't wake up the device
> > (presumably because there is no wakeup-source property) but this gets
> > USB working again on linux-next.
>
> Thanks for testing. And yes, the wakeup interrupts will indeed not be
> enabled at system suspend unless the wakeup-source property is there.
> Did you try adding it?

Just tested today. Adding it does not cause the system to wake up when
plugging in a laptop on the Pixel 3a, but that might just be because
USB wakeups are disabled when the adapter is configured for peripheral
mode.

drivers/usb/dwc3/dwc3-qcom.c (dwc3_qcom_suspend):
	/*
	 * The role is stable during suspend as role switching is done from a
	 * freezable workqueue.
	 */
	if (dwc3_qcom_is_host(qcom) && wakeup) {
		qcom->usb2_speed = dwc3_qcom_read_usb2_speed(qcom);
		dwc3_qcom_enable_interrupts(qcom);
	}
Richard Acayan Dec. 16, 2023, 2:34 a.m. UTC | #5
On Thu, Dec 14, 2023 at 08:43:17AM +0100, Johan Hovold wrote:
> The USB DP/DM HS PHY interrupts need to be provided by the PDC interrupt
> controller in order to be able to wake the system up from low-power
> states and to be able to detect disconnect events, which requires
> triggering on falling edges.
>
> A recent commit updated the trigger type but failed to change the
> interrupt provider as required. This leads to the current Linux driver
> failing to probe instead of printing an error during suspend and USB
> wakeup not working as intended.
>
> Fixes: de3b3de30999 ("arm64: dts: qcom: sdm670: fix USB wakeup interrupt types")
> Fixes: 07c8ded6e373 ("arm64: dts: qcom: add sdm670 and pixel 3a device trees")
> Cc: stable@vger.kernel.org      # 6.2

I almost forgot to mention, both SDM670 patches seem to depend on
b51ee205dc4f ("arm64: dts: qcom: sdm670: Add PDC") in 6.6 to compile
properly.

> Cc: Richard Acayan <mailingradian@gmail.com>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> ---
>  arch/arm64/boot/dts/qcom/sdm670.dtsi | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm64/boot/dts/qcom/sdm670.dtsi b/arch/arm64/boot/dts/qcom/sdm670.dtsi
> index c873560ae9d5..fe4067c012a0 100644
> --- a/arch/arm64/boot/dts/qcom/sdm670.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sdm670.dtsi
> @@ -1295,10 +1295,10 @@ usb_1: usb@a6f8800 {
>  					  <&gcc GCC_USB30_PRIM_MASTER_CLK>;
>  			assigned-clock-rates = <19200000>, <150000000>;
>  
> -			interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>,
> -				     <GIC_SPI 486 IRQ_TYPE_LEVEL_HIGH>,
> -				     <GIC_SPI 488 IRQ_TYPE_EDGE_BOTH>,
> -				     <GIC_SPI 489 IRQ_TYPE_EDGE_BOTH>;
> +			interrupts-extended = <&intc GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>,
> +					      <&intc GIC_SPI 486 IRQ_TYPE_LEVEL_HIGH>,
> +					      <&pdc 8 IRQ_TYPE_EDGE_BOTH>,
> +					      <&pdc 9 IRQ_TYPE_EDGE_BOTH>;
>  			interrupt-names = "hs_phy_irq", "ss_phy_irq",
>  					  "dm_hs_phy_irq", "dp_hs_phy_irq";
>  
> -- 
> 2.41.0
>
Johan Hovold Dec. 18, 2023, 7:36 a.m. UTC | #6
On Fri, Dec 15, 2023 at 07:04:23PM -0500, Richard Acayan wrote:
> On Fri, Dec 15, 2023 at 08:34:39AM +0100, Johan Hovold wrote:
> > On Thu, Dec 14, 2023 at 08:46:27PM -0500, Richard Acayan wrote:

> > > Tested-by: Richard Acayan <mailingradian@gmail.com>
> > > 
> > > On a Pixel 3a, plugging in a USB cable doesn't wake up the device
> > > (presumably because there is no wakeup-source property) but this gets
> > > USB working again on linux-next.
> >
> > Thanks for testing. And yes, the wakeup interrupts will indeed not be
> > enabled at system suspend unless the wakeup-source property is there.
> > Did you try adding it?
> 
> Just tested today. Adding it does not cause the system to wake up when
> plugging in a laptop on the Pixel 3a, but that might just be because
> USB wakeups are disabled when the adapter is configured for peripheral
> mode.

Right, wake up is currently only implemented for host mode.

Johan
Johan Hovold Dec. 18, 2023, 7:39 a.m. UTC | #7
On Fri, Dec 15, 2023 at 09:34:53PM -0500, Richard Acayan wrote:
> On Thu, Dec 14, 2023 at 08:43:17AM +0100, Johan Hovold wrote:
> > The USB DP/DM HS PHY interrupts need to be provided by the PDC interrupt
> > controller in order to be able to wake the system up from low-power
> > states and to be able to detect disconnect events, which requires
> > triggering on falling edges.
> >
> > A recent commit updated the trigger type but failed to change the
> > interrupt provider as required. This leads to the current Linux driver
> > failing to probe instead of printing an error during suspend and USB
> > wakeup not working as intended.
> >
> > Fixes: de3b3de30999 ("arm64: dts: qcom: sdm670: fix USB wakeup interrupt types")
> > Fixes: 07c8ded6e373 ("arm64: dts: qcom: add sdm670 and pixel 3a device trees")
> > Cc: stable@vger.kernel.org      # 6.2
> 
> I almost forgot to mention, both SDM670 patches seem to depend on
> b51ee205dc4f ("arm64: dts: qcom: sdm670: Add PDC") in 6.6 to compile
> properly.

Thanks for spotting that. The 6.5 stable tree is EOL now so this will
fortunately not be an issue in practice.

Johan
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/qcom/sdm670.dtsi b/arch/arm64/boot/dts/qcom/sdm670.dtsi
index c873560ae9d5..fe4067c012a0 100644
--- a/arch/arm64/boot/dts/qcom/sdm670.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm670.dtsi
@@ -1295,10 +1295,10 @@  usb_1: usb@a6f8800 {
 					  <&gcc GCC_USB30_PRIM_MASTER_CLK>;
 			assigned-clock-rates = <19200000>, <150000000>;
 
-			interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>,
-				     <GIC_SPI 486 IRQ_TYPE_LEVEL_HIGH>,
-				     <GIC_SPI 488 IRQ_TYPE_EDGE_BOTH>,
-				     <GIC_SPI 489 IRQ_TYPE_EDGE_BOTH>;
+			interrupts-extended = <&intc GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>,
+					      <&intc GIC_SPI 486 IRQ_TYPE_LEVEL_HIGH>,
+					      <&pdc 8 IRQ_TYPE_EDGE_BOTH>,
+					      <&pdc 9 IRQ_TYPE_EDGE_BOTH>;
 			interrupt-names = "hs_phy_irq", "ss_phy_irq",
 					  "dm_hs_phy_irq", "dp_hs_phy_irq";