diff options
Diffstat (limited to 'drivers/platform/x86')
-rw-r--r-- | drivers/platform/x86/msi-wmi.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/drivers/platform/x86/msi-wmi.c b/drivers/platform/x86/msi-wmi.c index 4db0c550ffcb..112ec1488ea8 100644 --- a/drivers/platform/x86/msi-wmi.c +++ b/drivers/platform/x86/msi-wmi.c | |||
@@ -42,19 +42,21 @@ MODULE_LICENSE("GPL"); | |||
42 | MODULE_ALIAS("wmi:" MSIWMI_BIOS_GUID); | 42 | MODULE_ALIAS("wmi:" MSIWMI_BIOS_GUID); |
43 | MODULE_ALIAS("wmi:" MSIWMI_EVENT_GUID); | 43 | MODULE_ALIAS("wmi:" MSIWMI_EVENT_GUID); |
44 | 44 | ||
45 | #define SCANCODE_BASE 0xD0 | 45 | enum msi_scancodes { |
46 | #define MSI_WMI_BRIGHTNESSUP SCANCODE_BASE | 46 | MSI_SCANCODE_BASE = 0xD0, |
47 | #define MSI_WMI_BRIGHTNESSDOWN (SCANCODE_BASE + 1) | 47 | MSI_KEY_BRIGHTNESSUP = MSI_SCANCODE_BASE, |
48 | #define MSI_WMI_VOLUMEUP (SCANCODE_BASE + 2) | 48 | MSI_KEY_BRIGHTNESSDOWN, |
49 | #define MSI_WMI_VOLUMEDOWN (SCANCODE_BASE + 3) | 49 | MSI_KEY_VOLUMEUP, |
50 | #define MSI_WMI_MUTE (SCANCODE_BASE + 4) | 50 | MSI_KEY_VOLUMEDOWN, |
51 | MSI_KEY_MUTE, | ||
52 | }; | ||
51 | static struct key_entry msi_wmi_keymap[] = { | 53 | static struct key_entry msi_wmi_keymap[] = { |
52 | { KE_KEY, MSI_WMI_BRIGHTNESSUP, {KEY_BRIGHTNESSUP} }, | 54 | { KE_KEY, MSI_KEY_BRIGHTNESSUP, {KEY_BRIGHTNESSUP} }, |
53 | { KE_KEY, MSI_WMI_BRIGHTNESSDOWN, {KEY_BRIGHTNESSDOWN} }, | 55 | { KE_KEY, MSI_KEY_BRIGHTNESSDOWN, {KEY_BRIGHTNESSDOWN} }, |
54 | { KE_KEY, MSI_WMI_VOLUMEUP, {KEY_VOLUMEUP} }, | 56 | { KE_KEY, MSI_KEY_VOLUMEUP, {KEY_VOLUMEUP} }, |
55 | { KE_KEY, MSI_WMI_VOLUMEDOWN, {KEY_VOLUMEDOWN} }, | 57 | { KE_KEY, MSI_KEY_VOLUMEDOWN, {KEY_VOLUMEDOWN} }, |
56 | { KE_KEY, MSI_WMI_MUTE, {KEY_MUTE} }, | 58 | { KE_KEY, MSI_KEY_MUTE, {KEY_MUTE} }, |
57 | { KE_END, 0} | 59 | { KE_END, 0 } |
58 | }; | 60 | }; |
59 | static ktime_t last_pressed[ARRAY_SIZE(msi_wmi_keymap) - 1]; | 61 | static ktime_t last_pressed[ARRAY_SIZE(msi_wmi_keymap) - 1]; |
60 | 62 | ||
@@ -169,7 +171,7 @@ static void msi_wmi_notify(u32 value, void *context) | |||
169 | ktime_t diff; | 171 | ktime_t diff; |
170 | cur = ktime_get_real(); | 172 | cur = ktime_get_real(); |
171 | diff = ktime_sub(cur, last_pressed[key->code - | 173 | diff = ktime_sub(cur, last_pressed[key->code - |
172 | SCANCODE_BASE]); | 174 | MSI_SCANCODE_BASE]); |
173 | /* Ignore event if the same event happened in a 50 ms | 175 | /* Ignore event if the same event happened in a 50 ms |
174 | timeframe -> Key press may result in 10-20 GPEs */ | 176 | timeframe -> Key press may result in 10-20 GPEs */ |
175 | if (ktime_to_us(diff) < 1000 * 50) { | 177 | if (ktime_to_us(diff) < 1000 * 50) { |
@@ -178,13 +180,13 @@ static void msi_wmi_notify(u32 value, void *context) | |||
178 | key->code, ktime_to_us(diff)); | 180 | key->code, ktime_to_us(diff)); |
179 | goto msi_wmi_notify_exit; | 181 | goto msi_wmi_notify_exit; |
180 | } | 182 | } |
181 | last_pressed[key->code - SCANCODE_BASE] = cur; | 183 | last_pressed[key->code - MSI_SCANCODE_BASE] = cur; |
182 | 184 | ||
183 | if (key->type == KE_KEY && | 185 | if (key->type == KE_KEY && |
184 | /* Brightness is served via acpi video driver */ | 186 | /* Brightness is served via acpi video driver */ |
185 | (!acpi_video_backlight_support() || | 187 | (!acpi_video_backlight_support() || |
186 | (key->code != MSI_WMI_BRIGHTNESSUP && | 188 | (key->code != MSI_KEY_BRIGHTNESSUP && |
187 | key->code != MSI_WMI_BRIGHTNESSDOWN))) { | 189 | key->code != MSI_KEY_BRIGHTNESSDOWN))) { |
188 | pr_debug("Send key: 0x%X - " | 190 | pr_debug("Send key: 0x%X - " |
189 | "Input layer keycode: %d\n", | 191 | "Input layer keycode: %d\n", |
190 | key->code, key->keycode); | 192 | key->code, key->keycode); |