]> git.baikalelectronics.ru Git - kernel.git/commitdiff
usb: host: xhci-plat: add .suspend_quirk for struct xhci_plat_priv
authorPeter Chen <peter.chen@nxp.com>
Fri, 18 Sep 2020 13:17:44 +0000 (16:17 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 20 Sep 2020 14:18:00 +0000 (16:18 +0200)
Some platforms (eg cdns3) may have special sequences between
xhci_bus_suspend and xhci_suspend, add .suspend_quick for it.

Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20200918131752.16488-3-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-plat.c
drivers/usb/host/xhci-plat.h

index c7f98edc56781f3326bfff9eeb9caa7582aa3d4f..c3ce4d762adff39d96b8469d6e9dcdb6e4357b3d 100644 (file)
@@ -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);
@@ -401,7 +411,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
@@ -438,6 +452,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);
 }
index b49f6447bd3a5d870f91334ce34b68e8c4b1a467..1fb149d1fbcea319d712ccc9af6857e54c9cc6f8 100644 (file)
@@ -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 *);
 };