xref: /openbmc/linux/arch/arm/mach-mxs/pm.c (revision c942fddf)
1c942fddfSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
2376e9c58SShawn Guo /*
3376e9c58SShawn Guo  * Copyright (C) 2010 Freescale Semiconductor, Inc.
4376e9c58SShawn Guo  */
5376e9c58SShawn Guo 
6376e9c58SShawn Guo #include <linux/kernel.h>
7376e9c58SShawn Guo #include <linux/suspend.h>
8376e9c58SShawn Guo #include <linux/io.h>
975433607SFabio Estevam #include "pm.h"
10376e9c58SShawn Guo 
mxs_suspend_enter(suspend_state_t state)11376e9c58SShawn Guo static int mxs_suspend_enter(suspend_state_t state)
12376e9c58SShawn Guo {
13376e9c58SShawn Guo 	switch (state) {
14376e9c58SShawn Guo 	case PM_SUSPEND_MEM:
15ae940913SNicolas Pitre 		cpu_do_idle();
16376e9c58SShawn Guo 		break;
17376e9c58SShawn Guo 
18376e9c58SShawn Guo 	default:
19376e9c58SShawn Guo 		return -EINVAL;
20376e9c58SShawn Guo 	}
21376e9c58SShawn Guo 	return 0;
22376e9c58SShawn Guo }
23376e9c58SShawn Guo 
245cd6bc68SArvind Yadav static const struct platform_suspend_ops mxs_suspend_ops = {
25376e9c58SShawn Guo 	.enter = mxs_suspend_enter,
26376e9c58SShawn Guo 	.valid = suspend_valid_only_mem,
27376e9c58SShawn Guo };
28376e9c58SShawn Guo 
mxs_pm_init(void)2945680995SShawn Guo void __init mxs_pm_init(void)
30376e9c58SShawn Guo {
31376e9c58SShawn Guo 	suspend_set_ops(&mxs_suspend_ops);
32376e9c58SShawn Guo }
33