2021-11-01 07:55:36

by Sandeep Maheswaram

[permalink] [raw]
Subject: [PATCH v9 4/5] usb: dwc3: qcom: Change the IRQ flag for DP/DM hs phy irq

Change the IRQ flags for DP/DM hs phy irq to avoid interrupt
triggering during system suspend.

Signed-off-by: Sandeep Maheswaram <[email protected]>
---
drivers/usb/dwc3/dwc3-qcom.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index 54461f1..356f4f8 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -473,7 +473,7 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev)
irq_set_status_flags(irq, IRQ_NOAUTOEN);
ret = devm_request_threaded_irq(qcom->dev, irq, NULL,
qcom_dwc3_resume_irq,
- IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+ IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
"qcom_dwc3 DP_HS", qcom);
if (ret) {
dev_err(qcom->dev, "dp_hs_phy_irq failed: %d\n", ret);
@@ -488,7 +488,7 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev)
irq_set_status_flags(irq, IRQ_NOAUTOEN);
ret = devm_request_threaded_irq(qcom->dev, irq, NULL,
qcom_dwc3_resume_irq,
- IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+ IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
"qcom_dwc3 DM_HS", qcom);
if (ret) {
dev_err(qcom->dev, "dm_hs_phy_irq failed: %d\n", ret);
--
2.7.4


2021-11-01 16:33:00

by Bjorn Andersson

[permalink] [raw]
Subject: Re: [PATCH v9 4/5] usb: dwc3: qcom: Change the IRQ flag for DP/DM hs phy irq

On Mon 01 Nov 00:53 PDT 2021, Sandeep Maheswaram wrote:

> Change the IRQ flags for DP/DM hs phy irq to avoid interrupt
> triggering during system suspend.
>

Why does replacing HIGH with RISING change this behavior, or do you get
a RISING interrupt just before hitting suspend which you ignore?

I think it would be nice to have the commit message for this (or per
below request the DTS change) include some details about what's really
happening on the irq line.

> Signed-off-by: Sandeep Maheswaram <[email protected]>
> ---
> drivers/usb/dwc3/dwc3-qcom.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index 54461f1..356f4f8 100644
> --- a/drivers/usb/dwc3/dwc3-qcom.c
> +++ b/drivers/usb/dwc3/dwc3-qcom.c
> @@ -473,7 +473,7 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev)
> irq_set_status_flags(irq, IRQ_NOAUTOEN);
> ret = devm_request_threaded_irq(qcom->dev, irq, NULL,
> qcom_dwc3_resume_irq,
> - IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
> + IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,

IRQF_TRIGGER_* should be omitted from the driver and supplied by the DT.

The dtbs out there should all have IRQ_TYPE_LEVEL_HIGH at this time, so
simply dropping that from this list and updating the dts would be the
right thing to do.

Regards,
Bjorn

> "qcom_dwc3 DP_HS", qcom);
> if (ret) {
> dev_err(qcom->dev, "dp_hs_phy_irq failed: %d\n", ret);
> @@ -488,7 +488,7 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev)
> irq_set_status_flags(irq, IRQ_NOAUTOEN);
> ret = devm_request_threaded_irq(qcom->dev, irq, NULL,
> qcom_dwc3_resume_irq,
> - IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
> + IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> "qcom_dwc3 DM_HS", qcom);
> if (ret) {
> dev_err(qcom->dev, "dm_hs_phy_irq failed: %d\n", ret);
> --
> 2.7.4
>

2021-11-18 11:46:47

by Sandeep Maheswaram

[permalink] [raw]
Subject: Re: [PATCH v9 4/5] usb: dwc3: qcom: Change the IRQ flag for DP/DM hs phy irq


On 11/1/2021 10:01 PM, Bjorn Andersson wrote:
> On Mon 01 Nov 00:53 PDT 2021, Sandeep Maheswaram wrote:
>
>> Change the IRQ flags for DP/DM hs phy irq to avoid interrupt
>> triggering during system suspend.
>>
> Why does replacing HIGH with RISING change this behavior, or do you get
> a RISING interrupt just before hitting suspend which you ignore?
>
> I think it would be nice to have the commit message for this (or per
> below request the DTS change) include some details about what's really
> happening on the irq line.

When we use IRQF_TRIGGER_HIGH we get interrupt during PM suspend and
causes resume.

[  119.743083] Resume caused by IRQ 101, qcom_dwc3 DP_HS

>> Signed-off-by: Sandeep Maheswaram <[email protected]>
>> ---
>> drivers/usb/dwc3/dwc3-qcom.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
>> index 54461f1..356f4f8 100644
>> --- a/drivers/usb/dwc3/dwc3-qcom.c
>> +++ b/drivers/usb/dwc3/dwc3-qcom.c
>> @@ -473,7 +473,7 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev)
>> irq_set_status_flags(irq, IRQ_NOAUTOEN);
>> ret = devm_request_threaded_irq(qcom->dev, irq, NULL,
>> qcom_dwc3_resume_irq,
>> - IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
>> + IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> IRQF_TRIGGER_* should be omitted from the driver and supplied by the DT.
>
> The dtbs out there should all have IRQ_TYPE_LEVEL_HIGH at this time, so
> simply dropping that from this list and updating the dts would be the
> right thing to do.
>
> Regards,
> Bjorn
Ok. Dropping IRQF_TRIGGER_*  solved the resume issue during PM suspend.
>> "qcom_dwc3 DP_HS", qcom);
>> if (ret) {
>> dev_err(qcom->dev, "dp_hs_phy_irq failed: %d\n", ret);
>> @@ -488,7 +488,7 @@ static int dwc3_qcom_setup_irq(struct platform_device *pdev)
>> irq_set_status_flags(irq, IRQ_NOAUTOEN);
>> ret = devm_request_threaded_irq(qcom->dev, irq, NULL,
>> qcom_dwc3_resume_irq,
>> - IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
>> + IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
>> "qcom_dwc3 DM_HS", qcom);
>> if (ret) {
>> dev_err(qcom->dev, "dm_hs_phy_irq failed: %d\n", ret);
>> --
>> 2.7.4
>>