devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rahul Sharma <rahul.sharma@samsung.com>
To: linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Cc: mturquette@linaro.org, kgene.kim@samsung.com,
	thomas.ab@samsung.com, tomasz.figa@gmail.com, joshi@samsung.com,
	r.sh.open@gmail.com, Rahul Sharma <rahul.sharma@samsung.com>
Subject: [PATCH V2 01/10] clk/exynos5410: move suspend/resume handling to SoC driver
Date: Tue, 07 Jan 2014 18:28:59 +0530	[thread overview]
Message-ID: <1389099548-14649-2-git-send-email-rahul.sharma@samsung.com> (raw)
In-Reply-To: <1389099548-14649-1-git-send-email-rahul.sharma@samsung.com>

Suspend/resume handling is already moved for all other Exynos
SoCs other than Exynos5420 which is addressed in this patch.

Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
---
 drivers/clk/samsung/clk-exynos5410.c |   49 ++++++++++++++++++++++++++++++----
 1 file changed, 44 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/samsung/clk-exynos5410.c b/drivers/clk/samsung/clk-exynos5410.c
index 858b3ff..f94c493 100644
--- a/drivers/clk/samsung/clk-exynos5410.c
+++ b/drivers/clk/samsung/clk-exynos5410.c
@@ -16,6 +16,7 @@
 #include <linux/clk-provider.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
+#include <linux/syscore_ops.h>
 
 #include "clk.h"
 
@@ -60,6 +61,11 @@ enum exynos5410_plls {
 	nr_plls			/* number of PLLs */
 };
 
+static void __iomem *reg_base;
+
+#ifdef CONFIG_PM_SLEEP
+static struct samsung_clk_reg_dump *exynos5410_save;
+
 /*
  * list of controller registers to be saved and restored during a
  * suspend/resume cycle.
@@ -89,6 +95,41 @@ static unsigned long exynos5410_clk_regs[] __initdata = {
 	DIV_KFC0,
 };
 
+static int exynos5410_clk_suspend(void)
+{
+	samsung_clk_save(reg_base, exynos5410_save,
+				ARRAY_SIZE(exynos5410_clk_regs));
+
+	return 0;
+}
+
+static void exynos5410_clk_resume(void)
+{
+	samsung_clk_restore(reg_base, exynos5410_save,
+				ARRAY_SIZE(exynos5410_clk_regs));
+}
+
+static struct syscore_ops exynos5410_clk_syscore_ops = {
+	.suspend = exynos5410_clk_suspend,
+	.resume = exynos5410_clk_resume,
+};
+
+static void exynos5410_clk_sleep_init(void)
+{
+	exynos5410_save = samsung_clk_alloc_reg_dump(exynos5410_clk_regs,
+					ARRAY_SIZE(exynos5410_clk_regs));
+	if (!exynos5410_save) {
+		pr_warn("%s: failed to allocate sleep save data, no sleep support!\n",
+			__func__);
+		return;
+	}
+
+	register_syscore_ops(&exynos5410_clk_syscore_ops);
+}
+#else
+static void exynos5410_clk_sleep_init(void) {}
+#endif
+
 /* list of all parent clocks */
 PNAME(apll_p)		= { "fin_pll", "fout_apll", };
 PNAME(bpll_p)		= { "fin_pll", "fout_bpll", };
@@ -214,15 +255,11 @@ static struct samsung_pll_clock exynos5410_plls[nr_plls] __initdata = {
 /* register exynos5410 clocks */
 static void __init exynos5410_clk_init(struct device_node *np)
 {
-	void __iomem *reg_base;
-
 	reg_base = of_iomap(np, 0);
 	if (!reg_base)
 		panic("%s: failed to map registers\n", __func__);
 
-	samsung_clk_init(np, reg_base, CLK_NR_CLKS,
-			exynos5410_clk_regs, ARRAY_SIZE(exynos5410_clk_regs),
-			NULL, 0);
+	samsung_clk_init(np, reg_base, CLK_NR_CLKS);
 
 	samsung_clk_register_pll(exynos5410_plls, ARRAY_SIZE(exynos5410_plls),
 					reg_base);
@@ -234,6 +271,8 @@ static void __init exynos5410_clk_init(struct device_node *np)
 	samsung_clk_register_gate(exynos5410_gate_clks,
 			ARRAY_SIZE(exynos5410_gate_clks));
 
+	exynos5410_clk_sleep_init();
+
 	pr_debug("Exynos5410: clock setup completed.\n");
 }
 CLK_OF_DECLARE(exynos5410_clk, "samsung,exynos5410-clock", exynos5410_clk_init);
-- 
1.7.9.5

  reply	other threads:[~2014-01-07 12:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-07 12:58 [PATCH V2 00/10] exynos: add basic support for exynos5260 SoC Rahul Sharma
2014-01-07 12:58 ` Rahul Sharma [this message]
2014-01-23 18:19   ` [PATCH V2 01/10] clk/exynos5410: move suspend/resume handling to SoC driver Tomasz Figa
2014-01-07 12:59 ` [PATCH V2 02/10] ARM: EXYNOS: initial board support for exynos5260 SoC Rahul Sharma
2014-01-07 13:24   ` Arnd Bergmann
2014-01-08  5:32     ` Rahul Sharma
2014-01-07 12:59 ` [PATCH V2 03/10] pinctrl: exynos: add exynos5260 SoC specific data Rahul Sharma
2014-01-07 13:31   ` Arnd Bergmann
2014-01-23 18:38     ` Tomasz Figa
2014-01-07 12:59 ` [PATCH V2 04/10] clk/samsung: add support for multiple clock providers Rahul Sharma
2014-01-23 18:24   ` Tomasz Figa
2014-01-07 12:59 ` [PATCH V2 05/10] clk/samsung: add support for pll2550xx Rahul Sharma
2014-01-23 18:40   ` Tomasz Figa
2014-01-07 12:59 ` [PATCH V2 06/10] clk/samsung: add support for pll2650xx Rahul Sharma
2014-01-23 18:46   ` Tomasz Figa
2014-01-07 12:59 ` [PATCH V2 07/10] clk/exynos5260: add macros and documentation for exynos5260 Rahul Sharma
     [not found] ` <1389099548-14649-1-git-send-email-rahul.sharma-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-01-07 12:59   ` [PATCH V2 08/10] clk/exynos5260: add clock file " Rahul Sharma
2014-01-07 12:59 ` [PATCH V2 09/10] ARM: dts: add dts files for exynos5260 SoC Rahul Sharma
2014-01-07 12:59 ` [PATCH V2 10/10] ARM: dts: add dts files for xyref5260 board Rahul Sharma

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=1389099548-14649-2-git-send-email-rahul.sharma@samsung.com \
    --to=rahul.sharma@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=joshi@samsung.com \
    --cc=kgene.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=mturquette@linaro.org \
    --cc=r.sh.open@gmail.com \
    --cc=thomas.ab@samsung.com \
    --cc=tomasz.figa@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).