From patchwork Mon Mar 30 15:53:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 6122571 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 950ED9F1BE for ; Mon, 30 Mar 2015 15:56:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A447A20364 for ; Mon, 30 Mar 2015 15:56:42 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C1A8B20361 for ; Mon, 30 Mar 2015 15:56:41 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ycc0s-0000cb-Gq; Mon, 30 Mar 2015 15:54:06 +0000 Received: from bhuna.collabora.co.uk ([93.93.135.160]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ycc0n-0000VX-EH for linux-arm-kernel@lists.infradead.org; Mon, 30 Mar 2015 15:54:02 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: javier) with ESMTPSA id F207B600E79 From: Javier Martinez Canillas To: Stephen Boyd Subject: [RFC PATCH v3 2/2] clk: exynos5420: Make sure MDMA0 clock is enabled during suspend Date: Mon, 30 Mar 2015 17:53:22 +0200 Message-Id: <1427730803-28635-3-git-send-email-javier.martinez@collabora.co.uk> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1427730803-28635-1-git-send-email-javier.martinez@collabora.co.uk> References: <1427730803-28635-1-git-send-email-javier.martinez@collabora.co.uk> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150330_085401_659234_A8D62CBF X-CRM114-Status: GOOD ( 15.54 ) X-Spam-Score: -0.0 (/) Cc: Krzysztof Kozlowski , Kevin Hilman , Mike Turquette , linux-kernel@vger.kernel.org, Tyler Baker , Tomasz Figa , Doug Anderson , Chanwoo Choi , Kukjin Kim , linux-samsung-soc@vger.kernel.org, Sylwester Nawrocki , Olof Johansson , Abhilash Kesavan , Javier Martinez Canillas , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit ae43b3289186 ("ARM: 8202/1: dmaengine: pl330: Add runtime Power Management support v12") added pm support for the pl330 dma driver but it makes the clock for the Exynos5420 MDMA0 DMA controller to be gated during suspend and this clock needs to remain enabled in order to make the system resume from a system suspend state. To make sure that the clock is enabled during suspend, enable it prior to entering a suspend state and disable it once the system has resumed. Thanks to Abhilash Kesavan for figuring out that this was the issue. Fixes: ae43b32 ("ARM: 8202/1: dmaengine: pl330: Add runtime Power Management support v12") Signed-off-by: Javier Martinez Canillas --- drivers/clk/samsung/clk-exynos5420.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c index 07d666cc6a29..2d39b629144a 100644 --- a/drivers/clk/samsung/clk-exynos5420.c +++ b/drivers/clk/samsung/clk-exynos5420.c @@ -151,6 +151,7 @@ enum exynos5x_plls { static void __iomem *reg_base; static enum exynos5x_soc exynos5x_soc; +struct samsung_clk_provider *ctx; #ifdef CONFIG_PM_SLEEP static struct samsung_clk_reg_dump *exynos5x_save; @@ -275,8 +276,18 @@ static const struct samsung_clk_reg_dump exynos5420_set_clksrc[] = { { .offset = GATE_IP_PERIC, .value = 0xffffffff, }, }; +/* + * list of clocks that have to be kept enabled during suspend/resume cycle. + */ +static unsigned int exynos5x_clk_suspend[] = { + CLK_MDMA0, +}; + static int exynos5420_clk_suspend(void) { + int i; + struct clk *clk; + samsung_clk_save(reg_base, exynos5x_save, ARRAY_SIZE(exynos5x_clk_regs)); @@ -287,11 +298,24 @@ static int exynos5420_clk_suspend(void) samsung_clk_restore(reg_base, exynos5420_set_clksrc, ARRAY_SIZE(exynos5420_set_clksrc)); + for (i = 0; i < ARRAY_SIZE(exynos5x_clk_suspend); i++) { + clk = samsung_clk_lookup(ctx, exynos5x_clk_suspend[i]); + clk_prepare_enable(clk); + } + return 0; } static void exynos5420_clk_resume(void) { + int i; + struct clk *clk; + + for (i = 0; i < ARRAY_SIZE(exynos5x_clk_suspend); i++) { + clk = samsung_clk_lookup(ctx, exynos5x_clk_suspend[i]); + clk_disable_unprepare(clk); + } + samsung_clk_restore(reg_base, exynos5x_save, ARRAY_SIZE(exynos5x_clk_regs)); @@ -1255,8 +1279,6 @@ static const struct of_device_id ext_clk_match[] __initconst = { static void __init exynos5x_clk_init(struct device_node *np, enum exynos5x_soc soc) { - struct samsung_clk_provider *ctx; - if (np) { reg_base = of_iomap(np, 0); if (!reg_base)