From patchwork Thu Sep 6 15:55:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10590817 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 174C569B4 for ; Thu, 6 Sep 2018 15:56:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B859287D2 for ; Thu, 6 Sep 2018 15:56:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 001092AE82; Thu, 6 Sep 2018 15:56:02 +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 95B952AE88 for ; Thu, 6 Sep 2018 15:56:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730464AbeIFUcK (ORCPT ); Thu, 6 Sep 2018 16:32:10 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:46882 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730410AbeIFUcI (ORCPT ); Thu, 6 Sep 2018 16:32:08 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180906155558euoutp0108fe49ce691e902bb19c5f84d504326f~R2qcDH-WK1529315293euoutp01V; Thu, 6 Sep 2018 15:55:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180906155558euoutp0108fe49ce691e902bb19c5f84d504326f~R2qcDH-WK1529315293euoutp01V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1536249358; bh=CPnc81ywhSSCq0oJ60Of33r3RDyqkTNgF9gjlQgz1jQ=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=NsCPIiezg/8CbsujYh4O1SBAkulS6Fr0wI4ScZvH6XipXIHFbI6M+LnGzjk1quitt XaxWYB/vxcMmfsK39ipwrtKm8p2ZO/oB2bWuIXbVQCeIc561xzOr7T9qPJg0mXQz3l nc+M6i95BY9LD8XkbMgATJlARL5Aq4zFul4VFv4g= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180906155558eucas1p2be6d2aec0c65f0cbd0075c82aed66d3d~R2qbnRnBK2540625406eucas1p2J; Thu, 6 Sep 2018 15:55:58 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 2E.56.04294.D0E419B5; Thu, 6 Sep 2018 16:55:57 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180906155557eucas1p2075b7bcf09c328e77686f70c57fbf79d~R2qazWh8F2541725417eucas1p2L; Thu, 6 Sep 2018 15:55:57 +0000 (GMT) X-AuditID: cbfec7f4-835ff700000010c6-c1-5b914e0de04d Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id B9.CE.04284.D0E419B5; Thu, 6 Sep 2018 16:55:57 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PEN009IJ5L4PE10@eusync3.samsung.com>; Thu, 06 Sep 2018 16:55:57 +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 v2 07/10] clk: samsung: exynos5250: Use generic helper for handling suspend/resume Date: Thu, 06 Sep 2018 17:55:29 +0200 Message-id: <20180906155532.4085-8-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20180906155532.4085-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrAIsWRmVeSWpSXmKPExsWy7djPc7q8fhOjDVrmW1hsnLGe1eL6l+es FufPb2C3+Nhzj9Vixvl9TBZrj9xlt2h/+pLZgd1j06pONo++LasYPT5vkgtgjuKySUnNySxL LdK3S+DKOHj2BmPBQtGKmxu2sjQwNgp1MXJwSAiYSHxa4NjFyMUhJLCCUeLq8jY2COczo8T6 xXeBHE6Ios9boBLLGCU+HfzLCuE0MEnMX72aEaSKTcBQouttF1iHiICDxOdPrxlBipgFHjNK bD35lRkkISyQIvHvTiNYEYuAqkTf74/sIHfwCthI9M4zg9gmL7F6wwGwck4BW4kZczvBlkkI fGWV+P2jGeokF4nvj6ewQtjCEq+Ob2GHsGUkOjsOMkE0NDNKtM+YxQ7h9ABdMWcHVLe1xOHj F8G6mQX4JCZtm84MCQ1eiY42IYgSD4kL3eeg3pzAKDG/cyrrBEbJBYwMqxjFU0uLc9NTi43y Usv1ihNzi0vz0vWS83M3MQLj7fS/4192MO76k3SIUYCDUYmH94HRxGgh1sSy4srcQ4wSHMxK Irzu1ROihXhTEiurUovy44tKc1KLDzFKc7AoifPyaaVFCwmkJ5akZqemFqQWwWSZODilGhhn 5/32feCcIy1i8uimxQfL1XxSd/R8iiPntIiFSP/YNnutDeMtk8t3duq0/aloCql2P/bKquYM Z6RNRP2kGKb16Vcvbt1q9PXImolPlvBGH6q6Ez8h6N1/7oWMjZ+eR3mfclu9Rq6l6aAb+/9H cwzDNzYv1CrsORJuG3efo/SuUXhw7YK96epKLMUZiYZazEXFiQC1ssCLswIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDJMWRmVeSWpSXmKPExsVy+t/xq7q8fhOjDab9ELLYOGM9q8X1L89Z Lc6f38Bu8bHnHqvFjPP7mCzWHrnLbtH+9CWzA7vHplWdbB59W1YxenzeJBfAHMVlk5Kak1mW WqRvl8CVcfDsDcaChaIVNzdsZWlgbBTqYuTkkBAwkfj0eQsbiC0ksIRRYuYx6y5GLiC7iUmi Y8MisASbgKFE19suMFtEwEHi86fXjCBFzAKPGSXOLd7ACpIQFkiR+HenEayIRUBVou/3R/Yu Rg4OXgEbid55ZhDL5CVWbzjADGJzCthKzJjbyQqx2EZiVeMU1gmMPAsYGVYxiqSWFuem5xYb 6hUn5haX5qXrJefnbmIEhsm2Yz8372C8tDH4EKMAB6MSD6+F6cRoIdbEsuLK3EOMEhzMSiK8 7tUTooV4UxIrq1KL8uOLSnNSiw8xSnOwKInznjeojBISSE8sSc1OTS1ILYLJMnFwSjUw8rOI Xbu7fp1gU1/h7RCH6VHakTPcHEMF+tkn3w959veEIRv3ppnbtu9fcHHxpfQnuS9X6HTqtHt4 VQpJbhWZ0mQTKDwvdkqo6B6jNAa9ffEM2c+/p5573RBXFsvRc7HjwaYT4g/7VWdnBm9RO5Nh HTElNn365uncMx8WFbw7VChyak39J2NhJZbijERDLeai4kQAx2wugg8CAAA= X-CMS-MailID: 20180906155557eucas1p2075b7bcf09c328e77686f70c57fbf79d X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180906155557eucas1p2075b7bcf09c328e77686f70c57fbf79d References: <20180906155532.4085-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. Almost no functional change, the only difference is in handling of hypothetical memory allocation failure on boot. Signed-off-by: Marek Szyprowski Acked-by: Chanwoo Choi Reviewed-by: Krzysztof Kozlowski --- drivers/clk/samsung/clk-exynos5250.c | 42 ++-------------------------- 1 file changed, 2 insertions(+), 40 deletions(-) diff --git a/drivers/clk/samsung/clk-exynos5250.c b/drivers/clk/samsung/clk-exynos5250.c index 347fd80c351b..f14139bcb0c1 100644 --- a/drivers/clk/samsung/clk-exynos5250.c +++ b/drivers/clk/samsung/clk-exynos5250.c @@ -14,7 +14,6 @@ #include #include #include -#include #include "clk.h" #include "clk-cpu.h" @@ -111,9 +110,6 @@ enum exynos5250_plls { static void __iomem *reg_base; -#ifdef CONFIG_PM_SLEEP -static struct samsung_clk_reg_dump *exynos5250_save; - /* * list of controller registers to be saved and restored during a * suspend/resume cycle. @@ -172,41 +168,6 @@ static const unsigned long exynos5250_clk_regs[] __initconst = { GATE_IP_ISP1, }; -static int exynos5250_clk_suspend(void) -{ - samsung_clk_save(reg_base, exynos5250_save, - ARRAY_SIZE(exynos5250_clk_regs)); - - return 0; -} - -static void exynos5250_clk_resume(void) -{ - samsung_clk_restore(reg_base, exynos5250_save, - ARRAY_SIZE(exynos5250_clk_regs)); -} - -static struct syscore_ops exynos5250_clk_syscore_ops = { - .suspend = exynos5250_clk_suspend, - .resume = exynos5250_clk_resume, -}; - -static void __init exynos5250_clk_sleep_init(void) -{ - exynos5250_save = samsung_clk_alloc_reg_dump(exynos5250_clk_regs, - ARRAY_SIZE(exynos5250_clk_regs)); - if (!exynos5250_save) { - pr_warn("%s: failed to allocate sleep save data, no sleep support!\n", - __func__); - return; - } - - register_syscore_ops(&exynos5250_clk_syscore_ops); -} -#else -static void __init exynos5250_clk_sleep_init(void) {} -#endif - /* list of all parent clock list */ PNAME(mout_apll_p) = { "fin_pll", "fout_apll", }; PNAME(mout_cpu_p) = { "mout_apll", "mout_mpll", }; @@ -882,7 +843,8 @@ static void __init exynos5250_clk_init(struct device_node *np) PWR_CTRL2_CORE2_UP_RATIO | PWR_CTRL2_CORE1_UP_RATIO); __raw_writel(tmp, reg_base + PWR_CTRL2); - exynos5250_clk_sleep_init(); + samsung_clk_sleep_init(reg_base, exynos5250_clk_regs, + ARRAY_SIZE(exynos5250_clk_regs)); exynos5_subcmus_init(ctx, 1, &exynos5250_disp_subcmu); samsung_clk_of_add_provider(np, ctx);