All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: linux-clk@vger.kernel.org, linux-samsung-soc@vger.kernel.org
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
	Sylwester Nawrocki <snawrocki@kernel.org>,
	Chanwoo Choi <cw00.choi@samsung.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: [PATCH 10/10] clk: samsung: exynos5420: Use generic helper for handling suspend/resume
Date: Wed, 29 Aug 2018 17:50:46 +0200	[thread overview]
Message-ID: <20180829155046.29359-11-m.szyprowski@samsung.com> (raw)
In-Reply-To: <20180829155046.29359-1-m.szyprowski@samsung.com>

Replace common suspend/resume handling code by generic helper.
No functional change.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/clk/samsung/clk-exynos5420.c | 73 +++-------------------------
 1 file changed, 7 insertions(+), 66 deletions(-)

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 <linux/clk-provider.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
-#include <linux/syscore_ops.h>
 
 #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);
 
-- 
2.17.1

      parent reply	other threads:[~2018-08-29 19:48 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180829155058eucas1p1db74951957e2d911ba91ddcc07df52ac@eucas1p1.samsung.com>
2018-08-29 15:50 ` [PATCH 00/10] Cleanup suspend/resume code in Samsung clock drivers Marek Szyprowski
     [not found]   ` <CGME20180829155059eucas1p28a20924521edaa4c9bd3d9683d0f2d0d@eucas1p2.samsung.com>
2018-08-29 15:50     ` [PATCH 01/10] clk: samsung: Remove excessive include Marek Szyprowski
2018-08-30  0:00       ` Chanwoo Choi
2018-08-30  6:34       ` Krzysztof Kozlowski
     [not found]   ` <CGME20180829155059eucas1p26a0ea66a0fc96c73cdd60648b82bd23e@eucas1p2.samsung.com>
2018-08-29 15:50     ` [PATCH 02/10] clk: samsung: s3c2410: Use generic helper for handling suspend/resume Marek Szyprowski
2018-08-30  1:10       ` Chanwoo Choi
2018-08-30  6:39       ` Krzysztof Kozlowski
2018-08-30 11:26         ` Marek Szyprowski
2018-08-31  6:34           ` Krzysztof Kozlowski
     [not found]   ` <CGME20180829155059eucas1p16fecde00348e0a2e6707aaf2a76320be@eucas1p1.samsung.com>
2018-08-29 15:50     ` [PATCH 03/10] clk: samsung: s3c2412: " Marek Szyprowski
2018-08-30  1:17       ` Chanwoo Choi
2018-08-30  6:42       ` Krzysztof Kozlowski
2018-08-30 12:50         ` Marek Szyprowski
2018-08-30 13:10           ` Krzysztof Kozlowski
     [not found]   ` <CGME20180829155100eucas1p1ba8149066e026fc15f82091968b78a08@eucas1p1.samsung.com>
2018-08-29 15:50     ` [PATCH 04/10] clk: samsung: s3c2443: " Marek Szyprowski
2018-08-30  1:18       ` Chanwoo Choi
2018-08-31  6:33       ` Krzysztof Kozlowski
     [not found]   ` <CGME20180829155100eucas1p16cded24187167d4af4d43f64c7abd88b@eucas1p1.samsung.com>
2018-08-29 15:50     ` [PATCH 05/10] clk: samsung: s3c64xx: " Marek Szyprowski
2018-08-30  1:18       ` Chanwoo Choi
2018-08-31  6:35       ` Krzysztof Kozlowski
     [not found]   ` <CGME20180829155101eucas1p2f6ecb6ad0eb37fa725ac950cad73c423@eucas1p2.samsung.com>
2018-08-29 15:50     ` [PATCH 06/10] clk: samsung: s5pv210: " Marek Szyprowski
2018-08-30  1:18       ` Chanwoo Choi
2018-08-31  6:36       ` Krzysztof Kozlowski
     [not found]   ` <CGME20180829155101eucas1p22b694bf6395d8efcb33ba3802e287c88@eucas1p2.samsung.com>
2018-08-29 15:50     ` [PATCH 07/10] clk: samsung: exynos5250: " Marek Szyprowski
2018-08-30  1:19       ` Chanwoo Choi
2018-08-31  6:36       ` Krzysztof Kozlowski
     [not found]   ` <CGME20180829155102eucas1p1ca7a26c10847dcb585f01b54657e29cb@eucas1p1.samsung.com>
2018-08-29 15:50     ` [PATCH 08/10] clk: samsung: Add support for setting registers state before suspend Marek Szyprowski
2018-08-30  1:36       ` Chanwoo Choi
2018-08-31 14:59       ` Krzysztof Kozlowski
2018-09-06 13:25         ` Marek Szyprowski
2018-09-06 16:15           ` Krzysztof Kozlowski
     [not found]   ` <CGME20180829155102eucas1p2a4b1c554623ff97a23f85f26a6b537e2@eucas1p2.samsung.com>
2018-08-29 15:50     ` [PATCH 09/10] clk: samsung: exynos4: Use generic helper for handling suspend/resume Marek Szyprowski
2018-09-06 19:49       ` Sylwester Nawrocki
2018-09-07  6:27         ` Marek Szyprowski
     [not found]   ` <CGME20180829155103eucas1p16b6cddb4babcfb60a3257e017bea347e@eucas1p1.samsung.com>
2018-08-29 15:50     ` Marek Szyprowski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180829155046.29359-11-m.szyprowski@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=cw00.choi@samsung.com \
    --cc=krzk@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=snawrocki@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.