Fabio Estevam | 8c4300c | 2016-02-02 19:45:38 -0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 NXP Semiconductors |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 as |
| 6 | * published by the Free Software Foundation. |
| 7 | */ |
| 8 | |
| 9 | #include <linux/kernel.h> |
| 10 | #include <linux/suspend.h> |
| 11 | #include <linux/io.h> |
| 12 | |
| 13 | static int imx25_suspend_enter(suspend_state_t state) |
| 14 | { |
| 15 | if (!IS_ENABLED(CONFIG_PM)) |
| 16 | return 0; |
| 17 | |
| 18 | switch (state) { |
| 19 | case PM_SUSPEND_MEM: |
| 20 | cpu_do_idle(); |
| 21 | break; |
| 22 | default: |
| 23 | return -EINVAL; |
| 24 | } |
| 25 | |
| 26 | return 0; |
| 27 | } |
| 28 | |
| 29 | static const struct platform_suspend_ops imx25_suspend_ops = { |
| 30 | .enter = imx25_suspend_enter, |
| 31 | .valid = suspend_valid_only_mem, |
| 32 | }; |
| 33 | |
| 34 | void __init imx25_pm_init(void) |
| 35 | { |
| 36 | suspend_set_ops(&imx25_suspend_ops); |
| 37 | } |