From bbb16fef19122ec9f20fb865c45375e12f85d2a1 Mon Sep 17 00:00:00 2001 From: Srinivas Pandruvada Date: Tue, 9 Dec 2014 16:15:40 -0800 Subject: ACPI / Fan: Use bus id as the name for non PNP0C0B (Fan) devices The _ART (Active Cooling Relationship Table), specifies relationship among heat generating sources to a target active cooling device like fan. The _ART table refers to actual bus id name for specifying relationship. Naming "Fan" is not enough as name in the _ART table can change on every platform, to establish relationship for user space thermal controllers. Signed-off-by: Srinivas Pandruvada Signed-off-by: Rafael J. Wysocki --- drivers/acpi/fan.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index caf9b76b7ef8..7a36f02598a6 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c @@ -325,6 +325,7 @@ static int acpi_fan_probe(struct platform_device *pdev) struct thermal_cooling_device *cdev; struct acpi_fan *fan; struct acpi_device *device = ACPI_COMPANION(&pdev->dev); + char *name; fan = devm_kzalloc(&pdev->dev, sizeof(*fan), GFP_KERNEL); if (!fan) { @@ -346,7 +347,12 @@ static int acpi_fan_probe(struct platform_device *pdev) } } - cdev = thermal_cooling_device_register("Fan", device, + if (!strncmp(pdev->name, "PNP0C0B", strlen("PNP0C0B"))) + name = "Fan"; + else + name = acpi_device_bid(device); + + cdev = thermal_cooling_device_register(name, device, &fan_cooling_ops); if (IS_ERR(cdev)) { result = PTR_ERR(cdev); -- cgit v1.2.3 From 80167a24a27449c06fbbfb1b0f4a5b965c41b428 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Fri, 12 Dec 2014 22:48:44 +0100 Subject: ACPI / scan: Change the level of _DEP-related messages to KERN_DEBUG Two _DEP-related failure messages are printed as dev_err() which is unnecessary and annoying. Use dev_dbg() to print them. While at it, one of the messages should actually say it is related to _DEP, so modify it to that effect. Fixes: 40e7fcb19293 (ACPI: Add _DEP support to fix battery issue on Asus T100TA) Reported-by: Linus Torvalds Signed-off-by: Rafael J. Wysocki --- drivers/acpi/scan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 00189ad63c8f..d838b2f83e21 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -2107,7 +2107,7 @@ static void acpi_device_dep_initialize(struct acpi_device *adev) status = acpi_evaluate_reference(adev->handle, "_DEP", NULL, &dep_devices); if (ACPI_FAILURE(status)) { - dev_err(&adev->dev, "Failed to evaluate _DEP.\n"); + dev_dbg(&adev->dev, "Failed to evaluate _DEP.\n"); return; } @@ -2117,7 +2117,7 @@ static void acpi_device_dep_initialize(struct acpi_device *adev) status = acpi_get_object_info(dep_devices.handles[i], &info); if (ACPI_FAILURE(status)) { - dev_err(&adev->dev, "Error reading device info\n"); + dev_dbg(&adev->dev, "Error reading _DEP device info\n"); continue; } -- cgit v1.2.3 From c48cf1b9dd8f01358e5385d40fb58061f32313a7 Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Fri, 12 Dec 2014 22:51:01 +0100 Subject: ACPI / utils: Drop error messages from acpi_evaluate_reference() Some of the error messages printed by acpi_evaluate_reference() with the KERN_ERR priority should really be debug messages, but then they would be redundant, because acpi_util_eval_error() is called too at the same spots (except for one). Drop the kernel messages from there entirely and leave the acpi_util_eval_error() to handle the debug printing. In one case, replace the kernel message with a call to acpi_util_eval_error(). Signed-off-by: Rafael J. Wysocki --- drivers/acpi/utils.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 371ac12d25b1..5512309d167b 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -347,22 +347,16 @@ acpi_evaluate_reference(acpi_handle handle, package = buffer.pointer; if ((buffer.length == 0) || !package) { - printk(KERN_ERR PREFIX "No return object (len %X ptr %p)\n", - (unsigned)buffer.length, package); status = AE_BAD_DATA; acpi_util_eval_error(handle, pathname, status); goto end; } if (package->type != ACPI_TYPE_PACKAGE) { - printk(KERN_ERR PREFIX "Expecting a [Package], found type %X\n", - package->type); status = AE_BAD_DATA; acpi_util_eval_error(handle, pathname, status); goto end; } if (!package->package.count) { - printk(KERN_ERR PREFIX "[Package] has zero elements (%p)\n", - package); status = AE_BAD_DATA; acpi_util_eval_error(handle, pathname, status); goto end; @@ -381,17 +375,13 @@ acpi_evaluate_reference(acpi_handle handle, if (element->type != ACPI_TYPE_LOCAL_REFERENCE) { status = AE_BAD_DATA; - printk(KERN_ERR PREFIX - "Expecting a [Reference] package element, found type %X\n", - element->type); acpi_util_eval_error(handle, pathname, status); break; } if (!element->reference.handle) { - printk(KERN_WARNING PREFIX "Invalid reference in" - " package %s\n", pathname); status = AE_NULL_ENTRY; + acpi_util_eval_error(handle, pathname, status); break; } /* Get the acpi_handle. */ -- cgit v1.2.3 From 175f8e2650f7ca6b33d338be3ccc1c00e89594ea Mon Sep 17 00:00:00 2001 From: "Rafael J. Wysocki" Date: Fri, 12 Dec 2014 22:51:58 +0100 Subject: ACPI / PM: Do not disable wakeup GPEs that have not been enabled In some cases acpi_device_wakeup() may be called to ensure wakeup power to be off for a given device even though that device's wakeup GPE has not been enabled so far. It calls acpi_disable_gpe() on a GPE that's not enabled and this causes ACPICA to return the AE_LIMIT status code from that call which then is reported as an error by the ACPICA's debug facilities (if enabled). This may lead to a fair amount of confusion, so introduce a new ACPI device wakeup flag to store the wakeup GPE status and avoid disabling wakeup GPEs that have not been enabled. Reported-and-tested-by: Venkat Raghavulu Signed-off-by: Rafael J. Wysocki --- drivers/acpi/device_pm.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index 076af8149566..e6ff33ecd784 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c @@ -680,13 +680,21 @@ static int acpi_device_wakeup(struct acpi_device *adev, u32 target_state, if (error) return error; + if (adev->wakeup.flags.enabled) + return 0; + res = acpi_enable_gpe(wakeup->gpe_device, wakeup->gpe_number); - if (ACPI_FAILURE(res)) { + if (ACPI_SUCCESS(res)) { + adev->wakeup.flags.enabled = 1; + } else { acpi_disable_wakeup_device_power(adev); return -EIO; } } else { - acpi_disable_gpe(wakeup->gpe_device, wakeup->gpe_number); + if (adev->wakeup.flags.enabled) { + acpi_disable_gpe(wakeup->gpe_device, wakeup->gpe_number); + adev->wakeup.flags.enabled = 0; + } acpi_disable_wakeup_device_power(adev); } return 0; -- cgit v1.2.3 From 1741acea75ea51ce709304a26baf72e1e99b8f3a Mon Sep 17 00:00:00 2001 From: Lv Zheng Date: Mon, 15 Dec 2014 08:47:52 +0800 Subject: ACPI / EC: Fix unexpected ec_remove_handlers() invocations The ec_remove_handlers() is invoked without checking EC_FLAGS_HANDLERS_INSTALLED, this patch enhances this check to avoid issues that acpi_disable_gpe() is invoked unexpectedly to reduce the GPE runtime count. This may happen when the EC handler installation failed on some platforms. Reported-by: Venkat Raghavulu Signed-off-by: Lv Zheng Signed-off-by: Rafael J. Wysocki --- drivers/acpi/ec.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/acpi') diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 5f9b74b9b71f..1b5853f384e2 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -844,6 +844,8 @@ static int ec_install_handlers(struct acpi_ec *ec) static void ec_remove_handlers(struct acpi_ec *ec) { + if (!test_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags)) + return; acpi_disable_gpe(NULL, ec->gpe); if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) -- cgit v1.2.3 From b4df463678fb9c6dae9548dbb7545993779fd416 Mon Sep 17 00:00:00 2001 From: Aaron Lu Date: Mon, 15 Dec 2014 16:01:29 +0800 Subject: ACPI / video: update the skip case for acpi_video_device_in_dod() If the firmware has declared more than 8 video output devices, and the one that control the internal panel's backlight is listed after the first 8 output devices, the _DOD will not include it due to the current i915 operation region implementation. As a result, we will not create a backlight device for it while we should. Solve this problem by special case the firmware that has 8+ output devices in that if we see such a firmware, we do not test if the device is in _DOD list. The creation of the backlight device will also enable the firmware to emit events on backlight hotkey press when the acpi_osi= cmdline option is specified on those affected ASUS laptops. Link: https://bugzilla.kernel.org/show_bug.cgi?id=70241 Reported-and-tested-by: Oleksij Rempel Reported-and-tested-by: Dmitry Tunin Reported-and-tested-by: Jimbo Cc: 3.18+ # 3.18+ Signed-off-by: Aaron Lu Acked-by: Jani Nikula Signed-off-by: Rafael J. Wysocki --- drivers/acpi/video.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'drivers/acpi') diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 185a57d13723..1eaadff2e198 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -155,6 +155,7 @@ struct acpi_video_bus { u8 dos_setting; struct acpi_video_enumerated_device *attached_array; u8 attached_count; + u8 child_count; struct acpi_video_bus_cap cap; struct acpi_video_bus_flags flags; struct list_head video_device_list; @@ -1159,8 +1160,12 @@ static bool acpi_video_device_in_dod(struct acpi_video_device *device) struct acpi_video_bus *video = device->video; int i; - /* If we have a broken _DOD, no need to test */ - if (!video->attached_count) + /* + * If we have a broken _DOD or we have more than 8 output devices + * under the graphics controller node that we can't proper deal with + * in the operation region code currently, no need to test. + */ + if (!video->attached_count || video->child_count > 8) return true; for (i = 0; i < video->attached_count; i++) { @@ -1413,6 +1418,7 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video, dev_err(&dev->dev, "Can't attach device\n"); break; } + video->child_count++; } return status; } -- cgit v1.2.3