Re: [PATCH v3 1/2] USB: Extend pci resume function to handle PM events

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
  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.

  	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

  }
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

  	if (err < 0) {
  		dev_err(tegra->dev, "failed to resume XHCI: %d\n", err);
  		goto disable_phy;

Thanks
Mathias



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux