1 // SPDX-License-Identifier: GPL-2.0 1 2 /* 3 * Author: Huacai Chen <chenhuacai@loongson.cn 4 * Copyright (C) 2020-2022 Loongson Technology 5 */ 6 #include <linux/acpi.h> 7 #include <linux/platform_device.h> 8 9 #include <asm/bootinfo.h> 10 #include <asm/loongson.h> 11 12 void enable_gpe_wakeup(void) 13 { 14 if (acpi_disabled) 15 return; 16 17 if (acpi_gbl_reduced_hardware) 18 return; 19 20 acpi_enable_all_wakeup_gpes(); 21 } 22 23 void enable_pci_wakeup(void) 24 { 25 if (acpi_disabled) 26 return; 27 28 if (acpi_gbl_reduced_hardware) 29 return; 30 31 acpi_write_bit_register(ACPI_BITREG_PC 32 33 if (acpi_gbl_FADT.flags & ACPI_FADT_PC 34 acpi_write_bit_register(ACPI_B 35 } 36 37 static struct platform_device loongson3_cpufre 38 .name = "loongson3_cpufreq", 39 .id = -1, 40 }; 41 42 static int __init loongson_cpufreq_init(void) 43 { 44 if (!cpu_has_scalefreq) 45 return -ENODEV; 46 47 return platform_device_register(&loong 48 } 49 50 arch_initcall(loongson_cpufreq_init); 51 52 static void default_suspend_addr(void) 53 { 54 acpi_enter_sleep_state(ACPI_STATE_S3); 55 } 56 57 static int __init loongson3_acpi_suspend_init( 58 { 59 #ifdef CONFIG_ACPI 60 acpi_status status; 61 uint64_t suspend_addr = 0; 62 63 if (acpi_disabled) 64 return 0; 65 66 if (!acpi_gbl_reduced_hardware) 67 acpi_write_bit_register(ACPI_B 68 69 if (!acpi_sleep_state_supported(ACPI_S 70 return 0; 71 72 status = acpi_evaluate_integer(NULL, " 73 if (ACPI_FAILURE(status) || !suspend_a 74 pr_info("ACPI S3 supported wit 75 loongson_sysconf.suspend_addr 76 } else { 77 pr_info("ACPI S3 supported wit 78 loongson_sysconf.suspend_addr 79 } 80 #endif 81 return 0; 82 } 83 84 device_initcall(loongson3_acpi_suspend_init); 85
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.