aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorAnisse Astier <anisse@astier.eu>2009-12-14 04:21:39 -0500
committerLen Brown <len.brown@intel.com>2009-12-16 12:40:54 -0500
commitde078e5747fa3a95efac04fd6725dcceb4520416 (patch)
treeb106fc602480d0a29bd475647b495ce6be24ecc8 /drivers/platform
parentc30116c6f0d26cd6e46dfa578163d573ef4730b2 (diff)
msi-wmi: depend on backlight and fix corner-cases problems
Now depends on BACKLIGHT_CLASS_DEVICE. Driver will return an error if it can't get actual backlight value Fix remapping of brightness keys when backlight is not controlled by ACPI. Signed-off-by: Anisse Astier <anisse@astier.eu> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/Kconfig1
-rw-r--r--drivers/platform/x86/msi-wmi.c23
2 files changed, 16 insertions, 8 deletions
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 1f82d6df96e1..a006dec3b3ef 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -369,6 +369,7 @@ config MSI_WMI
369 tristate "MSI WMI extras" 369 tristate "MSI WMI extras"
370 depends on ACPI_WMI 370 depends on ACPI_WMI
371 depends on INPUT 371 depends on INPUT
372 depends on BACKLIGHT_CLASS_DEVICE
372 select INPUT_SPARSEKMAP 373 select INPUT_SPARSEKMAP
373 help 374 help
374 Say Y here if you want to support WMI-based hotkeys on MSI laptops. 375 Say Y here if you want to support WMI-based hotkeys on MSI laptops.
diff --git a/drivers/platform/x86/msi-wmi.c b/drivers/platform/x86/msi-wmi.c
index e25b80c530f7..0c8fe145c4af 100644
--- a/drivers/platform/x86/msi-wmi.c
+++ b/drivers/platform/x86/msi-wmi.c
@@ -53,11 +53,15 @@ MODULE_ALIAS("dmi:*:svnMICRO-STARINTERNATIONAL*:pnMS-6638:*");
53#define dprintk(msg...) pr_debug(DRV_PFX msg) 53#define dprintk(msg...) pr_debug(DRV_PFX msg)
54 54
55#define KEYCODE_BASE 0xD0 55#define KEYCODE_BASE 0xD0
56#define MSI_WMI_BRIGHTNESSUP KEYCODE_BASE
57#define MSI_WMI_BRIGHTNESSDOWN (KEYCODE_BASE + 1)
58#define MSI_WMI_VOLUMEUP (KEYCODE_BASE + 2)
59#define MSI_WMI_VOLUMEDOWN (KEYCODE_BASE + 3)
56static struct key_entry msi_wmi_keymap[] = { 60static struct key_entry msi_wmi_keymap[] = {
57 { KE_KEY, KEYCODE_BASE, {KEY_BRIGHTNESSUP} }, 61 { KE_KEY, MSI_WMI_BRIGHTNESSUP, {KEY_BRIGHTNESSUP} },
58 { KE_KEY, KEYCODE_BASE + 1, {KEY_BRIGHTNESSDOWN} }, 62 { KE_KEY, MSI_WMI_BRIGHTNESSDOWN, {KEY_BRIGHTNESSDOWN} },
59 { KE_KEY, KEYCODE_BASE + 2, {KEY_VOLUMEUP} }, 63 { KE_KEY, MSI_WMI_VOLUMEUP, {KEY_VOLUMEUP} },
60 { KE_KEY, KEYCODE_BASE + 3, {KEY_VOLUMEDOWN} }, 64 { KE_KEY, MSI_WMI_VOLUMEDOWN, {KEY_VOLUMEDOWN} },
61 { KE_END, 0} 65 { KE_END, 0}
62}; 66};
63static ktime_t last_pressed[ARRAY_SIZE(msi_wmi_keymap) - 1]; 67static ktime_t last_pressed[ARRAY_SIZE(msi_wmi_keymap) - 1];
@@ -110,12 +114,14 @@ static int msi_wmi_set_block(int instance, int value)
110 114
111static int bl_get(struct backlight_device *bd) 115static int bl_get(struct backlight_device *bd)
112{ 116{
113 int level, err, ret = 0; 117 int level, err, ret;
114 118
115 /* Instance 1 is "get backlight", cmp with DSDT */ 119 /* Instance 1 is "get backlight", cmp with DSDT */
116 err = msi_wmi_query_block(1, &ret); 120 err = msi_wmi_query_block(1, &ret);
117 if (err) 121 if (err) {
118 printk(KERN_ERR DRV_PFX "Could not query backlight: %d\n", err); 122 printk(KERN_ERR DRV_PFX "Could not query backlight: %d\n", err);
123 return -EINVAL;
124 }
119 dprintk("Get: Query block returned: %d\n", ret); 125 dprintk("Get: Query block returned: %d\n", ret);
120 for (level = 0; level < ARRAY_SIZE(backlight_map); level++) { 126 for (level = 0; level < ARRAY_SIZE(backlight_map); level++) {
121 if (backlight_map[level] == ret) { 127 if (backlight_map[level] == ret) {
@@ -180,8 +186,9 @@ static void msi_wmi_notify(u32 value, void *context)
180 186
181 if (key->type == KE_KEY && 187 if (key->type == KE_KEY &&
182 /* Brightness is served via acpi video driver */ 188 /* Brightness is served via acpi video driver */
183 (backlight || (key->keycode != KEY_BRIGHTNESSUP && 189 (!acpi_video_backlight_support() ||
184 key->keycode != KEY_BRIGHTNESSDOWN))) { 190 (key->code != MSI_WMI_BRIGHTNESSUP &&
191 key->code != MSI_WMI_BRIGHTNESSDOWN))) {
185 dprintk("Send key: 0x%X - " 192 dprintk("Send key: 0x%X - "
186 "Input layer keycode: %d\n", key->code, 193 "Input layer keycode: %d\n", key->code,
187 key->keycode); 194 key->keycode);