From patchwork Wed Sep 26 11:24:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: vipul kumar samar X-Patchwork-Id: 1509031 Return-Path: X-Original-To: patchwork-spi-devel-general@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by patchwork2.kernel.org (Postfix) with ESMTP id 31CBCDF238 for ; Wed, 26 Sep 2012 11:24:38 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-2.b.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1TGpjJ-0005fY-Ie; Wed, 26 Sep 2012 11:24:37 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1TGpjI-0005fQ-5L for spi-devel-general@lists.sourceforge.net; Wed, 26 Sep 2012 11:24:36 +0000 X-ACL-Warn: Received: from eu1sys200aog110.obsmtp.com ([207.126.144.129]) by sog-mx-1.v43.ch3.sourceforge.com with smtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1TGpjG-0000m4-Tc for spi-devel-general@lists.sourceforge.net; Wed, 26 Sep 2012 11:24:36 +0000 Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob110.postini.com ([207.126.147.11]) with SMTP ID DSNKUGLl4Y6QGrRUywa+wuldVKX98T3ZxlqF@postini.com; Wed, 26 Sep 2012 11:24:34 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 08DDFCE; Wed, 26 Sep 2012 11:15:59 +0000 (GMT) Received: from Webmail-ap.st.com (eapex1hubcas4.st.com [10.80.176.69]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id D188D909; Wed, 26 Sep 2012 11:24:13 +0000 (GMT) Received: from localhost (10.199.88.141) by Webmail-ap.st.com (10.80.176.7) with Microsoft SMTP Server (TLS) id 8.3.192.1; Wed, 26 Sep 2012 19:24:13 +0800 From: Vipul Kumar Samar To: , , Subject: [PATCH 2/2] ARM: ABMA: Disable/Enable interface clock from suspend/resume Date: Wed, 26 Sep 2012 16:54:07 +0530 Message-ID: <1348658647-25975-3-git-send-email-vipulkumar.samar@st.com> X-Mailer: git-send-email 1.7.2.2 In-Reply-To: <1348658647-25975-1-git-send-email-vipulkumar.samar@st.com> References: <1348658647-25975-1-git-send-email-vipulkumar.samar@st.com> MIME-Version: 1.0 X-Spam-Score: -0.1 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.1 AWL AWL: From: address is in the auto white-list X-Headers-End: 1TGpjG-0000m4-Tc Cc: Vipul Kumar Samar , spi-devel-general@lists.sourceforge.net, spear-devel@list.st.com, linux-arm-kernel@lists.infradead.org X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spi-devel-general-bounces@lists.sourceforge.net 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 --- 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)