From: Vikas C Sajjan <vikas.sajjan@linaro.org>
To: linux-usb@vger.kernel.org
Cc: linux-omap@vger.kernel.org, gregkh@linuxfoundation.org,
sarah.a.sharp@linux.intel.com, balbi@ti.com,
Vikas Sajjan <vikas.sajjan@linaro.org>,
Abhilash Kesavan <a.kesavan@samsung.com>,
Doug Anderson <dianders@chromium.org>
Subject: [PATCH 2/3] usb: xhci: Add the suspend/resume functionality
Date: Wed, 10 Oct 2012 19:35:48 +0530 [thread overview]
Message-ID: <1349877949-18872-3-git-send-email-vikas.sajjan@linaro.org> (raw)
In-Reply-To: <1349877949-18872-1-git-send-email-vikas.sajjan@linaro.org>
From: Vikas Sajjan <vikas.sajjan@linaro.org>
Adding the suspend and resume functionality for the XHCI driver
Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
Signed-off-by: Vikas C Sajjan <vikas.sajjan@linaro.org>
CC: Doug Anderson <dianders@chromium.org>
---
drivers/usb/host/xhci-plat.c | 44 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index df90fe5..384cf4d 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -185,11 +185,55 @@ 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;
+ struct xhci_hcd *xhci;
+
+ hcd = dev_get_drvdata(dev);
+ if (!hcd)
+ return -EINVAL;
+
+ xhci = hcd_to_xhci(hcd);
+
+ /* Make sure that the HCD Core as set state HC_STATE_SUSPENDED */
+ if (hcd->state != HC_STATE_SUSPENDED ||
+ xhci->shared_hcd->state != HC_STATE_SUSPENDED)
+ return -EINVAL;
+
+ return xhci_suspend(xhci);
+}
+
+static int xhci_plat_resume(struct device *dev)
+{
+ struct usb_hcd *hcd;
+ struct xhci_hcd *xhci;
+
+ hcd = dev_get_drvdata(dev);
+
+ if (!hcd)
+ return -EINVAL;
+
+ xhci = hcd_to_xhci(hcd);
+
+ return xhci_resume(xhci, 0);
+}
+
+static const struct dev_pm_ops xhci_plat_pm_ops = {
+ .suspend = xhci_plat_suspend,
+ .resume = xhci_plat_resume,
+};
+#endif
+
static struct platform_driver usb_xhci_driver = {
.probe = xhci_plat_probe,
.remove = xhci_plat_remove,
.driver = {
.name = "xhci-hcd",
+#ifdef CONFIG_PM
+ .pm = &xhci_plat_pm_ops,
+#endif
},
};
MODULE_ALIAS("platform:xhci-hcd");
--
1.7.6.5
next prev parent reply other threads:[~2012-10-10 14:02 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-10 14:05 [PATCH 0/3] USB: dwc3: Add suspend/resume support Vikas C Sajjan
2012-10-10 14:05 ` [PATCH 1/3] usb: dwc3: Add the suspend/resume functionality Vikas C Sajjan
2012-10-11 7:47 ` Felipe Balbi
2012-10-12 8:59 ` Vikas Sajjan
[not found] ` <CAD025yS8sgTu=euBGErgysR0Xe135u=rv88how6z=dhVMEDniw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-10-12 10:35 ` Felipe Balbi
[not found] ` <1349877949-18872-2-git-send-email-vikas.sajjan-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-10-12 10:57 ` kishon
2012-10-12 13:54 ` Vikas Sajjan
[not found] ` <CAD025yRKnLWKzVGneMnudSKHasWw-2Qe8b40VpiFJev=zPiVdw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-10-15 12:02 ` Felipe Balbi
2012-10-10 14:05 ` Vikas C Sajjan [this message]
2012-10-10 17:58 ` [PATCH 2/3] usb: xhci: " Sarah Sharp
2012-10-11 7:35 ` Felipe Balbi
[not found] ` <1349877949-18872-3-git-send-email-vikas.sajjan-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-10-11 7:52 ` Felipe Balbi
[not found] ` <CAD025yQqytufzhcuuOkR9-qAVFLn7EssTCquV4bJEXsqoUZ8Qw@mail.gmail.com>
2012-10-11 9:01 ` Felipe Balbi
[not found] ` <1349877949-18872-1-git-send-email-vikas.sajjan-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-10-10 14:05 ` [PATCH 3/3] exynos5: usb: dwc3: " Vikas C Sajjan
2012-10-11 7:39 ` Felipe Balbi
2012-10-11 7:39 ` [PATCH 0/3] USB: dwc3: Add suspend/resume support Felipe Balbi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1349877949-18872-3-git-send-email-vikas.sajjan@linaro.org \
--to=vikas.sajjan@linaro.org \
--cc=a.kesavan@samsung.com \
--cc=balbi@ti.com \
--cc=dianders@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=sarah.a.sharp@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).