Skip to contentSkip to conversation

ACPI: video: Stop trying to use vendor backlight control on laptops from after ~2012

PATCH Applied Hans de Goede 2 participants 2 messages Jun 8, 2023 – Jun 12, 2023 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: video: Stop trying to use vendor backlight control on laptops from after ~2012

There have been 2 separate reports now about a non working "dell_backlight" device getting registered under /sys/class/backlight 1 report for a Raptor Lake based Dell and 1 report for a Meteor Lake (development) platform.

On hw from the last 10 years dell-laptop will not register "dell_backlight" because acpi_video_get_backlight_type() will return acpi_backlight_video there if called before the GPU/kms driver loads. So it does not matter if the GPU driver's native backlight is registered after dell-laptop loads.

But it seems that on the latest generation laptops the ACPI tables no longer contain acpi_video backlight control support which causes acpi_video_get_backlight_type() to return acpi_backlight_vendor causing "dell_backlight" to get registered if the dell-laptop module is loaded before the GPU/kms driver.

Vendor specific backlight control like the "dell_backlight" device is only necessary on quite old hw (from before acpi_video backlight control was introduced). Work around "dell_backlight" registering on very new hw (where acpi_video backlight control seems to be no more) by making acpi_video_get_backlight_type() return acpi_backlight_none instead of acpi_backlight_vendor as final fallback when the ACPI tables have support for Windows 8 or later (laptops from after ~2012).

---
 drivers/acpi/video_detect.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
drivers/acpi/video_detect.c +21 -0
index b87783c5872d..eb014c0eba42 100644
@@ -844,6 +844,27 @@ enum acpi_backlight_type __acpi_video_get_backlight_type(bool native, bool *auto
 	if (native_available)
 		return acpi_backlight_native;
 
+	/*
+	 * The vendor specific BIOS interfaces are only necessary for
+	 * laptops from before ~2008.
+	 *
+	 * For laptops from ~2008 till ~2023 this point is never reached
+	 * because on those (video_caps & ACPI_VIDEO_BACKLIGHT) above is true.
+	 *
+	 * Laptops from after ~2023 no longer support ACPI_VIDEO_BACKLIGHT,
+	 * if this point is reached on those, this likely means that
+	 * the GPU kms driver which sets native_available has not loaded yet.
+	 *
+	 * Returning acpi_backlight_vendor in this case is known to sometimes
+	 * cause a non working vendor specific /sys/class/backlight device to
+	 * get registered.
+	 *
+	 * Return acpi_backlight_none on laptops with ACPI tables written
+	 * for Windows 8 (laptops from after ~2012) to avoid this problem.
+	 */
+	if (acpi_osi_is_win8())
+		return acpi_backlight_none;
+
 	/* No ACPI video/native (old hw), use vendor specific fw methods. */
 	return acpi_backlight_vendor;
 }
Signature · 1 line
2.40.1
maintainer Applied
#1 lore raw
Quoted 56 lines · Hans de Goede

There have been 2 separate reports now about a non working "dell_backlight" device getting registered under /sys/class/backlight 1 report for a Raptor Lake based Dell and 1 report for a Meteor Lake (development) platform.

On hw from the last 10 years dell-laptop will not register "dell_backlight" because acpi_video_get_backlight_type() will return acpi_backlight_video there if called before the GPU/kms driver loads. So it does not matter if the GPU driver's native backlight is registered after dell-laptop loads.

But it seems that on the latest generation laptops the ACPI tables no longer contain acpi_video backlight control support which causes acpi_video_get_backlight_type() to return acpi_backlight_vendor causing "dell_backlight" to get registered if the dell-laptop module is loaded before the GPU/kms driver.

Vendor specific backlight control like the "dell_backlight" device is only necessary on quite old hw (from before acpi_video backlight control was introduced). Work around "dell_backlight" registering on very new hw (where acpi_video backlight control seems to be no more) by making acpi_video_get_backlight_type() return acpi_backlight_none instead of acpi_backlight_vendor as final fallback when the ACPI tables have support for Windows 8 or later (laptops from after ~2012).

---
 drivers/acpi/video_detect.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
drivers/acpi/video_detect.c +15 -0
index b87783c5872d..eb014c0eba42 100644
@@ -844,6 +844,27 @@ enum acpi_backlight_type __acpi_video_get_backlight_type(bool native, bool *auto
        if (native_available)
                return acpi_backlight_native;
 
+       /*
+        * The vendor specific BIOS interfaces are only necessary for
+        * laptops from before ~2008.
+        *
+        * For laptops from ~2008 till ~2023 this point is never reached
+        * because on those (video_caps & ACPI_VIDEO_BACKLIGHT) above is true.
+        *
+        * Laptops from after ~2023 no longer support ACPI_VIDEO_BACKLIGHT,
+        * if this point is reached on those, this likely means that
+        * the GPU kms driver which sets native_available has not loaded yet.
+        *
+        * Returning acpi_backlight_vendor in this case is known to sometimes
+        * cause a non working vendor specific /sys/class/backlight device to
+        * get registered.
+        *

drivers/acpi/video_detect.c enum acpi_backlight_type __acpi_video_get_backlight_type(bool native, bool *auto

Quoted 10 lines
drivers/acpi/video_detect.c +6 -1
+        * Return acpi_backlight_none on laptops with ACPI tables written
+        * for Windows 8 (laptops from after ~2012) to avoid this problem.
+        */
+       if (acpi_osi_is_win8())
+               return acpi_backlight_none;
+
        /* No ACPI video/native (old hw), use vendor specific fw methods. */
        return acpi_backlight_vendor;
 }
--

Applied as 6.5 material, thanks!