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: 146110 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp38541ljw; Thu, 6 Sep 2018 08:56:05 -0700 (PDT) X-Google-Smtp-Source: ANB0VdawPC7bYNNtNzPHmeYOwXYYHYCvsmCDzeY+9MbfeOjr1f84RcAFWIt8f0lOLzj0ofewdEht X-Received: by 2002:a63:67c3:: with SMTP id b186-v6mr3396010pgc.5.1536249365212; Thu, 06 Sep 2018 08:56:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536249365; cv=none; d=google.com; s=arc-20160816; b=LG7CKgbbep5iNVqcZ1GzCO6hUNPyu4xMUf43Hlxnk3qWI5326mj1xJVFMkdhmMuTno gO5ajj26DOTN/hpXwhACQ+PmKQtVfjw3qzZ33AK0JRu0G945uGdBE3/rnddHYH08ddb1 BUhSr0B6BcsdQLsbYmEhseJt12yphcTLrF3JyBhYM8vq7SdxKqUhRy2iIiOLTsY1pAEN BYiIKDYXUno/lrxu1H4OticjFfQvR2qUpWLMLgamedppRQcOqlsjy/XAwDW+VUjshO7X bUdG3mmHi8frBINQijmLJuu8lBiAyln/WvcnepLZ81lTaU/CkxqF6el7FgL24ZruVAnC KMug== 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=CPnc81ywhSSCq0oJ60Of33r3RDyqkTNgF9gjlQgz1jQ=; b=uRWjzPbRoHRALrkP6CntbHhv9GVry5WilfxGN1XxozlDMoTrMw0d6WvhR2peFmHUIX dpDafMZx9p1Sa8MxKnPRN+waNDaWvxwspl68gCLvs3Q9BYhtg2ya4aI2PEbRlmqAe6PI yViPf+TjVUS5sKAvUiVWdOdAPAWgU4UgEe8pTtA6i5mXfMuv/dx4OEQpPdTOIWMIUrFv 12UrzH7HXHcwbNra3jefgYW57TtONbf8Mdp3OEtEQytG/xV6IR0EqQlaJF2Bvcm/474z 3BBThaKQBkWCYp0ktHB8rF0pJta4ElzP5JmwYJnk8Qpl2PMecgu4C0wUfYElOS/iGwEX 16zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=NsCPIiez; 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:05 -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=NsCPIiez; 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 S1730432AbeIFUcK (ORCPT + 3 others); Thu, 6 Sep 2018 16:32:10 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:46882 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730410AbeIFUcI (ORCPT ); Thu, 6 Sep 2018 16:32:08 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180906155558euoutp0108fe49ce691e902bb19c5f84d504326f~R2qcDH-WK1529315293euoutp01V; Thu, 6 Sep 2018 15:55:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180906155558euoutp0108fe49ce691e902bb19c5f84d504326f~R2qcDH-WK1529315293euoutp01V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1536249358; bh=CPnc81ywhSSCq0oJ60Of33r3RDyqkTNgF9gjlQgz1jQ=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=NsCPIiezg/8CbsujYh4O1SBAkulS6Fr0wI4ScZvH6XipXIHFbI6M+LnGzjk1quitt XaxWYB/vxcMmfsK39ipwrtKm8p2ZO/oB2bWuIXbVQCeIc561xzOr7T9qPJg0mXQz3l nc+M6i95BY9LD8XkbMgATJlARL5Aq4zFul4VFv4g= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180906155558eucas1p2be6d2aec0c65f0cbd0075c82aed66d3d~R2qbnRnBK2540625406eucas1p2J; Thu, 6 Sep 2018 15:55:58 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 2E.56.04294.D0E419B5; Thu, 6 Sep 2018 16:55:57 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180906155557eucas1p2075b7bcf09c328e77686f70c57fbf79d~R2qazWh8F2541725417eucas1p2L; Thu, 6 Sep 2018 15:55:57 +0000 (GMT) X-AuditID: cbfec7f4-835ff700000010c6-c1-5b914e0de04d Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id B9.CE.04284.D0E419B5; Thu, 6 Sep 2018 16:55:57 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PEN009IJ5L4PE10@eusync3.samsung.com>; Thu, 06 Sep 2018 16:55:57 +0100 (BST) From: Marek Szyprowski To: linux-clk@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH v2 07/10] clk: samsung: exynos5250: Use generic helper for handling suspend/resume Date: Thu, 06 Sep 2018 17:55:29 +0200 Message-id: <20180906155532.4085-8-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20180906155532.4085-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrAIsWRmVeSWpSXmKPExsWy7djPc7q8fhOjDVrmW1hsnLGe1eL6l+es FufPb2C3+Nhzj9Vixvl9TBZrj9xlt2h/+pLZgd1j06pONo++LasYPT5vkgtgjuKySUnNySxL LdK3S+DKOHj2BmPBQtGKmxu2sjQwNgp1MXJwSAiYSHxa4NjFyMUhJLCCUeLq8jY2COczo8T6 xXeBHE6Ios9boBLLGCU+HfzLCuE0MEnMX72aEaSKTcBQouttF1iHiICDxOdPrxlBipgFHjNK bD35lRkkISyQIvHvTiNYEYuAqkTf74/sIHfwCthI9M4zg9gmL7F6wwGwck4BW4kZczvBlkkI fGWV+P2jGeokF4nvj6ewQtjCEq+Ob2GHsGUkOjsOMkE0NDNKtM+YxQ7h9ABdMWcHVLe1xOHj F8G6mQX4JCZtm84MCQ1eiY42IYgSD4kL3eeg3pzAKDG/cyrrBEbJBYwMqxjFU0uLc9NTi43y Usv1ihNzi0vz0vWS83M3MQLj7fS/4192MO76k3SIUYCDUYmH94HRxGgh1sSy4srcQ4wSHMxK Irzu1ROihXhTEiurUovy44tKc1KLDzFKc7AoifPyaaVFCwmkJ5akZqemFqQWwWSZODilGhhn 5/32feCcIy1i8uimxQfL1XxSd/R8iiPntIiFSP/YNnutDeMtk8t3duq0/aloCql2P/bKquYM Z6RNRP2kGKb16Vcvbt1q9PXImolPlvBGH6q6Ez8h6N1/7oWMjZ+eR3mfclu9Rq6l6aAb+/9H cwzDNzYv1CrsORJuG3efo/SuUXhw7YK96epKLMUZiYZazEXFiQC1ssCLswIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDJMWRmVeSWpSXmKPExsVy+t/xq7q8fhOjDab9ELLYOGM9q8X1L89Z Lc6f38Bu8bHnHqvFjPP7mCzWHrnLbtH+9CWzA7vHplWdbB59W1YxenzeJBfAHMVlk5Kak1mW WqRvl8CVcfDsDcaChaIVNzdsZWlgbBTqYuTkkBAwkfj0eQsbiC0ksIRRYuYx6y5GLiC7iUmi Y8MisASbgKFE19suMFtEwEHi86fXjCBFzAKPGSXOLd7ACpIQFkiR+HenEayIRUBVou/3R/Yu Rg4OXgEbid55ZhDL5CVWbzjADGJzCthKzJjbyQqx2EZiVeMU1gmMPAsYGVYxiqSWFuem5xYb 6hUn5haX5qXrJefnbmIEhsm2Yz8372C8tDH4EKMAB6MSD6+F6cRoIdbEsuLK3EOMEhzMSiK8 7tUTooV4UxIrq1KL8uOLSnNSiw8xSnOwKInznjeojBISSE8sSc1OTS1ILYLJMnFwSjUw8rOI Xbu7fp1gU1/h7RCH6VHakTPcHEMF+tkn3w959veEIRv3ppnbtu9fcHHxpfQnuS9X6HTqtHt4 VQpJbhWZ0mQTKDwvdkqo6B6jNAa9ffEM2c+/p5573RBXFsvRc7HjwaYT4g/7VWdnBm9RO5Nh HTElNn365uncMx8WFbw7VChyak39J2NhJZbijERDLeai4kQAx2wugg8CAAA= X-CMS-MailID: 20180906155557eucas1p2075b7bcf09c328e77686f70c57fbf79d X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180906155557eucas1p2075b7bcf09c328e77686f70c57fbf79d References: <20180906155532.4085-1-m.szyprowski@samsung.com> Sender: linux-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 Acked-by: Chanwoo Choi Reviewed-by: Krzysztof Kozlowski --- drivers/clk/samsung/clk-exynos5250.c | 42 ++-------------------------- 1 file changed, 2 insertions(+), 40 deletions(-) -- 2.17.1 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);