Skip to contentSkip to conversation

acpi: video: Allow forcing native backlight on non win8 laptops

RFC PATCH In review Hans de Goede 3 participants 16 messages Mar 3, 2015 – Mar 12, 2015 ACPI

lore
Share & tools
lore
#0 lore raw

cover acpi: video: Allow forcing native backlight on non win8 laptops

Hi All,

I've long wanted to have a way for users to force native-backlight behavior as that makes debugging backlight problems a bit easier.

And now a laptop has shown up which needs native backlight behavior for things to work, has a non win8 ready bios, and I cannot use a quirk in the vendor backlight driver as it implements both the acer-wmi and ideapad-laptop vendor interfaces and putting the same quirk in 2 places is just wrong.

So I've finally written a small patch to allow forcing native-backlight behavior as well as a second patch using this to add a quirk for said laptop.

For now this is just a RFC series as I'm waiting for confirmation from the user that this actually fixes things, but I wanted to get the discussion going beforehand in case anyone has any objections against the solution I've come up with.

Regards,

Hans

#1 lore raw

RFC PATCH 1/2 acpi: video: Allow forcing native backlight on non win8 machines

The native backlight behavior (so not registering both the acpi-video and the vendor backlight driver) can be useful on some non win8 machines too, allow the user to force this behavior by passing video.use_native_backlight=2 on the kernel commandline.

---
 drivers/acpi/video.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/acpi/video.c +5 -4
index debd309..9817b52 100644
@@ -84,7 +84,7 @@ module_param(allow_duplicates, bool, 0644);
  */
 static int use_native_backlight_param = -1;
 module_param_named(use_native_backlight, use_native_backlight_param, int, 0444);
-static bool use_native_backlight_dmi = true;
+static int use_native_backlight_dmi = 1;
 
 static int register_count;
 static struct mutex video_list_lock;
@@ -235,7 +235,7 @@ static int acpi_video_get_next_level(struct acpi_video_device *device,
 				     u32 level_current, u32 event);
 static void acpi_video_switch_brightness(struct work_struct *work);
 
-static bool acpi_video_use_native_backlight(void)
+static int acpi_video_use_native_backlight(void)
 {
 	if (use_native_backlight_param != -1)
 		return use_native_backlight_param;
@@ -245,7 +245,8 @@ static bool acpi_video_use_native_backlight(void)
 
 bool acpi_video_verify_backlight_support(void)
 {
-	if (acpi_osi_is_win8() && acpi_video_use_native_backlight() &&
+	if (((acpi_video_use_native_backlight() == 2) ||
+	     (acpi_video_use_native_backlight() == 1 && acpi_osi_is_win8())) &&
 	    backlight_device_registered(BACKLIGHT_RAW))
 		return false;
 	return acpi_video_backlight_support();
@@ -414,7 +415,7 @@ static int __init video_set_bqc_offset(const struct dmi_system_id *d)
 
 static int __init video_disable_native_backlight(const struct dmi_system_id *d)
 {
-	use_native_backlight_dmi = false;
+	use_native_backlight_dmi = 0;
 	return 0;
 }
 
Signature · 1 line
2.3.1
#2 lore raw

Re: [RFC PATCH 1/2] acpi: video: Allow forcing native backlight on non win8 machines

Quoted 4 lines · Hans de Goede

The native backlight behavior (so not registering both the acpi-video and the vendor backlight driver) can be useful on some non win8 machines too, allow the user to force this behavior by passing video.use_native_backlight=2 on the kernel commandline.

Just bikeshedding, what about doing it this way?

In the acpi_video_use_native_backlight function:
1 If user has set a cmdline option, use that(no matter if it is a win8
system or not);
2 If the system is in a DMI table, use that(no matter if it is a win8
system or not);
3 return true if this is a win8 system; false otherwise.

Something like this:

drivers/acpi/video.c +5 -4
index debd30917010..4cd0c8a4fd9d 100644
@@ -84,7 +84,7 @@ module_param(allow_duplicates, bool, 0644);
  */
 static int use_native_backlight_param = -1;
 module_param_named(use_native_backlight, use_native_backlight_param, int, 0444);
-static bool use_native_backlight_dmi = true;
+static int use_native_backlight_dmi = -1;
 
 static int register_count;
 static struct mutex video_list_lock;
@@ -239,13 +239,14 @@ static bool acpi_video_use_native_backlight(void)
 {
 	if (use_native_backlight_param != -1)
 		return use_native_backlight_param;
-	else
+	else if (use_native_backlight_dmi != -1)
 		return use_native_backlight_dmi;
+	return acpi_osi_is_win8();
 }
 
 bool acpi_video_verify_backlight_support(void)
 {
-	if (acpi_osi_is_win8() && acpi_video_use_native_backlight() &&
+	if (acpi_video_use_native_backlight() &&
 	    backlight_device_registered(BACKLIGHT_RAW))
 		return false;
 	return acpi_video_backlight_support();
@@ -414,7 +415,7 @@ static int __init video_set_bqc_offset(const struct dmi_system_id *d)
 
 static int __init video_disable_native_backlight(const struct dmi_system_id *d)
 {
-	use_native_backlight_dmi = false;
+	use_native_backlight_dmi = 0;
 	return 0;
 }
 

Regards,
Aaron

Quoted 48 lines
---
 drivers/acpi/video.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/acpi/video.c +5 -4
index debd309..9817b52 100644
@@ -84,7 +84,7 @@ module_param(allow_duplicates, bool, 0644);
  */
 static int use_native_backlight_param = -1;
 module_param_named(use_native_backlight, use_native_backlight_param, int, 0444);
-static bool use_native_backlight_dmi = true;
+static int use_native_backlight_dmi = 1;
 
 static int register_count;
 static struct mutex video_list_lock;
@@ -235,7 +235,7 @@ static int acpi_video_get_next_level(struct acpi_video_device *device,
 				     u32 level_current, u32 event);
 static void acpi_video_switch_brightness(struct work_struct *work);
 
-static bool acpi_video_use_native_backlight(void)
+static int acpi_video_use_native_backlight(void)
 {
 	if (use_native_backlight_param != -1)
 		return use_native_backlight_param;
@@ -245,7 +245,8 @@ static bool acpi_video_use_native_backlight(void)
 
 bool acpi_video_verify_backlight_support(void)
 {
-	if (acpi_osi_is_win8() && acpi_video_use_native_backlight() &&
+	if (((acpi_video_use_native_backlight() == 2) ||
+	     (acpi_video_use_native_backlight() == 1 && acpi_osi_is_win8())) &&
 	    backlight_device_registered(BACKLIGHT_RAW))
 		return false;
 	return acpi_video_backlight_support();
@@ -414,7 +415,7 @@ static int __init video_set_bqc_offset(const struct dmi_system_id *d)
 
 static int __init video_disable_native_backlight(const struct dmi_system_id *d)
 {
-	use_native_backlight_dmi = false;
+	use_native_backlight_dmi = 0;
 	return 0;
 }
 
author Acked-by
#3 lore raw

Re: [RFC PATCH 1/2] acpi: video: Allow forcing native backlight on non win8 machines

Hi,

Quoted 8 lines · Aaron Lu
Quoted 4 lines · Hans de Goede

The native backlight behavior (so not registering both the acpi-video and the vendor backlight driver) can be useful on some non win8 machines too, allow the user to force this behavior by passing video.use_native_backlight=2 on the kernel commandline.

Just bikeshedding, what about doing it this way?

Quoted 8 lines

In the acpi_video_use_native_backlight function:
1 If user has set a cmdline option, use that(no matter if it is a win8
system or not);
2 If the system is in a DMI table, use that(no matter if it is a win8
system or not);
3 return true if this is a win8 system; false otherwise.

Something like this:

That works for me, and has the added advantage of not changing the cmdline syntax (but it does change the cmdline behavior ...).

So going either way is fine with me.

Aaron's version is:

Regards,

Hans

Quoted 93 lines
drivers/acpi/video.c +5 -4
index debd30917010..4cd0c8a4fd9d 100644
@@ -84,7 +84,7 @@ module_param(allow_duplicates, bool, 0644);
   */
  static int use_native_backlight_param = -1;
  module_param_named(use_native_backlight, use_native_backlight_param, int, 0444);
-static bool use_native_backlight_dmi = true;
+static int use_native_backlight_dmi = -1;
 
  static int register_count;
  static struct mutex video_list_lock;
@@ -239,13 +239,14 @@ static bool acpi_video_use_native_backlight(void)
  {
  	if (use_native_backlight_param != -1)
  		return use_native_backlight_param;
-	else
+	else if (use_native_backlight_dmi != -1)
  		return use_native_backlight_dmi;
+	return acpi_osi_is_win8();
  }
 
  bool acpi_video_verify_backlight_support(void)
  {
-	if (acpi_osi_is_win8() && acpi_video_use_native_backlight() &&
+	if (acpi_video_use_native_backlight() &&
  	    backlight_device_registered(BACKLIGHT_RAW))
  		return false;
  	return acpi_video_backlight_support();
@@ -414,7 +415,7 @@ static int __init video_set_bqc_offset(const struct dmi_system_id *d)
 
  static int __init video_disable_native_backlight(const struct dmi_system_id *d)
  {
-	use_native_backlight_dmi = false;
+	use_native_backlight_dmi = 0;
  	return 0;
  }
 

Regards,
Aaron

Quoted 48 lines
---
  drivers/acpi/video.c | 9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)
drivers/acpi/video.c +5 -4
index debd309..9817b52 100644
@@ -84,7 +84,7 @@ module_param(allow_duplicates, bool, 0644);
   */
  static int use_native_backlight_param = -1;
  module_param_named(use_native_backlight, use_native_backlight_param, int, 0444);
-static bool use_native_backlight_dmi = true;
+static int use_native_backlight_dmi = 1;
 
  static int register_count;
  static struct mutex video_list_lock;
@@ -235,7 +235,7 @@ static int acpi_video_get_next_level(struct acpi_video_device *device,
  				     u32 level_current, u32 event);
  static void acpi_video_switch_brightness(struct work_struct *work);
 
-static bool acpi_video_use_native_backlight(void)
+static int acpi_video_use_native_backlight(void)
  {
  	if (use_native_backlight_param != -1)
  		return use_native_backlight_param;
@@ -245,7 +245,8 @@ static bool acpi_video_use_native_backlight(void)
 
  bool acpi_video_verify_backlight_support(void)
  {
-	if (acpi_osi_is_win8() && acpi_video_use_native_backlight() &&
+	if (((acpi_video_use_native_backlight() == 2) ||
+	     (acpi_video_use_native_backlight() == 1 && acpi_osi_is_win8())) &&
  	    backlight_device_registered(BACKLIGHT_RAW))
  		return false;
  	return acpi_video_backlight_support();
@@ -414,7 +415,7 @@ static int __init video_set_bqc_offset(const struct dmi_system_id *d)
 
  static int __init video_disable_native_backlight(const struct dmi_system_id *d)
  {
-	use_native_backlight_dmi = false;
+	use_native_backlight_dmi = 0;
  	return 0;
  }
 
Acked-by Hans de Goede
#4 lore raw

Re: [RFC PATCH 1/2] acpi: video: Allow forcing native backlight on non win8 machines

Quoted 18 lines · Hans de Goede

Hi,

Quoted 15 lines · Aaron Lu
Quoted 4 lines · Hans de Goede

The native backlight behavior (so not registering both the acpi-video and the vendor backlight driver) can be useful on some non win8 machines too, allow the user to force this behavior by passing video.use_native_backlight=2 on the kernel commandline.

Just bikeshedding, what about doing it this way?

In the acpi_video_use_native_backlight function:
1 If user has set a cmdline option, use that(no matter if it is a win8
system or not);
2 If the system is in a DMI table, use that(no matter if it is a win8
system or not);
3 return true if this is a win8 system; false otherwise.

Quoted 4 lines
Quoted 1 line

Something like this:

That works for me, and has the added advantage of not changing the cmdline syntax (but it does change the cmdline behavior ...).

Oh yes, I didn't consider this. Not sure how much impact this will have, but I don't see an immediate problem with it, so let's see.

Quoted 6 lines

So going either way is fine with me.

Aaron's version is:

Thanks. Here is the full patch:

From: Aaron Lu <[email protected]>
Date: Wed, 4 Mar 2015 10:24:58 +0800
Subject: [PATCH] acpi: video: Allow forcing native backlight on non win8
machines

The native backlight behavior (so not registering both the acpi-video and the vendor backlight driver) can be useful on some non win8 machines too, so change the behavior of the video.use_native_backlight=1 or 0 kernel cmdline option to be: if user has set video.use_native_backlight=1 or 0, use that no matter if it is a win8 system or not. Also, we will put some known systems into the DMI table to make them either use native backlight interface or not, so the use_native_backlight_dmi is used to reflect that.

Signed-offby: Aaron Lu <[email protected]>

---
 drivers/acpi/video.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/acpi/video.c +5 -4
index debd30917010..4cd0c8a4fd9d 100644
@@ -84,7 +84,7 @@ module_param(allow_duplicates, bool, 0644);
  */
 static int use_native_backlight_param = -1;
 module_param_named(use_native_backlight, use_native_backlight_param, int, 0444);
-static bool use_native_backlight_dmi = true;
+static int use_native_backlight_dmi = -1;
 
 static int register_count;
 static struct mutex video_list_lock;
@@ -239,13 +239,14 @@ static bool acpi_video_use_native_backlight(void)
 {
 	if (use_native_backlight_param != -1)
 		return use_native_backlight_param;
-	else
+	else if (use_native_backlight_dmi != -1)
 		return use_native_backlight_dmi;
+	return acpi_osi_is_win8();
 }
 
 bool acpi_video_verify_backlight_support(void)
 {
-	if (acpi_osi_is_win8() && acpi_video_use_native_backlight() &&
+	if (acpi_video_use_native_backlight() &&
 	    backlight_device_registered(BACKLIGHT_RAW))
 		return false;
 	return acpi_video_backlight_support();
@@ -414,7 +415,7 @@ static int __init video_set_bqc_offset(const struct dmi_system_id *d)
 
 static int __init video_disable_native_backlight(const struct dmi_system_id *d)
 {
-	use_native_backlight_dmi = false;
+	use_native_backlight_dmi = 0;
 	return 0;
 }
 
Signature · 1 line
2.1.0
#5 lore raw

Re: [RFC PATCH 1/2] acpi: video: Allow forcing native backlight on non win8 machines

Quoted 62 lines · Aaron Lu
Quoted 18 lines · Hans de Goede

Hi,

Quoted 15 lines · Aaron Lu
Quoted 4 lines · Hans de Goede

The native backlight behavior (so not registering both the acpi-video and the vendor backlight driver) can be useful on some non win8 machines too, allow the user to force this behavior by passing video.use_native_backlight=2 on the kernel commandline.

Just bikeshedding, what about doing it this way?

In the acpi_video_use_native_backlight function:
1 If user has set a cmdline option, use that(no matter if it is a win8
system or not);
2 If the system is in a DMI table, use that(no matter if it is a win8
system or not);
3 return true if this is a win8 system; false otherwise.

Quoted 4 lines
Quoted 1 line

Something like this:

That works for me, and has the added advantage of not changing the cmdline syntax (but it does change the cmdline behavior ...).

Oh yes, I didn't consider this. Not sure how much impact this will have, but I don't see an immediate problem with it, so let's see.

Quoted 6 lines

So going either way is fine with me.

Aaron's version is:

Thanks. Here is the full patch:

From: Aaron Lu <[email protected]>
Date: Wed, 4 Mar 2015 10:24:58 +0800
Subject: [PATCH] acpi: video: Allow forcing native backlight on non win8
machines

The native backlight behavior (so not registering both the acpi-video and the vendor backlight driver) can be useful on some non win8 machines too, so change the behavior of the video.use_native_backlight=1 or 0 kernel cmdline option to be: if user has set video.use_native_backlight=1 or 0, use that no matter if it is a win8 system or not. Also, we will put some known systems into the DMI table to make them either use native backlight interface or not, so the use_native_backlight_dmi is used to reflect that.

Signed-offby: Aaron Lu <[email protected]>

---
 drivers/acpi/video.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/acpi/video.c +0 -0
index debd30917010..4cd0c8a4fd9d 100644

drivers/acpi/video.c module_param(allow_duplicates, bool, 0644); · line 87

Quoted 5 lines
drivers/acpi/video.c +1 -1
@@ -84,7 +84,7 @@ module_param(allow_duplicates, bool, 0644);
  */
 static int use_native_backlight_param = -1;
 module_param_named(use_native_backlight, use_native_backlight_param, int, 0444);
-static bool use_native_backlight_dmi = true;
+static int use_native_backlight_dmi = -1;

So can we have proper symbols instead of these numbers, please?

Quoted 30 lines
drivers/acpi/video.c +4 -3
 static int register_count;
 static struct mutex video_list_lock;
@@ -239,13 +239,14 @@ static bool acpi_video_use_native_backlight(void)
 {
 	if (use_native_backlight_param != -1)
 		return use_native_backlight_param;
-	else
+	else if (use_native_backlight_dmi != -1)
 		return use_native_backlight_dmi;
+	return acpi_osi_is_win8();
 }
 
 bool acpi_video_verify_backlight_support(void)
 {
-	if (acpi_osi_is_win8() && acpi_video_use_native_backlight() &&
+	if (acpi_video_use_native_backlight() &&
 	    backlight_device_registered(BACKLIGHT_RAW))
 		return false;
 	return acpi_video_backlight_support();
@@ -414,7 +415,7 @@ static int __init video_set_bqc_offset(const struct dmi_system_id *d)
 
 static int __init video_disable_native_backlight(const struct dmi_system_id *d)
 {
-	use_native_backlight_dmi = false;
+	use_native_backlight_dmi = 0;
 	return 0;
 }
 
Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
#6 lore raw

Re: [RFC PATCH 1/2] acpi: video: Allow forcing native backlight on non win8 machines

Hi,

Quoted 58 lines · Rafael J. Wysocki
Quoted 57 lines · Aaron Lu
Quoted 18 lines · Hans de Goede

Hi,

Quoted 15 lines · Aaron Lu
Quoted 4 lines · Hans de Goede

The native backlight behavior (so not registering both the acpi-video and the vendor backlight driver) can be useful on some non win8 machines too, allow the user to force this behavior by passing video.use_native_backlight=2 on the kernel commandline.

Just bikeshedding, what about doing it this way?

In the acpi_video_use_native_backlight function:
1 If user has set a cmdline option, use that(no matter if it is a win8

    system or not);
2 If the system is in a DMI table, use that(no matter if it is a win8
    system or not);

3 return true if this is a win8 system; false otherwise.

Quoted 4 lines
Quoted 1 line

Something like this:

That works for me, and has the added advantage of not changing the cmdline syntax (but it does change the cmdline behavior ...).

Oh yes, I didn't consider this. Not sure how much impact this will have, but I don't see an immediate problem with it, so let's see.

Quoted 6 lines

So going either way is fine with me.

Aaron's version is:

Thanks. Here is the full patch:

From: Aaron Lu <[email protected]>
Date: Wed, 4 Mar 2015 10:24:58 +0800
Subject: [PATCH] acpi: video: Allow forcing native backlight on non win8
machines

The native backlight behavior (so not registering both the acpi-video and the vendor backlight driver) can be useful on some non win8 machines too, so change the behavior of the video.use_native_backlight=1 or 0 kernel cmdline option to be: if user has set video.use_native_backlight=1 or 0, use that no matter if it is a win8 system or not. Also, we will put some known systems into the DMI table to make them either use native backlight interface or not, so the use_native_backlight_dmi is used to reflect that.

Signed-offby: Aaron Lu <[email protected]>

---
  drivers/acpi/video.c | 9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)
Quoted 12 lines

drivers/acpi/video.c module_param(allow_duplicates, bool, 0644); · line 87

Quoted 10 lines
drivers/acpi/video.c +1 -1
index debd30917010..4cd0c8a4fd9d 100644
@@ -84,7 +84,7 @@ module_param(allow_duplicates, bool, 0644);
   */
  static int use_native_backlight_param = -1;
  module_param_named(use_native_backlight, use_native_backlight_param, int, 0444);
-static bool use_native_backlight_dmi = true;
+static int use_native_backlight_dmi = -1;

So can we have proper symbols instead of these numbers, please?

So you want to have a native_backlight enum or some such ? with -1 being not_set ?

Regards,

Hans

Quoted 32 lines
Quoted 31 lines
drivers/acpi/video.c +4 -3
  static int register_count;
  static struct mutex video_list_lock;
@@ -239,13 +239,14 @@ static bool acpi_video_use_native_backlight(void)
  {
  	if (use_native_backlight_param != -1)
  		return use_native_backlight_param;
-	else
+	else if (use_native_backlight_dmi != -1)
  		return use_native_backlight_dmi;
+	return acpi_osi_is_win8();
  }
 
  bool acpi_video_verify_backlight_support(void)
  {
-	if (acpi_osi_is_win8() && acpi_video_use_native_backlight() &&
+	if (acpi_video_use_native_backlight() &&
  	    backlight_device_registered(BACKLIGHT_RAW))
  		return false;
  	return acpi_video_backlight_support();
@@ -414,7 +415,7 @@ static int __init video_set_bqc_offset(const struct dmi_system_id *d)
 
  static int __init video_disable_native_backlight(const struct dmi_system_id *d)
  {
-	use_native_backlight_dmi = false;
+	use_native_backlight_dmi = 0;
  	return 0;
  }
 
#7 lore raw

Re: [RFC PATCH 1/2] acpi: video: Allow forcing native backlight on non win8 machines

Quoted 74 lines · Hans de Goede

Hi,

Quoted 58 lines · Rafael J. Wysocki
Quoted 57 lines · Aaron Lu
Quoted 18 lines · Hans de Goede

Hi,

Quoted 15 lines · Aaron Lu
Quoted 4 lines · Hans de Goede

The native backlight behavior (so not registering both the acpi-video and the vendor backlight driver) can be useful on some non win8 machines too, allow the user to force this behavior by passing video.use_native_backlight=2 on the kernel commandline.

Just bikeshedding, what about doing it this way?

In the acpi_video_use_native_backlight function:
1 If user has set a cmdline option, use that(no matter if it is a win8

    system or not);
2 If the system is in a DMI table, use that(no matter if it is a win8
    system or not);

3 return true if this is a win8 system; false otherwise.

Quoted 4 lines
Quoted 1 line

Something like this:

That works for me, and has the added advantage of not changing the cmdline syntax (but it does change the cmdline behavior ...).

Oh yes, I didn't consider this. Not sure how much impact this will have, but I don't see an immediate problem with it, so let's see.

Quoted 6 lines

So going either way is fine with me.

Aaron's version is:

Thanks. Here is the full patch:

From: Aaron Lu <[email protected]>
Date: Wed, 4 Mar 2015 10:24:58 +0800
Subject: [PATCH] acpi: video: Allow forcing native backlight on non win8
machines

The native backlight behavior (so not registering both the acpi-video and the vendor backlight driver) can be useful on some non win8 machines too, so change the behavior of the video.use_native_backlight=1 or 0 kernel cmdline option to be: if user has set video.use_native_backlight=1 or 0, use that no matter if it is a win8 system or not. Also, we will put some known systems into the DMI table to make them either use native backlight interface or not, so the use_native_backlight_dmi is used to reflect that.

Signed-offby: Aaron Lu <[email protected]>

---
  drivers/acpi/video.c | 9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)
Quoted 12 lines

drivers/acpi/video.c module_param(allow_duplicates, bool, 0644); · line 87

Quoted 10 lines
drivers/acpi/video.c +1 -1
index debd30917010..4cd0c8a4fd9d 100644
@@ -84,7 +84,7 @@ module_param(allow_duplicates, bool, 0644);
   */
  static int use_native_backlight_param = -1;
  module_param_named(use_native_backlight, use_native_backlight_param, int, 0444);
-static bool use_native_backlight_dmi = true;
+static int use_native_backlight_dmi = -1;

So can we have proper symbols instead of these numbers, please?

Quoted 1 line

So you want to have a native_backlight enum or some such ? with -1 being not_set ?

Yes, something like that.

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
#8 lore raw

PATCH 1/1 acpi: video: Allow forcing native backlight on non win8, machines

Quoted 4 lines · Rafael J. Wysocki
Quoted 1 line · Hans de Goede

So you want to have a native_backlight enum or some such ? with -1 being not_set ?

Yes, something like that.

OK, here is an updated one:

Quoted 1 line

From db4eb1928219e47fcfbffb913f08b1e1b432c28a Mon Sep 17 00:00:00 2001

From: Aaron Lu <[email protected]>
Date: Wed, 4 Mar 2015 10:24:58 +0800
Subject: [PATCH] acpi: video: Allow forcing native backlight on non win8
machines

The native backlight behavior (so not registering both the acpi-video and the vendor backlight driver) can be useful on some non win8 machines too, so change the behavior of the video.use_native_backlight=1 or 0 kernel cmdline option to be: if user has set video.use_native_backlight=1 or 0, use that no matter if it is a win8 system or not. Also, we will put some known systems into the DMI table to make them either use native backlight interface or not, and the use_native_backlight_dmi is used to reflect that.

---
 drivers/acpi/video.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/acpi/video.c +13 -6
index 26eb70c8f518..2f45dca31724 100644
@@ -82,9 +82,15 @@ module_param(allow_duplicates, bool, 0644);
  * For Windows 8 systems: used to decide if video module
  * should skip registering backlight interface of its own.
  */
-static int use_native_backlight_param = -1;
+enum {
+	NATIVE_BACKLIGHT_NOT_SET = -1,
+	NATIVE_BACKLIGHT_OFF,
+	NATIVE_BACKLIGHT_ON,
+};
+
+static int use_native_backlight_param = NATIVE_BACKLIGHT_NOT_SET;
 module_param_named(use_native_backlight, use_native_backlight_param, int, 0444);
-static bool use_native_backlight_dmi = true;
+static int use_native_backlight_dmi = NATIVE_BACKLIGHT_NOT_SET;
 
 static int register_count;
 static struct mutex video_list_lock;
@@ -237,15 +243,16 @@ static void acpi_video_switch_brightness(struct work_struct *work);
 
 static bool acpi_video_use_native_backlight(void)
 {
-	if (use_native_backlight_param != -1)
+	if (use_native_backlight_param != NATIVE_BACKLIGHT_NOT_SET)
 		return use_native_backlight_param;
-	else
+	else if (use_native_backlight_dmi != NATIVE_BACKLIGHT_NOT_SET)
 		return use_native_backlight_dmi;
+	return acpi_osi_is_win8();
 }
 
 bool acpi_video_verify_backlight_support(void)
 {
-	if (acpi_osi_is_win8() && acpi_video_use_native_backlight() &&
+	if (acpi_video_use_native_backlight() &&
 	    backlight_device_registered(BACKLIGHT_RAW))
 		return false;
 	return acpi_video_backlight_support();
@@ -414,7 +421,7 @@ static int __init video_set_bqc_offset(const struct dmi_system_id *d)
 
 static int __init video_disable_native_backlight(const struct dmi_system_id *d)
 {
-	use_native_backlight_dmi = false;
+	use_native_backlight_dmi = NATIVE_BACKLIGHT_OFF;
 	return 0;
 }
 
Signature · 1 line
2.1.0
#9 lore raw

Re: [PATCH update] acpi: video: Allow forcing native backlight on non win8, machines

Hi,

Quoted 7 lines · Aaron Lu
Quoted 4 lines · Rafael J. Wysocki
Quoted 1 line · Hans de Goede

So you want to have a native_backlight enum or some such ? with -1 being not_set ?

Yes, something like that.

OK, here is an updated one:

Looks good to me, my ack still stands. I need to send a bunch of mails back / forth to tackle the issue the ideapad which caused me to work on this in the first case. So lets merge this one first, and then I'll get back with a patch on top of this when I know how to actually best deal with the problem on that machine.

Regards,

Hans

Quoted 75 lines

From db4eb1928219e47fcfbffb913f08b1e1b432c28a Mon Sep 17 00:00:00 2001
From: Aaron Lu <[email protected]>
Date: Wed, 4 Mar 2015 10:24:58 +0800
Subject: [PATCH] acpi: video: Allow forcing native backlight on non win8
machines

The native backlight behavior (so not registering both the acpi-video and the vendor backlight driver) can be useful on some non win8 machines too, so change the behavior of the video.use_native_backlight=1 or 0 kernel cmdline option to be: if user has set video.use_native_backlight=1 or 0, use that no matter if it is a win8 system or not. Also, we will put some known systems into the DMI table to make them either use native backlight interface or not, and the use_native_backlight_dmi is used to reflect that.

---
  drivers/acpi/video.c | 19 +++++++++++++------
  1 file changed, 13 insertions(+), 6 deletions(-)
drivers/acpi/video.c +13 -6
index 26eb70c8f518..2f45dca31724 100644
@@ -82,9 +82,15 @@ module_param(allow_duplicates, bool, 0644);
   * For Windows 8 systems: used to decide if video module
   * should skip registering backlight interface of its own.
   */
-static int use_native_backlight_param = -1;
+enum {
+	NATIVE_BACKLIGHT_NOT_SET = -1,
+	NATIVE_BACKLIGHT_OFF,
+	NATIVE_BACKLIGHT_ON,
+};
+
+static int use_native_backlight_param = NATIVE_BACKLIGHT_NOT_SET;
  module_param_named(use_native_backlight, use_native_backlight_param, int, 0444);
-static bool use_native_backlight_dmi = true;
+static int use_native_backlight_dmi = NATIVE_BACKLIGHT_NOT_SET;
 
  static int register_count;
  static struct mutex video_list_lock;
@@ -237,15 +243,16 @@ static void acpi_video_switch_brightness(struct work_struct *work);
 
  static bool acpi_video_use_native_backlight(void)
  {
-	if (use_native_backlight_param != -1)
+	if (use_native_backlight_param != NATIVE_BACKLIGHT_NOT_SET)
  		return use_native_backlight_param;
-	else
+	else if (use_native_backlight_dmi != NATIVE_BACKLIGHT_NOT_SET)
  		return use_native_backlight_dmi;
+	return acpi_osi_is_win8();
  }
 
  bool acpi_video_verify_backlight_support(void)
  {
-	if (acpi_osi_is_win8() && acpi_video_use_native_backlight() &&
+	if (acpi_video_use_native_backlight() &&
  	    backlight_device_registered(BACKLIGHT_RAW))
  		return false;
  	return acpi_video_backlight_support();
@@ -414,7 +421,7 @@ static int __init video_set_bqc_offset(const struct dmi_system_id *d)
 
  static int __init video_disable_native_backlight(const struct dmi_system_id *d)
  {
-	use_native_backlight_dmi = false;
+	use_native_backlight_dmi = NATIVE_BACKLIGHT_OFF;
  	return 0;
  }
 
#10 lore raw

Re: [PATCH update] acpi: video: Allow forcing native backlight on non win8, machines

Quoted 9 lines · Hans de Goede

Hi,

Quoted 6 lines · Aaron Lu
Quoted 4 lines · Rafael J. Wysocki
Quoted 1 line · Hans de Goede

So you want to have a native_backlight enum or some such ? with -1 being not_set ?

Yes, something like that.

Quoted 7 lines
Quoted 1 line

OK, here is an updated one:

Looks good to me, my ack still stands. I need to send a bunch of mails back / forth to tackle the issue the ideapad which caused me to work on this in the first case. So lets merge this one first, and then I'll get back with a patch on top of this when I know how to actually best deal with the problem on that machine.

Thanks for the ack and taking care of the problem.

Regards,
Aaron

Quoted 81 lines

Regards,

Hans

Quoted 75 lines

From db4eb1928219e47fcfbffb913f08b1e1b432c28a Mon Sep 17 00:00:00 2001
From: Aaron Lu <[email protected]>
Date: Wed, 4 Mar 2015 10:24:58 +0800
Subject: [PATCH] acpi: video: Allow forcing native backlight on non win8
machines

The native backlight behavior (so not registering both the acpi-video and the vendor backlight driver) can be useful on some non win8 machines too, so change the behavior of the video.use_native_backlight=1 or 0 kernel cmdline option to be: if user has set video.use_native_backlight=1 or 0, use that no matter if it is a win8 system or not. Also, we will put some known systems into the DMI table to make them either use native backlight interface or not, and the use_native_backlight_dmi is used to reflect that.

---
 drivers/acpi/video.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/acpi/video.c +13 -6
index 26eb70c8f518..2f45dca31724 100644
@@ -82,9 +82,15 @@ module_param(allow_duplicates, bool, 0644);
  * For Windows 8 systems: used to decide if video module
  * should skip registering backlight interface of its own.
  */
-static int use_native_backlight_param = -1;
+enum {
+	NATIVE_BACKLIGHT_NOT_SET = -1,
+	NATIVE_BACKLIGHT_OFF,
+	NATIVE_BACKLIGHT_ON,
+};
+
+static int use_native_backlight_param = NATIVE_BACKLIGHT_NOT_SET;
 module_param_named(use_native_backlight, use_native_backlight_param, int, 0444);
-static bool use_native_backlight_dmi = true;
+static int use_native_backlight_dmi = NATIVE_BACKLIGHT_NOT_SET;
 
 static int register_count;
 static struct mutex video_list_lock;
@@ -237,15 +243,16 @@ static void acpi_video_switch_brightness(struct work_struct *work);
 
 static bool acpi_video_use_native_backlight(void)
 {
-	if (use_native_backlight_param != -1)
+	if (use_native_backlight_param != NATIVE_BACKLIGHT_NOT_SET)
 		return use_native_backlight_param;
-	else
+	else if (use_native_backlight_dmi != NATIVE_BACKLIGHT_NOT_SET)
 		return use_native_backlight_dmi;
+	return acpi_osi_is_win8();
 }
 
 bool acpi_video_verify_backlight_support(void)
 {
-	if (acpi_osi_is_win8() && acpi_video_use_native_backlight() &&
+	if (acpi_video_use_native_backlight() &&
 	    backlight_device_registered(BACKLIGHT_RAW))
 		return false;
 	return acpi_video_backlight_support();
@@ -414,7 +421,7 @@ static int __init video_set_bqc_offset(const struct dmi_system_id *d)
 
 static int __init video_disable_native_backlight(const struct dmi_system_id *d)
 {
-	use_native_backlight_dmi = false;
+	use_native_backlight_dmi = NATIVE_BACKLIGHT_OFF;
 	return 0;
 }
 
#11 lore raw

Re: [PATCH update] acpi: video: Allow forcing native backlight on non win8, machines

Quoted 18 lines · Aaron Lu
Quoted 9 lines · Hans de Goede

Hi,

Quoted 6 lines · Aaron Lu
Quoted 4 lines · Rafael J. Wysocki
Quoted 1 line · Hans de Goede

So you want to have a native_backlight enum or some such ? with -1 being not_set ?

Yes, something like that.

Quoted 7 lines
Quoted 1 line

OK, here is an updated one:

Looks good to me, my ack still stands. I need to send a bunch of mails back / forth to tackle the issue the ideapad which caused me to work on this in the first case. So lets merge this one first, and then I'll get back with a patch on top of this when I know how to actually best deal with the problem on that machine.

Quoted 30 lines

Thanks for the ack and taking care of the problem.

Regards,
Aaron

Quoted 25 lines

Regards,

Hans

Quoted 19 lines

From db4eb1928219e47fcfbffb913f08b1e1b432c28a Mon Sep 17 00:00:00 2001
From: Aaron Lu <[email protected]>
Date: Wed, 4 Mar 2015 10:24:58 +0800
Subject: [PATCH] acpi: video: Allow forcing native backlight on non win8
machines

The native backlight behavior (so not registering both the acpi-video and the vendor backlight driver) can be useful on some non win8 machines too, so change the behavior of the video.use_native_backlight=1 or 0 kernel cmdline option to be: if user has set video.use_native_backlight=1 or 0, use that no matter if it is a win8 system or not. Also, we will put some known systems into the DMI table to make them either use native backlight interface or not, and the use_native_backlight_dmi is used to reflect that.

Queued up for 4.1, thanks!

Quoted 60 lines
Quoted 48 lines
Quoted 48 lines
---
 drivers/acpi/video.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/acpi/video.c +12 -5
index 26eb70c8f518..2f45dca31724 100644
@@ -82,9 +82,15 @@ module_param(allow_duplicates, bool, 0644);
  * For Windows 8 systems: used to decide if video module
  * should skip registering backlight interface of its own.
  */
-static int use_native_backlight_param = -1;
+enum {
+	NATIVE_BACKLIGHT_NOT_SET = -1,
+	NATIVE_BACKLIGHT_OFF,
+	NATIVE_BACKLIGHT_ON,
+};
+
+static int use_native_backlight_param = NATIVE_BACKLIGHT_NOT_SET;
 module_param_named(use_native_backlight, use_native_backlight_param, int, 0444);
-static bool use_native_backlight_dmi = true;
+static int use_native_backlight_dmi = NATIVE_BACKLIGHT_NOT_SET;
 
 static int register_count;
 static struct mutex video_list_lock;
@@ -237,15 +243,16 @@ static void acpi_video_switch_brightness(struct work_struct *work);
 
 static bool acpi_video_use_native_backlight(void)
 {
-	if (use_native_backlight_param != -1)
+	if (use_native_backlight_param != NATIVE_BACKLIGHT_NOT_SET)
 		return use_native_backlight_param;
-	else
+	else if (use_native_backlight_dmi != NATIVE_BACKLIGHT_NOT_SET)
 		return use_native_backlight_dmi;
+	return acpi_osi_is_win8();
 }
 
 bool acpi_video_verify_backlight_support(void)
 {
-	if (acpi_osi_is_win8() && acpi_video_use_native_backlight() &&
+	if (acpi_video_use_native_backlight() &&
 	    backlight_device_registered(BACKLIGHT_RAW))
 		return false;
 	return acpi_video_backlight_support();
@@ -414,7 +421,7 @@ static int __init video_set_bqc_offset(const struct dmi_system_id *d)
 
Quoted 8 lines

drivers/acpi/video.c static int __init video_set_bqc_offset(const struct dmi_system_id *d) · line 427

Quoted 8 lines
drivers/acpi/video.c +1 -1
 static int __init video_disable_native_backlight(const struct dmi_system_id *d)
 {
-	use_native_backlight_dmi = false;
+	use_native_backlight_dmi = NATIVE_BACKLIGHT_OFF;
 	return 0;
 }
 

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
#12 lore raw

RFC PATCH 2/2 acpi: video: Add force native backlight quirk for Lenovo Ideapad Z570

In reply to Hans de Goede

The Lenovo Ideapad Z570 (which is an Acer in disguise like some other Ideapads) has a broken acpi_video interface and is too old for the acpi-video code to automatically prefer the native backlight interface, so add a quirk for it.

Note that this cannot be done with a quirk in the vendor backlight driver as is the normal way to fix this as the Z570 offers both acer-wmi and ideapad-laptop vendor backlight interfaces, so this would require the same quirk in 2 places which is the wrong thing to do.

---
 drivers/acpi/video.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
drivers/acpi/video.c +17 -0
index 9817b52..70a7ec3 100644
@@ -419,6 +419,12 @@ static int __init video_disable_native_backlight(const struct dmi_system_id *d)
 	return 0;
 }
 
+static int __init video_force_native_backlight(const struct dmi_system_id *d)
+{
+	use_native_backlight_dmi = 2;
+	return 0;
+}
+
 static struct dmi_system_id video_dmi_table[] __initdata = {
 	/*
 	 * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121
@@ -560,6 +566,17 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
 		DMI_MATCH(DMI_PRODUCT_NAME, "XPS L521X"),
 		},
 	},
+
+	/* Non win8 machines which need native backlight nevertheless */
+	{
+	 /* https://bugzilla.redhat.com/show_bug.cgi?id=1187004 */
+	 .callback = video_force_native_backlight,
+	 .ident = "Lenovo Ideapad Z570",
+	 .matches = {
+		DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+		DMI_MATCH(DMI_PRODUCT_NAME, "102434U"),
+		},
+	},
 	{}
 };
 
Signature · 1 line
2.3.1
#13 lore raw

Re: [RFC PATCH 2/2] acpi: video: Add force native backlight quirk for Lenovo Ideapad Z570

Quoted 11 lines · Hans de Goede

The Lenovo Ideapad Z570 (which is an Acer in disguise like some other Ideapads) has a broken acpi_video interface and is too old for the acpi-video code to automatically prefer the native backlight interface, so add a quirk for it.

Note that this cannot be done with a quirk in the vendor backlight driver as is the normal way to fix this as the Z570 offers both acer-wmi and ideapad-laptop vendor backlight interfaces, so this would require the same quirk in 2 places which is the wrong thing to do.

This one would need to be updated on top of the Aaron's patch, right?

Quoted 40 lines
---
 drivers/acpi/video.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
drivers/acpi/video.c +17 -0
index 9817b52..70a7ec3 100644
@@ -419,6 +419,12 @@ static int __init video_disable_native_backlight(const struct dmi_system_id *d)
 	return 0;
 }
 
+static int __init video_force_native_backlight(const struct dmi_system_id *d)
+{
+	use_native_backlight_dmi = 2;
+	return 0;
+}
+
 static struct dmi_system_id video_dmi_table[] __initdata = {
 	/*
 	 * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121
@@ -560,6 +566,17 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
 		DMI_MATCH(DMI_PRODUCT_NAME, "XPS L521X"),
 		},
 	},
+
+	/* Non win8 machines which need native backlight nevertheless */
+	{
+	 /* https://bugzilla.redhat.com/show_bug.cgi?id=1187004 */
+	 .callback = video_force_native_backlight,
+	 .ident = "Lenovo Ideapad Z570",
+	 .matches = {
+		DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+		DMI_MATCH(DMI_PRODUCT_NAME, "102434U"),
+		},
+	},
 	{}
 };
 
Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
#14 lore raw

Re: [RFC PATCH 2/2] acpi: video: Add force native backlight quirk for Lenovo Ideapad Z570

Hi,

Quoted 10 lines · Rafael J. Wysocki
Quoted 9 lines · Hans de Goede

The Lenovo Ideapad Z570 (which is an Acer in disguise like some other Ideapads) has a broken acpi_video interface and is too old for the acpi-video code to automatically prefer the native backlight interface, so add a quirk for it.

Note that this cannot be done with a quirk in the vendor backlight driver as is the normal way to fix this as the Z570 offers both acer-wmi and ideapad-laptop vendor backlight interfaces, so this would require the same quirk in 2 places which is the wrong thing to do.

Quoted 4 lines
Quoted 2 lines

This one would need to be updated on top of the Aaron's patch, right?

Correct, and it seems to need some more work in general as it conflicts with a patch to video-detect.c which is already upstream for this laptop model, but does not seem to 100% fix the problem.

Regards,

Hans

Quoted 42 lines
Quoted 41 lines
---
  drivers/acpi/video.c | 17 +++++++++++++++++
  1 file changed, 17 insertions(+)
drivers/acpi/video.c +17 -0
index 9817b52..70a7ec3 100644
@@ -419,6 +419,12 @@ static int __init video_disable_native_backlight(const struct dmi_system_id *d)
  	return 0;
  }
 
+static int __init video_force_native_backlight(const struct dmi_system_id *d)
+{
+	use_native_backlight_dmi = 2;
+	return 0;
+}
+
  static struct dmi_system_id video_dmi_table[] __initdata = {
  	/*
  	 * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121
@@ -560,6 +566,17 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
  		DMI_MATCH(DMI_PRODUCT_NAME, "XPS L521X"),
  		},
  	},
+
+	/* Non win8 machines which need native backlight nevertheless */
+	{
+	 /* https://bugzilla.redhat.com/show_bug.cgi?id=1187004 */
+	 .callback = video_force_native_backlight,
+	 .ident = "Lenovo Ideapad Z570",
+	 .matches = {
+		DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+		DMI_MATCH(DMI_PRODUCT_NAME, "102434U"),
+		},
+	},
  	{}
  };
 
#15 lore raw
In reply to Hans de Goede
Quoted 4 lines · Hans de Goede

Hi All,

I've long wanted to have a way for users to force native-backlight behavior as that makes debugging backlight problems a bit easier.

I agree.

Quoted 6 lines

And now a laptop has shown up which needs native backlight behavior for things to work, has a non win8 ready bios, and I cannot use a quirk in the vendor backlight driver as it implements both the acer-wmi and ideapad-laptop vendor interfaces and putting the same quirk in 2 places is just wrong.

Quoted 7 lines

So I've finally written a small patch to allow forcing native-backlight behavior as well as a second patch using this to add a quirk for said laptop.

For now this is just a RFC series as I'm waiting for confirmation from the user that this actually fixes things, but I wanted to get the discussion going beforehand in case anyone has any objections against the solution I've come up with.

See my comments for patch 1.

Thanks,
Aaron

Quoted 5 lines

Regards,

Hans