Commit 8bd954c5 authored by Justin Chen's avatar Justin Chen Committed by Greg Kroah-Hartman

usb: host: xhci-plat: suspend and resume clocks

Introduce XHCI_SUSPEND_RESUME_CLKS quirk as a means to suspend and resume
clocks if the hardware is capable of doing so. We assume that clocks will
be needed if the device may wake.
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarJustin Chen <justinpopo6@gmail.com>
Link: https://lore.kernel.org/r/1660170455-15781-2-git-send-email-justinpopo6@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b7feb442
...@@ -432,7 +432,16 @@ static int __maybe_unused xhci_plat_suspend(struct device *dev) ...@@ -432,7 +432,16 @@ static int __maybe_unused xhci_plat_suspend(struct device *dev)
* xhci_suspend() needs `do_wakeup` to know whether host is allowed * xhci_suspend() needs `do_wakeup` to know whether host is allowed
* to do wakeup during suspend. * to do wakeup during suspend.
*/ */
return xhci_suspend(xhci, device_may_wakeup(dev)); ret = xhci_suspend(xhci, device_may_wakeup(dev));
if (ret)
return ret;
if (!device_may_wakeup(dev) && (xhci->quirks & XHCI_SUSPEND_RESUME_CLKS)) {
clk_disable_unprepare(xhci->clk);
clk_disable_unprepare(xhci->reg_clk);
}
return 0;
} }
static int __maybe_unused xhci_plat_resume(struct device *dev) static int __maybe_unused xhci_plat_resume(struct device *dev)
...@@ -441,6 +450,11 @@ static int __maybe_unused xhci_plat_resume(struct device *dev) ...@@ -441,6 +450,11 @@ static int __maybe_unused xhci_plat_resume(struct device *dev)
struct xhci_hcd *xhci = hcd_to_xhci(hcd); struct xhci_hcd *xhci = hcd_to_xhci(hcd);
int ret; int ret;
if (!device_may_wakeup(dev) && (xhci->quirks & XHCI_SUSPEND_RESUME_CLKS)) {
clk_prepare_enable(xhci->clk);
clk_prepare_enable(xhci->reg_clk);
}
ret = xhci_priv_resume_quirk(hcd); ret = xhci_priv_resume_quirk(hcd);
if (ret) if (ret)
return ret; return ret;
......
...@@ -1899,6 +1899,7 @@ struct xhci_hcd { ...@@ -1899,6 +1899,7 @@ struct xhci_hcd {
#define XHCI_NO_SOFT_RETRY BIT_ULL(40) #define XHCI_NO_SOFT_RETRY BIT_ULL(40)
#define XHCI_BROKEN_D3COLD BIT_ULL(41) #define XHCI_BROKEN_D3COLD BIT_ULL(41)
#define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42) #define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42)
#define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43)
unsigned int num_active_eps; unsigned int num_active_eps;
unsigned int limit_active_eps; unsigned int limit_active_eps;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment