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