| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2013 Samsung Electronics Co., Ltd. |
|---|
| 3 | 4 | * Author: Mateusz Krawczuk <m.krawczuk@partner.samsung.com> |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * Based on clock drivers for S3C64xx and Exynos4 SoCs. |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 8 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 9 | | - * published by the Free Software Foundation. |
|---|
| 10 | 7 | * |
|---|
| 11 | 8 | * Common Clock Framework support for all S5PC110/S5PV210 SoCs. |
|---|
| 12 | 9 | */ |
|---|
| .. | .. |
|---|
| 14 | 11 | #include <linux/clk-provider.h> |
|---|
| 15 | 12 | #include <linux/of.h> |
|---|
| 16 | 13 | #include <linux/of_address.h> |
|---|
| 17 | | -#include <linux/syscore_ops.h> |
|---|
| 18 | 14 | |
|---|
| 19 | 15 | #include "clk.h" |
|---|
| 20 | 16 | #include "clk-pll.h" |
|---|
| .. | .. |
|---|
| 83 | 79 | |
|---|
| 84 | 80 | static void __iomem *reg_base; |
|---|
| 85 | 81 | |
|---|
| 86 | | -#ifdef CONFIG_PM_SLEEP |
|---|
| 87 | | -static struct samsung_clk_reg_dump *s5pv210_clk_dump; |
|---|
| 88 | | - |
|---|
| 89 | 82 | /* List of registers that need to be preserved across suspend/resume. */ |
|---|
| 90 | 83 | static unsigned long s5pv210_clk_regs[] __initdata = { |
|---|
| 91 | 84 | CLK_SRC0, |
|---|
| .. | .. |
|---|
| 131 | 124 | VPLL_CON, |
|---|
| 132 | 125 | CLK_OUT, |
|---|
| 133 | 126 | }; |
|---|
| 134 | | - |
|---|
| 135 | | -static int s5pv210_clk_suspend(void) |
|---|
| 136 | | -{ |
|---|
| 137 | | - samsung_clk_save(reg_base, s5pv210_clk_dump, |
|---|
| 138 | | - ARRAY_SIZE(s5pv210_clk_regs)); |
|---|
| 139 | | - return 0; |
|---|
| 140 | | -} |
|---|
| 141 | | - |
|---|
| 142 | | -static void s5pv210_clk_resume(void) |
|---|
| 143 | | -{ |
|---|
| 144 | | - samsung_clk_restore(reg_base, s5pv210_clk_dump, |
|---|
| 145 | | - ARRAY_SIZE(s5pv210_clk_regs)); |
|---|
| 146 | | -} |
|---|
| 147 | | - |
|---|
| 148 | | -static struct syscore_ops s5pv210_clk_syscore_ops = { |
|---|
| 149 | | - .suspend = s5pv210_clk_suspend, |
|---|
| 150 | | - .resume = s5pv210_clk_resume, |
|---|
| 151 | | -}; |
|---|
| 152 | | - |
|---|
| 153 | | -static void s5pv210_clk_sleep_init(void) |
|---|
| 154 | | -{ |
|---|
| 155 | | - s5pv210_clk_dump = |
|---|
| 156 | | - samsung_clk_alloc_reg_dump(s5pv210_clk_regs, |
|---|
| 157 | | - ARRAY_SIZE(s5pv210_clk_regs)); |
|---|
| 158 | | - if (!s5pv210_clk_dump) { |
|---|
| 159 | | - pr_warn("%s: Failed to allocate sleep save data\n", __func__); |
|---|
| 160 | | - return; |
|---|
| 161 | | - } |
|---|
| 162 | | - |
|---|
| 163 | | - register_syscore_ops(&s5pv210_clk_syscore_ops); |
|---|
| 164 | | -} |
|---|
| 165 | | -#else |
|---|
| 166 | | -static inline void s5pv210_clk_sleep_init(void) { } |
|---|
| 167 | | -#endif |
|---|
| 168 | 127 | |
|---|
| 169 | 128 | /* Mux parent lists. */ |
|---|
| 170 | 129 | static const char *const fin_pll_p[] __initconst = { |
|---|
| .. | .. |
|---|
| 822 | 781 | samsung_clk_register_alias(ctx, s5pv210_aliases, |
|---|
| 823 | 782 | ARRAY_SIZE(s5pv210_aliases)); |
|---|
| 824 | 783 | |
|---|
| 825 | | - s5pv210_clk_sleep_init(); |
|---|
| 784 | + samsung_clk_sleep_init(reg_base, s5pv210_clk_regs, |
|---|
| 785 | + ARRAY_SIZE(s5pv210_clk_regs)); |
|---|
| 826 | 786 | |
|---|
| 827 | 787 | samsung_clk_of_add_provider(np, ctx); |
|---|
| 828 | 788 | |
|---|