From patchwork Thu Sep 6 15:55:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10590789 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 8787669B4 for ; Thu, 6 Sep 2018 15:56:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F50D2AE86 for ; Thu, 6 Sep 2018 15:56:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73C8B2AEA5; Thu, 6 Sep 2018 15:56:01 +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=unavailable 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 9C7722AE86 for ; Thu, 6 Sep 2018 15:55:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730407AbeIFUcG (ORCPT ); Thu, 6 Sep 2018 16:32:06 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:46866 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730358AbeIFUcG (ORCPT ); Thu, 6 Sep 2018 16:32:06 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180906155556euoutp01c0b37dc042e81b1b711e045a86a29f54~R2qaXFepj1529515295euoutp01N; Thu, 6 Sep 2018 15:55:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180906155556euoutp01c0b37dc042e81b1b711e045a86a29f54~R2qaXFepj1529515295euoutp01N DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1536249356; bh=v2aGrZ7AYUfrdRxgNpw6l0hPLBb3klGoM/baggWG5aI=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=jVZe4eXlKlT0eYZmo3Un6g1YNl82r33CQzzUXwH06thlsxhdkUkss1ge7nnxD51/G JfVYBdG6WxqTnMc50bhpcDeD9NSHuIQk3mGhTrnpF1evB9hm865J7jrulnrLBM+MWa d3UAkX9cqsChZEWhpltCgYyh3LGNTLTLSGxkTrsE= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180906155556eucas1p2d7234de66a6ae7526291b408c3624cbe~R2qZiHp890634606346eucas1p2M; Thu, 6 Sep 2018 15:55:56 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 74.31.04806.B0E419B5; Thu, 6 Sep 2018 16:55:55 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180906155555eucas1p2ee5a32177a108e01496d2210b8e197b1~R2qYwGHAO0455004550eucas1p2U; Thu, 6 Sep 2018 15:55:55 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-97-5b914e0b3ff6 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 17.CE.04284.B0E419B5; Thu, 6 Sep 2018 16:55:55 +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:55 +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 01/10] clk: samsung: Remove excessive include Date: Thu, 06 Sep 2018 17:55:23 +0200 Message-id: <20180906155532.4085-2-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+NgFlrAIsWRmVeSWpSXmKPExsWy7djPc7rcfhOjDX5d0rLYOGM9q8X1L89Z Lc6f38Bu8bHnHqvFjPP7mCzWHrnLbtH+9CWzA7vHplWdbB59W1YxenzeJBfAHMVlk5Kak1mW WqRvl8CV8eT6MZaCnVwVm95tYm5gnM7ZxcjJISFgIvFh2TWmLkYuDiGBFYwSCy9vYQZJCAl8 ZpT4u0QRpuhy4xFmiKJljBJLls2G6mhgkpj5/xobSBWbgKFE19suMFtEwEHi86fXjCBFzAKP GSW2nvwK1M7BIQyUmPUwDKSGRUBVYuqyvYwgNq+AjUTXpq2sENvkJVZvOAB2BaeArcSMuZ2s IHMkBH6ySlxa/IkRoshF4tPD70wQtrDEq+Nb2CFsGYnOjoNMEA3NjBLtM2axQzg9QFfM2cEG UWUtcfj4RbB1zAJ8EpO2TQe7TkKAV6KjTQiixEPiVPN/qDcnMEqsvfGTdQKj5AJGhlWM4qml xbnpqcXGeanlesWJucWleel6yfm5mxiB8Xb63/GvOxj3/Uk6xCjAwajEw/vAaGK0EGtiWXFl 7iFGCQ5mJRFe9+oJ0UK8KYmVValF+fFFpTmpxYcYpTlYlMR5+bTSooUE0hNLUrNTUwtSi2Cy TBycUg2MQX2FbjPSA6sbnX+zb8iKK76o4bU2/EV6j+y0sKOZRVfK35oZLZuSs5RDhj9d50CY l5GM9u3Z5cHLGj2ZXLvVY87ELuo88Dpjs+3qXM+/l5iNr0+9xpCRuYxTw1YryFji7IaW8NuL nf92c89ydSs491F/i/aGWTZ7fHxeWf7rqX1ul3Xzb4oSS3FGoqEWc1FxIgCLibuMswIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLJMWRmVeSWpSXmKPExsVy+t/xq7rcfhOjDe5O47HYOGM9q8X1L89Z Lc6f38Bu8bHnHqvFjPP7mCzWHrnLbtH+9CWzA7vHplWdbB59W1YxenzeJBfAHMVlk5Kak1mW WqRvl8CV8eT6MZaCnVwVm95tYm5gnM7ZxcjJISFgInG58QhzFyMXh5DAEkaJtlNbmCCcJiaJ loWzmUCq2AQMJbredrGB2CICDhKfP71mBCliFnjMKHFu8QbWLkYODmGgxKyHYSA1LAKqElOX 7WUEsXkFbCS6Nm1lhdgmL7F6wwFmEJtTwFZixtxOsLgQUM2qximsExh5FjAyrGIUSS0tzk3P LTbUK07MLS7NS9dLzs/dxAgMlG3Hfm7ewXhpY/AhRgEORiUeXgvTidFCrIllxZW5hxglOJiV RHjdqydEC/GmJFZWpRblxxeV5qQWH2KU5mBREuc9b1AZJSSQnliSmp2aWpBaBJNl4uCUamCc P1Fnw454Nt75UULTs98xvPcoYhWfnHDeRLRdam+m/ONdm4VusiccKs145nP1idqBS/MYDD5d uhqz893v4o9VVh7vJVU32Wsd/Hv5nRiLzdxEf1eVgshn79PWrt4kLV/fz1Ops2NNTMDm6c9M F3uzZNt41bnrxaf2HAye+pZbOHBKcWPjrVVKLMUZiYZazEXFiQCdm0smEAIAAA== X-CMS-MailID: 20180906155555eucas1p2ee5a32177a108e01496d2210b8e197b1 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180906155555eucas1p2ee5a32177a108e01496d2210b8e197b1 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 Exynos Audio SubSystem and Exynos3250 clock drivers don't use any syscore function, so don't include linux/syscore_ops.h in their code. Signed-off-by: Marek Szyprowski Acked-by: Chanwoo Choi Reviewed-by: Krzysztof Kozlowski --- drivers/clk/samsung/clk-exynos-audss.c | 1 - drivers/clk/samsung/clk-exynos3250.c | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/clk/samsung/clk-exynos-audss.c b/drivers/clk/samsung/clk-exynos-audss.c index f659c5cbf1d5..8f8a0f9fc842 100644 --- a/drivers/clk/samsung/clk-exynos-audss.c +++ b/drivers/clk/samsung/clk-exynos-audss.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/clk/samsung/clk-exynos3250.c b/drivers/clk/samsung/clk-exynos3250.c index 27c9d23657b3..0e9a41a4cac8 100644 --- a/drivers/clk/samsung/clk-exynos3250.c +++ b/drivers/clk/samsung/clk-exynos3250.c @@ -12,7 +12,6 @@ #include #include #include -#include #include From patchwork Thu Sep 6 15:55:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10590801 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 3C5B769BA for ; Thu, 6 Sep 2018 15:56:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30E312AE86 for ; Thu, 6 Sep 2018 15:56:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 253132AE90; 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 826762AEA6 for ; Thu, 6 Sep 2018 15:56:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730304AbeIFUcI (ORCPT ); Thu, 6 Sep 2018 16:32:08 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:46869 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730364AbeIFUcH (ORCPT ); Thu, 6 Sep 2018 16:32:07 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180906155557euoutp01faf6090c9d6179fda02346e60238a4e4~R2qa3UWpB1567915679euoutp014; Thu, 6 Sep 2018 15:55:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180906155557euoutp01faf6090c9d6179fda02346e60238a4e4~R2qa3UWpB1567915679euoutp014 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1536249357; bh=emB5fOdp7j4ZrlI8bJ7cjYP3wU85Vhkd5vXaiPYYECk=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=Bg3ay2cZsy5OmwDAjwKjnwnlZ2WKERJdObGENZ/Lzu60g9IIqyeb8Pe4hXwxug9sj 88rjilrjGCm6YOeIlJHM3aB0PWc6D9p/uWDOVPk9gofEo9dlvNGgcMEF+2gJaGUD5Z uJjPgBbst2EVAj1spSaC2Q4PSf1zdfC7aKyg8OxY= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180906155556eucas1p1f401491b1fec081703790f1d264c9e34~R2qaD-Jac1238612386eucas1p1_; Thu, 6 Sep 2018 15:55:56 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 0D.56.04294.C0E419B5; Thu, 6 Sep 2018 16:55:56 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180906155555eucas1p23adcf0ad28416aefacb8519f8f5741ed~R2qZH8duA2540625406eucas1p2H; Thu, 6 Sep 2018 15:55:55 +0000 (GMT) X-AuditID: cbfec7f4-84fff700000010c6-bc-5b914e0c8546 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 87.DC.04128.B0E419B5; Thu, 6 Sep 2018 16:55:55 +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:55 +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 02/10] clk: samsung: s3c2410: Use generic helper for handling suspend/resume Date: Thu, 06 Sep 2018 17:55:24 +0200 Message-id: <20180906155532.4085-3-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+NgFlrIIsWRmVeSWpSXmKPExsWy7djP87o8fhOjDabsErTYOGM9q8X1L89Z Lc6f38Bu8bHnHqvFjPP7mCzWHrnLbtH+9CWzA7vHplWdbB59W1YxenzeJBfAHMVlk5Kak1mW WqRvl8CVsenoVJaCO8IVM/99Zm5gPCrQxcjJISFgIvFt5Qf2LkYuDiGBFYwSbze1M0E4nxkl 2hoPMXcxcoBVffqVCRFfxigx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ez kgive/WEaCHelMTKqtSi/Pii0pzU4kOM0hwsSuK85w0qo4QE0hNLUrNTUwtSi2CyTBycUg2M ylzCU9b/2rh4S43Yik3+uXx1azrTFZUl17Otv/d+reKuwt2XnPd+PWh3f7WSrfTWFS3Kfqni KYYrncIX+rV9Lb8zbaXonCuvs6pWNTGcV1p8tzN7V7q79eZ50yurLEuuWsVlBe075RMnp+R4 +sXdM43TfX6UHHt+jEdooUrXBj2d66tSSnzslViKMxINtZiLihMBTWfdRg8CAAA= X-CMS-MailID: 20180906155555eucas1p23adcf0ad28416aefacb8519f8f5741ed X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180906155555eucas1p23adcf0ad28416aefacb8519f8f5741ed 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-s3c2410.c | 43 ++----------------------------- 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/drivers/clk/samsung/clk-s3c2410.c b/drivers/clk/samsung/clk-s3c2410.c index a9c887475054..8cb868f06257 100644 --- a/drivers/clk/samsung/clk-s3c2410.c +++ b/drivers/clk/samsung/clk-s3c2410.c @@ -11,7 +11,6 @@ #include #include #include -#include #include @@ -40,9 +39,6 @@ enum s3c2410_plls { static void __iomem *reg_base; -#ifdef CONFIG_PM_SLEEP -static struct samsung_clk_reg_dump *s3c2410_save; - /* * list of controller registers to be saved and restored during a * suspend/resume cycle. @@ -57,42 +53,6 @@ static unsigned long s3c2410_clk_regs[] __initdata = { CAMDIVN, }; -static int s3c2410_clk_suspend(void) -{ - samsung_clk_save(reg_base, s3c2410_save, - ARRAY_SIZE(s3c2410_clk_regs)); - - return 0; -} - -static void s3c2410_clk_resume(void) -{ - samsung_clk_restore(reg_base, s3c2410_save, - ARRAY_SIZE(s3c2410_clk_regs)); -} - -static struct syscore_ops s3c2410_clk_syscore_ops = { - .suspend = s3c2410_clk_suspend, - .resume = s3c2410_clk_resume, -}; - -static void __init s3c2410_clk_sleep_init(void) -{ - s3c2410_save = samsung_clk_alloc_reg_dump(s3c2410_clk_regs, - ARRAY_SIZE(s3c2410_clk_regs)); - if (!s3c2410_save) { - pr_warn("%s: failed to allocate sleep save data, no sleep support!\n", - __func__); - return; - } - - register_syscore_ops(&s3c2410_clk_syscore_ops); - return; -} -#else -static void __init s3c2410_clk_sleep_init(void) {} -#endif - PNAME(fclk_p) = { "mpll", "div_slow" }; static struct samsung_mux_clock s3c2410_common_muxes[] __initdata = { @@ -461,7 +421,8 @@ void __init s3c2410_common_clk_init(struct device_node *np, unsigned long xti_f, ARRAY_SIZE(s3c244x_common_aliases)); } - s3c2410_clk_sleep_init(); + samsung_clk_sleep_init(reg_base, s3c2410_clk_regs, + ARRAY_SIZE(s3c2410_clk_regs)); samsung_clk_of_add_provider(np, ctx); } From patchwork Thu Sep 6 15:55:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10590787 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 6D83B1669 for ; Thu, 6 Sep 2018 15:56:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62E6F287D2 for ; Thu, 6 Sep 2018 15:56:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 575962AEA5; Thu, 6 Sep 2018 15:56:01 +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=unavailable 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 35D20287D2 for ; Thu, 6 Sep 2018 15:56:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730351AbeIFUcH (ORCPT ); Thu, 6 Sep 2018 16:32:07 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:59519 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730304AbeIFUcG (ORCPT ); Thu, 6 Sep 2018 16:32:06 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180906155557euoutp0273b9071db898d02014252665a9da0965~R2qa-BCB63136531365euoutp028; Thu, 6 Sep 2018 15:55:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180906155557euoutp0273b9071db898d02014252665a9da0965~R2qa-BCB63136531365euoutp028 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1536249357; bh=+a8K72v2pIeHACaCg/9dKVqnSWhHUiL1oB4K2zKw2Ik=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=UKziCdkGDp9tpykSayfPtOYCrhIWduOIVnQ8i+JbQ3uyJoI6FxBa/EbozeOE8XuaG urbo304U9uTUszPLEEk6rUbK0ZTFT6GMbUlZOuH1egFNSEywa7Q7/IMOHy5cyzE6fQ AQ0TLo/9y/pa6cXgv3fPz60giElepIJpcjE/kFMM= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180906155556eucas1p2ab0604012b5873a2a99e732259c2b994~R2qaXRGEe2541725417eucas1p2J; Thu, 6 Sep 2018 15:55:56 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id A8.85.04441.C0E419B5; Thu, 6 Sep 2018 16:55:56 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180906155555eucas1p209b1988a1a1bf42298f1f1e483f47b55~R2qZZ_Q7k0610806108eucas1p2h; Thu, 6 Sep 2018 15:55:55 +0000 (GMT) X-AuditID: cbfec7f2-5e3ff70000001159-0d-5b914e0c04f5 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 97.CE.04284.B0E419B5; Thu, 6 Sep 2018 16:55:55 +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:55 +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 03/10] clk: samsung: s3c2412: Use generic helper for handling suspend/resume Date: Thu, 06 Sep 2018 17:55:25 +0200 Message-id: <20180906155532.4085-4-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+NgFlrEIsWRmVeSWpSXmKPExsWy7djPc7o8fhOjDfrXqVhsnLGe1eL6l+es FufPb2C3+Nhzj9Vixvl9TBZrj9xlt2h/+pLZgd1j06pONo++LasYPT5vkgtgjuKySUnNySxL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o0hqaXFuem6x oV5xYm5xaV66XnJ+7iZGYKBsO/Zz8w7GSxuDDzEKcDAq8fBamE6MFmJNLCuuzD3EKMHBrCTC 6149IVqINyWxsiq1KD++qDQntfgQozQHi5I473mDyighgfTEktTs1NSC1CKYLBMHp1QDo+P0 RQsverV+mLp1YWn2yYMHDok/1Vsfmr1B1+CjXdhyzh2iVjbtl/+efvHIwm7/vq+983KkMwRW HTi0WfJRU1jx6bUTGKR92dax3lx2qPv633RjizOrEx/1m/DNjDyk3sH19JnB2uRa5oe9kQ47 ehnv31RN7bx6SG310XXcYdLLdpUIeGc2NCqxFGckGmoxFxUnAgBdHpL/EAIAAA== X-CMS-MailID: 20180906155555eucas1p209b1988a1a1bf42298f1f1e483f47b55 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180906155555eucas1p209b1988a1a1bf42298f1f1e483f47b55 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-s3c2412.c | 43 ++----------------------------- 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/drivers/clk/samsung/clk-s3c2412.c b/drivers/clk/samsung/clk-s3c2412.c index 6bc94d3aff78..dd1159050a5a 100644 --- a/drivers/clk/samsung/clk-s3c2412.c +++ b/drivers/clk/samsung/clk-s3c2412.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include @@ -29,9 +28,6 @@ static void __iomem *reg_base; -#ifdef CONFIG_PM_SLEEP -static struct samsung_clk_reg_dump *s3c2412_save; - /* * list of controller registers to be saved and restored during a * suspend/resume cycle. @@ -45,42 +41,6 @@ static unsigned long s3c2412_clk_regs[] __initdata = { CLKSRC, }; -static int s3c2412_clk_suspend(void) -{ - samsung_clk_save(reg_base, s3c2412_save, - ARRAY_SIZE(s3c2412_clk_regs)); - - return 0; -} - -static void s3c2412_clk_resume(void) -{ - samsung_clk_restore(reg_base, s3c2412_save, - ARRAY_SIZE(s3c2412_clk_regs)); -} - -static struct syscore_ops s3c2412_clk_syscore_ops = { - .suspend = s3c2412_clk_suspend, - .resume = s3c2412_clk_resume, -}; - -static void __init s3c2412_clk_sleep_init(void) -{ - s3c2412_save = samsung_clk_alloc_reg_dump(s3c2412_clk_regs, - ARRAY_SIZE(s3c2412_clk_regs)); - if (!s3c2412_save) { - pr_warn("%s: failed to allocate sleep save data, no sleep support!\n", - __func__); - return; - } - - register_syscore_ops(&s3c2412_clk_syscore_ops); - return; -} -#else -static void __init s3c2412_clk_sleep_init(void) {} -#endif - static struct clk_div_table divxti_d[] = { { .val = 0, .div = 1 }, { .val = 1, .div = 2 }, @@ -278,7 +238,8 @@ void __init s3c2412_common_clk_init(struct device_node *np, unsigned long xti_f, samsung_clk_register_alias(ctx, s3c2412_aliases, ARRAY_SIZE(s3c2412_aliases)); - s3c2412_clk_sleep_init(); + samsung_clk_sleep_init(reg_base, s3c2412_clk_regs, + ARRAY_SIZE(s3c2412_clk_regs)); samsung_clk_of_add_provider(np, ctx); From patchwork Thu Sep 6 15:55:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10590795 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 C220614BD for ; Thu, 6 Sep 2018 15:56:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5D902AE86 for ; Thu, 6 Sep 2018 15:56:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA4BA2AE90; Thu, 6 Sep 2018 15:56:01 +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 44E7A2AE8B for ; Thu, 6 Sep 2018 15:56:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730358AbeIFUcI (ORCPT ); Thu, 6 Sep 2018 16:32:08 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:46872 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730389AbeIFUcI (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 20180906155557euoutp0171951b2a94ddc0507eaf3e8f9e7794bf~R2qa-VvLW1529315293euoutp01U; Thu, 6 Sep 2018 15:55:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180906155557euoutp0171951b2a94ddc0507eaf3e8f9e7794bf~R2qa-VvLW1529315293euoutp01U DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1536249357; bh=VGEaPtZRW2v0h9vmhjnQR67U2fTUUB34E+GMkkQq6BU=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=WKdy3PXjYJWSWeHQTFqGPTEHZmbNMKcc+mpoLyOjlapFopefqKnqJsIOJJj8HHsh/ qxNabqKPe8iUFpTCqpTXWp3Df7+8kd2aiqjiSYwbeoU8R6Ojt4ELl8yLX2zeO6/xEG iCC/rWxrxa7ewpnNF1byfNE9GRCihIo2NmvnkHwQ= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180906155557eucas1p13a98fc7af9753a993eb2ffe353aa0b2e~R2qajWQeL1224912249eucas1p19; Thu, 6 Sep 2018 15:55:57 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id F4.31.04806.C0E419B5; Thu, 6 Sep 2018 16:55:56 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180906155556eucas1p26cc9f85524938192ea01bde8e1b977e2~R2qZxpoCk2540625406eucas1p2I; Thu, 6 Sep 2018 15:55:56 +0000 (GMT) X-AuditID: cbfec7f5-34dff700000012c6-98-5b914e0c284a Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 28.DC.04128.C0E419B5; Thu, 6 Sep 2018 16:55:56 +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:56 +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 04/10] clk: samsung: s3c2443: Use generic helper for handling suspend/resume Date: Thu, 06 Sep 2018 17:55:26 +0200 Message-id: <20180906155532.4085-5-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+NgFlrAIsWRmVeSWp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q2AQMJbredrGB2CICDhKfP71mBCliFnjMKHFu8QZWkISwQKLEzo832EFsFgFVidZp v8DivAI2Ev335zBCrJOXWL3hADOIzSlgKzFjbidYjRBQzarGKawTGHkWMDKsYhRJLS3OTc8t NtIrTswtLs1L10vOz93ECAyVbcd+btnB2PUu+BCjAAejEg+vhenEaCHWxLLiytxDjBIczEoi vO7VE6KFeFMSK6tSi/Lji0pzUosPMUpzsCiJ8543qIwSEkhPLEnNTk0tSC2CyTJxcEo1MM5x dzDpWhS/Lr531V2jYOcjlr059SYKHz5Xl+4sPHjmXp2t4s/9H3vO5U/s22fF/zov6aqZv+CT Qg0xX9aKCzdbGHX81s/3PbxUJrVwft2b6h9HVq3d5iv943dEymeWjBWuEpI9b9g38B3nOPVG qrN4mZ3flOe6pUx2N7h4l/mGa6UcbogzVGIpzkg01GIuKk4EAGhW+ZMRAgAA X-CMS-MailID: 20180906155556eucas1p26cc9f85524938192ea01bde8e1b977e2 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180906155556eucas1p26cc9f85524938192ea01bde8e1b977e2 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-s3c2443.c | 43 ++----------------------------- 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/drivers/clk/samsung/clk-s3c2443.c b/drivers/clk/samsung/clk-s3c2443.c index c46e6d5bc9bc..884067e4f1a1 100644 --- a/drivers/clk/samsung/clk-s3c2443.c +++ b/drivers/clk/samsung/clk-s3c2443.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include @@ -43,9 +42,6 @@ enum supported_socs { static void __iomem *reg_base; -#ifdef CONFIG_PM_SLEEP -static struct samsung_clk_reg_dump *s3c2443_save; - /* * list of controller registers to be saved and restored during a * suspend/resume cycle. @@ -65,42 +61,6 @@ static unsigned long s3c2443_clk_regs[] __initdata = { SCLKCON, }; -static int s3c2443_clk_suspend(void) -{ - samsung_clk_save(reg_base, s3c2443_save, - ARRAY_SIZE(s3c2443_clk_regs)); - - return 0; -} - -static void s3c2443_clk_resume(void) -{ - samsung_clk_restore(reg_base, s3c2443_save, - ARRAY_SIZE(s3c2443_clk_regs)); -} - -static struct syscore_ops s3c2443_clk_syscore_ops = { - .suspend = s3c2443_clk_suspend, - .resume = s3c2443_clk_resume, -}; - -static void __init s3c2443_clk_sleep_init(void) -{ - s3c2443_save = samsung_clk_alloc_reg_dump(s3c2443_clk_regs, - ARRAY_SIZE(s3c2443_clk_regs)); - if (!s3c2443_save) { - pr_warn("%s: failed to allocate sleep save data, no sleep support!\n", - __func__); - return; - } - - register_syscore_ops(&s3c2443_clk_syscore_ops); - return; -} -#else -static void __init s3c2443_clk_sleep_init(void) {} -#endif - PNAME(epllref_p) = { "mpllref", "mpllref", "xti", "ext" }; PNAME(esysclk_p) = { "epllref", "epll" }; PNAME(mpllref_p) = { "xti", "mdivclk" }; @@ -450,7 +410,8 @@ void __init s3c2443_common_clk_init(struct device_node *np, unsigned long xti_f, break; } - s3c2443_clk_sleep_init(); + samsung_clk_sleep_init(reg_base, s3c2443_clk_regs, + ARRAY_SIZE(s3c2443_clk_regs)); samsung_clk_of_add_provider(np, ctx); From patchwork Thu Sep 6 15:55:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10590785 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 4EFD5112B for ; Thu, 6 Sep 2018 15:56:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 451B82AEA5 for ; Thu, 6 Sep 2018 15:56:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 395CA2AEAA; Thu, 6 Sep 2018 15:56:01 +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 A455A2AE8B for ; Thu, 6 Sep 2018 15:56:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730427AbeIFUcI (ORCPT ); Thu, 6 Sep 2018 16:32:08 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:46877 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730394AbeIFUcH (ORCPT ); Thu, 6 Sep 2018 16:32:07 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180906155558euoutp01de6c9929698f823532c6a88910e076b7~R2qbfUg1V1529515295euoutp01O; Thu, 6 Sep 2018 15:55:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180906155558euoutp01de6c9929698f823532c6a88910e076b7~R2qbfUg1V1529515295euoutp01O DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1536249358; bh=kQIeyNC3ZImMir+NRNDhB5TnQKrBTAjvLPc3H6mRdGI=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=RiDNoaf1LK0419oqN8aUTVe/eIJdgmhJaMEDtA/6JPvmK6jTBVa3NB91UZTz2WxJb t3JdAZubPB/dg1LXkNVx+wF2CvX3lCt38NrN8aR1t4n/MWyCM36juWZ9aZR9sDydqA OkJYN+1z3y6wPBCsOKvWtDeZxbbCDwjftK+yjsIs= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180906155557eucas1p16e685f158a3451d60df577337d3b6922~R2qbBLhX21224512245eucas1p16; Thu, 6 Sep 2018 15:55:57 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 75.31.04806.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 20180906155556eucas1p2546c6d2fa7d42bad8ea021aea249752a~R2qaDrcLd0455004550eucas1p2V; Thu, 6 Sep 2018 15:55:56 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-99-5b914e0de17d Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 68.CE.04284.C0E419B5; Thu, 6 Sep 2018 16:55:56 +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:56 +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 05/10] clk: samsung: s3c64xx: Use generic helper for handling suspend/resume Date: Thu, 06 Sep 2018 17:55:27 +0200 Message-id: <20180906155532.4085-6-m.szyprowski@samsung.com> X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ONo++LasYPT5vkgtgjuKySUnNySxL LdK3S+DK+L6kn72gQ6piyuxvrA2MX0S7GDk5JARMJN7MPcDaxcjFISSwhFHiZutmKKeJSaLx zgEmkCo2AUOJrrddbCC2iICDxOdPrxlBipgFHjNKnFu8gRUkISyQKLHm4052EJtFQFXi6/f1 LF2MHBy8AjYSl7cWQmyTl1i94QAziM0pYCsxY24nWKsQUMmqximsExh5FjAyrGIUSS0tzk3P LTbUK07MLS7NS9dLzs/dxAgMlG3Hfm7ewXhpY/AhRgEORiUeXgvTidFCrIllxZW5hxglOJiV RHjdqydEC/GmJFZWpRblxxeV5qQWH2KU5mBREuc9b1AZJSSQnliSmp2aWpBaBJNl4uCUamBU 9JRtuba8h/e5TLltPePzawucmC8vqVn/LHLpldq6Ha+NN/18V/qaec6RF5Oj9hbNnckj++nR xospzx7zuIZkH1AX2Xjg7hzBJQeTM78cLT3aGbSoSkhDL/Hlk1Lm0sBDB0r8g6Y6WB/denf5 +u1OF2Zs0ujPO75vIc/beRYfXm3Zfvds5b7Nu5RYijMSDbWYi4oTAQ2Lg9QQAgAA X-CMS-MailID: 20180906155556eucas1p2546c6d2fa7d42bad8ea021aea249752a X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180906155556eucas1p2546c6d2fa7d42bad8ea021aea249752a 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-s3c64xx.c | 66 +++---------------------------- 1 file changed, 6 insertions(+), 60 deletions(-) diff --git a/drivers/clk/samsung/clk-s3c64xx.c b/drivers/clk/samsung/clk-s3c64xx.c index 6db01cf5ab83..329a449f78c3 100644 --- a/drivers/clk/samsung/clk-s3c64xx.c +++ b/drivers/clk/samsung/clk-s3c64xx.c @@ -12,7 +12,6 @@ #include #include #include -#include #include @@ -59,10 +58,6 @@ static void __iomem *reg_base; static bool is_s3c6400; -#ifdef CONFIG_PM_SLEEP -static struct samsung_clk_reg_dump *s3c64xx_save_common; -static struct samsung_clk_reg_dump *s3c64xx_save_soc; - /* * List of controller registers to be saved and restored during * a suspend/resume cycle. @@ -89,60 +84,6 @@ static unsigned long s3c6410_clk_regs[] __initdata = { MEM0_GATE, }; -static int s3c64xx_clk_suspend(void) -{ - samsung_clk_save(reg_base, s3c64xx_save_common, - ARRAY_SIZE(s3c64xx_clk_regs)); - - if (!is_s3c6400) - samsung_clk_save(reg_base, s3c64xx_save_soc, - ARRAY_SIZE(s3c6410_clk_regs)); - - return 0; -} - -static void s3c64xx_clk_resume(void) -{ - samsung_clk_restore(reg_base, s3c64xx_save_common, - ARRAY_SIZE(s3c64xx_clk_regs)); - - if (!is_s3c6400) - samsung_clk_restore(reg_base, s3c64xx_save_soc, - ARRAY_SIZE(s3c6410_clk_regs)); -} - -static struct syscore_ops s3c64xx_clk_syscore_ops = { - .suspend = s3c64xx_clk_suspend, - .resume = s3c64xx_clk_resume, -}; - -static void __init s3c64xx_clk_sleep_init(void) -{ - s3c64xx_save_common = samsung_clk_alloc_reg_dump(s3c64xx_clk_regs, - ARRAY_SIZE(s3c64xx_clk_regs)); - if (!s3c64xx_save_common) - goto err_warn; - - if (!is_s3c6400) { - s3c64xx_save_soc = samsung_clk_alloc_reg_dump(s3c6410_clk_regs, - ARRAY_SIZE(s3c6410_clk_regs)); - if (!s3c64xx_save_soc) - goto err_soc; - } - - register_syscore_ops(&s3c64xx_clk_syscore_ops); - return; - -err_soc: - kfree(s3c64xx_save_common); -err_warn: - pr_warn("%s: failed to allocate sleep save data, no sleep support!\n", - __func__); -} -#else -static void __init s3c64xx_clk_sleep_init(void) {} -#endif - /* List of parent clocks common for all S3C64xx SoCs. */ PNAME(spi_mmc_p) = { "mout_epll", "dout_mpll", "fin_pll", "clk27m" }; PNAME(uart_p) = { "mout_epll", "dout_mpll" }; @@ -508,7 +449,12 @@ void __init s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f, samsung_clk_register_alias(ctx, s3c64xx_clock_aliases, ARRAY_SIZE(s3c64xx_clock_aliases)); - s3c64xx_clk_sleep_init(); + + samsung_clk_sleep_init(reg_base, s3c64xx_clk_regs, + ARRAY_SIZE(s3c64xx_clk_regs)); + if (!is_s3c6400) + samsung_clk_sleep_init(reg_base, s3c6410_clk_regs, + ARRAY_SIZE(s3c6410_clk_regs)); samsung_clk_of_add_provider(np, ctx); From patchwork Thu Sep 6 15:55:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10590791 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 9F3B969B5 for ; Thu, 6 Sep 2018 15:56:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9196D2AE86 for ; Thu, 6 Sep 2018 15:56:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 858822AEAA; Thu, 6 Sep 2018 15:56:01 +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 021CB2AE96 for ; Thu, 6 Sep 2018 15:56:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730364AbeIFUcI (ORCPT ); Thu, 6 Sep 2018 16:32:08 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:59529 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730358AbeIFUcH (ORCPT ); Thu, 6 Sep 2018 16:32:07 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180906155558euoutp02543284c4c2455aee8a29ad18755a586f~R2qb6ugNz3136531365euoutp029; Thu, 6 Sep 2018 15:55:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180906155558euoutp02543284c4c2455aee8a29ad18755a586f~R2qb6ugNz3136531365euoutp029 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1536249358; bh=B/btBmd7fmEvzdadhim6Z93O8J9igi0RZYs1C33JoGg=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=XmGjI32SrYvI6+SxTZUUEiQnILSeAcR58zAfei3fAdaCyzI5ZgKmFCboecbTKSaGr k/x+ct5qZnFcmPLKpKjZsUb3HHK7bLVUj5eHZS1HDWGbVPC1M1Ad98vF02n1qvZ/GW O/oZJMm/6kwvY7hvnL8HNwTNs4lZgN0k78UzeBPo= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180906155558eucas1p15bab6a87fff78eefd13ff08fb068c6a0~R2qbXagXO1238212382eucas1p1k; Thu, 6 Sep 2018 15:55:58 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id AD.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 20180906155556eucas1p26451379042b32e08d9199d6eab9841ef~R2qaZkBP10558005580eucas1p2P; Thu, 6 Sep 2018 15:55:56 +0000 (GMT) X-AuditID: cbfec7f4-84fff700000010c6-c0-5b914e0dee00 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 19.CE.04284.C0E419B5; Thu, 6 Sep 2018 16:55:56 +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:56 +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 06/10] clk: samsung: s5pv210: Use generic helper for handling suspend/resume Date: Thu, 06 Sep 2018 17:55:28 +0200 Message-id: <20180906155532.4085-7-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+NgFlrIIsWRmVeSWpSXmKPExsWy7djP87q8fhOjDVYdULfYOGM9q8X1L89Z Lc6f38Bu8bHnHqvFjPP7mCzWHrnLbtH+9CWzA7vHplWdbB59W1YxenzeJBfAHMVlk5Kak1mW WqRvl8CVcaXjEkvBC+GKLXdOsTYwXhLoYuTkkBAwkej9d4Kxi5GLQ0hgBaPE0ku3mCGcz4wS /dfbGGGqvk5dzwqRWMYoMav1B1RVA5PE13enmECq2AQMJbredrGB2CICDhKfP70Gm8ss8JhR YuvJr8wgCWGBRIkTk66xdzFycLAIqEoc/ekIEuYVsJHY1fKcFWKbvMTqDQfAyjkFbCVmzO0E 2ywh8JNV4uXN11BFLhLz1q9ig7CFJV4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XqB+JOeF+7ellq+amzGd/zH9vx3596rdyX95tI /1v1bVsYPrV0f9vyKWFuB2ebS5GfoXKw42MlluKMREMt5qLiRAD1rupRDwIAAA== X-CMS-MailID: 20180906155556eucas1p26451379042b32e08d9199d6eab9841ef X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180906155556eucas1p26451379042b32e08d9199d6eab9841ef 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-s5pv210.c | 41 ++----------------------------- 1 file changed, 2 insertions(+), 39 deletions(-) diff --git a/drivers/clk/samsung/clk-s5pv210.c b/drivers/clk/samsung/clk-s5pv210.c index fd2725710a6f..41d2337fe030 100644 --- a/drivers/clk/samsung/clk-s5pv210.c +++ b/drivers/clk/samsung/clk-s5pv210.c @@ -14,7 +14,6 @@ #include #include #include -#include #include "clk.h" #include "clk-pll.h" @@ -83,9 +82,6 @@ enum { static void __iomem *reg_base; -#ifdef CONFIG_PM_SLEEP -static struct samsung_clk_reg_dump *s5pv210_clk_dump; - /* List of registers that need to be preserved across suspend/resume. */ static unsigned long s5pv210_clk_regs[] __initdata = { CLK_SRC0, @@ -132,40 +128,6 @@ static unsigned long s5pv210_clk_regs[] __initdata = { CLK_OUT, }; -static int s5pv210_clk_suspend(void) -{ - samsung_clk_save(reg_base, s5pv210_clk_dump, - ARRAY_SIZE(s5pv210_clk_regs)); - return 0; -} - -static void s5pv210_clk_resume(void) -{ - samsung_clk_restore(reg_base, s5pv210_clk_dump, - ARRAY_SIZE(s5pv210_clk_regs)); -} - -static struct syscore_ops s5pv210_clk_syscore_ops = { - .suspend = s5pv210_clk_suspend, - .resume = s5pv210_clk_resume, -}; - -static void s5pv210_clk_sleep_init(void) -{ - s5pv210_clk_dump = - samsung_clk_alloc_reg_dump(s5pv210_clk_regs, - ARRAY_SIZE(s5pv210_clk_regs)); - if (!s5pv210_clk_dump) { - pr_warn("%s: Failed to allocate sleep save data\n", __func__); - return; - } - - register_syscore_ops(&s5pv210_clk_syscore_ops); -} -#else -static inline void s5pv210_clk_sleep_init(void) { } -#endif - /* Mux parent lists. */ static const char *const fin_pll_p[] __initconst = { "xxti", @@ -822,7 +784,8 @@ static void __init __s5pv210_clk_init(struct device_node *np, samsung_clk_register_alias(ctx, s5pv210_aliases, ARRAY_SIZE(s5pv210_aliases)); - s5pv210_clk_sleep_init(); + samsung_clk_sleep_init(reg_base, s5pv210_clk_regs, + ARRAY_SIZE(s5pv210_clk_regs)); samsung_clk_of_add_provider(np, ctx); 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+HfzLCuE0MEnMX72aEaSKTcBQouttF1iHiICDxOdPrxlBip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JMnFwSjUw8rOI 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); From patchwork Thu Sep 6 15:55:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10590805 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 4C6C21669 for ; Thu, 6 Sep 2018 15:56:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B1DE2AE9F for ; Thu, 6 Sep 2018 15:56:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2CDAE2AE8B; 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=unavailable 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 BF0532AE96 for ; Thu, 6 Sep 2018 15:56:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730394AbeIFUcI (ORCPT ); Thu, 6 Sep 2018 16:32:08 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:59532 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730413AbeIFUcI (ORCPT ); Thu, 6 Sep 2018 16:32:08 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180906155558euoutp025b77b8a2343411a8dc8262060132248f~R2qcQL-T63096130961euoutp02W; Thu, 6 Sep 2018 15:55:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180906155558euoutp025b77b8a2343411a8dc8262060132248f~R2qcQL-T63096130961euoutp02W DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1536249359; bh=ZzRNgv7l9G4MMJjfXIpCYY4RwcjeLSwooGe7of1Z+c8=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=O1puGGMOnM0w2bpskngejOR2Jkk29rBvVJTY9uJnASTlKmD0O1WKn/crogKX20QYE gb1UPrt7i0zdV1zwJHJ/mcPyWcDhPuKkK5fdXgr1LcELM1MbdxErySvzbTMoC8mJ79 P8TaYQONpYGcdWur+zpCCxudsgSnmQ09VszX1Ins= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180906155558eucas1p2b71242ff65c451e69057b39ed0f0ff4b~R2qbyRExt0454104541eucas1p2W; Thu, 6 Sep 2018 15:55:58 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 56.31.04806.E0E419B5; Thu, 6 Sep 2018 16:55:58 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180906155557eucas1p2e964b85aa74304c458807ee2f7ffeea7~R2qbFETrQ0610806108eucas1p2k; Thu, 6 Sep 2018 15:55:57 +0000 (GMT) X-AuditID: cbfec7f5-34dff700000012c6-9e-5b914e0e2fc1 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 79.DC.04128.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 08/10] clk: samsung: Add support for setting registers state before suspend Date: Thu, 06 Sep 2018 17:55:30 +0200 Message-id: <20180906155532.4085-9-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+NgFlrIIsWRmVeSWpSXmKPExsWy7djP87p8fhOjDX5v5LbYOGM9q8X1L89Z Lc6f38Bu8b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FVi2doH 7CA2r4CNxIl/d9kh1slLrN5wAKyGU8BWYsbcTrBeIaCaVY1TWCcw8ixgZFjFKJJaWpybnlts pFecmFtcmpeul5yfu4kRGCrbjv3csoOx613wIUYBDkYlHl4L04nRQqyJZcWVuYcYJTiYlUR4 3asnRAvxpiRWVqUW5ccXleakFh9ilOZgURLnPW9QGSUkkJ5YkpqdmlqQWgSTZeLglGpg7Lg9 7e6ZN/eUtN6eb2hZNHWN4tbV+4SfBZSWap7cbsV24uHFZeKc3b7b7zzVadNXlNkpurracf9q zTaHDesyli6qfZLDNMFzgamLVy9X4J6shXtcQ8KlE06r+cdMmmkdo5TdknzH+7XPQqP6xd/u LFhQHCVr1xCQYXryadCGLscr5uWdYXdWK7EUZyQaajEXFScCADUnA5wRAgAA X-CMS-MailID: 20180906155557eucas1p2e964b85aa74304c458807ee2f7ffeea7 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180906155557eucas1p2e964b85aa74304c458807ee2f7ffeea7 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 Some registers of clock controller have to be set to certain values before entering system suspend state. Till now drivers did that on their own, but it will be easier to handle it by generic code and let drivers simply to provide the list of registers and their state. Signed-off-by: Marek Szyprowski --- drivers/clk/samsung/clk.c | 23 +++++++++++++---------- drivers/clk/samsung/clk.h | 18 ++++++++++++++++-- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/drivers/clk/samsung/clk.c b/drivers/clk/samsung/clk.c index 8634884aa11c..1f6e47cd327d 100644 --- a/drivers/clk/samsung/clk.c +++ b/drivers/clk/samsung/clk.c @@ -290,9 +290,12 @@ static int samsung_clk_suspend(void) { struct samsung_clock_reg_cache *reg_cache; - list_for_each_entry(reg_cache, &clock_reg_cache_list, node) + list_for_each_entry(reg_cache, &clock_reg_cache_list, node) { samsung_clk_save(reg_cache->reg_base, reg_cache->rdump, reg_cache->rd_num); + samsung_clk_restore(reg_cache->reg_base, reg_cache->rsuspend, + reg_cache->rsuspend_num); + } return 0; } @@ -310,9 +313,11 @@ static struct syscore_ops samsung_clk_syscore_ops = { .resume = samsung_clk_resume, }; -void samsung_clk_sleep_init(void __iomem *reg_base, +void samsung_clk_extended_sleep_init(void __iomem *reg_base, const unsigned long *rdump, - unsigned long nr_rdump) + unsigned long nr_rdump, + const struct samsung_clk_reg_dump *rsuspend, + unsigned long nr_rsuspend) { struct samsung_clock_reg_cache *reg_cache; @@ -330,13 +335,10 @@ void samsung_clk_sleep_init(void __iomem *reg_base, reg_cache->reg_base = reg_base; reg_cache->rd_num = nr_rdump; + reg_cache->rsuspend = rsuspend; + reg_cache->rsuspend_num = nr_rsuspend; list_add_tail(®_cache->node, &clock_reg_cache_list); } - -#else -void samsung_clk_sleep_init(void __iomem *reg_base, - const unsigned long *rdump, - unsigned long nr_rdump) {} #endif /* @@ -380,8 +382,9 @@ struct samsung_clk_provider * __init samsung_cmu_register_one( samsung_clk_register_fixed_factor(ctx, cmu->fixed_factor_clks, cmu->nr_fixed_factor_clks); if (cmu->clk_regs) - samsung_clk_sleep_init(reg_base, cmu->clk_regs, - cmu->nr_clk_regs); + samsung_clk_extended_sleep_init(reg_base, + cmu->clk_regs, cmu->nr_clk_regs, + cmu->suspend_regs, cmu->nr_suspend_regs); samsung_clk_of_add_provider(np, ctx); diff --git a/drivers/clk/samsung/clk.h b/drivers/clk/samsung/clk.h index 3880d2f9d582..c3f309d7100d 100644 --- a/drivers/clk/samsung/clk.h +++ b/drivers/clk/samsung/clk.h @@ -279,6 +279,8 @@ struct samsung_clock_reg_cache { void __iomem *reg_base; struct samsung_clk_reg_dump *rdump; unsigned int rd_num; + const struct samsung_clk_reg_dump *rsuspend; + unsigned int rsuspend_num; }; struct samsung_cmu_info { @@ -358,9 +360,21 @@ extern struct samsung_clk_provider __init *samsung_cmu_register_one( extern unsigned long _get_rate(const char *clk_name); -extern void samsung_clk_sleep_init(void __iomem *reg_base, +#ifdef CONFIG_PM_SLEEP +extern void samsung_clk_extended_sleep_init(void __iomem *reg_base, const unsigned long *rdump, - unsigned long nr_rdump); + unsigned long nr_rdump, + const struct samsung_clk_reg_dump *rsuspend, + unsigned long nr_rsuspend); +#else +static inline void samsung_clk_extended_sleep_init(void __iomem *reg_base, + const unsigned long *rdump, + unsigned long nr_rdump, + const struct samsung_clk_reg_dump *rsuspend, + unsigned long nr_rsuspend) {} +#endif +#define samsung_clk_sleep_init(reg_base, rdump, nr_rdump) \ + samsung_clk_extended_sleep_init(reg_base, rdump, nr_rdump, NULL, 0) extern void samsung_clk_save(void __iomem *base, struct samsung_clk_reg_dump *rd, From patchwork Thu Sep 6 15:55:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10590813 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 E637A69BD for ; Thu, 6 Sep 2018 15:56:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA8FB2AE82 for ; Thu, 6 Sep 2018 15:56:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE85D2AE9D; 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=unavailable 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 5412D287D2 for ; Thu, 6 Sep 2018 15:56:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730389AbeIFUcJ (ORCPT ); Thu, 6 Sep 2018 16:32:09 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:46886 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730422AbeIFUcJ (ORCPT ); Thu, 6 Sep 2018 16:32:09 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180906155559euoutp01643743b98abf6c8768ecd531567e343b~R2qcjQnBD1567915679euoutp015; Thu, 6 Sep 2018 15:55:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180906155559euoutp01643743b98abf6c8768ecd531567e343b~R2qcjQnBD1567915679euoutp015 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1536249359; bh=CXD7gZhI1WzEeKHAgIuv6YluoXXruUgwWRMciLqM83s=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=ebd94WuJlmHu5ihbC6NDudGE2HaZFGDr5Giv9jKkYWMVL2fEVSAWPXLPH0m9UroHd pQ0mhhCLeFhQeEot9+8vLoIBZCx6RgOjLduW/srpzGQF0RokSviBkn4hWH9/Uh4van /4HqN3QM4NHONU0I3lQhfBSPN140dAPvTlhZievQ= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180906155558eucas1p2cd925ba307233c5ad27cdd0f9e441990~R2qcFK0oD0634606346eucas1p2P; Thu, 6 Sep 2018 15:55:58 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id D6.31.04806.E0E419B5; Thu, 6 Sep 2018 16:55:58 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180906155558eucas1p2778fb4476678214f4509f46a5b92dd5d~R2qbZjJ3W0455004550eucas1p2Z; Thu, 6 Sep 2018 15:55:58 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-9f-5b914e0e83b9 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id F9.DC.04128.E0E419B5; Thu, 6 Sep 2018 16:55:58 +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 09/10] clk: samsung: exynos4: Use generic helper for handling suspend/resume Date: Thu, 06 Sep 2018 17:55:31 +0200 Message-id: <20180906155532.4085-10-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+NgFlrIIsWRmVeSWpSXmKPExsWy7djPc7p8fhOjDc5NlbPYOGM9q8X1L89Z Lc6f38Bu8bHnHqvFjPP7mCzWHrnLbtH+9CWzA7vHplWdbB59W1YxenzeJBfAHMVlk5Kak1mW WqRvl8CVMe/pBLaCDUYVN1tyGxibtLoYOTkkBEwkvh0/xdrFyMUhJLCCUWJS12k2COczo0TD pLmsMFV3nlxkhEgsY5R48nMRVEsDk8T81asZQarYBAwlut52sYHYIgIOEp8/vQbrYBZ4zCix 9eRXZpCEsECixOPl78HGsgioSrx5cZMdxOYVsJX4evA8O8Q6eYnVGw6A1XMCxWfM7QTbJiHw k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C9xf814zP2CR /PatT3Fu58PZDcnTi12kzt4t8rG5GRu3N9r1nOlDGfPer8Eqy2x3Hmh8q7dx4+2QQtG3W6Tv C32d+myxwFSTyq4HP7XO682fL3ngpBJLcUaioRZzUXEiAE7/evAQAgAA X-CMS-MailID: 20180906155558eucas1p2778fb4476678214f4509f46a5b92dd5d X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180906155558eucas1p2778fb4476678214f4509f46a5b92dd5d 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. Handling of PLLs is a bit different in generic code, as they are handled in the same way as other clock registers. Such approach was already used on later Exynos SoCs and worked fine. Tests have shown that it works also on Exynos4 SoCs and significantly simplifies the code. Signed-off-by: Marek Szyprowski --- drivers/clk/samsung/clk-exynos4.c | 145 +++--------------------------- 1 file changed, 14 insertions(+), 131 deletions(-) diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-exynos4.c index 0421960eb963..d7cfdb0732c8 100644 --- a/drivers/clk/samsung/clk-exynos4.c +++ b/drivers/clk/samsung/clk-exynos4.c @@ -16,7 +16,6 @@ #include #include #include -#include #include "clk.h" #include "clk-cpu.h" @@ -157,14 +156,6 @@ enum exynos4_plls { static void __iomem *reg_base; static enum exynos4_soc exynos4_soc; -/* - * Support for CMU save/restore across system suspends - */ -#ifdef CONFIG_PM_SLEEP -static struct samsung_clk_reg_dump *exynos4_save_common; -static struct samsung_clk_reg_dump *exynos4_save_soc; -static struct samsung_clk_reg_dump *exynos4_save_pll; - /* * list of controller registers to be saved and restored during a * suspend/resume cycle. @@ -192,7 +183,7 @@ static const unsigned long exynos4x12_clk_save[] __initconst = { E4X12_PWR_CTRL2, }; -static const unsigned long exynos4_clk_pll_regs[] __initconst = { +static const unsigned long exynos4_clk_regs[] __initconst = { EPLL_LOCK, VPLL_LOCK, EPLL_CON0, @@ -201,9 +192,6 @@ static const unsigned long exynos4_clk_pll_regs[] __initconst = { VPLL_CON0, VPLL_CON1, VPLL_CON2, -}; - -static const unsigned long exynos4_clk_regs[] __initconst = { SRC_LEFTBUS, DIV_LEFTBUS, GATE_IP_LEFTBUS, @@ -276,6 +264,8 @@ static const unsigned long exynos4_clk_regs[] __initconst = { }; static const struct samsung_clk_reg_dump src_mask_suspend[] = { + { .offset = VPLL_CON0, .value = 0x80600302, }, + { .offset = EPLL_CON0, .value = 0x806F0302, }, { .offset = SRC_MASK_TOP, .value = 0x00000001, }, { .offset = SRC_MASK_CAM, .value = 0x11111111, }, { .offset = SRC_MASK_TV, .value = 0x00000111, }, @@ -291,123 +281,6 @@ static const struct samsung_clk_reg_dump src_mask_suspend_e4210[] = { { .offset = E4210_SRC_MASK_LCD1, .value = 0x00001111, }, }; -#define PLL_ENABLED (1 << 31) -#define PLL_LOCKED (1 << 29) - -static void exynos4_clk_enable_pll(u32 reg) -{ - u32 pll_con = readl(reg_base + reg); - pll_con |= PLL_ENABLED; - writel(pll_con, reg_base + reg); - - while (!(pll_con & PLL_LOCKED)) { - cpu_relax(); - pll_con = readl(reg_base + reg); - } -} - -static void exynos4_clk_wait_for_pll(u32 reg) -{ - u32 pll_con; - - pll_con = readl(reg_base + reg); - if (!(pll_con & PLL_ENABLED)) - return; - - while (!(pll_con & PLL_LOCKED)) { - cpu_relax(); - pll_con = readl(reg_base + reg); - } -} - -static int exynos4_clk_suspend(void) -{ - samsung_clk_save(reg_base, exynos4_save_common, - ARRAY_SIZE(exynos4_clk_regs)); - samsung_clk_save(reg_base, exynos4_save_pll, - ARRAY_SIZE(exynos4_clk_pll_regs)); - - exynos4_clk_enable_pll(EPLL_CON0); - exynos4_clk_enable_pll(VPLL_CON0); - - if (exynos4_soc == EXYNOS4210) { - samsung_clk_save(reg_base, exynos4_save_soc, - ARRAY_SIZE(exynos4210_clk_save)); - samsung_clk_restore(reg_base, src_mask_suspend_e4210, - ARRAY_SIZE(src_mask_suspend_e4210)); - } else { - samsung_clk_save(reg_base, exynos4_save_soc, - ARRAY_SIZE(exynos4x12_clk_save)); - } - - samsung_clk_restore(reg_base, src_mask_suspend, - ARRAY_SIZE(src_mask_suspend)); - - return 0; -} - -static void exynos4_clk_resume(void) -{ - samsung_clk_restore(reg_base, exynos4_save_pll, - ARRAY_SIZE(exynos4_clk_pll_regs)); - - exynos4_clk_wait_for_pll(EPLL_CON0); - exynos4_clk_wait_for_pll(VPLL_CON0); - - samsung_clk_restore(reg_base, exynos4_save_common, - ARRAY_SIZE(exynos4_clk_regs)); - - if (exynos4_soc == EXYNOS4210) - samsung_clk_restore(reg_base, exynos4_save_soc, - ARRAY_SIZE(exynos4210_clk_save)); - else - samsung_clk_restore(reg_base, exynos4_save_soc, - ARRAY_SIZE(exynos4x12_clk_save)); -} - -static struct syscore_ops exynos4_clk_syscore_ops = { - .suspend = exynos4_clk_suspend, - .resume = exynos4_clk_resume, -}; - -static void __init exynos4_clk_sleep_init(void) -{ - exynos4_save_common = samsung_clk_alloc_reg_dump(exynos4_clk_regs, - ARRAY_SIZE(exynos4_clk_regs)); - if (!exynos4_save_common) - goto err_warn; - - if (exynos4_soc == EXYNOS4210) - exynos4_save_soc = samsung_clk_alloc_reg_dump( - exynos4210_clk_save, - ARRAY_SIZE(exynos4210_clk_save)); - else - exynos4_save_soc = samsung_clk_alloc_reg_dump( - exynos4x12_clk_save, - ARRAY_SIZE(exynos4x12_clk_save)); - if (!exynos4_save_soc) - goto err_common; - - exynos4_save_pll = samsung_clk_alloc_reg_dump(exynos4_clk_pll_regs, - ARRAY_SIZE(exynos4_clk_pll_regs)); - if (!exynos4_save_pll) - goto err_soc; - - register_syscore_ops(&exynos4_clk_syscore_ops); - return; - -err_soc: - kfree(exynos4_save_soc); -err_common: - kfree(exynos4_save_common); -err_warn: - pr_warn("%s: failed to allocate sleep save data, no sleep support!\n", - __func__); -} -#else -static void __init exynos4_clk_sleep_init(void) {} -#endif - /* list of all parent clock list */ PNAME(mout_apll_p) = { "fin_pll", "fout_apll", }; PNAME(mout_mpll_p) = { "fin_pll", "fout_mpll", }; @@ -1532,7 +1405,17 @@ static void __init exynos4_clk_init(struct device_node *np, if (soc == EXYNOS4X12) exynos4x12_core_down_clock(); - exynos4_clk_sleep_init(); + + samsung_clk_extended_sleep_init(reg_base, + exynos4_clk_regs, ARRAY_SIZE(exynos4_clk_regs), + src_mask_suspend, ARRAY_SIZE(src_mask_suspend)); + if (exynos4_soc == EXYNOS4210) + samsung_clk_extended_sleep_init(reg_base, + exynos4210_clk_save, ARRAY_SIZE(exynos4210_clk_save), + src_mask_suspend_e4210, ARRAY_SIZE(src_mask_suspend_e4210)); + else + samsung_clk_sleep_init(reg_base, exynos4x12_clk_save, + ARRAY_SIZE(exynos4x12_clk_save)); samsung_clk_of_add_provider(np, ctx); From patchwork Thu Sep 6 15:55:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10590809 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 933F814BD for ; Thu, 6 Sep 2018 15:56:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87C652ACF0 for ; Thu, 6 Sep 2018 15:56:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C3E82AE96; 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 129322ACF0 for ; Thu, 6 Sep 2018 15:56:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730422AbeIFUcJ (ORCPT ); Thu, 6 Sep 2018 16:32:09 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:46889 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730432AbeIFUcJ (ORCPT ); Thu, 6 Sep 2018 16:32:09 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180906155559euoutp01226a8396b59047d081f50efcd49b34a9~R2qc7mxe01529315293euoutp01W; Thu, 6 Sep 2018 15:55:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180906155559euoutp01226a8396b59047d081f50efcd49b34a9~R2qc7mxe01529315293euoutp01W DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1536249359; bh=rY/bSwnJXBqprcu8Tamfh60rexcrlVXVTpaEwehjUGU=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=BxefgBhz6rgXJ9FH5gQg1wPCwaQW/biOoJeGOwYBM2CLjK949zb9D2cEFJcAWGUFg 85v8zNKJvyb6V1zvCFwASENbYaSH8+LntMkQXQmdTDr2QkcogHxW0VDzPXw41HlK38 0YnhHvPBSFUhoIyicgAMseCtbPY/m0QUSrh3niYs= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180906155559eucas1p26bae61b57db744cd547c3b88c586903f~R2qch045R2541725417eucas1p2M; Thu, 6 Sep 2018 15:55:59 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 3A.85.04441.E0E419B5; Thu, 6 Sep 2018 16:55:58 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180906155558eucas1p2df01efef605c1261cc8aaf53a7157614~R2qbutfGS0558005580eucas1p2Q; Thu, 6 Sep 2018 15:55:58 +0000 (GMT) X-AuditID: cbfec7f2-5c9ff70000001159-14-5b914e0e6053 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 5A.CE.04284.E0E419B5; Thu, 6 Sep 2018 16:55:58 +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:58 +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 10/10] clk: samsung: exynos5420: Use generic helper for handling suspend/resume Date: Thu, 06 Sep 2018 17:55:32 +0200 Message-id: <20180906155532.4085-11-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+NgFlrIIsWRmVeSWpSXmKPExsWy7djP87p8fhOjDU6vs7TYOGM9q8X1L89Z Lc6f38Bu8bHnHqvFjPP7mCzWHrnLbtH+9CWzA7vHplWdbB59W1YxenzeJBfAHMVlk5Kak1mW WqRvl8CVsWLWC6aCNTIVZ55uZ25g/C3excjJISFgInF4znPWLkYuDiGBFYwSl599YoRwPjNK rLhxlBmmasnPBywQiWWMEtufzmIFSQgJNDBJbN4dD2KzCRhKdL3tYgOxRQQcJD5/eg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5I473mDyighgfTEktTs1NSC1CKYLBMHp1QD4zRt vsKFfUXHKwp1nD8d1m7acr27ovjUtVRjlvyId0yWDz8v5Z+qdy+KZf5507P8hwJvn/4p8Pgb K8vH+9tKGOSPGYmffbrt1IucOcwizgrJ23SWTa7c9/voRpkNJuzsR9fGLpzuF8OirVN7MkjB wabwVJr0BL/Dxjvfmk5X05bSq37A++iMjxJLcUaioRZzUXEiACC+MQMRAgAA X-CMS-MailID: 20180906155558eucas1p2df01efef605c1261cc8aaf53a7157614 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180906155558eucas1p2df01efef605c1261cc8aaf53a7157614 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 --- drivers/clk/samsung/clk-exynos5420.c | 72 +++------------------------- 1 file changed, 6 insertions(+), 66 deletions(-) diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c index 95e1bf69449b..76e7686c6162 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,12 @@ 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_extended_sleep_init(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);