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: 146109 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp38522ljw; Thu, 6 Sep 2018 08:56:04 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZtZFA3kIW3BQ8UrgPGSpjN7WxVRGBcAWJ8SvzBalo9GHuIuMJHXnB6pKeV7wDRrZO7qHRh X-Received: by 2002:a62:1fdd:: with SMTP id l90-v6mr3462960pfj.121.1536249364666; Thu, 06 Sep 2018 08:56:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536249364; cv=none; d=google.com; s=arc-20160816; b=zGGim64kwfGHuH2SdhJzAbsZjMQ3FjsVRyWV+230OSkI+YqASIdgx3MMliQSj/kBmT SHh+w2oX3iraooM2USYKCNoYFu32dGE1w3G5gCNRuDHbReYifGi33gIpn6GbM9O25mIP 2EBpejGxHUbDqKtZj9/be4m7Yx8fAdUgEI7pmz9LaXv5H/t6wZvBO9G5eiiaZXU4Ef4u mDUXfA+ydmHdl6eVTetSF8ouk4xa8weGdplLkh02x1RIY6boJCBVT1eSaX/btlP16Mn4 p60FyYuQKkktVwR0jmslQCq9V8eG+Ln4331llGp1kNAid83viYvlID2XXS5Gkh0vBJHE sWtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=rY/bSwnJXBqprcu8Tamfh60rexcrlVXVTpaEwehjUGU=; b=w56KaFO4hDnC8lTj1st1XLdEOCDMdMmfphVhGSC0CXW+kBdm5ym81XMhnxVc/+ayk4 FBEd5KohsOe66stwaofI4D11eNaY/7a6HHpOZCj9R4DPEdEDB2Jxyb8F/7S+YLROWD5W okGp0uSGWom0YSa923Dlrx5qxMtV4fLUmVaRLovaiBZhKKs4D55pdpxIoeicZHU3bwED oaLooVwcB91iC6UFpL8WSgD6wbsPoJ1TwZFLF39YWLlg7stPq896scaHCpuhR+6QSG2R OP84bOFrNgQBq6flDcO43qhA1tV2wB2LxYe5llOstLXtl5lWcdEZftqaVqNXppkDwnyD Rfag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=BxefgBhz; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k18-v6si5180597pff.91.2018.09.06.08.56.04; Thu, 06 Sep 2018 08:56:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=BxefgBhz; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730462AbeIFUcJ (ORCPT + 3 others); 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/eg02iVng MaPE1pNfwSYJC6RIzNz+hwnEZhFQlWheMJURxOYVsJXY1HuHEWKbvMTqDQfA6jmB4jPmdoLd JyHwlVWifUoLO0SRi8TH7VugbGGJV8dhbBmJzo6DTBANzYwS7TNmsUM4PUBnzNnBBlFlLXH4 +EWwH5gF+CQmbZsOtI4DKM4r0dEmBFHiIfFpag8zxM8TGCVenTzPMoFRcgEjwypG8dTS4tz0 1GLDvNRyveLE3OLSvHS95PzcTYzAiDv97/inHYxfLyUdYhTgYFTi4X1gNDFaiDWxrLgy9xCj BAezkgive/WEaCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8fFpp0UIC6YklqdmpqQWpRTBZJg5O qQZGj2Uq/f0bpbfv3pmgvPCN1uzr586sdXum+PIdx9Jth7Z9/zwtqrBl4s+92dEsb+elPb2h +3Lqg9SA0zPMGw1nPj3SPu1vjZGB4p63QsU3sk2uV2i+v/pyi8nskg2//c6m+HKkp75a4XD8 /fsPv7puTf5aevBKY8vq24kLPh/3C9rb8vDkJr1HAk1KLMUZiYZazEXFiQCgAtTVtAIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHJMWRmVeSWpSXmKPExsVy+t/xq7p8fhOjDZY9FrfYOGM9q8X1L89Z Lc6f38Bu8bHnHqvFjPP7mCzWHrnLbtH+9CWzA7vHplWdbB59W1YxenzeJBfAHMVlk5Kak1mW WqRvl8CVsWLWC6aCNTIVZ55uZ25g/C3excjJISFgIrHk5wOWLkYuDiGBJYwSi7c+Z4Rwmpgk Nr3+xgRSxSZgKNH1tosNxBYRcJD4/Ok1WBGzwGNGiXOLN7CCJIQFUiRmbv8D1sAioCrRvGAq I4jNK2Arsan3DiPEOnmJ1RsOMIPYnEDxGXM7wXqFBGwkVjVOYZ3AyLOAkWEVo0hqaXFuem6x oV5xYm5xaV66XnJ+7iZGYKhsO/Zz8w7GSxuDDzEKcDAq8fBamE6MFmJNLCuuzD3EKMHBrCTC 6149IVqINyWxsiq1KD++qDQntfgQozQHi5I473mDyighgfTEktTs1NSC1CKYLBMHp1QD4zRt 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-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org 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(-) -- 2.17.1 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);