xref: /openbmc/linux/arch/arm/mach-mxs/pm.c (revision 376e9c5848abef8c72c09bd89f2f7ee128caa104)
1*376e9c58SShawn Guo /*
2*376e9c58SShawn Guo  * Copyright (C) 2010 Freescale Semiconductor, Inc.
3*376e9c58SShawn Guo  *
4*376e9c58SShawn Guo  * This program is free software; you can redistribute it and/or modify
5*376e9c58SShawn Guo  * it under the terms of the GNU General Public License as published by
6*376e9c58SShawn Guo  * the Free Software Foundation; either version 2 of the License, or
7*376e9c58SShawn Guo  * (at your option) any later version.
8*376e9c58SShawn Guo  *
9*376e9c58SShawn Guo  * This program is distributed in the hope that it will be useful,
10*376e9c58SShawn Guo  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11*376e9c58SShawn Guo  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12*376e9c58SShawn Guo  * GNU General Public License for more details.
13*376e9c58SShawn Guo  */
14*376e9c58SShawn Guo 
15*376e9c58SShawn Guo #include <linux/kernel.h>
16*376e9c58SShawn Guo #include <linux/suspend.h>
17*376e9c58SShawn Guo #include <linux/io.h>
18*376e9c58SShawn Guo #include <mach/system.h>
19*376e9c58SShawn Guo 
20*376e9c58SShawn Guo static int mxs_suspend_enter(suspend_state_t state)
21*376e9c58SShawn Guo {
22*376e9c58SShawn Guo 	switch (state) {
23*376e9c58SShawn Guo 	case PM_SUSPEND_MEM:
24*376e9c58SShawn Guo 		arch_idle();
25*376e9c58SShawn Guo 		break;
26*376e9c58SShawn Guo 
27*376e9c58SShawn Guo 	default:
28*376e9c58SShawn Guo 		return -EINVAL;
29*376e9c58SShawn Guo 	}
30*376e9c58SShawn Guo 	return 0;
31*376e9c58SShawn Guo }
32*376e9c58SShawn Guo 
33*376e9c58SShawn Guo static struct platform_suspend_ops mxs_suspend_ops = {
34*376e9c58SShawn Guo 	.enter = mxs_suspend_enter,
35*376e9c58SShawn Guo 	.valid = suspend_valid_only_mem,
36*376e9c58SShawn Guo };
37*376e9c58SShawn Guo 
38*376e9c58SShawn Guo static int __init mxs_pm_init(void)
39*376e9c58SShawn Guo {
40*376e9c58SShawn Guo 	suspend_set_ops(&mxs_suspend_ops);
41*376e9c58SShawn Guo 	return 0;
42*376e9c58SShawn Guo }
43*376e9c58SShawn Guo device_initcall(mxs_pm_init);
44