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: 1509041 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 7F9D040B1E for ; Wed, 26 Sep 2012 11:26:40 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TGpjT-0003tN-Ql; Wed, 26 Sep 2012 11:24:47 +0000 Received: from eu1sys200aog110.obsmtp.com ([207.126.144.129]) by merlin.infradead.org with smtps (Exim 4.76 #1 (Red Hat Linux)) id 1TGpjG-0003sO-TL for linux-arm-kernel@lists.infradead.org; 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-Note: CRM114 invocation failed X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [207.126.144.129 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Vipul Kumar Samar , spi-devel-general@lists.sourceforge.net, spear-devel@list.st.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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)