Re: [PATCH v2] usb: xhci: add the suspend/resume functionality

2013-02-26 Thread Sarah Sharp
Ok, I've added this patch to my for-usb-next-queue branch.  I'll be
sending it off to Greg for 3.10 after 3.9-rc1 is out and he's accepting
pull requests again.

Sarah Sharp

On Mon, Feb 11, 2013 at 12:58:00PM +0200, Felipe Balbi wrote:
 From: Vikas Sajjan vikas.saj...@linaro.org
 
 Adds power management support to xHCI platform driver.
 
 This patch facilitates the transition of xHCI host controller
 between S0 and S3/S4 power states, during suspend/resume cycles.
 
 Signed-off-by: Abhilash Kesavan a.kesa...@samsung.com
 Signed-off-by: Vikas C Sajjan vikas.saj...@linaro.org
 CC: Doug Anderson diand...@chromium.org
 Signed-off-by: Felipe Balbi ba...@ti.com
 ---
 
 changes since v1:
   - better placement for #edif
   - use DEV_PM_OPS trickery (although not really necessary,
   it looks a bit nicer)
 
  drivers/usb/host/xhci-plat.c | 26 ++
  1 file changed, 26 insertions(+)
 
 diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
 index df90fe5..c9c7e13 100644
 --- a/drivers/usb/host/xhci-plat.c
 +++ b/drivers/usb/host/xhci-plat.c
 @@ -185,11 +185,37 @@ static int xhci_plat_remove(struct platform_device *dev)
   return 0;
  }
  
 +#ifdef CONFIG_PM
 +static int xhci_plat_suspend(struct device *dev)
 +{
 + struct usb_hcd  *hcd = dev_get_drvdata(dev);
 + struct xhci_hcd *xhci = hcd_to_xhci(hcd);
 +
 + return xhci_suspend(xhci);
 +}
 +
 +static int xhci_plat_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);
 +}
 +
 +static const struct dev_pm_ops xhci_plat_pm_ops = {
 + SET_SYSTEM_SLEEP_PM_OPS(xhci_plat_suspend, xhci_plat_resume)
 +};
 +#define DEV_PM_OPS   (xhci_plat_pm_ops)
 +#else
 +#define DEV_PM_OPS   NULL
 +#endif /* CONFIG_PM */
 +
  static struct platform_driver usb_xhci_driver = {
   .probe  = xhci_plat_probe,
   .remove = xhci_plat_remove,
   .driver = {
   .name = xhci-hcd,
 + .pm = DEV_PM_OPS,
   },
  };
  MODULE_ALIAS(platform:xhci-hcd);
 -- 
 1.8.1.rc1.5.g7e0651a
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-usb in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] usb: xhci: add the suspend/resume functionality

2013-02-11 Thread Felipe Balbi
From: Vikas Sajjan vikas.saj...@linaro.org

Adds power management support to xHCI platform driver.

This patch facilitates the transition of xHCI host controller
between S0 and S3/S4 power states, during suspend/resume cycles.

Signed-off-by: Abhilash Kesavan a.kesa...@samsung.com
Signed-off-by: Vikas C Sajjan vikas.saj...@linaro.org
CC: Doug Anderson diand...@chromium.org
Signed-off-by: Felipe Balbi ba...@ti.com
---

changes since v1:
- better placement for #edif
- use DEV_PM_OPS trickery (although not really necessary,
it looks a bit nicer)

 drivers/usb/host/xhci-plat.c | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index df90fe5..c9c7e13 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -185,11 +185,37 @@ static int xhci_plat_remove(struct platform_device *dev)
return 0;
 }
 
+#ifdef CONFIG_PM
+static int xhci_plat_suspend(struct device *dev)
+{
+   struct usb_hcd  *hcd = dev_get_drvdata(dev);
+   struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+
+   return xhci_suspend(xhci);
+}
+
+static int xhci_plat_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);
+}
+
+static const struct dev_pm_ops xhci_plat_pm_ops = {
+   SET_SYSTEM_SLEEP_PM_OPS(xhci_plat_suspend, xhci_plat_resume)
+};
+#define DEV_PM_OPS (xhci_plat_pm_ops)
+#else
+#define DEV_PM_OPS NULL
+#endif /* CONFIG_PM */
+
 static struct platform_driver usb_xhci_driver = {
.probe  = xhci_plat_probe,
.remove = xhci_plat_remove,
.driver = {
.name = xhci-hcd,
+   .pm = DEV_PM_OPS,
},
 };
 MODULE_ALIAS(platform:xhci-hcd);
-- 
1.8.1.rc1.5.g7e0651a

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html