summaryrefslogtreecommitdiff
path: root/drivers/platform/x86/asus-wmi.c
diff options
context:
space:
mode:
authorAceLan Kao <acelan.kao@canonical.com>2012-10-03 13:26:31 +0400
committerMatthew Garrett <matthew.garrett@nebula.com>2013-02-25 02:49:55 +0400
commita2a96f0c7221806c8a8072b662e6deaa119833da (patch)
treea82f6c25dab4f4b906275e28909ce3d0d939cd20 /drivers/platform/x86/asus-wmi.c
parent3da4cd2015630f50d8d80c6ff5089d3daa2306c6 (diff)
downloadlinux-a2a96f0c7221806c8a8072b662e6deaa119833da.tar.xz
asus-wmi: add display toggle quirk
For machines with AMD graphic chips, it will send out WMI event and ACPI interrupt at the same time while hitting the hotkey. BIOS will notify the system the next display output mode throught WMI event code, so that windows' application can show an OSD to tell the user which mode will be taken effect. User can hit the display toggle key many times within 2 seconds to choose the mode they want. After 2 seconds, WMI dirver should send a WMIMethod(SDSP) command to tell the BIOS which mode the user chose. And then BIOS will raise another ACPI interrupt to tell the system to really switch the display mode. In Linux desktop, we don't have this kind of OSD to let users to choose the mode they want, so we don't need to call WMIMethod(SDSP) to have another ACPI interrupt. To simplify the problem, we just have to ignore the WMI event, and let the first ACPI interrupt to send out the key event. For the need, here comes another quirk to add machines with this kind of behavior. When the WMI driver receives the display toggle WMI event, and found the machin is in the list, it will do nothing and let ACPI video driver to report the key event. Signed-off-by: AceLan Kao <acelan.kao@canonical.com> Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Diffstat (limited to 'drivers/platform/x86/asus-wmi.c')
-rw-r--r--drivers/platform/x86/asus-wmi.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 912ec7de71f4..208e71c61847 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -1341,6 +1341,23 @@ static void asus_wmi_backlight_exit(struct asus_wmi *asus)
asus->backlight_device = NULL;
}
+static int is_display_toggle(int code)
+{
+ /* display toggle keys */
+ if ((code >= 0x61 && code <= 0x67) ||
+ (code >= 0x8c && code <= 0x93) ||
+ (code >= 0xa0 && code <= 0xa7) ||
+ (code >= 0xd0 && code <= 0xd5))
+ return 1;
+
+ return 0;
+}
+
+static void do_nothing(void)
+{
+ return;
+}
+
static void asus_wmi_notify(u32 value, void *context)
{
struct asus_wmi *asus = context;
@@ -1380,10 +1397,18 @@ static void asus_wmi_notify(u32 value, void *context)
code = NOTIFY_BRNDOWN_MIN;
if (code == NOTIFY_BRNUP_MIN || code == NOTIFY_BRNDOWN_MIN) {
- if (!acpi_video_backlight_support())
+ if (!acpi_video_backlight_support()) {
asus_wmi_backlight_notify(asus, orig_code);
- } else if (!sparse_keymap_report_event(asus->inputdev, code,
- key_value, autorelease))
+ }
+ goto exit;
+ }
+
+ if (is_display_toggle(code) &&
+ asus->driver->quirks->no_display_toggle)
+ goto exit;
+
+ if (!sparse_keymap_report_event(asus->inputdev, code,
+ key_value, autorelease))
pr_info("Unknown key %x pressed\n", code);
exit: