mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 10:40:53 +07:00
Merge branches 'acpi-cleanup', 'acpi-thermal', 'acpi-pci', 'acpi-lpss' and 'acpi-button'
* acpi-cleanup: ACPI: Remove duplicate definitions of PREFIX ACPI / tables: Replace printk with pr_* * acpi-thermal: ACPI / thermal: make acpi_thermal_check asynchronous on resume * acpi-pci: ACPI / PCI: Do not call ISA-specific code if ISA is not supported * acpi-lpss: ACPI / LPSS: Add Intel BayTrail ACPI mode PWM * acpi-button: ACPI / button: Add ACPI Button event via netlink routine
This commit is contained in:
commit
e25c5abf41
@ -18,8 +18,6 @@
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
#define PREFIX "ACPI: "
|
||||
|
||||
ACPI_MODULE_NAME("cmos rtc");
|
||||
|
||||
static const struct acpi_device_id acpi_cmos_rtc_ids[] = {
|
||||
|
@ -102,6 +102,16 @@ static struct lpss_device_desc lpt_sdio_dev_desc = {
|
||||
.ltr_required = true,
|
||||
};
|
||||
|
||||
static struct lpss_shared_clock pwm_clock = {
|
||||
.name = "pwm_clk",
|
||||
.rate = 25000000,
|
||||
};
|
||||
|
||||
static struct lpss_device_desc byt_pwm_dev_desc = {
|
||||
.clk_required = true,
|
||||
.shared_clock = &pwm_clock,
|
||||
};
|
||||
|
||||
static struct lpss_shared_clock uart_clock = {
|
||||
.name = "uart_clk",
|
||||
.rate = 44236800,
|
||||
@ -157,6 +167,7 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = {
|
||||
{ "INT33C7", },
|
||||
|
||||
/* BayTrail LPSS devices */
|
||||
{ "80860F09", (unsigned long)&byt_pwm_dev_desc },
|
||||
{ "80860F0A", (unsigned long)&byt_uart_dev_desc },
|
||||
{ "80860F0E", (unsigned long)&byt_spi_dev_desc },
|
||||
{ "80860F14", (unsigned long)&byt_sdio_dev_desc },
|
||||
|
@ -302,6 +302,10 @@ static void acpi_button_notify(struct acpi_device *device, u32 event)
|
||||
input_sync(input);
|
||||
|
||||
pm_wakeup_event(&device->dev, 0);
|
||||
acpi_bus_generate_netlink_event(
|
||||
device->pnp.device_class,
|
||||
dev_name(&device->dev),
|
||||
event, ++button->pushed);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -31,8 +31,6 @@
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
#define PREFIX "ACPI: "
|
||||
|
||||
#define _COMPONENT ACPI_CONTAINER_COMPONENT
|
||||
ACPI_MODULE_NAME("container");
|
||||
|
||||
|
@ -37,8 +37,6 @@
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
#define PREFIX "ACPI: "
|
||||
|
||||
#define ACPI_DOCK_DRIVER_DESCRIPTION "ACPI Dock Station Driver"
|
||||
|
||||
ACPI_MODULE_NAME("dock");
|
||||
|
@ -52,7 +52,7 @@
|
||||
|
||||
#define _COMPONENT ACPI_OS_SERVICES
|
||||
ACPI_MODULE_NAME("osl");
|
||||
#define PREFIX "ACPI: "
|
||||
|
||||
struct acpi_os_dpc {
|
||||
acpi_osd_exec_callback function;
|
||||
void *context;
|
||||
|
@ -370,6 +370,30 @@ static struct acpi_prt_entry *acpi_pci_irq_lookup(struct pci_dev *dev, int pin)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if IS_ENABLED(CONFIG_ISA) || IS_ENABLED(CONFIG_EISA)
|
||||
static int acpi_isa_register_gsi(struct pci_dev *dev)
|
||||
{
|
||||
u32 dev_gsi;
|
||||
|
||||
/* Interrupt Line values above 0xF are forbidden */
|
||||
if (dev->irq > 0 && (dev->irq <= 0xF) &&
|
||||
(acpi_isa_irq_to_gsi(dev->irq, &dev_gsi) == 0)) {
|
||||
dev_warn(&dev->dev, "PCI INT %c: no GSI - using ISA IRQ %d\n",
|
||||
pin_name(dev->pin), dev->irq);
|
||||
acpi_register_gsi(&dev->dev, dev_gsi,
|
||||
ACPI_LEVEL_SENSITIVE,
|
||||
ACPI_ACTIVE_LOW);
|
||||
return 0;
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
#else
|
||||
static inline int acpi_isa_register_gsi(struct pci_dev *dev)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
#endif
|
||||
|
||||
int acpi_pci_irq_enable(struct pci_dev *dev)
|
||||
{
|
||||
struct acpi_prt_entry *entry;
|
||||
@ -416,19 +440,9 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
|
||||
* driver reported one, then use it. Exit in any case.
|
||||
*/
|
||||
if (gsi < 0) {
|
||||
u32 dev_gsi;
|
||||
/* Interrupt Line values above 0xF are forbidden */
|
||||
if (dev->irq > 0 && (dev->irq <= 0xF) &&
|
||||
(acpi_isa_irq_to_gsi(dev->irq, &dev_gsi) == 0)) {
|
||||
dev_warn(&dev->dev, "PCI INT %c: no GSI - using ISA IRQ %d\n",
|
||||
pin_name(pin), dev->irq);
|
||||
acpi_register_gsi(&dev->dev, dev_gsi,
|
||||
ACPI_LEVEL_SENSITIVE,
|
||||
ACPI_ACTIVE_LOW);
|
||||
} else {
|
||||
if (acpi_isa_register_gsi(dev))
|
||||
dev_warn(&dev->dev, "PCI INT %c: no GSI\n",
|
||||
pin_name(pin));
|
||||
}
|
||||
|
||||
kfree(entry);
|
||||
return 0;
|
||||
|
@ -43,8 +43,6 @@
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
#define PREFIX "ACPI: "
|
||||
|
||||
#define _COMPONENT ACPI_PCI_COMPONENT
|
||||
ACPI_MODULE_NAME("pci_link");
|
||||
#define ACPI_PCI_LINK_CLASS "pci_irq_routing"
|
||||
|
@ -39,8 +39,6 @@
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
#define PREFIX "ACPI: "
|
||||
|
||||
#define _COMPONENT ACPI_PCI_COMPONENT
|
||||
ACPI_MODULE_NAME("pci_root");
|
||||
#define ACPI_PCI_ROOT_CLASS "pci_bridge"
|
||||
|
@ -46,8 +46,6 @@
|
||||
#include "sleep.h"
|
||||
#include "internal.h"
|
||||
|
||||
#define PREFIX "ACPI: "
|
||||
|
||||
#define _COMPONENT ACPI_POWER_COMPONENT
|
||||
ACPI_MODULE_NAME("power");
|
||||
#define ACPI_POWER_CLASS "power_resource"
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
#define PREFIX "ACPI: "
|
||||
#define _COMPONENT ACPI_PROCESSOR_COMPONENT
|
||||
ACPI_MODULE_NAME("processor_core");
|
||||
|
||||
|
@ -41,8 +41,6 @@
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
#define PREFIX "ACPI: "
|
||||
|
||||
#define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80
|
||||
#define ACPI_PROCESSOR_NOTIFY_POWER 0x81
|
||||
#define ACPI_PROCESSOR_NOTIFY_THROTTLING 0x82
|
||||
|
@ -12,8 +12,6 @@
|
||||
#define _COMPONENT ACPI_SYSTEM_COMPONENT
|
||||
ACPI_MODULE_NAME("sysfs");
|
||||
|
||||
#define PREFIX "ACPI: "
|
||||
|
||||
#ifdef CONFIG_ACPI_DEBUG
|
||||
/*
|
||||
* ACPI debug sysfs I/F, including:
|
||||
|
@ -23,6 +23,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) "ACPI: " fmt
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/smp.h>
|
||||
@ -33,8 +35,6 @@
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/bootmem.h>
|
||||
|
||||
#define PREFIX "ACPI: "
|
||||
|
||||
#define ACPI_MAX_TABLES 128
|
||||
|
||||
static char *mps_inti_flags_polarity[] = { "dfl", "high", "res", "low" };
|
||||
@ -55,10 +55,9 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
|
||||
{
|
||||
struct acpi_madt_local_apic *p =
|
||||
(struct acpi_madt_local_apic *)header;
|
||||
printk(KERN_INFO PREFIX
|
||||
"LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n",
|
||||
p->processor_id, p->id,
|
||||
(p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
|
||||
pr_info("LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n",
|
||||
p->processor_id, p->id,
|
||||
(p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
|
||||
}
|
||||
break;
|
||||
|
||||
@ -66,11 +65,9 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
|
||||
{
|
||||
struct acpi_madt_local_x2apic *p =
|
||||
(struct acpi_madt_local_x2apic *)header;
|
||||
printk(KERN_INFO PREFIX
|
||||
"X2APIC (apic_id[0x%02x] uid[0x%02x] %s)\n",
|
||||
p->local_apic_id, p->uid,
|
||||
(p->lapic_flags & ACPI_MADT_ENABLED) ?
|
||||
"enabled" : "disabled");
|
||||
pr_info("X2APIC (apic_id[0x%02x] uid[0x%02x] %s)\n",
|
||||
p->local_apic_id, p->uid,
|
||||
(p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
|
||||
}
|
||||
break;
|
||||
|
||||
@ -78,9 +75,8 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
|
||||
{
|
||||
struct acpi_madt_io_apic *p =
|
||||
(struct acpi_madt_io_apic *)header;
|
||||
printk(KERN_INFO PREFIX
|
||||
"IOAPIC (id[0x%02x] address[0x%08x] gsi_base[%d])\n",
|
||||
p->id, p->address, p->global_irq_base);
|
||||
pr_info("IOAPIC (id[0x%02x] address[0x%08x] gsi_base[%d])\n",
|
||||
p->id, p->address, p->global_irq_base);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -88,18 +84,15 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
|
||||
{
|
||||
struct acpi_madt_interrupt_override *p =
|
||||
(struct acpi_madt_interrupt_override *)header;
|
||||
printk(KERN_INFO PREFIX
|
||||
"INT_SRC_OVR (bus %d bus_irq %d global_irq %d %s %s)\n",
|
||||
p->bus, p->source_irq, p->global_irq,
|
||||
mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK],
|
||||
mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2]);
|
||||
pr_info("INT_SRC_OVR (bus %d bus_irq %d global_irq %d %s %s)\n",
|
||||
p->bus, p->source_irq, p->global_irq,
|
||||
mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK],
|
||||
mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2]);
|
||||
if (p->inti_flags &
|
||||
~(ACPI_MADT_POLARITY_MASK | ACPI_MADT_TRIGGER_MASK))
|
||||
printk(KERN_INFO PREFIX
|
||||
"INT_SRC_OVR unexpected reserved flags: 0x%x\n",
|
||||
p->inti_flags &
|
||||
pr_info("INT_SRC_OVR unexpected reserved flags: 0x%x\n",
|
||||
p->inti_flags &
|
||||
~(ACPI_MADT_POLARITY_MASK | ACPI_MADT_TRIGGER_MASK));
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
@ -107,11 +100,10 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
|
||||
{
|
||||
struct acpi_madt_nmi_source *p =
|
||||
(struct acpi_madt_nmi_source *)header;
|
||||
printk(KERN_INFO PREFIX
|
||||
"NMI_SRC (%s %s global_irq %d)\n",
|
||||
mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK],
|
||||
mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2],
|
||||
p->global_irq);
|
||||
pr_info("NMI_SRC (%s %s global_irq %d)\n",
|
||||
mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK],
|
||||
mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2],
|
||||
p->global_irq);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -119,12 +111,11 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
|
||||
{
|
||||
struct acpi_madt_local_apic_nmi *p =
|
||||
(struct acpi_madt_local_apic_nmi *)header;
|
||||
printk(KERN_INFO PREFIX
|
||||
"LAPIC_NMI (acpi_id[0x%02x] %s %s lint[0x%x])\n",
|
||||
p->processor_id,
|
||||
mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK ],
|
||||
mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2],
|
||||
p->lint);
|
||||
pr_info("LAPIC_NMI (acpi_id[0x%02x] %s %s lint[0x%x])\n",
|
||||
p->processor_id,
|
||||
mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK ],
|
||||
mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2],
|
||||
p->lint);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -137,12 +128,11 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
|
||||
polarity = p->inti_flags & ACPI_MADT_POLARITY_MASK;
|
||||
trigger = (p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2;
|
||||
|
||||
printk(KERN_INFO PREFIX
|
||||
"X2APIC_NMI (uid[0x%02x] %s %s lint[0x%x])\n",
|
||||
p->uid,
|
||||
mps_inti_flags_polarity[polarity],
|
||||
mps_inti_flags_trigger[trigger],
|
||||
p->lint);
|
||||
pr_info("X2APIC_NMI (uid[0x%02x] %s %s lint[0x%x])\n",
|
||||
p->uid,
|
||||
mps_inti_flags_polarity[polarity],
|
||||
mps_inti_flags_trigger[trigger],
|
||||
p->lint);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -150,9 +140,8 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
|
||||
{
|
||||
struct acpi_madt_local_apic_override *p =
|
||||
(struct acpi_madt_local_apic_override *)header;
|
||||
printk(KERN_INFO PREFIX
|
||||
"LAPIC_ADDR_OVR (address[%p])\n",
|
||||
(void *)(unsigned long)p->address);
|
||||
pr_info("LAPIC_ADDR_OVR (address[%p])\n",
|
||||
(void *)(unsigned long)p->address);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -160,10 +149,9 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
|
||||
{
|
||||
struct acpi_madt_io_sapic *p =
|
||||
(struct acpi_madt_io_sapic *)header;
|
||||
printk(KERN_INFO PREFIX
|
||||
"IOSAPIC (id[0x%x] address[%p] gsi_base[%d])\n",
|
||||
p->id, (void *)(unsigned long)p->address,
|
||||
p->global_irq_base);
|
||||
pr_info("IOSAPIC (id[0x%x] address[%p] gsi_base[%d])\n",
|
||||
p->id, (void *)(unsigned long)p->address,
|
||||
p->global_irq_base);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -171,10 +159,9 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
|
||||
{
|
||||
struct acpi_madt_local_sapic *p =
|
||||
(struct acpi_madt_local_sapic *)header;
|
||||
printk(KERN_INFO PREFIX
|
||||
"LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n",
|
||||
p->processor_id, p->id, p->eid,
|
||||
(p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
|
||||
pr_info("LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n",
|
||||
p->processor_id, p->id, p->eid,
|
||||
(p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
|
||||
}
|
||||
break;
|
||||
|
||||
@ -182,19 +169,17 @@ void acpi_table_print_madt_entry(struct acpi_subtable_header *header)
|
||||
{
|
||||
struct acpi_madt_interrupt_source *p =
|
||||
(struct acpi_madt_interrupt_source *)header;
|
||||
printk(KERN_INFO PREFIX
|
||||
"PLAT_INT_SRC (%s %s type[0x%x] id[0x%04x] eid[0x%x] iosapic_vector[0x%x] global_irq[0x%x]\n",
|
||||
mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK],
|
||||
mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2],
|
||||
p->type, p->id, p->eid, p->io_sapic_vector,
|
||||
p->global_irq);
|
||||
pr_info("PLAT_INT_SRC (%s %s type[0x%x] id[0x%04x] eid[0x%x] iosapic_vector[0x%x] global_irq[0x%x]\n",
|
||||
mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK],
|
||||
mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2],
|
||||
p->type, p->id, p->eid, p->io_sapic_vector,
|
||||
p->global_irq);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
printk(KERN_WARNING PREFIX
|
||||
"Found unsupported MADT entry (type = 0x%x)\n",
|
||||
header->type);
|
||||
pr_warn("Found unsupported MADT entry (type = 0x%x)\n",
|
||||
header->type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -225,7 +210,7 @@ acpi_table_parse_entries(char *id,
|
||||
acpi_get_table_with_size(id, 0, &table_header, &tbl_size);
|
||||
|
||||
if (!table_header) {
|
||||
printk(KERN_WARNING PREFIX "%4.4s not present\n", id);
|
||||
pr_warn("%4.4s not present\n", id);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@ -248,7 +233,7 @@ acpi_table_parse_entries(char *id,
|
||||
* infinite loop.
|
||||
*/
|
||||
if (entry->length == 0) {
|
||||
pr_err(PREFIX "[%4.4s:0x%02x] Invalid zero length\n", id, entry_id);
|
||||
pr_err("[%4.4s:0x%02x] Invalid zero length\n", id, entry_id);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@ -256,8 +241,8 @@ acpi_table_parse_entries(char *id,
|
||||
((unsigned long)entry + entry->length);
|
||||
}
|
||||
if (max_entries && count > max_entries) {
|
||||
printk(KERN_WARNING PREFIX "[%4.4s:0x%02x] ignored %i entries of "
|
||||
"%i found\n", id, entry_id, count - max_entries, count);
|
||||
pr_warn("[%4.4s:0x%02x] ignored %i entries of %i found\n",
|
||||
id, entry_id, count - max_entries, count);
|
||||
}
|
||||
|
||||
early_acpi_os_unmap_memory((char *)table_header, tbl_size);
|
||||
@ -322,13 +307,11 @@ static void __init check_multiple_madt(void)
|
||||
|
||||
acpi_get_table_with_size(ACPI_SIG_MADT, 2, &table, &tbl_size);
|
||||
if (table) {
|
||||
printk(KERN_WARNING PREFIX
|
||||
"BIOS bug: multiple APIC/MADT found,"
|
||||
" using %d\n", acpi_apic_instance);
|
||||
printk(KERN_WARNING PREFIX
|
||||
"If \"acpi_apic_instance=%d\" works better, "
|
||||
"notify linux-acpi@vger.kernel.org\n",
|
||||
acpi_apic_instance ? 0 : 2);
|
||||
pr_warn("BIOS bug: multiple APIC/MADT found, using %d\n",
|
||||
acpi_apic_instance);
|
||||
pr_warn("If \"acpi_apic_instance=%d\" works better, "
|
||||
"notify linux-acpi@vger.kernel.org\n",
|
||||
acpi_apic_instance ? 0 : 2);
|
||||
early_acpi_os_unmap_memory(table, tbl_size);
|
||||
|
||||
} else
|
||||
@ -365,8 +348,7 @@ static int __init acpi_parse_apic_instance(char *str)
|
||||
|
||||
acpi_apic_instance = simple_strtoul(str, NULL, 0);
|
||||
|
||||
printk(KERN_NOTICE PREFIX "Shall use APIC/MADT table %d\n",
|
||||
acpi_apic_instance);
|
||||
pr_notice("Shall use APIC/MADT table %d\n", acpi_apic_instance);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include <linux/device.h>
|
||||
#include <linux/thermal.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
#define PREFIX "ACPI: "
|
||||
@ -90,6 +91,8 @@ static int psv;
|
||||
module_param(psv, int, 0644);
|
||||
MODULE_PARM_DESC(psv, "Disable or override all passive trip points.");
|
||||
|
||||
static struct workqueue_struct *acpi_thermal_pm_queue;
|
||||
|
||||
static int acpi_thermal_add(struct acpi_device *device);
|
||||
static int acpi_thermal_remove(struct acpi_device *device);
|
||||
static void acpi_thermal_notify(struct acpi_device *device, u32 event);
|
||||
@ -101,11 +104,13 @@ static const struct acpi_device_id thermal_device_ids[] = {
|
||||
MODULE_DEVICE_TABLE(acpi, thermal_device_ids);
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int acpi_thermal_suspend(struct device *dev);
|
||||
static int acpi_thermal_resume(struct device *dev);
|
||||
#else
|
||||
#define acpi_thermal_suspend NULL
|
||||
#define acpi_thermal_resume NULL
|
||||
#endif
|
||||
static SIMPLE_DEV_PM_OPS(acpi_thermal_pm, NULL, acpi_thermal_resume);
|
||||
static SIMPLE_DEV_PM_OPS(acpi_thermal_pm, acpi_thermal_suspend, acpi_thermal_resume);
|
||||
|
||||
static struct acpi_driver acpi_thermal_driver = {
|
||||
.name = "thermal",
|
||||
@ -186,6 +191,7 @@ struct acpi_thermal {
|
||||
struct thermal_zone_device *thermal_zone;
|
||||
int tz_enabled;
|
||||
int kelvin_offset;
|
||||
struct work_struct thermal_check_work;
|
||||
};
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
@ -1064,6 +1070,13 @@ static void acpi_thermal_guess_offset(struct acpi_thermal *tz)
|
||||
tz->kelvin_offset = 2732;
|
||||
}
|
||||
|
||||
static void acpi_thermal_check_fn(struct work_struct *work)
|
||||
{
|
||||
struct acpi_thermal *tz = container_of(work, struct acpi_thermal,
|
||||
thermal_check_work);
|
||||
acpi_thermal_check(tz);
|
||||
}
|
||||
|
||||
static int acpi_thermal_add(struct acpi_device *device)
|
||||
{
|
||||
int result = 0;
|
||||
@ -1093,6 +1106,8 @@ static int acpi_thermal_add(struct acpi_device *device)
|
||||
if (result)
|
||||
goto free_memory;
|
||||
|
||||
INIT_WORK(&tz->thermal_check_work, acpi_thermal_check_fn);
|
||||
|
||||
pr_info(PREFIX "%s [%s] (%ld C)\n", acpi_device_name(device),
|
||||
acpi_device_bid(device), KELVIN_TO_CELSIUS(tz->temperature));
|
||||
goto end;
|
||||
@ -1110,6 +1125,7 @@ static int acpi_thermal_remove(struct acpi_device *device)
|
||||
if (!device || !acpi_driver_data(device))
|
||||
return -EINVAL;
|
||||
|
||||
flush_workqueue(acpi_thermal_pm_queue);
|
||||
tz = acpi_driver_data(device);
|
||||
|
||||
acpi_thermal_unregister_thermal_zone(tz);
|
||||
@ -1118,6 +1134,13 @@ static int acpi_thermal_remove(struct acpi_device *device)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int acpi_thermal_suspend(struct device *dev)
|
||||
{
|
||||
/* Make sure the previously queued thermal check work has been done */
|
||||
flush_workqueue(acpi_thermal_pm_queue);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int acpi_thermal_resume(struct device *dev)
|
||||
{
|
||||
struct acpi_thermal *tz;
|
||||
@ -1148,7 +1171,7 @@ static int acpi_thermal_resume(struct device *dev)
|
||||
tz->state.active |= tz->trips.active[i].flags.enabled;
|
||||
}
|
||||
|
||||
acpi_thermal_check(tz);
|
||||
queue_work(acpi_thermal_pm_queue, &tz->thermal_check_work);
|
||||
|
||||
return AE_OK;
|
||||
}
|
||||
@ -1240,16 +1263,22 @@ static int __init acpi_thermal_init(void)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
result = acpi_bus_register_driver(&acpi_thermal_driver);
|
||||
if (result < 0)
|
||||
acpi_thermal_pm_queue = create_workqueue("acpi_thermal_pm");
|
||||
if (!acpi_thermal_pm_queue)
|
||||
return -ENODEV;
|
||||
|
||||
result = acpi_bus_register_driver(&acpi_thermal_driver);
|
||||
if (result < 0) {
|
||||
destroy_workqueue(acpi_thermal_pm_queue);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit acpi_thermal_exit(void)
|
||||
{
|
||||
|
||||
destroy_workqueue(acpi_thermal_pm_queue);
|
||||
acpi_bus_unregister_driver(&acpi_thermal_driver);
|
||||
|
||||
return;
|
||||
|
@ -45,8 +45,6 @@
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
#define PREFIX "ACPI: "
|
||||
|
||||
#define ACPI_VIDEO_BUS_NAME "Video Bus"
|
||||
#define ACPI_VIDEO_DEVICE_NAME "Video Device"
|
||||
#define ACPI_VIDEO_NOTIFY_SWITCH 0x80
|
||||
|
@ -40,8 +40,6 @@
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
#define PREFIX "ACPI: "
|
||||
|
||||
ACPI_MODULE_NAME("video");
|
||||
#define _COMPONENT ACPI_VIDEO_COMPONENT
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user