Thomas Gleixner | c942fdd | 2019-05-27 08:55:06 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
Shawn Guo | 376e9c5 | 2011-01-24 17:05:25 +0800 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2010 Freescale Semiconductor, Inc. |
Shawn Guo | 376e9c5 | 2011-01-24 17:05:25 +0800 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include <linux/kernel.h> |
| 7 | #include <linux/suspend.h> |
| 8 | #include <linux/io.h> |
Fabio Estevam | 7543360 | 2013-07-16 10:32:39 -0300 | [diff] [blame] | 9 | #include "pm.h" |
Shawn Guo | 376e9c5 | 2011-01-24 17:05:25 +0800 | [diff] [blame] | 10 | |
| 11 | static int mxs_suspend_enter(suspend_state_t state) |
| 12 | { |
| 13 | switch (state) { |
| 14 | case PM_SUSPEND_MEM: |
Nicolas Pitre | ae94091 | 2011-12-19 03:03:58 -0500 | [diff] [blame] | 15 | cpu_do_idle(); |
Shawn Guo | 376e9c5 | 2011-01-24 17:05:25 +0800 | [diff] [blame] | 16 | break; |
| 17 | |
| 18 | default: |
| 19 | return -EINVAL; |
| 20 | } |
| 21 | return 0; |
| 22 | } |
| 23 | |
Arvind Yadav | 5cd6bc6 | 2017-08-30 22:17:51 +0530 | [diff] [blame] | 24 | static const struct platform_suspend_ops mxs_suspend_ops = { |
Shawn Guo | 376e9c5 | 2011-01-24 17:05:25 +0800 | [diff] [blame] | 25 | .enter = mxs_suspend_enter, |
| 26 | .valid = suspend_valid_only_mem, |
| 27 | }; |
| 28 | |
Shawn Guo | 4568099 | 2013-03-29 14:41:27 +0800 | [diff] [blame] | 29 | void __init mxs_pm_init(void) |
Shawn Guo | 376e9c5 | 2011-01-24 17:05:25 +0800 | [diff] [blame] | 30 | { |
| 31 | suspend_set_ops(&mxs_suspend_ops); |
Shawn Guo | 376e9c5 | 2011-01-24 17:05:25 +0800 | [diff] [blame] | 32 | } |