summaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/msi-wmi.c
diff options
context:
space:
mode:
authorAnisse Astier <anisse@astier.eu>2009-12-14 10:21:39 +0100
committerLen Brown <len.brown@intel.com>2009-12-16 12:40:54 -0500
commitde078e5747fa3a95efac04fd6725dcceb4520416 (patch)
treeb106fc602480d0a29bd475647b495ce6be24ecc8 /drivers/platform/x86/msi-wmi.c
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/x86/msi-wmi.c')
-rw-r--r--drivers/platform/x86/msi-wmi.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/platform/x86/msi-wmi.c b/drivers/platform/x86/msi-wmi.c
index e25b80c530f..0c8fe145c4a 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:*");
#define dprintk(msg...) pr_debug(DRV_PFX msg)
#define KEYCODE_BASE 0xD0
+#define MSI_WMI_BRIGHTNESSUP KEYCODE_BASE
+#define MSI_WMI_BRIGHTNESSDOWN (KEYCODE_BASE + 1)
+#define MSI_WMI_VOLUMEUP (KEYCODE_BASE + 2)
+#define MSI_WMI_VOLUMEDOWN (KEYCODE_BASE + 3)
static struct key_entry msi_wmi_keymap[] = {
- { KE_KEY, KEYCODE_BASE, {KEY_BRIGHTNESSUP} },
- { KE_KEY, KEYCODE_BASE + 1, {KEY_BRIGHTNESSDOWN} },
- { KE_KEY, KEYCODE_BASE + 2, {KEY_VOLUMEUP} },
- { KE_KEY, KEYCODE_BASE + 3, {KEY_VOLUMEDOWN} },
+ { KE_KEY, MSI_WMI_BRIGHTNESSUP, {KEY_BRIGHTNESSUP} },
+ { KE_KEY, MSI_WMI_BRIGHTNESSDOWN, {KEY_BRIGHTNESSDOWN} },
+ { KE_KEY, MSI_WMI_VOLUMEUP, {KEY_VOLUMEUP} },
+ { KE_KEY, MSI_WMI_VOLUMEDOWN, {KEY_VOLUMEDOWN} },
{ KE_END, 0}
};
static ktime_t last_pressed[ARRAY_SIZE(msi_wmi_keymap) - 1];
@@ -110,12 +114,14 @@ static int msi_wmi_set_block(int instance, int value)
static int bl_get(struct backlight_device *bd)
{
- int level, err, ret = 0;
+ int level, err, ret;
/* Instance 1 is "get backlight", cmp with DSDT */
err = msi_wmi_query_block(1, &ret);
- if (err)
+ if (err) {
printk(KERN_ERR DRV_PFX "Could not query backlight: %d\n", err);
+ return -EINVAL;
+ }
dprintk("Get: Query block returned: %d\n", ret);
for (level = 0; level < ARRAY_SIZE(backlight_map); level++) {
if (backlight_map[level] == ret) {
@@ -180,8 +186,9 @@ static void msi_wmi_notify(u32 value, void *context)
if (key->type == KE_KEY &&
/* Brightness is served via acpi video driver */
- (backlight || (key->keycode != KEY_BRIGHTNESSUP &&
- key->keycode != KEY_BRIGHTNESSDOWN))) {
+ (!acpi_video_backlight_support() ||
+ (key->code != MSI_WMI_BRIGHTNESSUP &&
+ key->code != MSI_WMI_BRIGHTNESSDOWN))) {
dprintk("Send key: 0x%X - "
"Input layer keycode: %d\n", key->code,
key->keycode);