Merge tag 'renesas-soc-r8a7790-for-v3.10' of git://git.kernel.org/pub/scm/linux/kerne...
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / arm / mach-imx / pm-imx6q.c
CommitLineData
a1f1c7ef
SG
1/*
2 * Copyright 2011 Freescale Semiconductor, Inc.
3 * Copyright 2011 Linaro Ltd.
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
13#include <linux/init.h>
14#include <linux/io.h>
15#include <linux/of.h>
16#include <linux/suspend.h>
17#include <asm/cacheflush.h>
18#include <asm/proc-fns.h>
19#include <asm/suspend.h>
20#include <asm/hardware/cache-l2x0.h>
a1f1c7ef 21
e3372474 22#include "common.h"
50f2de61 23#include "hardware.h"
e3372474 24
a1f1c7ef
SG
25static int imx6q_suspend_finish(unsigned long val)
26{
27 cpu_do_idle();
28 return 0;
29}
30
31static int imx6q_pm_enter(suspend_state_t state)
32{
33 switch (state) {
34 case PM_SUSPEND_MEM:
35 imx6q_set_lpm(STOP_POWER_OFF);
36 imx_gpc_pre_suspend();
37 imx_set_cpu_jump(0, v7_cpu_resume);
38 /* Zzz ... */
39 cpu_suspend(0, imx6q_suspend_finish);
40 imx_smp_prepare();
41 imx_gpc_post_resume();
83ae2098 42 imx6q_set_lpm(WAIT_CLOCKED);
a1f1c7ef
SG
43 break;
44 default:
45 return -EINVAL;
46 }
47
48 return 0;
49}
50
51static const struct platform_suspend_ops imx6q_pm_ops = {
52 .enter = imx6q_pm_enter,
53 .valid = suspend_valid_only_mem,
54};
55
56void __init imx6q_pm_init(void)
57{
a1f1c7ef
SG
58 suspend_set_ops(&imx6q_pm_ops);
59}