mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-26 22:24:09 +08:00
clk: samsung: exynos5420: Use generic helper for handling suspend/resume
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 <m.szyprowski@samsung.com> Signed-off-by: Sylwester Nawrocki <snawrocki@kernel.org>
This commit is contained in:
parent
9a4d8a8c4d
commit
2d77f77c0a
@ -15,7 +15,6 @@
|
|||||||
#include <linux/clk-provider.h>
|
#include <linux/clk-provider.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
#include <linux/of_address.h>
|
#include <linux/of_address.h>
|
||||||
#include <linux/syscore_ops.h>
|
|
||||||
|
|
||||||
#include "clk.h"
|
#include "clk.h"
|
||||||
#include "clk-cpu.h"
|
#include "clk-cpu.h"
|
||||||
@ -156,10 +155,6 @@ enum exynos5x_plls {
|
|||||||
static void __iomem *reg_base;
|
static void __iomem *reg_base;
|
||||||
static enum exynos5x_soc exynos5x_soc;
|
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
|
* list of controller registers to be saved and restored during a
|
||||||
* suspend/resume cycle.
|
* suspend/resume cycle.
|
||||||
@ -283,66 +278,6 @@ static const struct samsung_clk_reg_dump exynos5420_set_clksrc[] = {
|
|||||||
{ .offset = GATE_IP_PERIC, .value = 0xffffffff, },
|
{ .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 */
|
/* list of all parent clocks */
|
||||||
PNAME(mout_mspll_cpu_p) = {"mout_sclk_cpll", "mout_sclk_dpll",
|
PNAME(mout_mspll_cpu_p) = {"mout_sclk_cpll", "mout_sclk_dpll",
|
||||||
"mout_sclk_mpll", "mout_sclk_spll"};
|
"mout_sclk_mpll", "mout_sclk_spll"};
|
||||||
@ -1540,7 +1475,12 @@ static void __init exynos5x_clk_init(struct device_node *np,
|
|||||||
mout_kfc_p[0], mout_kfc_p[1], 0x28200,
|
mout_kfc_p[0], mout_kfc_p[1], 0x28200,
|
||||||
exynos5420_kfcclk_d, ARRAY_SIZE(exynos5420_kfcclk_d), 0);
|
exynos5420_kfcclk_d, ARRAY_SIZE(exynos5420_kfcclk_d), 0);
|
||||||
|
|
||||||
exynos5420_clk_sleep_init();
|
samsung_clk_extended_sleep_init(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),
|
exynos5_subcmus_init(ctx, ARRAY_SIZE(exynos5x_subcmus),
|
||||||
exynos5x_subcmus);
|
exynos5x_subcmus);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user