From patchwork Wed Aug 29 15:50:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 145456 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp831332ljw; Wed, 29 Aug 2018 08:51:09 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ+CCG1P/VER25ZIJQWofX2F7JbwrUBWG2ZykGfzprH5rfSvg2HOV8suwRdSjtjMrWpZSWy X-Received: by 2002:a63:5055:: with SMTP id q21-v6mr6203405pgl.397.1535557869483; Wed, 29 Aug 2018 08:51:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535557869; cv=none; d=google.com; s=arc-20160816; b=jRLqbqWSbBQ/w98GDXhIJr6Vbp7hYrN//0YH6D1HLGJSAlmo1RK83VwnLqxfyz/Od5 u5Lg03r4XGtQqmBMpwTGqoCItQMvQgxvqihCqpZBzPOgxpJG9HpEnq2yBSfsNwFnr/AT bczlVcv0aeRJ8Kf1tsWNVrgWXdcnpVhAMgMvGRPQzu9WsxcJz7xWlqnaKja14l1tBqMJ n25ZhYQboYJZMVx2btRwS/U3UoSHc8jCt4iq/ZzHgdHufw6f0+ft/SbEChwXEFEo16eR XhiThpUlASb14AZVpSTyeWPq60B/8IpBIYZ3rz6AWMD07AMMP+shaxYODAd3VekH8Ibx J2Fg== 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 :arc-authentication-results; bh=TI9gOZRB3r4tnQPcekOrcuMLRHftqnHX83vDH5qp3q0=; b=PpoameMkgtWr2vUWS4j05HBjR0T0pJ8MLXRhOLIrVnD/FICvcs6FDI7+1Nafo7lp9p 4oUscq2Stkfq9dF1WkFvqkPt98GyjNlDJ5p0j9OYf/6lSUrSNTETN2YenixdKivjOq/b NusewjtJTZz3HQO4CmAuozVPTbt3tlFru+hqx+Lgt5IVfvDjw1nDktNFfN+WbFa51Uzq 3RsfMFlepPb1cQKuIbcrw03CzUle9FG+vKUq79swNF5PMqYRmDt4ZA+P6B/y9iyZu+bM CbMVRIM8Uygf4/76Csj+Vt9h3elJ19zuJ4KSptMDEkVzanxaV7Pu8f6MQHPW74FeBY2u Heow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=dKSJxC+5; 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 32-v6si4160278pgk.59.2018.08.29.08.51.09; Wed, 29 Aug 2018 08:51:09 -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=dKSJxC+5; 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 S1729179AbeH2Tsj (ORCPT + 3 others); Wed, 29 Aug 2018 15:48:39 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:55850 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729218AbeH2Tsj (ORCPT ); Wed, 29 Aug 2018 15:48:39 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180829155104euoutp017bc2e2dcc7d05193579677f4e3cf6212~PZb34kBIg0370903709euoutp01q; Wed, 29 Aug 2018 15:51:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180829155104euoutp017bc2e2dcc7d05193579677f4e3cf6212~PZb34kBIg0370903709euoutp01q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1535557864; bh=TI9gOZRB3r4tnQPcekOrcuMLRHftqnHX83vDH5qp3q0=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=dKSJxC+5Na+UahVGMpY67dLZjLmx1rgy5MFwfGLpGJ6l2rQ4kophGQcW33vVPmbZy /8mvfk8yz+LgsQZ3QkjNwSM8IA+wPd/tovRI4++HawDASc23bBWRaYdzkPFjGA0eH6 4ZMHBzpxb3Plq+2Bzjv8jivdzMa2QLwwWSndIru4= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180829155104eucas1p14b1737f1b75a68ecaf7885e6866521a8~PZb3dTqhe0107501075eucas1p11; Wed, 29 Aug 2018 15:51:04 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 4F.FA.04806.7E0C68B5; Wed, 29 Aug 2018 16:51:03 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180829155103eucas1p16b6cddb4babcfb60a3257e017bea347e~PZb2dLvAz0667306673eucas1p1Z; Wed, 29 Aug 2018 15:51:03 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-3f-5b86c0e7ecdd Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 28.76.04128.6E0C68B5; Wed, 29 Aug 2018 16:51:02 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PE800FCUC0UPL60@eusync4.samsung.com>; Wed, 29 Aug 2018 16:51:02 +0100 (BST) From: Marek Szyprowski To: linux-clk@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH 10/10] clk: samsung: exynos5420: Use generic helper for handling suspend/resume Date: Wed, 29 Aug 2018 17:50:46 +0200 Message-id: <20180829155046.29359-11-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20180829155046.29359-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrAIsWRmVeSWpSXmKPExsWy7djPc7rPD7RFGzzYpG+xccZ6VovrX56z Wpw/v4Hd4mPPPVaLGef3MVmsPXKX3aL96UtmB3aPTas62Tz6tqxi9Pi8SS6AOYrLJiU1J7Ms tUjfLoEr4918g4JH0hVfLj5lb2BcKt7FyMkhIWAicf/OXZYuRi4OIYEVjBILz/xghHA+M0rs WrSBrYuRA6yq86ImRHwZo8SeV1egihqYJCYv28gCMopNwFCi620XG4gtIuAg8fnTa7AiZoHH jBJbT35lBkkICyRKTH73kBXEZhFQlVjR8wMszitgJ7Hw5Rx2iJvkJVZvOAAW5wSKvzjeywoy SELgK6vElilL2CCKXCR2nfwB1SAs8er4FihbRuLy5G4WiIZmRon2GbPYIZweoDPm7IDqtpY4 fPwi2BnMAnwSk7ZNZ4Z4lFeio00IosRDovfmK2aIPycySnT9OsU2gVFyASPDKkbx1NLi3PTU YuO81HK94sTc4tK8dL3k/NxNjMB4O/3v+NcdjPv+JB1iFOBgVOLhvTCjLVqINbGsuDL3EKME B7OSCO/ehUAh3pTEyqrUovz4otKc1OJDjNIcLErivHxaadFCAumJJanZqakFqUUwWSYOTqkG RpEDOrZl0z9rGF63rti5i8eHwSAs8KKKx69lSc+DH3N494Rutfe22Vz74siTZWpP+Ayfzou9 vsztTo6KeorMBDXlCxGfxUwsOrOm2e4K7M+J8shrV1nCy86spLz62/LVlQ9e5y9ftPp1b9Tn HW2M/lM5Sg2eiMn+3ru1usw04PC5h8ZyWms7lViKMxINtZiLihMB2MlfQLMCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNJMWRmVeSWpSXmKPExsVy+t/xa7rPDrRFG/Q+s7LYOGM9q8X1L89Z Lc6f38Bu8bHnHqvFjPP7mCzWHrnLbtH+9CWzA7vHplWdbB59W1YxenzeJBfAHMVlk5Kak1mW WqRvl8CV8W6+QcEj6YovF5+yNzAuFe9i5OCQEDCR6Lyo2cXIySEksIRRYupG6S5GLiC7iUli 5/zTzCAJNgFDia63XWwgtoiAg8TnT68ZQYqYBR4zSpxbvIEVJCEskCgx+d1DMJtFQFViRc8P sGZeATuJhS/nsIPYEgLyEqs3HACLcwLFXxzvZYXYbCux8M53xgmMPAsYGVYxiqSWFuem5xYb 6RUn5haX5qXrJefnbmIEBsm2Yz+37GDsehd8iFGAg1GJh9dgUVu0EGtiWXFl7iFGCQ5mJRHe vQuBQrwpiZVVqUX58UWlOanFhxilOViUxHnPG1RGCQmkJ5akZqemFqQWwWSZODilGhhTq+Nb 8h5wSf2rlfHbOl24z/rlBuu0JZc/3csXbvpv6fC+MfjK8y8dmSL7A4/fmBtsK7UkbOlH43/S +nFGnwUfBG1bbuctOmPJ5/a3c37wC0y69P/Jogduf+w1hVJWBB+eNN+t7qjwfZtvyrOspFhU Mzef6Y/lCTtxYdt1rbD0J0fdfDoufPikxFKckWioxVxUnAgA4h5BHQ4CAAA= X-CMS-MailID: 20180829155103eucas1p16b6cddb4babcfb60a3257e017bea347e X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180829155103eucas1p16b6cddb4babcfb60a3257e017bea347e References: <20180829155046.29359-1-m.szyprowski@samsung.com> Sender: linux-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. No functional change. Signed-off-by: Marek Szyprowski --- drivers/clk/samsung/clk-exynos5420.c | 73 +++------------------------- 1 file changed, 7 insertions(+), 66 deletions(-) -- 2.17.1 diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c index 95e1bf69449b..9f2f53d7be70 100644 --- a/drivers/clk/samsung/clk-exynos5420.c +++ b/drivers/clk/samsung/clk-exynos5420.c @@ -15,7 +15,6 @@ #include #include #include -#include #include "clk.h" #include "clk-cpu.h" @@ -156,10 +155,6 @@ enum exynos5x_plls { static void __iomem *reg_base; static enum exynos5x_soc exynos5x_soc; -#ifdef CONFIG_PM_SLEEP -static struct samsung_clk_reg_dump *exynos5x_save; -static struct samsung_clk_reg_dump *exynos5800_save; - /* * list of controller registers to be saved and restored during a * suspend/resume cycle. @@ -283,66 +278,6 @@ static const struct samsung_clk_reg_dump exynos5420_set_clksrc[] = { { .offset = GATE_IP_PERIC, .value = 0xffffffff, }, }; -static int exynos5420_clk_suspend(void) -{ - samsung_clk_save(reg_base, exynos5x_save, - ARRAY_SIZE(exynos5x_clk_regs)); - - if (exynos5x_soc == EXYNOS5800) - samsung_clk_save(reg_base, exynos5800_save, - ARRAY_SIZE(exynos5800_clk_regs)); - - samsung_clk_restore(reg_base, exynos5420_set_clksrc, - ARRAY_SIZE(exynos5420_set_clksrc)); - - return 0; -} - -static void exynos5420_clk_resume(void) -{ - samsung_clk_restore(reg_base, exynos5x_save, - ARRAY_SIZE(exynos5x_clk_regs)); - - if (exynos5x_soc == EXYNOS5800) - samsung_clk_restore(reg_base, exynos5800_save, - ARRAY_SIZE(exynos5800_clk_regs)); -} - -static struct syscore_ops exynos5420_clk_syscore_ops = { - .suspend = exynos5420_clk_suspend, - .resume = exynos5420_clk_resume, -}; - -static void __init exynos5420_clk_sleep_init(void) -{ - exynos5x_save = samsung_clk_alloc_reg_dump(exynos5x_clk_regs, - ARRAY_SIZE(exynos5x_clk_regs)); - if (!exynos5x_save) { - pr_warn("%s: failed to allocate sleep save data, no sleep support!\n", - __func__); - return; - } - - if (exynos5x_soc == EXYNOS5800) { - exynos5800_save = - samsung_clk_alloc_reg_dump(exynos5800_clk_regs, - ARRAY_SIZE(exynos5800_clk_regs)); - if (!exynos5800_save) - goto err_soc; - } - - register_syscore_ops(&exynos5420_clk_syscore_ops); - return; -err_soc: - kfree(exynos5x_save); - pr_warn("%s: failed to allocate sleep save data, no sleep support!\n", - __func__); - return; -} -#else -static void __init exynos5420_clk_sleep_init(void) {} -#endif - /* list of all parent clocks */ PNAME(mout_mspll_cpu_p) = {"mout_sclk_cpll", "mout_sclk_dpll", "mout_sclk_mpll", "mout_sclk_spll"}; @@ -1540,7 +1475,13 @@ static void __init exynos5x_clk_init(struct device_node *np, mout_kfc_p[0], mout_kfc_p[1], 0x28200, exynos5420_kfcclk_d, ARRAY_SIZE(exynos5420_kfcclk_d), 0); - exynos5420_clk_sleep_init(); + samsung_clk_sleep_init2(reg_base, exynos5x_clk_regs, + ARRAY_SIZE(exynos5x_clk_regs), + exynos5420_set_clksrc, + ARRAY_SIZE(exynos5420_set_clksrc)); + if (soc == EXYNOS5800) + samsung_clk_sleep_init(reg_base, exynos5800_clk_regs, + ARRAY_SIZE(exynos5800_clk_regs)); exynos5_subcmus_init(ctx, ARRAY_SIZE(exynos5x_subcmus), exynos5x_subcmus);