xhci-plat: Add hibernation support to xhci platform
Add hibernation support to xhci platform by adding the proper PM ops freeze and restore. Also set the hibernated argument to xhci_resume which will trigger the reset-resume of the connected root-hubs and the devices. Change-Id: Ib536bb2485928326f34bfc3422b672cc62309efe Signed-off-by: Sriharsha Allenki <sallenki@codeaurora.org> Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
This commit is contained in:
parent
6a6d52ab38
commit
dd4a9bfbf0
1 changed files with 38 additions and 1 deletions
|
@ -370,6 +370,39 @@ static int xhci_plat_runtime_idle(struct device *dev)
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int xhci_plat_pm_freeze(struct device *dev)
|
||||||
|
{
|
||||||
|
struct usb_hcd *hcd = dev_get_drvdata(dev);
|
||||||
|
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
|
||||||
|
|
||||||
|
if (!xhci)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
dev_dbg(dev, "xhci-plat freeze\n");
|
||||||
|
|
||||||
|
return xhci_suspend(xhci, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int xhci_plat_pm_restore(struct device *dev)
|
||||||
|
{
|
||||||
|
struct usb_hcd *hcd = dev_get_drvdata(dev);
|
||||||
|
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (!xhci)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
dev_dbg(dev, "xhci-plat restore\n");
|
||||||
|
|
||||||
|
ret = xhci_resume(xhci, true);
|
||||||
|
pm_runtime_disable(dev);
|
||||||
|
pm_runtime_set_active(dev);
|
||||||
|
pm_runtime_enable(dev);
|
||||||
|
pm_runtime_mark_last_busy(dev);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static int xhci_plat_runtime_suspend(struct device *dev)
|
static int xhci_plat_runtime_suspend(struct device *dev)
|
||||||
{
|
{
|
||||||
struct usb_hcd *hcd = dev_get_drvdata(dev);
|
struct usb_hcd *hcd = dev_get_drvdata(dev);
|
||||||
|
@ -401,7 +434,11 @@ static int xhci_plat_runtime_resume(struct device *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct dev_pm_ops xhci_plat_pm_ops = {
|
static const struct dev_pm_ops xhci_plat_pm_ops = {
|
||||||
SET_SYSTEM_SLEEP_PM_OPS(xhci_plat_suspend, xhci_plat_resume)
|
.suspend = xhci_plat_suspend,
|
||||||
|
.resume = xhci_plat_resume,
|
||||||
|
.freeze = xhci_plat_pm_freeze,
|
||||||
|
.restore = xhci_plat_pm_restore,
|
||||||
|
.thaw = xhci_plat_pm_restore,
|
||||||
SET_RUNTIME_PM_OPS(xhci_plat_runtime_suspend, xhci_plat_runtime_resume,
|
SET_RUNTIME_PM_OPS(xhci_plat_runtime_suspend, xhci_plat_runtime_resume,
|
||||||
xhci_plat_runtime_idle)
|
xhci_plat_runtime_idle)
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue