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