From patchwork Wed Aug 29 15:50:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10580599 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7CB115A4 for ; Wed, 29 Aug 2018 15:51:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B0F22B683 for ; Wed, 29 Aug 2018 15:51:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 67ED32B6A7; Wed, 29 Aug 2018 15:51:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB4B02B683 for ; Wed, 29 Aug 2018 15:51:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729200AbeH2Tsj (ORCPT ); Wed, 29 Aug 2018 15:48:39 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:55850 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729218AbeH2Tsj (ORCPT ); Wed, 29 Aug 2018 15:48:39 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180829155104euoutp017bc2e2dcc7d05193579677f4e3cf6212~PZb34kBIg0370903709euoutp01q; Wed, 29 Aug 2018 15:51:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180829155104euoutp017bc2e2dcc7d05193579677f4e3cf6212~PZb34kBIg0370903709euoutp01q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1535557864; bh=TI9gOZRB3r4tnQPcekOrcuMLRHftqnHX83vDH5qp3q0=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=dKSJxC+5Na+UahVGMpY67dLZjLmx1rgy5MFwfGLpGJ6l2rQ4kophGQcW33vVPmbZy /8mvfk8yz+LgsQZ3QkjNwSM8IA+wPd/tovRI4++HawDASc23bBWRaYdzkPFjGA0eH6 4ZMHBzpxb3Plq+2Bzjv8jivdzMa2QLwwWSndIru4= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180829155104eucas1p14b1737f1b75a68ecaf7885e6866521a8~PZb3dTqhe0107501075eucas1p11; Wed, 29 Aug 2018 15:51:04 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 4F.FA.04806.7E0C68B5; Wed, 29 Aug 2018 16:51:03 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180829155103eucas1p16b6cddb4babcfb60a3257e017bea347e~PZb2dLvAz0667306673eucas1p1Z; Wed, 29 Aug 2018 15:51:03 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-3f-5b86c0e7ecdd Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 28.76.04128.6E0C68B5; Wed, 29 Aug 2018 16:51:02 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PE800FCUC0UPL60@eusync4.samsung.com>; Wed, 29 Aug 2018 16:51:02 +0100 (BST) From: Marek Szyprowski To: linux-clk@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH 10/10] clk: samsung: exynos5420: Use generic helper for handling suspend/resume Date: Wed, 29 Aug 2018 17:50:46 +0200 Message-id: <20180829155046.29359-11-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20180829155046.29359-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrAIsWRmVeSWpSXmKPExsWy7djPc7rPD7RFGzzYpG+xccZ6VovrX56z Wpw/v4Hd4mPPPVaLGef3MVmsPXKX3aL96UtmB3aPTas62Tz6tqxi9Pi8SS6AOYrLJiU1J7Ms tUjfLoEr4918g4JH0hVfLj5lb2BcKt7FyMkhIWAicf/OXZYuRi4OIYEVjBILz/xghHA+M0rs WrSBrYuRA6yq86ImRHwZo8SeV1egihqYJCYv28gCMopNwFCi620XG4gtIuAg8fnTa7AiZoHH jBJbT35lBkkICyRKTH73kBXEZhFQlVjR8wMszitgJ7Hw5Rx2iJvkJVZvOAAW5wSKvzjeywoy SELgK6vElilL2CCKXCR2nfwB1SAs8er4FihbRuLy5G4WiIZmRon2GbPYIZweoDPm7IDqtpY4 fPwi2BnMAnwSk7ZNZ4Z4lFeio00IosRDovfmK2aIPycySnT9OsU2gVFyASPDKkbx1NLi3PTU YuO81HK94sTc4tK8dL3k/NxNjMB4O/3v+NcdjPv+JB1iFOBgVOLhvTCjLVqINbGsuDL3EKME B7OSCO/ehUAh3pTEyqrUovz4otKc1OJDjNIcLErivHxaadFCAumJJanZqakFqUUwWSYOTqkG RpEDOrZl0z9rGF63rti5i8eHwSAs8KKKx69lSc+DH3N494Rutfe22Vz74siTZWpP+Ayfzou9 vsztTo6KeorMBDXlCxGfxUwsOrOm2e4K7M+J8shrV1nCy86spLz62/LVlQ9e5y9ftPp1b9Tn HW2M/lM5Sg2eiMn+3ru1usw04PC5h8ZyWms7lViKMxINtZiLihMB2MlfQLMCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNJMWRmVeSWpSXmKPExsVy+t/xa7rPDrRFG/Q+s7LYOGM9q8X1L89Z Lc6f38Bu8bHnHqvFjPP7mCzWHrnLbtH+9CWzA7vHplWdbB59W1YxenzeJBfAHMVlk5Kak1mW WqRvl8CV8W6+QcEj6YovF5+yNzAuFe9i5OCQEDCR6Lyo2cXIySEksIRRYupG6S5GLiC7iUli 5/zTzCAJNgFDia63XWwgtoiAg8TnT68ZQYqYBR4zSpxbvIEVJCEskCgx+d1DMJtFQFViRc8P sGZeATuJhS/nsIPYEgLyEqs3HACLcwLFXxzvZYXYbCux8M53xgmMPAsYGVYxiqSWFuem5xYb 6RUn5haX5qXrJefnbmIEBsm2Yz+37GDsehd8iFGAg1GJh9dgUVu0EGtiWXFl7iFGCQ5mJRHe vQuBQrwpiZVVqUX58UWlOanFhxilOViUxHnPG1RGCQmkJ5akZqemFqQWwWSZODilGhhTq+Nb 8h5wSf2rlfHbOl24z/rlBuu0JZc/3csXbvpv6fC+MfjK8y8dmSL7A4/fmBtsK7UkbOlH43/S +nFGnwUfBG1bbuctOmPJ5/a3c37wC0y69P/Jogduf+w1hVJWBB+eNN+t7qjwfZtvyrOspFhU Mzef6Y/lCTtxYdt1rbD0J0fdfDoufPikxFKckWioxVxUnAgA4h5BHQ4CAAA= X-CMS-MailID: 20180829155103eucas1p16b6cddb4babcfb60a3257e017bea347e X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180829155103eucas1p16b6cddb4babcfb60a3257e017bea347e References: <20180829155046.29359-1-m.szyprowski@samsung.com> Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Replace common suspend/resume handling code by generic helper. No functional change. Signed-off-by: Marek Szyprowski --- drivers/clk/samsung/clk-exynos5420.c | 73 +++------------------------- 1 file changed, 7 insertions(+), 66 deletions(-) diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c index 95e1bf69449b..9f2f53d7be70 100644 --- a/drivers/clk/samsung/clk-exynos5420.c +++ b/drivers/clk/samsung/clk-exynos5420.c @@ -15,7 +15,6 @@ #include #include #include -#include #include "clk.h" #include "clk-cpu.h" @@ -156,10 +155,6 @@ enum exynos5x_plls { static void __iomem *reg_base; static enum exynos5x_soc exynos5x_soc; -#ifdef CONFIG_PM_SLEEP -static struct samsung_clk_reg_dump *exynos5x_save; -static struct samsung_clk_reg_dump *exynos5800_save; - /* * list of controller registers to be saved and restored during a * suspend/resume cycle. @@ -283,66 +278,6 @@ static const struct samsung_clk_reg_dump exynos5420_set_clksrc[] = { { .offset = GATE_IP_PERIC, .value = 0xffffffff, }, }; -static int exynos5420_clk_suspend(void) -{ - samsung_clk_save(reg_base, exynos5x_save, - ARRAY_SIZE(exynos5x_clk_regs)); - - if (exynos5x_soc == EXYNOS5800) - samsung_clk_save(reg_base, exynos5800_save, - ARRAY_SIZE(exynos5800_clk_regs)); - - samsung_clk_restore(reg_base, exynos5420_set_clksrc, - ARRAY_SIZE(exynos5420_set_clksrc)); - - return 0; -} - -static void exynos5420_clk_resume(void) -{ - samsung_clk_restore(reg_base, exynos5x_save, - ARRAY_SIZE(exynos5x_clk_regs)); - - if (exynos5x_soc == EXYNOS5800) - samsung_clk_restore(reg_base, exynos5800_save, - ARRAY_SIZE(exynos5800_clk_regs)); -} - -static struct syscore_ops exynos5420_clk_syscore_ops = { - .suspend = exynos5420_clk_suspend, - .resume = exynos5420_clk_resume, -}; - -static void __init exynos5420_clk_sleep_init(void) -{ - exynos5x_save = samsung_clk_alloc_reg_dump(exynos5x_clk_regs, - ARRAY_SIZE(exynos5x_clk_regs)); - if (!exynos5x_save) { - pr_warn("%s: failed to allocate sleep save data, no sleep support!\n", - __func__); - return; - } - - if (exynos5x_soc == EXYNOS5800) { - exynos5800_save = - samsung_clk_alloc_reg_dump(exynos5800_clk_regs, - ARRAY_SIZE(exynos5800_clk_regs)); - if (!exynos5800_save) - goto err_soc; - } - - register_syscore_ops(&exynos5420_clk_syscore_ops); - return; -err_soc: - kfree(exynos5x_save); - pr_warn("%s: failed to allocate sleep save data, no sleep support!\n", - __func__); - return; -} -#else -static void __init exynos5420_clk_sleep_init(void) {} -#endif - /* list of all parent clocks */ PNAME(mout_mspll_cpu_p) = {"mout_sclk_cpll", "mout_sclk_dpll", "mout_sclk_mpll", "mout_sclk_spll"}; @@ -1540,7 +1475,13 @@ static void __init exynos5x_clk_init(struct device_node *np, mout_kfc_p[0], mout_kfc_p[1], 0x28200, exynos5420_kfcclk_d, ARRAY_SIZE(exynos5420_kfcclk_d), 0); - exynos5420_clk_sleep_init(); + samsung_clk_sleep_init2(reg_base, exynos5x_clk_regs, + ARRAY_SIZE(exynos5x_clk_regs), + exynos5420_set_clksrc, + ARRAY_SIZE(exynos5420_set_clksrc)); + if (soc == EXYNOS5800) + samsung_clk_sleep_init(reg_base, exynos5800_clk_regs, + ARRAY_SIZE(exynos5800_clk_regs)); exynos5_subcmus_init(ctx, ARRAY_SIZE(exynos5x_subcmus), exynos5x_subcmus);