Skip to contentSkip to conversation

asus-wmi: Disable acpi-video backlight on desktop machi

PATCH New Hans de Goede 1 participant 3 messages Jul 8, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover asus-wmi: Disable acpi-video backlight on desktop machi

Hi All,

Here is v2 of my patch series to stop certain asus desktop motherboards registering a backlight interface for a non-existent backlight.

Changes since v1:
-Simply stop acpi-video from registering a backlight interface on all boards
with a dmi-chassis-type of desktop rather then using a dmi-product-name based blacklist
-Add a patch to make the asus-wmi not register its own backlight interface
despite the BIOS having no support for it

Regards,

Hans

#1 lore raw

PATCH v2 1/2 asus-wmi: Disable acpi-video backlight on desktop machines

Some Asus motherboards for desktop PC-s export an acpi-video interface advertising backlight support. Test the dmi chassis-type and tell acpi-video to not register a backlight interface on desktops.

https://bugzilla.redhat.com/show_bug.cgi?id=1097436

---
 drivers/platform/x86/asus-wmi.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/platform/x86/asus-wmi.c +7 -0
index 3c6cced..70aec19 100644
@@ -46,6 +46,7 @@
 #include <linux/platform_device.h>
 #include <linux/thermal.h>
 #include <linux/acpi.h>
+#include <linux/dmi.h>
 #include <acpi/video.h>
 
 #include "asus-wmi.h"
@@ -1734,6 +1735,7 @@ static int asus_wmi_add(struct platform_device *pdev)
 	struct platform_driver *pdrv = to_platform_driver(pdev->dev.driver);
 	struct asus_wmi_driver *wdrv = to_asus_wmi_driver(pdrv);
 	struct asus_wmi *asus;
+	const char *chassis_type;
 	acpi_status status;
 	int err;
 	u32 result;
@@ -1770,6 +1772,11 @@ static int asus_wmi_add(struct platform_device *pdev)
 	if (err)
 		goto fail_rfkill;
 
+	/* Some Asus desktop boards export an acpi-video backlight interface,
+	   stop this from showing up */
+	chassis_type = dmi_get_system_info(DMI_CHASSIS_TYPE);
+	if (chassis_type && !strcmp(chassis_type, "3"))
+		acpi_video_dmi_promote_vendor();
 	if (asus->driver->quirks->wmi_backlight_power)
 		acpi_video_dmi_promote_vendor();
 	if (!acpi_video_backlight_support()) {
Signature · 1 line
2.0.0
#2 lore raw

PATCH v2 2/2 asus-wmi: backlight_init: Stop treating -ENODEV as if its not an error

In reply to Hans de Goede

When bl_power support got added to asus-wmi, the error handling for it was written to ignore -ENODEV, to avoid not registering a backlight interface for models which have no bl_power control, but do have brightness control.

At the same time the error handling for brightness_max was modified to do the same, this is wrong, when there is no brightness_max asus-wmi should not register a backlight interface.

Note the caller of asus_wmi_backlight_init already special cases -ENODEV, and will not cause the wmi driver regristration to fail because of a -ENODEV return from asus_wmi_backlight_init.

https://bugzilla.redhat.com/show_bug.cgi?id=1097436

---
 drivers/platform/x86/asus-wmi.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/platform/x86/asus-wmi.c +1 -4
index 70aec19..8a88416 100644
@@ -1271,10 +1271,7 @@ static int asus_wmi_backlight_init(struct asus_wmi *asus)
 	int power;
 
 	max = read_brightness_max(asus);
-
-	if (max == -ENODEV)
-		max = 0;
-	else if (max < 0)
+	if (max < 0)
 		return max;
 
 	power = read_backlight_power(asus);
Signature · 1 line
2.0.0