Re: [PATCH v5 1/4] usb: dwc3: core: Host wake up support from system suspend

2021-03-23 Thread Matthias Kaehlcke
On Mon, Mar 22, 2021 at 11:01:17PM +0530, Sandeep Maheswaram wrote:
> Avoiding phy powerdown when wakeup capable devices are connected.
> 
> Signed-off-by: Sandeep Maheswaram 
> ---
>  drivers/usb/dwc3/core.c | 8 +---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 94fdbe5..9ecd7ac 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -1702,7 +1702,7 @@ static int dwc3_suspend_common(struct dwc3 *dwc, 
> pm_message_t msg)
>   dwc3_core_exit(dwc);
>   break;
>   case DWC3_GCTL_PRTCAP_HOST:
> - if (!PMSG_IS_AUTO(msg)) {
> + if (!PMSG_IS_AUTO(msg) && dwc->phy_power_off) {

This is the first patch of the series, but the 'phy_power_off' flag is
only added by '[2/4] usb: dwc3: host: Add suspend_quirk for dwc3 host'.
Patches should not rely on later patches in the series in order to build
error/warning free. It seems you need to swap the order of patch 1 and 2.

>   dwc3_core_exit(dwc);
>   break;
>   }
> @@ -1763,13 +1763,15 @@ static int dwc3_resume_common(struct dwc3 *dwc, 
> pm_message_t msg)
>   spin_unlock_irqrestore(>lock, flags);
>   break;
>   case DWC3_GCTL_PRTCAP_HOST:
> - if (!PMSG_IS_AUTO(msg)) {
> + if (!PMSG_IS_AUTO(msg) && dwc->phy_power_off) {
>   ret = dwc3_core_init_for_resume(dwc);
>   if (ret)
>   return ret;
>   dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST);
>   break;
> - }
> + } else
> + dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST);
> +

nit: use curly braces since the 'if' block has them.


Re: [PATCH v5 1/4] usb: dwc3: core: Host wake up support from system suspend

2021-03-23 Thread Greg Kroah-Hartman
On Mon, Mar 22, 2021 at 11:01:17PM +0530, Sandeep Maheswaram wrote:
> Avoiding phy powerdown when wakeup capable devices are connected.

That says "what" (in a very abbreviated way), but not _WHY_ you want to
do this.  Please fix this up.

thanks,

greg k-h


[PATCH v5 1/4] usb: dwc3: core: Host wake up support from system suspend

2021-03-22 Thread Sandeep Maheswaram
Avoiding phy powerdown when wakeup capable devices are connected.

Signed-off-by: Sandeep Maheswaram 
---
 drivers/usb/dwc3/core.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 94fdbe5..9ecd7ac 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1702,7 +1702,7 @@ static int dwc3_suspend_common(struct dwc3 *dwc, 
pm_message_t msg)
dwc3_core_exit(dwc);
break;
case DWC3_GCTL_PRTCAP_HOST:
-   if (!PMSG_IS_AUTO(msg)) {
+   if (!PMSG_IS_AUTO(msg) && dwc->phy_power_off) {
dwc3_core_exit(dwc);
break;
}
@@ -1763,13 +1763,15 @@ static int dwc3_resume_common(struct dwc3 *dwc, 
pm_message_t msg)
spin_unlock_irqrestore(>lock, flags);
break;
case DWC3_GCTL_PRTCAP_HOST:
-   if (!PMSG_IS_AUTO(msg)) {
+   if (!PMSG_IS_AUTO(msg) && dwc->phy_power_off) {
ret = dwc3_core_init_for_resume(dwc);
if (ret)
return ret;
dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST);
break;
-   }
+   } else
+   dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST);
+
/* Restore GUSB2PHYCFG bits that were modified in suspend */
reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
if (dwc->dis_u2_susphy_quirk)
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation