author: Hans de Goede <hdegoede@redhat.com> 2021-04-06 23:16:53 +0200
committer: Rafael J. Wysocki <rafael.j.wysocki@intel.com> 2021-04-08 19:50:58 +0200
commit: 81cc7e9947c0d54ba2b714899ca90f14f029cb0b
parent: 8eb99e9a64a07ea08070591bdc2615526a103e62
Commit Summary:
Diffstat:
1 file changed, 23 insertions, 13 deletions
diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
index 2ea1781290cc..ade02152bb06 100644
--- a/drivers/acpi/acpi_video.c
+++ b/drivers/acpi/acpi_video.c
@@ -2182,6 +2182,30 @@ static bool dmi_is_desktop(void)
return false;
}
+/*
+ * We're seeing a lot of bogus backlight interfaces on newer machines
+ * without a LCD such as desktops, servers and HDMI sticks. Checking the
+ * lcd flag fixes this, enable this by default on any machines which are:
+ * 1. Win8 ready (where we also prefer the native backlight driver, so
+ * normally the acpi_video code should not register there anyways); *and*
+ * 2.1 Report a desktop/server DMI chassis-type, or
+ * 2.2 Are an ACPI-reduced-hardware platform (and thus won't use the EC for
+ backlight control)
+ */
+static bool should_check_lcd_flag(void)
+{
+ if (!acpi_osi_is_win8())
+ return false;
+
+ if (dmi_is_desktop())
+ return true;
+
+ if (acpi_reduced_hardware())
+ return true;
+
+ return false;
+}
+
int acpi_video_register(void)
{
int ret = 0;
@@ -2195,19 +2219,8 @@ int acpi_video_register(void)
goto leave;
}
- /*
- * We're seeing a lot of bogus backlight interfaces on newer machines
- * without a LCD such as desktops, servers and HDMI sticks. Checking
- * the lcd flag fixes this, so enable this on any machines which are
- * win8 ready (where we also prefer the native backlight driver, so
- * normally the acpi_video code should not register there anyways).
- */
- if (only_lcd == -1) {
- if (dmi_is_desktop() && acpi_osi_is_win8())
- only_lcd = true;
- else
- only_lcd = false;
- }
+ if (only_lcd == -1)
+ only_lcd = should_check_lcd_flag();
dmi_check_system(video_dmi_table);