From: vipulkumar.samar@st.com (Vipul Kumar Samar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] ARM: ABMA: Disable/Enable interface clock from suspend/resume
Date: Wed, 26 Sep 2012 16:54:07 +0530 [thread overview]
Message-ID: <1348658647-25975-3-git-send-email-vipulkumar.samar@st.com> (raw)
In-Reply-To: <1348658647-25975-1-git-send-email-vipulkumar.samar@st.com>
AMBA devices interface clock is disabled in RTPM suspend/resume hooks
but not in conventional hooks.
This patch adds support to disable/enable clock for conventional
suspend/resume calls.
Signed-off-by: Vipul Kumar Samar <vipulkumar.samar@st.com>
---
drivers/amba/bus.c | 42 +++++++++++++++++++++++++++++++++++++++---
1 file changed, 39 insertions(+), 3 deletions(-)
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index b7e7285..ded3d98 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -120,6 +120,7 @@ static int amba_legacy_resume(struct device *dev)
static int amba_pm_suspend(struct device *dev)
{
struct device_driver *drv = dev->driver;
+ struct amba_device *pcdev = to_amba_device(dev);
int ret = 0;
if (!drv)
@@ -132,16 +133,27 @@ static int amba_pm_suspend(struct device *dev)
ret = amba_legacy_suspend(dev, PMSG_SUSPEND);
}
+ if (!ret)
+ clk_disable(pcdev->pclk);
+
return ret;
}
static int amba_pm_resume(struct device *dev)
{
struct device_driver *drv = dev->driver;
+ struct amba_device *pcdev = to_amba_device(dev);
int ret = 0;
- if (!drv)
+ if (!drv) {
return 0;
+ } else {
+ ret = clk_enable(pcdev->pclk);
+ if (ret) {
+ dev_err(dev, "Resume: Clk enable failed");
+ return ret;
+ }
+ }
if (drv->pm) {
if (drv->pm->resume)
@@ -165,6 +177,7 @@ static int amba_pm_resume(struct device *dev)
static int amba_pm_freeze(struct device *dev)
{
struct device_driver *drv = dev->driver;
+ struct amba_device *pcdev = to_amba_device(dev);
int ret = 0;
if (!drv)
@@ -177,16 +190,27 @@ static int amba_pm_freeze(struct device *dev)
ret = amba_legacy_suspend(dev, PMSG_FREEZE);
}
+ if (!ret)
+ clk_disable(pcdev->pclk);
+
return ret;
}
static int amba_pm_thaw(struct device *dev)
{
struct device_driver *drv = dev->driver;
+ struct amba_device *pcdev = to_amba_device(dev);
int ret = 0;
- if (!drv)
+ if (!drv) {
return 0;
+ } else {
+ ret = clk_enable(pcdev->pclk);
+ if (ret) {
+ dev_err(dev, "Thaw: Clk enable failed");
+ return ret;
+ }
+ }
if (drv->pm) {
if (drv->pm->thaw)
@@ -201,6 +225,7 @@ static int amba_pm_thaw(struct device *dev)
static int amba_pm_poweroff(struct device *dev)
{
struct device_driver *drv = dev->driver;
+ struct amba_device *pcdev = to_amba_device(dev);
int ret = 0;
if (!drv)
@@ -213,16 +238,27 @@ static int amba_pm_poweroff(struct device *dev)
ret = amba_legacy_suspend(dev, PMSG_HIBERNATE);
}
+ if (!ret)
+ clk_disable(pcdev->pclk);
+
return ret;
}
static int amba_pm_restore(struct device *dev)
{
struct device_driver *drv = dev->driver;
+ struct amba_device *pcdev = to_amba_device(dev);
int ret = 0;
- if (!drv)
+ if (!drv) {
return 0;
+ } else {
+ ret = clk_enable(pcdev->pclk);
+ if (ret) {
+ dev_err(dev, "Restore: Clk enable failed");
+ return ret;
+ }
+ }
if (drv->pm) {
if (drv->pm->restore)
--
1.7.10
next prev parent reply other threads:[~2012-09-26 11:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-26 11:24 [PATCH 0/2] ARM: AMBA: Fix clock disable/enable issue in conventional suspend/resume Vipul Kumar Samar
2012-09-26 11:24 ` [PATCH 1/2] spi:pl022: Disable/Enable functional clock from suspend/resume Vipul Kumar Samar
2012-09-26 12:17 ` Linus Walleij
2012-09-26 12:19 ` Mark Brown
2012-09-26 12:41 ` Linus Walleij
2012-09-27 17:03 ` Mark Brown
2012-09-26 14:08 ` viresh kumar
2012-09-26 14:13 ` Linus Walleij
2012-09-26 11:24 ` Vipul Kumar Samar [this message]
2012-09-26 12:38 ` [PATCH 2/2] ARM: ABMA: Disable/Enable interface " Linus Walleij
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=1348658647-25975-3-git-send-email-vipulkumar.samar@st.com \
--to=vipulkumar.samar@st.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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).