diff options
author | Tomasz Figa <t.figa@samsung.com> | 2014-02-13 18:16:00 -0500 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2014-02-13 18:16:00 -0500 |
commit | 388c78851ee3c1fa6e80e9e06dc3bb9d77fb5f55 (patch) | |
tree | d98bf8b2201af978fbcee03aaf919dc19936b52e /drivers/clk/samsung/clk-exynos5420.c | |
parent | c3b6c1d7015a5a19d87725fe22b58aeea9a88f3c (diff) |
clk: samsung: exynos5420: Move suspend/resume handling to SoC driver
Since there are multiple differences in how suspend/resume of particular
Exynos SoCs must be handled, SoC driver is better place for
suspend/resume handlers and so this patch moves them.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Thomas Abraham <thomas.ab@samsung.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'drivers/clk/samsung/clk-exynos5420.c')
-rw-r--r-- | drivers/clk/samsung/clk-exynos5420.c | 49 |
1 files changed, 44 insertions, 5 deletions
diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c index ab4f2f7d88ef..8ce078049fb4 100644 --- a/drivers/clk/samsung/clk-exynos5420.c +++ b/drivers/clk/samsung/clk-exynos5420.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/clk-provider.h> | 16 | #include <linux/clk-provider.h> |
17 | #include <linux/of.h> | 17 | #include <linux/of.h> |
18 | #include <linux/of_address.h> | 18 | #include <linux/of_address.h> |
19 | #include <linux/syscore_ops.h> | ||
19 | 20 | ||
20 | #include "clk.h" | 21 | #include "clk.h" |
21 | 22 | ||
@@ -108,6 +109,11 @@ enum exynos5420_plls { | |||
108 | nr_plls /* number of PLLs */ | 109 | nr_plls /* number of PLLs */ |
109 | }; | 110 | }; |
110 | 111 | ||
112 | static void __iomem *reg_base; | ||
113 | |||
114 | #ifdef CONFIG_PM_SLEEP | ||
115 | static struct samsung_clk_reg_dump *exynos5420_save; | ||
116 | |||
111 | /* | 117 | /* |
112 | * list of controller registers to be saved and restored during a | 118 | * list of controller registers to be saved and restored during a |
113 | * suspend/resume cycle. | 119 | * suspend/resume cycle. |
@@ -174,6 +180,41 @@ static unsigned long exynos5420_clk_regs[] __initdata = { | |||
174 | DIV_KFC0, | 180 | DIV_KFC0, |
175 | }; | 181 | }; |
176 | 182 | ||
183 | static int exynos5420_clk_suspend(void) | ||
184 | { | ||
185 | samsung_clk_save(reg_base, exynos5420_save, | ||
186 | ARRAY_SIZE(exynos5420_clk_regs)); | ||
187 | |||
188 | return 0; | ||
189 | } | ||
190 | |||
191 | static void exynos5420_clk_resume(void) | ||
192 | { | ||
193 | samsung_clk_restore(reg_base, exynos5420_save, | ||
194 | ARRAY_SIZE(exynos5420_clk_regs)); | ||
195 | } | ||
196 | |||
197 | static struct syscore_ops exynos5420_clk_syscore_ops = { | ||
198 | .suspend = exynos5420_clk_suspend, | ||
199 | .resume = exynos5420_clk_resume, | ||
200 | }; | ||
201 | |||
202 | static void exynos5420_clk_sleep_init(void) | ||
203 | { | ||
204 | exynos5420_save = samsung_clk_alloc_reg_dump(exynos5420_clk_regs, | ||
205 | ARRAY_SIZE(exynos5420_clk_regs)); | ||
206 | if (!exynos5420_save) { | ||
207 | pr_warn("%s: failed to allocate sleep save data, no sleep support!\n", | ||
208 | __func__); | ||
209 | return; | ||
210 | } | ||
211 | |||
212 | register_syscore_ops(&exynos5420_clk_syscore_ops); | ||
213 | } | ||
214 | #else | ||
215 | static void exynos5420_clk_sleep_init(void) {} | ||
216 | #endif | ||
217 | |||
177 | /* list of all parent clocks */ | 218 | /* list of all parent clocks */ |
178 | PNAME(mspll_cpu_p) = { "sclk_cpll", "sclk_dpll", | 219 | PNAME(mspll_cpu_p) = { "sclk_cpll", "sclk_dpll", |
179 | "sclk_mpll", "sclk_spll" }; | 220 | "sclk_mpll", "sclk_spll" }; |
@@ -737,8 +778,6 @@ static struct of_device_id ext_clk_match[] __initdata = { | |||
737 | /* register exynos5420 clocks */ | 778 | /* register exynos5420 clocks */ |
738 | static void __init exynos5420_clk_init(struct device_node *np) | 779 | static void __init exynos5420_clk_init(struct device_node *np) |
739 | { | 780 | { |
740 | void __iomem *reg_base; | ||
741 | |||
742 | if (np) { | 781 | if (np) { |
743 | reg_base = of_iomap(np, 0); | 782 | reg_base = of_iomap(np, 0); |
744 | if (!reg_base) | 783 | if (!reg_base) |
@@ -747,9 +786,7 @@ static void __init exynos5420_clk_init(struct device_node *np) | |||
747 | panic("%s: unable to determine soc\n", __func__); | 786 | panic("%s: unable to determine soc\n", __func__); |
748 | } | 787 | } |
749 | 788 | ||
750 | samsung_clk_init(np, reg_base, CLK_NR_CLKS, | 789 | samsung_clk_init(np, reg_base, CLK_NR_CLKS, NULL, 0, NULL, 0); |
751 | exynos5420_clk_regs, ARRAY_SIZE(exynos5420_clk_regs), | ||
752 | NULL, 0); | ||
753 | samsung_clk_of_register_fixed_ext(exynos5420_fixed_rate_ext_clks, | 790 | samsung_clk_of_register_fixed_ext(exynos5420_fixed_rate_ext_clks, |
754 | ARRAY_SIZE(exynos5420_fixed_rate_ext_clks), | 791 | ARRAY_SIZE(exynos5420_fixed_rate_ext_clks), |
755 | ext_clk_match); | 792 | ext_clk_match); |
@@ -765,5 +802,7 @@ static void __init exynos5420_clk_init(struct device_node *np) | |||
765 | ARRAY_SIZE(exynos5420_div_clks)); | 802 | ARRAY_SIZE(exynos5420_div_clks)); |
766 | samsung_clk_register_gate(exynos5420_gate_clks, | 803 | samsung_clk_register_gate(exynos5420_gate_clks, |
767 | ARRAY_SIZE(exynos5420_gate_clks)); | 804 | ARRAY_SIZE(exynos5420_gate_clks)); |
805 | |||
806 | exynos5420_clk_sleep_init(); | ||
768 | } | 807 | } |
769 | CLK_OF_DECLARE(exynos5420_clk, "samsung,exynos5420-clock", exynos5420_clk_init); | 808 | CLK_OF_DECLARE(exynos5420_clk, "samsung,exynos5420-clock", exynos5420_clk_init); |