aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/toshiba_acpi.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-04-29 09:15:38 -0400
committerMatthew Garrett <matthew.garrett@nebula.com>2014-06-09 17:39:58 -0400
commitfe808bfb59d693e07ee23c99542cd64e1f41b8c9 (patch)
tree1684216e62375959da52df244c9beab85de9b33f /drivers/platform/x86/toshiba_acpi.c
parent21a3542753a63091bc4700525e6096d76fe32f62 (diff)
toshiba_acpi: Add alternative keymap support for Satellite M840
Toshiba Satellite M840 laptop has a complete different keymap although it's bound with the same ACPI ID "TOS1900". This patch provides an alternative keymap specific to this machine by identifying via DMI matching. The keymap table doesn't fill all entries that were used before since some keys aren't found on this machine at all. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=69761 Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=812209 Reported-and-tested-by: Federico Vecchiarelli <fedev@gmx.net> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Diffstat (limited to 'drivers/platform/x86/toshiba_acpi.c')
-rw-r--r--drivers/platform/x86/toshiba_acpi.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 46473ca7566b..76441dcbe5ff 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -56,6 +56,7 @@
56#include <linux/workqueue.h> 56#include <linux/workqueue.h>
57#include <linux/i8042.h> 57#include <linux/i8042.h>
58#include <linux/acpi.h> 58#include <linux/acpi.h>
59#include <linux/dmi.h>
59#include <asm/uaccess.h> 60#include <asm/uaccess.h>
60 61
61MODULE_AUTHOR("John Belmonte"); 62MODULE_AUTHOR("John Belmonte");
@@ -213,6 +214,30 @@ static const struct key_entry toshiba_acpi_keymap[] = {
213 { KE_END, 0 }, 214 { KE_END, 0 },
214}; 215};
215 216
217/* alternative keymap */
218static const struct dmi_system_id toshiba_alt_keymap_dmi[] = {
219 {
220 .matches = {
221 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
222 DMI_MATCH(DMI_PRODUCT_NAME, "Satellite M840"),
223 },
224 },
225 {}
226};
227
228static const struct key_entry toshiba_acpi_alt_keymap[] = {
229 { KE_KEY, 0x157, { KEY_MUTE } },
230 { KE_KEY, 0x102, { KEY_ZOOMOUT } },
231 { KE_KEY, 0x103, { KEY_ZOOMIN } },
232 { KE_KEY, 0x139, { KEY_ZOOMRESET } },
233 { KE_KEY, 0x13e, { KEY_SWITCHVIDEOMODE } },
234 { KE_KEY, 0x13c, { KEY_BRIGHTNESSDOWN } },
235 { KE_KEY, 0x13d, { KEY_BRIGHTNESSUP } },
236 { KE_KEY, 0x158, { KEY_WLAN } },
237 { KE_KEY, 0x13f, { KEY_TOUCHPAD_TOGGLE } },
238 { KE_END, 0 },
239};
240
216/* utility 241/* utility
217 */ 242 */
218 243
@@ -1440,6 +1465,7 @@ static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev)
1440 acpi_handle ec_handle; 1465 acpi_handle ec_handle;
1441 int error; 1466 int error;
1442 u32 hci_result; 1467 u32 hci_result;
1468 const struct key_entry *keymap = toshiba_acpi_keymap;
1443 1469
1444 dev->hotkey_dev = input_allocate_device(); 1470 dev->hotkey_dev = input_allocate_device();
1445 if (!dev->hotkey_dev) 1471 if (!dev->hotkey_dev)
@@ -1449,7 +1475,9 @@ static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev)
1449 dev->hotkey_dev->phys = "toshiba_acpi/input0"; 1475 dev->hotkey_dev->phys = "toshiba_acpi/input0";
1450 dev->hotkey_dev->id.bustype = BUS_HOST; 1476 dev->hotkey_dev->id.bustype = BUS_HOST;
1451 1477
1452 error = sparse_keymap_setup(dev->hotkey_dev, toshiba_acpi_keymap, NULL); 1478 if (dmi_check_system(toshiba_alt_keymap_dmi))
1479 keymap = toshiba_acpi_alt_keymap;
1480 error = sparse_keymap_setup(dev->hotkey_dev, keymap, NULL);
1453 if (error) 1481 if (error)
1454 goto err_free_dev; 1482 goto err_free_dev;
1455 1483