diff mbox series

[4/8] usb: host: xhci-plat: add .suspend_quirk for struct xhci_plat_priv

Message ID 20200522103256.16322-5-peter.chen@nxp.com (mailing list archive)
State New, archived
Headers show
Series usb: cdns3: add runtime PM support | expand

Commit Message

Peter Chen May 22, 2020, 10:32 a.m. UTC
Some platforms (eg cdns3) may have special sequences between
xhci_bus_suspend and xhci_suspend, add .suspend_quick for it.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 drivers/usb/host/xhci-plat.c | 19 +++++++++++++++++++
 drivers/usb/host/xhci-plat.h |  1 +
 2 files changed, 20 insertions(+)

Comments

Felipe Balbi Aug. 31, 2020, 10:06 a.m. UTC | #1
Peter Chen <peter.chen@nxp.com> writes:

> Some platforms (eg cdns3) may have special sequences between
> xhci_bus_suspend and xhci_suspend, add .suspend_quick for it.
                                                  ^^^^^
                                                  quirk?
Peter Chen Aug. 31, 2020, 11 a.m. UTC | #2
> Subject: Re: [PATCH 4/8] usb: host: xhci-plat: add .suspend_quirk for struct
> xhci_plat_priv
> 
> Peter Chen <peter.chen@nxp.com> writes:
> 
> > Some platforms (eg cdns3) may have special sequences between
> > xhci_bus_suspend and xhci_suspend, add .suspend_quick for it.
>                                                   ^^^^^
>                                                   quirk?
> 

Thanks, will change.

Peter
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index e00efd84ea1a..ca02e7f36238 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -54,6 +54,16 @@  static int xhci_priv_init_quirk(struct usb_hcd *hcd)
 	return priv->init_quirk(hcd);
 }
 
+static int xhci_priv_suspend_quirk(struct usb_hcd *hcd)
+{
+	struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
+
+	if (!priv->suspend_quirk)
+		return 0;
+
+	return priv->suspend_quirk(hcd);
+}
+
 static int xhci_priv_resume_quirk(struct usb_hcd *hcd)
 {
 	struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
@@ -396,7 +406,11 @@  static int __maybe_unused xhci_plat_suspend(struct device *dev)
 {
 	struct usb_hcd	*hcd = dev_get_drvdata(dev);
 	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
+	int ret;
 
+	ret = xhci_priv_suspend_quirk(hcd);
+	if (ret)
+		return ret;
 	/*
 	 * xhci_suspend() needs `do_wakeup` to know whether host is allowed
 	 * to do wakeup during suspend. Since xhci_plat_suspend is currently
@@ -425,6 +439,11 @@  static int __maybe_unused xhci_plat_runtime_suspend(struct device *dev)
 {
 	struct usb_hcd  *hcd = dev_get_drvdata(dev);
 	struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+	int ret;
+
+	ret = xhci_priv_suspend_quirk(hcd);
+	if (ret)
+		return ret;
 
 	return xhci_suspend(xhci, true);
 }
diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h
index 5681723fc9cd..9338a4f946d0 100644
--- a/drivers/usb/host/xhci-plat.h
+++ b/drivers/usb/host/xhci-plat.h
@@ -15,6 +15,7 @@  struct xhci_plat_priv {
 	unsigned long long quirks;
 	void (*plat_start)(struct usb_hcd *);
 	int (*init_quirk)(struct usb_hcd *);
+	int (*suspend_quirk)(struct usb_hcd *);
 	int (*resume_quirk)(struct usb_hcd *);
 };