All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] toshiba_acpi: Add hotkeys support for Toshiba Satellite U940
@ 2013-11-22 23:02 Jose Ignacio Naranjo
  2013-12-05  6:55 ` Jose Ignacio Naranjo
  2014-01-21 13:38 ` Matthew Garrett
  0 siblings, 2 replies; 4+ messages in thread
From: Jose Ignacio Naranjo @ 2013-11-22 23:02 UTC (permalink / raw)
  To: platform-driver-x86; +Cc: Jose Ignacio Naranjo

---
 drivers/platform/x86/toshiba_acpi.c | 41 +++++++++++++++++++++++++++++++++++--
 1 file changed, 39 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 0cfadb6..ff711d5 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -54,6 +54,7 @@
 #include <linux/slab.h>
 #include <linux/workqueue.h>
 #include <linux/i8042.h>
+#include <linux/dmi.h>
 
 #include <asm/uaccess.h>
 
@@ -150,7 +151,7 @@ static const struct acpi_device_id toshiba_device_ids[] = {
 };
 MODULE_DEVICE_TABLE(acpi, toshiba_device_ids);
 
-static const struct key_entry toshiba_acpi_keymap[] = {
+static const struct key_entry toshiba_acpi_default_keymap[] = {
 	{ KE_KEY, 0x101, { KEY_MUTE } },
 	{ KE_KEY, 0x102, { KEY_ZOOMOUT } },
 	{ KE_KEY, 0x103, { KEY_ZOOMIN } },
@@ -178,6 +179,41 @@ static const struct key_entry toshiba_acpi_keymap[] = {
 	{ KE_END, 0 },
 };
 
+static const struct key_entry *keymap = toshiba_acpi_default_keymap;
+
+static struct key_entry keymap_satellite_u940[] = {
+	{ KE_KEY, 0x13c, { KEY_BRIGHTNESSDOWN } },
+	{ KE_KEY, 0x13d, { KEY_BRIGHTNESSUP } },
+	{ KE_KEY, 0x13e, { KEY_SWITCHVIDEOMODE } },
+	{ KE_KEY, 0x13f, { KEY_TOUCHPAD_TOGGLE } },
+	{ KE_KEY, 0x157, { KEY_MUTE} },
+	{ KE_KEY, 0x158, { KEY_WLAN } },
+	{ KE_KEY, 0x12c, { KEY_KBDILLUMTOGGLE } },
+	{ KE_KEY, 0x102, { KEY_ZOOMOUT } },
+	{ KE_KEY, 0x103, { KEY_ZOOMIN } },
+	{ KE_KEY, 0x139, { KEY_ZOOMRESET } },
+	{ KE_END, 0 }
+};
+
+static int dmi_matched(const struct dmi_system_id *dmi)
+{
+	keymap = dmi->driver_data;
+	return 1;
+}
+
+static const struct dmi_system_id dmi_ids[] = {
+	{
+		/* Toshiba Satellite U940 */
+		.callback = dmi_matched,
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE U940"),
+		},
+		.driver_data = keymap_satellite_u940
+	},
+	{ NULL, }
+};
+
 /* utility
  */
 
@@ -984,7 +1020,8 @@ static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev)
 	dev->hotkey_dev->phys = "toshiba_acpi/input0";
 	dev->hotkey_dev->id.bustype = BUS_HOST;
 
-	error = sparse_keymap_setup(dev->hotkey_dev, toshiba_acpi_keymap, NULL);
+	dmi_check_system(dmi_ids);
+	error = sparse_keymap_setup(dev->hotkey_dev, keymap, NULL);
 	if (error)
 		goto err_free_dev;
 
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-01-21 13:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-22 23:02 [PATCH] toshiba_acpi: Add hotkeys support for Toshiba Satellite U940 Jose Ignacio Naranjo
2013-12-05  6:55 ` Jose Ignacio Naranjo
2013-12-05 15:21   ` Matthew Garrett
2014-01-21 13:38 ` Matthew Garrett

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.