Commit 272c77d55672ef92eda9d5e24a5a7ac62df9c431

Authored by AceLan Kao
Committed by Matthew Garrett
1 parent e052067df0

asus-wmi: control backlight power through WMI, not ACPI

BugLink: https://bugs.launchpad.net/bugs/1000146

Some h/w that can adjust screen brightness through ACPI functions, but
can't turn on/off the backlight power correctly. So, we list those h/w in
quirks and try to turn on/off the backlight power through WMI.
Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>

Showing 3 changed files with 34 additions and 1 deletions Side-by-side Diff

drivers/platform/x86/asus-wmi.c
... ... @@ -47,6 +47,9 @@
47 47 #include <linux/thermal.h>
48 48 #include <acpi/acpi_bus.h>
49 49 #include <acpi/acpi_drivers.h>
  50 +#ifdef CONFIG_ACPI_VIDEO
  51 +#include <acpi/video.h>
  52 +#endif
50 53  
51 54 #include "asus-wmi.h"
52 55  
53 56  
... ... @@ -1676,7 +1679,13 @@
1676 1679 if (err)
1677 1680 goto fail_rfkill;
1678 1681  
  1682 + if (asus->driver->quirks->wmi_backlight_power)
  1683 + acpi_video_dmi_promote_vendor();
1679 1684 if (!acpi_video_backlight_support()) {
  1685 +#ifdef CONFIG_ACPI_VIDEO
  1686 + pr_info("Disabling ACPI video driver\n");
  1687 + acpi_video_unregister();
  1688 +#endif
1680 1689 err = asus_wmi_backlight_init(asus);
1681 1690 if (err && err != -ENODEV)
1682 1691 goto fail_backlight;
drivers/platform/x86/asus-wmi.h
... ... @@ -39,6 +39,7 @@
39 39 bool hotplug_wireless;
40 40 bool scalar_panel_brightness;
41 41 bool store_backlight_power;
  42 + bool wmi_backlight_power;
42 43 int wapf;
43 44 };
44 45  
drivers/platform/x86/eeepc-wmi.c
... ... @@ -79,7 +79,7 @@
79 79 { KE_KEY, 0xe1, { KEY_F14 } }, /* Change Resolution */
80 80 { KE_KEY, HOME_PRESS, { KEY_CONFIG } }, /* Home/Express gate key */
81 81 { KE_KEY, 0xe8, { KEY_SCREENLOCK } },
82   - { KE_KEY, 0xe9, { KEY_BRIGHTNESS_ZERO } },
  82 + { KE_KEY, 0xe9, { KEY_DISPLAYTOGGLE } },
83 83 { KE_KEY, 0xeb, { KEY_CAMERA_ZOOMOUT } },
84 84 { KE_KEY, 0xec, { KEY_CAMERA_UP } },
85 85 { KE_KEY, 0xed, { KEY_CAMERA_DOWN } },
... ... @@ -107,6 +107,11 @@
107 107 .store_backlight_power = true,
108 108 };
109 109  
  110 +static struct quirk_entry quirk_asus_x101ch = {
  111 + /* We need this when ACPI function doesn't do this well */
  112 + .wmi_backlight_power = true,
  113 +};
  114 +
110 115 static struct quirk_entry *quirks;
111 116  
112 117 static void et2012_quirks(void)
... ... @@ -156,6 +161,24 @@
156 161 DMI_MATCH(DMI_PRODUCT_NAME, "ET2012"),
157 162 },
158 163 .driver_data = &quirk_asus_unknown,
  164 + },
  165 + {
  166 + .callback = dmi_matched,
  167 + .ident = "ASUSTeK Computer INC. X101CH",
  168 + .matches = {
  169 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
  170 + DMI_MATCH(DMI_PRODUCT_NAME, "X101CH"),
  171 + },
  172 + .driver_data = &quirk_asus_x101ch,
  173 + },
  174 + {
  175 + .callback = dmi_matched,
  176 + .ident = "ASUSTeK Computer INC. 1015CX",
  177 + .matches = {
  178 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
  179 + DMI_MATCH(DMI_PRODUCT_NAME, "1015CX"),
  180 + },
  181 + .driver_data = &quirk_asus_x101ch,
159 182 },
160 183 {},
161 184 };