acer-wmi: add quirk table for video backlight vendor mode
authorLee, Chun-Yi <jlee@suse.com>
Mon, 26 Mar 2012 19:47:58 +0000 (15:47 -0400)
committerMatthew Garrett <mjg@redhat.com>
Mon, 26 Mar 2012 19:47:58 +0000 (15:47 -0400)
There have some acer laptop have broken _BCM implemenation, the AML
code wrote value to EC register but firmware didn't change brighenss.

Fortunately, the brightness control works on those machines with
vendor mode. So, add quirk table for video backlight vendor mode
and unregister acpi video interface on those machines.

Tested on Acer TravelMate 4750

Cc: Carlos Corbacho <carlos@strangeworlds.co.uk>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: Dmitry Torokhov <dtor@mail.ru>
Cc: Corentin Chary <corentincj@iksaif.net>
Cc: Thomas Renninger <trenn@suse.de>
Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>

drivers/platform/x86/Kconfig
drivers/platform/x86/acer-wmi.c

index c5b4bfe..2a262f5 100644 (file)
@@ -26,6 +26,10 @@ config ACER_WMI
        depends on RFKILL || RFKILL = n
        depends on ACPI_WMI
        select INPUT_SPARSEKMAP
+       # Acer WMI depends on ACPI_VIDEO when ACPI is enabled
+       # but for select to work, need to select ACPI_VIDEO's dependencies, ick
+        select VIDEO_OUTPUT_CONTROL if ACPI
+        select ACPI_VIDEO if ACPI
        ---help---
          This is a driver for newer Acer (and Wistron) laptops. It adds
          wireless radio and bluetooth control, and on some laptops,
index b253e21..c1a3fd8 100644 (file)
@@ -43,6 +43,7 @@
 #include <linux/input/sparse-keymap.h>
 
 #include <acpi/acpi_drivers.h>
+#include <acpi/video.h>
 
 MODULE_AUTHOR("Carlos Corbacho");
 MODULE_DESCRIPTION("Acer Laptop WMI Extras Driver");
@@ -506,6 +507,25 @@ static struct dmi_system_id acer_quirks[] = {
        {}
 };
 
+static int video_set_backlight_video_vendor(const struct dmi_system_id *d)
+{
+       interface->capability &= ~ACER_CAP_BRIGHTNESS;
+       pr_info("Brightness must be controlled by generic video driver\n");
+       return 0;
+}
+
+static const struct dmi_system_id video_vendor_dmi_table[] = {
+       {
+               .callback = video_set_backlight_video_vendor,
+               .ident = "Acer TravelMate 4750",
+               .matches = {
+                       DMI_MATCH(DMI_BOARD_VENDOR, "Acer"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 4750"),
+               },
+       },
+       {}
+};
+
 /* Find which quirks are needed for a particular vendor/ model pair */
 static void find_quirks(void)
 {
@@ -2017,8 +2037,13 @@ static int __init acer_wmi_init(void)
        set_quirks();
 
        if (acpi_video_backlight_support()) {
-               interface->capability &= ~ACER_CAP_BRIGHTNESS;
-               pr_info("Brightness must be controlled by generic video driver\n");
+               if (dmi_check_system(video_vendor_dmi_table)) {
+                       acpi_video_unregister();
+               } else {
+                       interface->capability &= ~ACER_CAP_BRIGHTNESS;
+                       pr_info("Brightness must be controlled by "
+                               "acpi video driver\n");
+               }
        }
 
        if (wmi_has_guid(WMID_GUID3)) {