xref: /openbmc/linux/arch/arm/mach-mxs/pm.c (revision ae940913030386884f259eb4d95ac4d93b57144f)
1376e9c58SShawn Guo /*
2376e9c58SShawn Guo  * Copyright (C) 2010 Freescale Semiconductor, Inc.
3376e9c58SShawn Guo  *
4376e9c58SShawn Guo  * This program is free software; you can redistribute it and/or modify
5376e9c58SShawn Guo  * it under the terms of the GNU General Public License as published by
6376e9c58SShawn Guo  * the Free Software Foundation; either version 2 of the License, or
7376e9c58SShawn Guo  * (at your option) any later version.
8376e9c58SShawn Guo  *
9376e9c58SShawn Guo  * This program is distributed in the hope that it will be useful,
10376e9c58SShawn Guo  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11376e9c58SShawn Guo  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12376e9c58SShawn Guo  * GNU General Public License for more details.
13376e9c58SShawn Guo  */
14376e9c58SShawn Guo 
15376e9c58SShawn Guo #include <linux/kernel.h>
16376e9c58SShawn Guo #include <linux/suspend.h>
17376e9c58SShawn Guo #include <linux/io.h>
18376e9c58SShawn Guo 
19376e9c58SShawn Guo static int mxs_suspend_enter(suspend_state_t state)
20376e9c58SShawn Guo {
21376e9c58SShawn Guo 	switch (state) {
22376e9c58SShawn Guo 	case PM_SUSPEND_MEM:
23*ae940913SNicolas Pitre 		cpu_do_idle();
24376e9c58SShawn Guo 		break;
25376e9c58SShawn Guo 
26376e9c58SShawn Guo 	default:
27376e9c58SShawn Guo 		return -EINVAL;
28376e9c58SShawn Guo 	}
29376e9c58SShawn Guo 	return 0;
30376e9c58SShawn Guo }
31376e9c58SShawn Guo 
32376e9c58SShawn Guo static struct platform_suspend_ops mxs_suspend_ops = {
33376e9c58SShawn Guo 	.enter = mxs_suspend_enter,
34376e9c58SShawn Guo 	.valid = suspend_valid_only_mem,
35376e9c58SShawn Guo };
36376e9c58SShawn Guo 
37376e9c58SShawn Guo static int __init mxs_pm_init(void)
38376e9c58SShawn Guo {
39376e9c58SShawn Guo 	suspend_set_ops(&mxs_suspend_ops);
40376e9c58SShawn Guo 	return 0;
41376e9c58SShawn Guo }
42376e9c58SShawn Guo device_initcall(mxs_pm_init);
43