1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * loongson-specific suspend support
5 * Copyright (C) 2009 Lemote Inc.
6 * Author: Wu Zhangjin <wuzhangjin@gmail.com>
8 #include <linux/suspend.h>
11 #include <asm/mipsregs.h>
15 asmlinkage
void loongson_lefi_sleep(unsigned long sleep_addr
);
17 static int lefi_pm_enter(suspend_state_t state
)
21 pm_set_suspend_via_firmware();
22 loongson_lefi_sleep(loongson_sysconf
.suspend_addr
);
23 pm_set_resume_via_firmware();
30 static int lefi_pm_valid_state(suspend_state_t state
)
34 return !!loongson_sysconf
.suspend_addr
;
40 static const struct platform_suspend_ops lefi_pm_ops
= {
41 .valid
= lefi_pm_valid_state
,
42 .enter
= lefi_pm_enter
,
45 static int __init
loongson_pm_init(void)
47 if (loongson_sysconf
.fw_interface
== LOONGSON_LEFI
)
48 suspend_set_ops(&lefi_pm_ops
);
52 arch_initcall(loongson_pm_init
);