mbox series

[v10,0/6] USB DWC3 host wake up support from system suspend

Message ID 1642398248-21753-1-git-send-email-quic_c_sanm@quicinc.com
Headers show
Series USB DWC3 host wake up support from system suspend | expand

Message

Sandeep Maheswaram Jan. 17, 2022, 5:44 a.m. UTC
Avoiding phy powerdown in host mode when wakeup capable devices are 
connected, so that it can be wake up by devices.
Set GENPD_FLAG_ALWAYS_ON flag to keep usb30_prim gdsc active to retain
controller status during suspend/resume.

Changes in v10:
PATCH 1/6: Change device_set_wakeup_capable to device_set_wakeup_enable
PATCH 2/6: Remove redundant else part in dwc3_resume_common
PATCH 4/6: Change the irg flags
PATCH 5/6: Set flag GENPD_FLAG_ALWAYS_ON
PATCH 6/6: Remove remove disable interrupts function and enable
interrupts in probe.


Changes in v9:
Checking with device_may_makeup property instead of phy_power_off flag.
Changed the IRQ flags and removed hs_phy_mode variable.

Changes in v8:
Moved the dwc3 suspend quirk code in dwc3/host.c to xhci-plat.c
Checking phy_power_off flag instead of usb_wakeup_enabled_descendants 
to keep gdsc active.

Changes in v7:
Change in commit text and message in PATCH 1/5 and PATCH 5/5
as per Matthias suggestion.
Added curly braces for if and else if sections in PATCH 4/5.

Changes in v6:
Addressed comments in host.c and core.c
Separated the patches in dwc3-qcom.c to make it simple.
Dropped wakeup-source change as it is not related to this series.

Changes in v5:
Added phy_power_off flag to check presence of wakeup capable devices.
Dropped patch[v4,4/5] as it is present linux-next.
Addressed comments in host.c and dwc3-qcom.c.

Changes in v4:
Addressed Matthias comments raised in v3.

Changes in v3:
Removed need_phy_for_wakeup flag and by default avoiding phy powerdown.
Addressed Matthias comments and added entry for DEV_SUPERSPEED.
Added suspend_quirk in dwc3 host and moved the dwc3_set_phy_speed_flags.
Added wakeup-source dt entry and reading in dwc-qcom.c glue driver.

Changes in v2:
Dropped the patch in clock to set GENPD_FLAG_ACTIVE_WAKEUP flag and 
setting in usb dwc3 driver.
Separated the core patch and glue driver patch.
Made need_phy_for_wakeup flag part of dwc structure and 
hs_phy_flags as unsgined int.
Adrressed the comment on device_init_wakeup call.
Corrected offset for reading portsc register.
Added pacth to support wakeup in xo shutdown case.

Sandeep Maheswaram (6):
  usb: host: xhci: plat: Add suspend quirk for dwc3 controller
  usb: dwc3: core: Host wake up support from system suspend
  usb: dwc3: qcom: Add helper functions to enable,disable wake irqs
  usb: dwc3: qcom: Change the IRQ flag for DP/DM hs phy irq
  usb: dwc3: qcom: Keep power domain on to retain controller status
  usb: dwc3: qcom: Enable the interrupts during probe

 drivers/usb/dwc3/core.c      |  4 +--
 drivers/usb/dwc3/dwc3-qcom.c | 64 +++++++++++++++-----------------------------
 drivers/usb/host/xhci-plat.c | 12 +++++++++
 3 files changed, 36 insertions(+), 44 deletions(-)

Comments

Sandeep Maheswaram Jan. 18, 2022, 6:30 a.m. UTC | #1
Hi Steev,

On 1/18/2022 11:42 AM, Steev Klimaszewski wrote:
>
> On 1/16/22 11:44 PM, Sandeep Maheswaram wrote:
>> Enable the interrupts during probe and remove the disable interrupts
>> function.
>>
>> Signed-off-by: Sandeep Maheswaram <quic_c_sanm@quicinc.com>
>> ---
>>   drivers/usb/dwc3/dwc3-qcom.c | 28 ++++------------------------
>>   1 file changed, 4 insertions(+), 24 deletions(-)
>>
>> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
>> index 54dc3d3..7c5e636 100644
>> --- a/drivers/usb/dwc3/dwc3-qcom.c
>> +++ b/drivers/usb/dwc3/dwc3-qcom.c
>> @@ -306,25 +306,7 @@ static void dwc3_qcom_enable_wakeup_irq(int irq)
>>       enable_irq_wake(irq);
>>   }
>>   -static void dwc3_qcom_disable_wakeup_irq(int irq)
>> -{
>> -    if (!irq)
>> -        return;
>> -
>> -    disable_irq_wake(irq);
>> -    disable_irq_nosync(irq);
>> -}
>>   -static void dwc3_qcom_disable_interrupts(struct dwc3_qcom *qcom)
>> -{
>> -    dwc3_qcom_disable_wakeup_irq(qcom->hs_phy_irq);
>> -
>> -    dwc3_qcom_disable_wakeup_irq(qcom->dp_hs_phy_irq);
>> -
>> -    dwc3_qcom_disable_wakeup_irq(qcom->dm_hs_phy_irq);
>> -
>> -    dwc3_qcom_disable_wakeup_irq(qcom->ss_phy_irq);
>> -}
>>     static void dwc3_qcom_enable_interrupts(struct dwc3_qcom *qcom)
>>   {
>> @@ -356,9 +338,6 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom)
>>       if (ret)
>>           dev_warn(qcom->dev, "failed to disable interconnect: %d\n", 
>> ret);
>>   -    if (device_may_wakeup(qcom->dev))
>> -        dwc3_qcom_enable_interrupts(qcom);
>> -
>>       qcom->is_suspended = true;
>>         return 0;
>> @@ -372,9 +351,6 @@ static int dwc3_qcom_resume(struct dwc3_qcom *qcom)
>>       if (!qcom->is_suspended)
>>           return 0;
>>   -    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]);
>>           if (ret < 0) {
>> @@ -832,6 +808,10 @@ static int dwc3_qcom_probe(struct 
>> platform_device *pdev)
>>       genpd->flags |= GENPD_FLAG_ALWAYS_ON;
>>         device_init_wakeup(&pdev->dev, 1);
>> +
>> +    if (device_may_wakeup(qcom->dev))
>> +        dwc3_qcom_enable_interrupts(qcom);
>> +
>>       qcom->is_suspended = false;
>>       pm_runtime_set_active(dev);
>>       pm_runtime_enable(dev);
>
> Hi Sandeep,
>
> I was testing this series on my Lenovo Yoga C630, and with this patch 
> in particular applied, my system will no longer boot. Unfortunately I 
> don't get any sort of good output at all, I just get hung tasks when 
> trying to probe things it would seem.
>
>
> With the other 5 patches in the series applied, the system still boots 
> and works correctly.
>
>
> -- Steev
>
Will check this. Is your controller in host mode or device mode?

Regards

Sandeep
Steev Klimaszewski Jan. 18, 2022, 8:46 a.m. UTC | #2
On 1/18/22 12:30 AM, Sandeep Maheswaram wrote:
> Hi Steev,
<snip>
>> Hi Sandeep,
>>
>> I was testing this series on my Lenovo Yoga C630, and with this patch 
>> in particular applied, my system will no longer boot. Unfortunately I 
>> don't get any sort of good output at all, I just get hung tasks when 
>> trying to probe things it would seem.
>>
>>
>> With the other 5 patches in the series applied, the system still 
>> boots and works correctly.
>>
>>
>> -- Steev
>>
> Will check this. Is your controller in host mode or device mode?
>
> Regards
>
> Sandeep
>
Both usb_1_dwc3 and usb_2_dwc3 are in host mode

-- Steev