Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | #include <linux/init.h> |
| 3 | #include <linux/suspend.h> |
| 4 | #include <asm/suspend.h> |
| 5 | #include "smc.h" |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 6 | #include "pm.h" |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 7 | |
| 8 | static int tango_pm_powerdown(unsigned long arg) |
| 9 | { |
| 10 | tango_suspend(__pa_symbol(cpu_resume)); |
| 11 | |
| 12 | return -EIO; /* tango_suspend has failed */ |
| 13 | } |
| 14 | |
| 15 | static int tango_pm_enter(suspend_state_t state) |
| 16 | { |
| 17 | if (state == PM_SUSPEND_MEM) |
| 18 | return cpu_suspend(0, tango_pm_powerdown); |
| 19 | |
| 20 | return -EINVAL; |
| 21 | } |
| 22 | |
| 23 | static const struct platform_suspend_ops tango_pm_ops = { |
| 24 | .enter = tango_pm_enter, |
| 25 | .valid = suspend_valid_only_mem, |
| 26 | }; |
| 27 | |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 28 | void __init tango_pm_init(void) |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 29 | { |
| 30 | suspend_set_ops(&tango_pm_ops); |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 31 | } |