55244d5
Bugzilla: 1097436
55244d5
Upstream-status: Sent upstream for 3.16
55244d5
55244d5
From f6fad201a0e4584e9826a2deb8ebbfccdb8cb13b Mon Sep 17 00:00:00 2001
55244d5
From: Hans de Goede <hdegoede@redhat.com>
55244d5
Date: Mon, 2 Jun 2014 17:41:01 +0200
55244d5
Subject: [PATCH 04/14] asus-wmi: Add a no backlight quirk
55244d5
55244d5
Some Asus motherboards for desktop PC-s export an acpi-video and
55244d5
an asus-wmi interface advertising backlight support. Add a quirk to allow
55244d5
to blacklist these so that desktop environments such as gnome don't start
55244d5
showing nonsense brightness controls.
55244d5
55244d5
https://bugzilla.redhat.com/show_bug.cgi?id=1097436
55244d5
55244d5
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
55244d5
---
55244d5
 drivers/platform/x86/asus-wmi.c | 8 ++++++--
55244d5
 drivers/platform/x86/asus-wmi.h | 1 +
55244d5
 2 files changed, 7 insertions(+), 2 deletions(-)
55244d5
55244d5
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
55244d5
index c5e082fb82fa..6f73dc5125ca 100644
55244d5
--- a/drivers/platform/x86/asus-wmi.c
55244d5
+++ b/drivers/platform/x86/asus-wmi.c
55244d5
@@ -1272,6 +1272,9 @@ static int asus_wmi_backlight_init(struct asus_wmi *asus)
55244d5
 	int max;
55244d5
 	int power;
55244d5
 
55244d5
+	if (asus->driver->quirks->no_backlight)
55244d5
+		return -ENODEV;
55244d5
+
55244d5
 	max = read_brightness_max(asus);
55244d5
 
55244d5
 	if (max == -ENODEV)
55244d5
@@ -1370,7 +1373,7 @@ static void asus_wmi_notify(u32 value, void *context)
55244d5
 		code = ASUS_WMI_BRN_DOWN;
55244d5
 
55244d5
 	if (code == ASUS_WMI_BRN_DOWN || code == ASUS_WMI_BRN_UP) {
55244d5
-		if (!acpi_video_backlight_support()) {
55244d5
+		if (asus->backlight_device) {
55244d5
 			asus_wmi_backlight_notify(asus, orig_code);
55244d5
 			goto exit;
55244d5
 		}
55244d5
@@ -1773,7 +1776,8 @@ static int asus_wmi_add(struct platform_device *pdev)
55244d5
 	if (err)
55244d5
 		goto fail_rfkill;
55244d5
 
55244d5
-	if (asus->driver->quirks->wmi_backlight_power)
55244d5
+	if (asus->driver->quirks->wmi_backlight_power ||
55244d5
+			asus->driver->quirks->no_backlight)
55244d5
 		acpi_video_dmi_promote_vendor();
55244d5
 	if (!acpi_video_backlight_support()) {
55244d5
 		pr_info("Disabling ACPI video driver\n");
55244d5
diff --git a/drivers/platform/x86/asus-wmi.h b/drivers/platform/x86/asus-wmi.h
55244d5
index 4da4c8bafe70..cc47efe14974 100644
55244d5
--- a/drivers/platform/x86/asus-wmi.h
55244d5
+++ b/drivers/platform/x86/asus-wmi.h
55244d5
@@ -42,6 +42,7 @@ struct quirk_entry {
55244d5
 	bool scalar_panel_brightness;
55244d5
 	bool store_backlight_power;
55244d5
 	bool wmi_backlight_power;
55244d5
+	bool no_backlight;
55244d5
 	int wapf;
55244d5
 	/*
55244d5
 	 * For machines with AMD graphic chips, it will send out WMI event
55244d5
-- 
55244d5
1.9.0
55244d5