~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/loongarch/power/platform.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 /*
  3  * Author: Huacai Chen <chenhuacai@loongson.cn>
  4  * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
  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_PCIEXP_WAKE_STATUS, 1);
 32 
 33         if (acpi_gbl_FADT.flags & ACPI_FADT_PCI_EXPRESS_WAKE)
 34                 acpi_write_bit_register(ACPI_BITREG_PCIEXP_WAKE_DISABLE, 0);
 35 }
 36 
 37 static struct platform_device loongson3_cpufreq_device = {
 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(&loongson3_cpufreq_device);
 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(void)
 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_BITREG_SCI_ENABLE, 1);
 68 
 69         if (!acpi_sleep_state_supported(ACPI_STATE_S3))
 70                 return 0;
 71 
 72         status = acpi_evaluate_integer(NULL, "\\SADR", NULL, &suspend_addr);
 73         if (ACPI_FAILURE(status) || !suspend_addr) {
 74                 pr_info("ACPI S3 supported with hardware register default\n");
 75                 loongson_sysconf.suspend_addr = (u64)default_suspend_addr;
 76         } else {
 77                 pr_info("ACPI S3 supported with Loongson ACPI SADR extension\n");
 78                 loongson_sysconf.suspend_addr = (u64)phys_to_virt(PHYSADDR(suspend_addr));
 79         }
 80 #endif
 81         return 0;
 82 }
 83 
 84 device_initcall(loongson3_acpi_suspend_init);
 85 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php