From 8eaa29f92a66c92ade1ad663d14d975d776ef492 Mon Sep 17 00:00:00 2001 From: Lan Tianyu Date: Thu, 12 Dec 2013 18:08:17 +0800 Subject: [PATCH 1/7] ACPI / Button: Fix enabling button GPEs twice Button GPEs have been enabled in the acpi_wake_device_init() during boot and the button driver enables them for the second time. Consequently, it is necessary to do # echo disable > /sys/firmware/acpi/interrupts/gpeXXX twice in a row to disable those GPEs via sysfs. This patch is to remove the GPE enabling code from the button driver to avoid the problem. Signed-off-by: Lan Tianyu [rjw: Changelog] Signed-off-by: Rafael J. Wysocki --- drivers/acpi/button.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index c971929d75c2..5401e9a98b35 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -101,7 +101,6 @@ struct acpi_button { struct input_dev *input; char phys[32]; /* for input device */ unsigned long pushed; - bool wakeup_enabled; }; static BLOCKING_NOTIFIER_HEAD(acpi_lid_notifier); @@ -407,16 +406,6 @@ static int acpi_button_add(struct acpi_device *device) lid_device = device; } - if (device->wakeup.flags.valid) { - /* Button's GPE is run-wake GPE */ - acpi_enable_gpe(device->wakeup.gpe_device, - device->wakeup.gpe_number); - if (!device_may_wakeup(&device->dev)) { - device_set_wakeup_enable(&device->dev, true); - button->wakeup_enabled = true; - } - } - printk(KERN_INFO PREFIX "%s [%s]\n", name, acpi_device_bid(device)); return 0; @@ -433,13 +422,6 @@ static int acpi_button_remove(struct acpi_device *device) { struct acpi_button *button = acpi_driver_data(device); - if (device->wakeup.flags.valid) { - acpi_disable_gpe(device->wakeup.gpe_device, - device->wakeup.gpe_number); - if (button->wakeup_enabled) - device_set_wakeup_enable(&device->dev, false); - } - acpi_button_remove_fs(device); input_unregister_device(button->input); kfree(button); From 42b946bb35ef0057f13887dec5f081df0ba8840a Mon Sep 17 00:00:00 2001 From: Lan Tianyu Date: Thu, 12 Dec 2013 18:08:52 +0800 Subject: [PATCH 2/7] ACPI / EC: disable GPE before removing GPE handler Adjust the order of disabling the EC GPE and removing its handler to avoid unhandled events. Signed-off-by: Lan Tianyu [rjw: Changelog] Signed-off-by: Rafael J. Wysocki --- drivers/acpi/ec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index ba5b56db9d27..7dac048e8f07 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -779,9 +779,9 @@ static int ec_install_handlers(struct acpi_ec *ec) pr_err("Fail in evaluating the _REG object" " of EC device. Broken bios is suspected.\n"); } else { + acpi_disable_gpe(NULL, ec->gpe); acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler); - acpi_disable_gpe(NULL, ec->gpe); return -ENODEV; } } From 0039735e960e1f39e777aab7087d438507d9819f Mon Sep 17 00:00:00 2001 From: Masanari Iida Date: Fri, 20 Dec 2013 00:51:37 +0900 Subject: [PATCH 3/7] ACPI / video: Fix typo in video_detect.c Correct "**retyurn_value" to "**return_value". Signed-off-by: Masanari Iida Signed-off-by: Rafael J. Wysocki --- drivers/acpi/video_detect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 84875fd4c74f..f0447d3daf2c 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c @@ -50,7 +50,7 @@ static bool acpi_video_caps_checked; static acpi_status acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context, - void **retyurn_value) + void **return_value) { long *cap = context; From 2d4054d8422462cb2771fdb4eb1925df55d2b320 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 19 Dec 2013 17:09:12 +0100 Subject: [PATCH 4/7] ACPI: Blacklist Win8 OSI for some HP laptop 2013 models The BIOS on recent HP laptops behaves differently with Win8 OSI, e.g. no backlight control and no rfkill are available. List them in the blacklist as a workaround. This patch tries to reduce the added items by matching "G1" suffix, e.g. machines are named like "HP ProBook 430 G1". References: https://bugzilla.novell.com/show_bug.cgi?id=856294 Signed-off-by: Takashi Iwai Signed-off-by: Rafael J. Wysocki --- drivers/acpi/blacklist.c | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c index 078c4f7fe2dd..40c91f5052ef 100644 --- a/drivers/acpi/blacklist.c +++ b/drivers/acpi/blacklist.c @@ -323,6 +323,56 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { DMI_MATCH(DMI_PRODUCT_VERSION, "2349D15"), }, }, + { + .callback = dmi_disable_osi_win8, + .ident = "HP ProBook 2013 models", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), + DMI_MATCH(DMI_PRODUCT_NAME, "HP ProBook "), + DMI_MATCH(DMI_PRODUCT_NAME, " G1"), + }, + }, + { + .callback = dmi_disable_osi_win8, + .ident = "HP EliteBook 2013 models", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), + DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook "), + DMI_MATCH(DMI_PRODUCT_NAME, " G1"), + }, + }, + { + .callback = dmi_disable_osi_win8, + .ident = "HP ZBook 14", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), + DMI_MATCH(DMI_PRODUCT_NAME, "HP ZBook 14"), + }, + }, + { + .callback = dmi_disable_osi_win8, + .ident = "HP ZBook 15", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), + DMI_MATCH(DMI_PRODUCT_NAME, "HP ZBook 15"), + }, + }, + { + .callback = dmi_disable_osi_win8, + .ident = "HP ZBook 17", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), + DMI_MATCH(DMI_PRODUCT_NAME, "HP ZBook 17"), + }, + }, + { + .callback = dmi_disable_osi_win8, + .ident = "HP EliteBook 8780w", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), + DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook 8780w"), + }, + }, /* * BIOS invocation of _OSI(Linux) is almost always a BIOS bug. From ec9c9c2ec1d164f3c5f3c9ac41f43de40040e43c Mon Sep 17 00:00:00 2001 From: Emil Goode Date: Tue, 7 Jan 2014 17:24:55 +0100 Subject: [PATCH 5/7] ACPI / thermal: remove const from thermal_zone_device_ops declaration The following commit introduced the requirement to not declare thermal_zone_device_ops structs as const in order to allow changing the .get_temp callback. commit 4e5e4705bf69ea450f58fc709ac5888f321a9299 Author: Eduardo Valentin Date: Wed Jul 3 15:35:39 2013 -0400 thermal: introduce device tree parser Modify acpi_thermal_zone_ops to follow the new requirement. Signed-off-by: Emil Goode Acked-by: Eduardo Valentin [rjw: Changelog] Signed-off-by: Rafael J. Wysocki --- drivers/acpi/thermal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 0d9f46b5ae6d..9eaf3bf013f0 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -862,7 +862,7 @@ acpi_thermal_unbind_cooling_device(struct thermal_zone_device *thermal, return acpi_thermal_cooling_device_cb(thermal, cdev, false); } -static const struct thermal_zone_device_ops acpi_thermal_zone_ops = { +static struct thermal_zone_device_ops acpi_thermal_zone_ops = { .bind = acpi_thermal_bind_cooling_device, .unbind = acpi_thermal_unbind_cooling_device, .get_temp = thermal_get_temp, From b981513f806d26b2cc971eb65ced14bede67558b Mon Sep 17 00:00:00 2001 From: Jiang Liu Date: Thu, 9 Jan 2014 16:15:19 +0800 Subject: [PATCH 6/7] ACPI / scan: bail out early if failed to parse APIC ID for CPU Enhance ACPI CPU hotplug driver to print clear error message and bail out early if BIOS returns wrong value in ACPI MADT table or _MAT method. Otherwise it will add the CPU device even if failed to get APIC ID and fails any operations against sysfs interface: /sys/devices/system/cpu/cpux/online Signed-off-by: Jiang Liu Signed-off-by: Rafael J. Wysocki --- drivers/acpi/acpi_processor.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index 3c1d6b0c09a4..6ce71b07c197 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -212,7 +212,7 @@ static int acpi_processor_get_info(struct acpi_device *device) union acpi_object object = { 0 }; struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; struct acpi_processor *pr = acpi_driver_data(device); - int cpu_index, device_declaration = 0; + int apic_id, cpu_index, device_declaration = 0; acpi_status status = AE_OK; static int cpu0_initialized; unsigned long long value; @@ -258,18 +258,21 @@ static int acpi_processor_get_info(struct acpi_device *device) device_declaration = 1; pr->acpi_id = value; } - pr->apic_id = acpi_get_apicid(pr->handle, device_declaration, - pr->acpi_id); - cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id); - /* Handle UP system running SMP kernel, with no LAPIC in MADT */ - if (!cpu0_initialized && (cpu_index == -1) && - (num_online_cpus() == 1)) { - cpu_index = 0; + apic_id = acpi_get_apicid(pr->handle, device_declaration, pr->acpi_id); + if (apic_id < 0) { + acpi_handle_err(pr->handle, "failed to get CPU APIC ID.\n"); + return -ENODEV; } + pr->apic_id = apic_id; - cpu0_initialized = 1; - + cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id); + if (!cpu0_initialized) { + cpu0_initialized = 1; + /* Handle UP system running SMP kernel, with no LAPIC in MADT */ + if ((cpu_index == -1) && (num_online_cpus() == 1)) + cpu_index = 0; + } pr->id = cpu_index; /* @@ -282,6 +285,7 @@ static int acpi_processor_get_info(struct acpi_device *device) if (ret) return ret; } + /* * On some boxes several processors use the same processor bus id. * But they are located in different scope. For example: From 5c551e624abba6782034edd5b9eb58ac6f146b38 Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: Fri, 10 Jan 2014 10:51:53 +0100 Subject: [PATCH 7/7] ACPI / sleep: remove panic in case hardware has changed after S4 Some BIOSes change hardware based on the state of a laptop's lid. If the lid is closed, the touchpad is disabled and the checksum changes. Windows 8 no longer aborts resume if the checksum has changed. Signed-off-by: Oliver Neukum [rjw: Use pr_crit() for the message and don't break the string] Signed-off-by: Rafael J. Wysocki --- drivers/acpi/sleep.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 721e949e606e..32f7dee2f16b 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -670,11 +670,8 @@ static void acpi_hibernation_leave(void) /* Reprogram control registers */ acpi_leave_sleep_state_prep(ACPI_STATE_S4); /* Check the hardware signature */ - if (facs && s4_hardware_signature != facs->hardware_signature) { - printk(KERN_EMERG "ACPI: Hardware changed while hibernated, " - "cannot resume!\n"); - panic("ACPI S4 hardware signature mismatch"); - } + if (facs && s4_hardware_signature != facs->hardware_signature) + pr_crit("ACPI: Hardware changed while hibernated, success doubtful!\n"); /* Restore the NVS memory area */ suspend_nvs_restore(); /* Allow EC transactions to happen. */