OSDN Git Service

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 151
[uclinux-h8/linux.git] / arch / mips / jz4740 / pm.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  *  Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
4  *      JZ4740 SoC power management support
5  */
6
7 #include <linux/init.h>
8 #include <linux/pm.h>
9 #include <linux/delay.h>
10 #include <linux/suspend.h>
11
12 #include <asm/mach-jz4740/clock.h>
13
14 static int jz4740_pm_enter(suspend_state_t state)
15 {
16         jz4740_clock_suspend();
17
18         jz4740_clock_set_wait_mode(JZ4740_WAIT_MODE_SLEEP);
19
20         __asm__(".set\tmips3\n\t"
21                 "wait\n\t"
22                 ".set\tmips0");
23
24         jz4740_clock_set_wait_mode(JZ4740_WAIT_MODE_IDLE);
25
26         jz4740_clock_resume();
27
28         return 0;
29 }
30
31 static const struct platform_suspend_ops jz4740_pm_ops = {
32         .valid          = suspend_valid_only_mem,
33         .enter          = jz4740_pm_enter,
34 };
35
36 static int __init jz4740_pm_init(void)
37 {
38         suspend_set_ops(&jz4740_pm_ops);
39         return 0;
40
41 }
42 late_initcall(jz4740_pm_init);