All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vivek Gautam <gautam.vivek@samsung.com>
To: linux-usb@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-samsung-soc@vger.kernel.org, gregkh@linuxfoundation.org,
	balbi@ti.com, sarah.a.sharp@linux.intel.com,
	kgene.kim@samsung.com, kishon@ti.com
Subject: [PATCH v2 04/10] usb: dwc3: Add runtime power management callbacks
Date: Sat, 02 Mar 2013 18:53:05 +0530	[thread overview]
Message-ID: <1362230590-20960-5-git-send-email-gautam.vivek@samsung.com> (raw)
In-Reply-To: <1362230590-20960-1-git-send-email-gautam.vivek@samsung.com>

Right now it doesn't handle full runtime suspend/resume
functionality. However it allows to handle PHYs' sleep
and wakeup across runtime suspend/resume.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
---
 drivers/usb/dwc3/core.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 2a77327..45e1aae 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -704,11 +704,38 @@ static int dwc3_resume(struct device *dev)
 	return 0;
 }
 
+#ifdef CONFIG_PM_RUNTIME
+static int dwc3_runtime_suspend(struct device *dev)
+{
+	struct dwc3	*dwc = dev_get_drvdata(dev);
+
+	usb_phy_autopm_put_sync(dwc->usb2_phy);
+	usb_phy_autopm_put_sync(dwc->usb3_phy);
+
+	return 0;
+}
+
+static int dwc3_runtime_resume(struct device *dev)
+{
+	struct dwc3	*dwc = dev_get_drvdata(dev);
+
+	usb_phy_autopm_get_sync(dwc->usb2_phy);
+	usb_phy_autopm_get_sync(dwc->usb3_phy);
+
+	return 0;
+}
+#else
+#define dwc3_runtime_suspend		NULL
+#define dwc3_runtime_resume		NULL
+#endif
+
 static const struct dev_pm_ops dwc3_dev_pm_ops = {
 	.prepare	= dwc3_prepare,
 	.complete	= dwc3_complete,
 
 	SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume)
+	SET_RUNTIME_PM_OPS(dwc3_runtime_suspend,
+				dwc3_runtime_resume, NULL)
 };
 
 #define DWC3_PM_OPS	&(dwc3_dev_pm_ops)
-- 
1.7.6.5


WARNING: multiple messages have this Message-ID (diff)
From: Vivek Gautam <gautam.vivek-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
To: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
	balbi-l0cyMroinI0@public.gmane.org,
	sarah.a.sharp-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
	kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
	kishon-l0cyMroinI0@public.gmane.org
Subject: [PATCH v2 04/10] usb: dwc3: Add runtime power management callbacks
Date: Sat, 02 Mar 2013 18:53:05 +0530	[thread overview]
Message-ID: <1362230590-20960-5-git-send-email-gautam.vivek@samsung.com> (raw)
In-Reply-To: <1362230590-20960-1-git-send-email-gautam.vivek-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>

Right now it doesn't handle full runtime suspend/resume
functionality. However it allows to handle PHYs' sleep
and wakeup across runtime suspend/resume.

Signed-off-by: Vivek Gautam <gautam.vivek-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
---
 drivers/usb/dwc3/core.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 2a77327..45e1aae 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -704,11 +704,38 @@ static int dwc3_resume(struct device *dev)
 	return 0;
 }
 
+#ifdef CONFIG_PM_RUNTIME
+static int dwc3_runtime_suspend(struct device *dev)
+{
+	struct dwc3	*dwc = dev_get_drvdata(dev);
+
+	usb_phy_autopm_put_sync(dwc->usb2_phy);
+	usb_phy_autopm_put_sync(dwc->usb3_phy);
+
+	return 0;
+}
+
+static int dwc3_runtime_resume(struct device *dev)
+{
+	struct dwc3	*dwc = dev_get_drvdata(dev);
+
+	usb_phy_autopm_get_sync(dwc->usb2_phy);
+	usb_phy_autopm_get_sync(dwc->usb3_phy);
+
+	return 0;
+}
+#else
+#define dwc3_runtime_suspend		NULL
+#define dwc3_runtime_resume		NULL
+#endif
+
 static const struct dev_pm_ops dwc3_dev_pm_ops = {
 	.prepare	= dwc3_prepare,
 	.complete	= dwc3_complete,
 
 	SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume)
+	SET_RUNTIME_PM_OPS(dwc3_runtime_suspend,
+				dwc3_runtime_resume, NULL)
 };
 
 #define DWC3_PM_OPS	&(dwc3_dev_pm_ops)
-- 
1.7.6.5

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

  parent reply	other threads:[~2013-03-02 13:27 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-02 13:23 [PATCH v2 00/10] usb: dwc3/xhci/phy: Enable runtime power management Vivek Gautam
2013-03-02 13:23 ` [PATCH v2 01/10] usb: phy: Add APIs for " Vivek Gautam
2013-03-02 13:23   ` Vivek Gautam
2013-03-04 15:29   ` Felipe Balbi
2013-03-04 15:29     ` Felipe Balbi
2013-03-02 13:23 ` [PATCH v2 02/10] USB: dwc3: Adjust runtime pm to allow autosuspend Vivek Gautam
2013-03-02 13:23 ` [PATCH v2 03/10] usb: dwc3: Enable runtime pm only after PHYs are initialized Vivek Gautam
2013-03-02 13:23 ` Vivek Gautam [this message]
2013-03-02 13:23   ` [PATCH v2 04/10] usb: dwc3: Add runtime power management callbacks Vivek Gautam
2013-03-02 13:23 ` [PATCH v2 05/10] usb: dwc3: exynos: Enable runtime power management Vivek Gautam
2013-03-02 13:23 ` [PATCH v2 06/10] usb: xhci: Enable runtime pm in xhci-plat Vivek Gautam
2013-03-02 13:23   ` Vivek Gautam
2013-03-02 15:53   ` Alan Stern
2013-03-02 15:53     ` Alan Stern
2013-03-02 20:39     ` Felipe Balbi
2013-03-02 20:39       ` Felipe Balbi
2013-03-02 22:02       ` Alan Stern
2013-03-02 22:02         ` Alan Stern
2013-03-02 23:21         ` Felipe Balbi
2013-03-02 23:21           ` Felipe Balbi
2013-03-02 23:24           ` Felipe Balbi
2013-03-02 23:24             ` Felipe Balbi
2013-03-04 15:57           ` Alan Stern
2013-03-04 15:57             ` Alan Stern
2013-03-04  8:08     ` Vivek Gautam
2013-03-04 15:29       ` Alan Stern
2013-03-04 15:29         ` Alan Stern
2013-03-02 13:23 ` [PATCH v2 07/10] usb: phy: samsung: Enable runtime power management on usb3phy Vivek Gautam
2013-03-02 13:23 ` [PATCH v2 08/10] usb: phy: samsung: Add support for external reference clock Vivek Gautam
2013-03-02 13:23 ` [PATCH v2 09/10] usb: phy: samsung: Add support for PHY ref_clk gpio Vivek Gautam

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=1362230590-20960-5-git-send-email-gautam.vivek@samsung.com \
    --to=gautam.vivek@samsung.com \
    --cc=balbi@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kgene.kim@samsung.com \
    --cc=kishon@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-samsung-soc@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.