diff mbox series

usb: dwc3: qcom: Honor wakeup enabled/disabled state

Message ID 20200915123123.1.I44954d9e1169f2cf5c44e6454d357c75ddfa99a2@changeid
State Superseded
Headers show
Series usb: dwc3: qcom: Honor wakeup enabled/disabled state | expand

Commit Message

Matthias Kaehlcke Sept. 15, 2020, 7:31 p.m. UTC
The dwc3-qcom currently enables wakeup interrupts unconditionally
when suspending, however this should not be done when wakeup is
disabled (e.g. through the sysfs attribute power/wakeup). Only
enable wakeup interrupts when device_may_wakeup() returns true.

Fixes: a4333c3a6ba9 ("usb: dwc3: Add Qualcomm DWC3 glue driver")
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---

 drivers/usb/dwc3/dwc3-qcom.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Bjorn Andersson Sept. 15, 2020, 11:50 p.m. UTC | #1
On Tue 15 Sep 14:31 CDT 2020, Matthias Kaehlcke wrote:

> The dwc3-qcom currently enables wakeup interrupts unconditionally

> when suspending, however this should not be done when wakeup is

> disabled (e.g. through the sysfs attribute power/wakeup). Only

> enable wakeup interrupts when device_may_wakeup() returns true.

> 

> Fixes: a4333c3a6ba9 ("usb: dwc3: Add Qualcomm DWC3 glue driver")

> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>


Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>


Regards,
Bjorn

> ---

> 

>  drivers/usb/dwc3/dwc3-qcom.c | 7 +++++--

>  1 file changed, 5 insertions(+), 2 deletions(-)

> 

> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c

> index e1e78e9824b1..56d14c09506d 100644

> --- a/drivers/usb/dwc3/dwc3-qcom.c

> +++ b/drivers/usb/dwc3/dwc3-qcom.c

> @@ -251,8 +251,10 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom)

>  	for (i = qcom->num_clocks - 1; i >= 0; i--)

>  		clk_disable_unprepare(qcom->clks[i]);

>  

> +	if (device_may_wakeup(qcom->dev))

> +		dwc3_qcom_enable_interrupts(qcom);

> +

>  	qcom->is_suspended = true;

> -	dwc3_qcom_enable_interrupts(qcom);

>  

>  	return 0;

>  }

> @@ -265,7 +267,8 @@ static int dwc3_qcom_resume(struct dwc3_qcom *qcom)

>  	if (!qcom->is_suspended)

>  		return 0;

>  

> -	dwc3_qcom_disable_interrupts(qcom);

> +	if (device_may_wakeup(qcom->dev))

> +		dwc3_qcom_disable_interrupts(qcom);

>  

>  	for (i = 0; i < qcom->num_clocks; i++) {

>  		ret = clk_prepare_enable(qcom->clks[i]);

> -- 

> 2.28.0.618.gf4bc123cb7-goog

>
Matthias Kaehlcke Feb. 23, 2021, 5:22 p.m. UTC | #2
ping

I noticed this was never picked up, can it be landed or are there any
concerns with this patch?

On Tue, Sep 15, 2020 at 06:50:32PM -0500, Bjorn Andersson wrote:
> On Tue 15 Sep 14:31 CDT 2020, Matthias Kaehlcke wrote:

> 

> > The dwc3-qcom currently enables wakeup interrupts unconditionally

> > when suspending, however this should not be done when wakeup is

> > disabled (e.g. through the sysfs attribute power/wakeup). Only

> > enable wakeup interrupts when device_may_wakeup() returns true.

> > 

> > Fixes: a4333c3a6ba9 ("usb: dwc3: Add Qualcomm DWC3 glue driver")

> > Signed-off-by: Matthias Kaehlcke <mka@chromium.org>

> 

> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

> 

> Regards,

> Bjorn

> 

> > ---

> > 

> >  drivers/usb/dwc3/dwc3-qcom.c | 7 +++++--

> >  1 file changed, 5 insertions(+), 2 deletions(-)

> > 

> > diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c

> > index e1e78e9824b1..56d14c09506d 100644

> > --- a/drivers/usb/dwc3/dwc3-qcom.c

> > +++ b/drivers/usb/dwc3/dwc3-qcom.c

> > @@ -251,8 +251,10 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom)

> >  	for (i = qcom->num_clocks - 1; i >= 0; i--)

> >  		clk_disable_unprepare(qcom->clks[i]);

> >  

> > +	if (device_may_wakeup(qcom->dev))

> > +		dwc3_qcom_enable_interrupts(qcom);

> > +

> >  	qcom->is_suspended = true;

> > -	dwc3_qcom_enable_interrupts(qcom);

> >  

> >  	return 0;

> >  }

> > @@ -265,7 +267,8 @@ static int dwc3_qcom_resume(struct dwc3_qcom *qcom)

> >  	if (!qcom->is_suspended)

> >  		return 0;

> >  

> > -	dwc3_qcom_disable_interrupts(qcom);

> > +	if (device_may_wakeup(qcom->dev))

> > +		dwc3_qcom_disable_interrupts(qcom);

> >  

> >  	for (i = 0; i < qcom->num_clocks; i++) {

> >  		ret = clk_prepare_enable(qcom->clks[i]);

> > -- 

> > 2.28.0.618.gf4bc123cb7-goog

> >
Greg Kroah-Hartman March 2, 2021, 7:06 a.m. UTC | #3
On Tue, Feb 23, 2021 at 09:22:02AM -0800, Matthias Kaehlcke wrote:
> ping
> 
> I noticed this was never picked up, can it be landed or are there any
> concerns with this patch?

No idea, try resending it.

thanks,

greg k-h
diff mbox series

Patch

diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index e1e78e9824b1..56d14c09506d 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -251,8 +251,10 @@  static int dwc3_qcom_suspend(struct dwc3_qcom *qcom)
 	for (i = qcom->num_clocks - 1; i >= 0; i--)
 		clk_disable_unprepare(qcom->clks[i]);
 
+	if (device_may_wakeup(qcom->dev))
+		dwc3_qcom_enable_interrupts(qcom);
+
 	qcom->is_suspended = true;
-	dwc3_qcom_enable_interrupts(qcom);
 
 	return 0;
 }
@@ -265,7 +267,8 @@  static int dwc3_qcom_resume(struct dwc3_qcom *qcom)
 	if (!qcom->is_suspended)
 		return 0;
 
-	dwc3_qcom_disable_interrupts(qcom);
+	if (device_may_wakeup(qcom->dev))
+		dwc3_qcom_disable_interrupts(qcom);
 
 	for (i = 0; i < qcom->num_clocks; i++) {
 		ret = clk_prepare_enable(qcom->clks[i]);