[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-usb
Subject:    Re: [PATCH v3 1/2] USB: Extend pci resume function to handle PM events
From:       Basavaraj Natikar <bnatikar () amd ! com>
Date:       2023-04-28 13:22:30
Message-ID: f02f613c-5d21-82f9-abf6-89b1378c3545 () amd ! com
[Download RAW message or body]


On 4/28/2023 5:45 PM, Mathias Nyman wrote:
> On 27.4.2023 20.42, Basavaraj Natikar wrote:
>> Currently, the pci_resume method has only a flag indicating whether the
>> system is resuming from hibernation. In order to handle all PM events
>> like
>> AUTO_RESUME (runtime resume from device in D3), RESUME (system resume
>> from
>> s2idle, S3 or S4 states) etc change the pci_resume method to handle
>> all PM
>> events.
>>
>> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
>> ---
>>   drivers/usb/core/hcd-pci.c    | 24 +++++++++++++-----------
>>   drivers/usb/host/ehci-pci.c   |  3 ++-
>>   drivers/usb/host/ohci-pci.c   |  8 +++++++-
>>   drivers/usb/host/uhci-pci.c   |  7 ++++---
>>   drivers/usb/host/xhci-histb.c |  2 +-
>>   drivers/usb/host/xhci-pci.c   |  4 ++--
>>   drivers/usb/host/xhci-plat.c  |  4 ++--
>>   drivers/usb/host/xhci-tegra.c |  2 +-
>>   drivers/usb/host/xhci.c       |  3 ++-
>>   drivers/usb/host/xhci.h       |  2 +-
>>   include/linux/usb/hcd.h       |  2 +-
>>   11 files changed, 36 insertions(+), 25 deletions(-)
>>
>
> ...
>
>>   diff --git a/drivers/usb/host/xhci-plat.c
>> b/drivers/usb/host/xhci-plat.c
>> index b9f9625467d6..727e771d4d5f 100644
>> --- a/drivers/usb/host/xhci-plat.c
>> +++ b/drivers/usb/host/xhci-plat.c
>> @@ -465,7 +465,7 @@ static int __maybe_unused xhci_plat_resume(struct
>> device *dev)
>>       if (ret)
>>           return ret;
>>   -    ret = xhci_resume(xhci, 0);
>> +    ret = xhci_resume(xhci, PMSG_ON);
>
> Maybe PMSG_RESUME, not that it has any bigger impact.

Sure will change it to PMSG_RESUME

>
>>       if (ret)
>>           return ret;
>>   @@ -494,7 +494,7 @@ static int __maybe_unused
>> xhci_plat_runtime_resume(struct device *dev)
>>       struct usb_hcd  *hcd = dev_get_drvdata(dev);
>>       struct xhci_hcd *xhci = hcd_to_xhci(hcd);
>>   -    return xhci_resume(xhci, 0);
>> +    return xhci_resume(xhci, PMSG_ON);
>
> This should be PMSG_AUTO_RESUME, otherwise we will skip the 120ms port
> event check that needs
> to be done for runtime resume cases
>
yes correct will change to PMSG_AUTO_RESUME

>>   }
>>     const struct dev_pm_ops xhci_plat_pm_ops = {
>> diff --git a/drivers/usb/host/xhci-tegra.c
>> b/drivers/usb/host/xhci-tegra.c
>> index a88c39e525c2..665f5c20f551 100644
>> --- a/drivers/usb/host/xhci-tegra.c
>> +++ b/drivers/usb/host/xhci-tegra.c
>> @@ -2275,7 +2275,7 @@ static int tegra_xusb_exit_elpg(struct
>> tegra_xusb *tegra, bool runtime)
>>       if (wakeup)
>>           tegra_xhci_disable_phy_sleepwalk(tegra);
>>   -    err = xhci_resume(xhci, 0);
>> +    err = xhci_resume(xhci, PMSG_ON);
>
> Same here,  runtime ? PMSG_AUTO_RESUME : PMSG_RESUME

yes will change accordingly.

Thanks,
--
Basavaraj


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic