Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 177589
b: refs/heads/master
c: de078e5
h: refs/heads/master
i:
  177587: d857e67
v: v3
  • Loading branch information
Anisse Astier authored and Len Brown committed Dec 16, 2009
1 parent 540c0e0 commit c47e670
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c30116c6f0d26cd6e46dfa578163d573ef4730b2
refs/heads/master: de078e5747fa3a95efac04fd6725dcceb4520416
1 change: 1 addition & 0 deletions trunk/drivers/platform/x86/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ config MSI_WMI
tristate "MSI WMI extras"
depends on ACPI_WMI
depends on INPUT
depends on BACKLIGHT_CLASS_DEVICE
select INPUT_SPARSEKMAP
help
Say Y here if you want to support WMI-based hotkeys on MSI laptops.
Expand Down
23 changes: 15 additions & 8 deletions trunk/drivers/platform/x86/msi-wmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit c47e670

Please sign in to comment.