c89e5c
From: Aaron Lu <aaron.lu@intel.com>
c89e5c
Date: Wed, 11 Mar 2015 14:14:56 +0800
c89e5c
Subject: [PATCH] acpi: video: Allow forcing native backlight on non win8
c89e5c
 machines
c89e5c
c89e5c
The native backlight behavior (so not registering both the acpi-video
c89e5c
and the vendor backlight driver) can be useful on some non win8 machines
c89e5c
too, so change the behavior of the video.use_native_backlight=1 or 0
c89e5c
kernel cmdline option to be: if user has set video.use_native_backlight=1
c89e5c
or 0, use that no matter if it is a win8 system or not. Also, we will
c89e5c
put some known systems into the DMI table to make them either use native
c89e5c
backlight interface or not, and the use_native_backlight_dmi is used to
c89e5c
reflect that.
c89e5c
c89e5c
Original-by: Hans de Goede <hdegoede@redhat.com>
c89e5c
Signed-off-by: Aaron Lu <aaron.lu@intel.com>
c89e5c
Acked-by: Hans de Goede <hdegoede@redhat.com>
c89e5c
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
c89e5c
---
c89e5c
 drivers/acpi/video.c | 19 +++++++++++++------
c89e5c
 1 file changed, 13 insertions(+), 6 deletions(-)
c89e5c
c89e5c
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
c89e5c
index 497622ce5c31..2f1f16df460c 100644
c89e5c
--- a/drivers/acpi/video.c
c89e5c
+++ b/drivers/acpi/video.c
c89e5c
@@ -82,9 +82,15 @@ module_param(allow_duplicates, bool, 0644);
c89e5c
  * For Windows 8 systems: used to decide if video module
c89e5c
  * should skip registering backlight interface of its own.
c89e5c
  */
c89e5c
-static int use_native_backlight_param = -1;
c89e5c
+enum {
c89e5c
+	NATIVE_BACKLIGHT_NOT_SET = -1,
c89e5c
+	NATIVE_BACKLIGHT_OFF,
c89e5c
+	NATIVE_BACKLIGHT_ON,
c89e5c
+};
c89e5c
+
c89e5c
+static int use_native_backlight_param = NATIVE_BACKLIGHT_NOT_SET;
c89e5c
 module_param_named(use_native_backlight, use_native_backlight_param, int, 0444);
c89e5c
-static bool use_native_backlight_dmi = true;
c89e5c
+static int use_native_backlight_dmi = NATIVE_BACKLIGHT_NOT_SET;
c89e5c
 
c89e5c
 static int register_count;
c89e5c
 static struct mutex video_list_lock;
c89e5c
@@ -237,15 +243,16 @@ static void acpi_video_switch_brightness(struct work_struct *work);
c89e5c
 
c89e5c
 static bool acpi_video_use_native_backlight(void)
c89e5c
 {
c89e5c
-	if (use_native_backlight_param != -1)
c89e5c
+	if (use_native_backlight_param != NATIVE_BACKLIGHT_NOT_SET)
c89e5c
 		return use_native_backlight_param;
c89e5c
-	else
c89e5c
+	else if (use_native_backlight_dmi != NATIVE_BACKLIGHT_NOT_SET)
c89e5c
 		return use_native_backlight_dmi;
c89e5c
+	return acpi_osi_is_win8();
c89e5c
 }
c89e5c
 
c89e5c
 bool acpi_video_verify_backlight_support(void)
c89e5c
 {
c89e5c
-	if (acpi_osi_is_win8() && acpi_video_use_native_backlight() &&
c89e5c
+	if (acpi_video_use_native_backlight() &&
c89e5c
 	    backlight_device_registered(BACKLIGHT_RAW))
c89e5c
 		return false;
c89e5c
 	return acpi_video_backlight_support();
c89e5c
@@ -414,7 +421,7 @@ static int __init video_set_bqc_offset(const struct dmi_system_id *d)
c89e5c
 
c89e5c
 static int __init video_disable_native_backlight(const struct dmi_system_id *d)
c89e5c
 {
c89e5c
-	use_native_backlight_dmi = false;
c89e5c
+	use_native_backlight_dmi = NATIVE_BACKLIGHT_OFF;
c89e5c
 	return 0;
c89e5c
 }
c89e5c
 
c89e5c
-- 
c89e5c
2.1.0
c89e5c