1 // SPDX-License-Identifier: GPL-2.0
3 * Author: Huacai Chen <chenhuacai@loongson.cn>
4 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
6 #include <linux/acpi.h>
7 #include <linux/platform_device.h>
9 #include <asm/bootinfo.h>
10 #include <asm/loongson.h>
12 void enable_gpe_wakeup(void)
17 if (acpi_gbl_reduced_hardware)
20 acpi_enable_all_wakeup_gpes();
23 void enable_pci_wakeup(void)
28 if (acpi_gbl_reduced_hardware)
31 acpi_write_bit_register(ACPI_BITREG_PCIEXP_WAKE_STATUS, 1);
33 if (acpi_gbl_FADT.flags & ACPI_FADT_PCI_EXPRESS_WAKE)
34 acpi_write_bit_register(ACPI_BITREG_PCIEXP_WAKE_DISABLE, 0);
37 static int __init loongson3_acpi_suspend_init(void)
41 uint64_t suspend_addr = 0;
43 if (acpi_disabled || acpi_gbl_reduced_hardware)
46 acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1);
47 status = acpi_evaluate_integer(NULL, "\\SADR", NULL, &suspend_addr);
48 if (ACPI_FAILURE(status) || !suspend_addr) {
49 pr_err("ACPI S3 is not support!\n");
52 loongson_sysconf.suspend_addr = (u64)phys_to_virt(PHYSADDR(suspend_addr));
57 device_initcall(loongson3_acpi_suspend_init);