xref: /openbmc/linux/arch/arm/mach-mxs/pm.c (revision 5cd6bc68)
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>
1875433607SFabio Estevam #include "pm.h"
19376e9c58SShawn Guo 
20376e9c58SShawn Guo static int mxs_suspend_enter(suspend_state_t state)
21376e9c58SShawn Guo {
22376e9c58SShawn Guo 	switch (state) {
23376e9c58SShawn Guo 	case PM_SUSPEND_MEM:
24ae940913SNicolas Pitre 		cpu_do_idle();
25376e9c58SShawn Guo 		break;
26376e9c58SShawn Guo 
27376e9c58SShawn Guo 	default:
28376e9c58SShawn Guo 		return -EINVAL;
29376e9c58SShawn Guo 	}
30376e9c58SShawn Guo 	return 0;
31376e9c58SShawn Guo }
32376e9c58SShawn Guo 
335cd6bc68SArvind Yadav static const struct platform_suspend_ops mxs_suspend_ops = {
34376e9c58SShawn Guo 	.enter = mxs_suspend_enter,
35376e9c58SShawn Guo 	.valid = suspend_valid_only_mem,
36376e9c58SShawn Guo };
37376e9c58SShawn Guo 
3845680995SShawn Guo void __init mxs_pm_init(void)
39376e9c58SShawn Guo {
40376e9c58SShawn Guo 	suspend_set_ops(&mxs_suspend_ops);
41376e9c58SShawn Guo }
42