Skip to contentSkip to conversation

toshiba_acpi: Add alternative keymap support for Satellite M840

PATCH In review Takashi Iwai 1 participant 2 messages Apr 29, 2014 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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

---
 drivers/platform/x86/toshiba_acpi.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)
drivers/platform/x86/toshiba_acpi.c +29 -1
index 46473ca7566b..76441dcbe5ff 100644
@@ -56,6 +56,7 @@
 #include <linux/workqueue.h>
 #include <linux/i8042.h>
 #include <linux/acpi.h>
+#include <linux/dmi.h>
 #include <asm/uaccess.h>
 
 MODULE_AUTHOR("John Belmonte");
@@ -213,6 +214,30 @@ static const struct key_entry toshiba_acpi_keymap[] = {
 	{ KE_END, 0 },
 };
 
+/* alternative keymap */
+static const struct dmi_system_id toshiba_alt_keymap_dmi[] = {
+	{
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Satellite M840"),
+		},
+	},
+	{}
+};
+
+static const struct key_entry toshiba_acpi_alt_keymap[] = {
+	{ KE_KEY, 0x157, { KEY_MUTE } },
+	{ KE_KEY, 0x102, { KEY_ZOOMOUT } },
+	{ KE_KEY, 0x103, { KEY_ZOOMIN } },
+	{ KE_KEY, 0x139, { KEY_ZOOMRESET } },
+	{ KE_KEY, 0x13e, { KEY_SWITCHVIDEOMODE } },
+	{ KE_KEY, 0x13c, { KEY_BRIGHTNESSDOWN } },
+	{ KE_KEY, 0x13d, { KEY_BRIGHTNESSUP } },
+	{ KE_KEY, 0x158, { KEY_WLAN } },
+	{ KE_KEY, 0x13f, { KEY_TOUCHPAD_TOGGLE } },
+	{ KE_END, 0 },
+};
+
 /* utility
  */
 
@@ -1440,6 +1465,7 @@ static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev)
 	acpi_handle ec_handle;
 	int error;
 	u32 hci_result;
+	const struct key_entry *keymap = toshiba_acpi_keymap;
 
 	dev->hotkey_dev = input_allocate_device();
 	if (!dev->hotkey_dev)
@@ -1449,7 +1475,9 @@ 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);
+	if (dmi_check_system(toshiba_alt_keymap_dmi))
+		keymap = toshiba_acpi_alt_keymap;
+	error = sparse_keymap_setup(dev->hotkey_dev, keymap, NULL);
 	if (error)
 		goto err_free_dev;
 
Signature · 1 line
1.9.2

A message that is not in the archive (sent off-list or not yet received): CAO0y3r6ech=2o+NjFzK=6m83H_TsXnnD3-8aUbmDHp2CySug_g@mail.gmail.com

#2 lore raw

At Tue, 29 Apr 2014 16:05:54 +0200,

Quoted 5 lines · Jose Ignacio Naranjo

Hi,

I sent a similar solution some months ago for another Toshiba's model

Quoted 7 lines

http://permalink.gmane.org/gmane.linux.drivers.platform.x86.devel/5198

I answered to the thread, but I just noticed it didn't make it to the list. Don't know why, maybe because of having attached some files :(

My answer was basically if we could use the oem_table_id instead of DMI, but I don't know others dsdt from Toshiba.

Yeah, that sounds feasible. I'm also not particularly in favor of DMI, either. It was used just because it's the easiest way.

I cannot answer to both of Matthew's questions in the thread above, as I'm no owner of the machine but merely a patch monkey who tried to solve a bug on openSUSE. Feel free to join to the bugzilla thread mentioned in the patch for more detailed information.

thanks,

Takashi

Quoted 100 lines

Regards,
JI

Quoted 81 lines · Takashi Iwai

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

---
 drivers/platform/x86/toshiba_acpi.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)
drivers/platform/x86/toshiba_acpi.c +26 -0
index 46473ca7566b..76441dcbe5ff 100644
@@ -56,6 +56,7 @@
 #include <linux/workqueue.h>
 #include <linux/i8042.h>
 #include <linux/acpi.h>
+#include <linux/dmi.h>
 #include <asm/uaccess.h>
 
 MODULE_AUTHOR("John Belmonte");
@@ -213,6 +214,30 @@ static const struct key_entry toshiba_acpi_keymap[] =
 {
        { KE_END, 0 },
 };
 
+/* alternative keymap */
+static const struct dmi_system_id toshiba_alt_keymap_dmi[] = {
+       {
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Satellite M840"),
+               },
+       },
+       {}
+};
+
+static const struct key_entry toshiba_acpi_alt_keymap[] = {
+       { KE_KEY, 0x157, { KEY_MUTE } },
+       { KE_KEY, 0x102, { KEY_ZOOMOUT } },
+       { KE_KEY, 0x103, { KEY_ZOOMIN } },
+       { KE_KEY, 0x139, { KEY_ZOOMRESET } },
+       { KE_KEY, 0x13e, { KEY_SWITCHVIDEOMODE } },
+       { KE_KEY, 0x13c, { KEY_BRIGHTNESSDOWN } },
+       { KE_KEY, 0x13d, { KEY_BRIGHTNESSUP } },
+       { KE_KEY, 0x158, { KEY_WLAN } },
+       { KE_KEY, 0x13f, { KEY_TOUCHPAD_TOGGLE } },
+       { KE_END, 0 },
+};
+
 /* utility
  */
@@ -1440,6 +1465,7 @@ static int toshiba_acpi_setup_keyboard(struct
 toshiba_acpi_dev *dev)
        acpi_handle ec_handle;
        int error;
        u32 hci_result;
+       const struct key_entry *keymap = toshiba_acpi_keymap;
 
        dev->hotkey_dev = input_allocate_device();
        if (!dev->hotkey_dev)
drivers/platform/x86/toshiba_acpi.c +3 -1
@@ -1449,7 +1475,9 @@ 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);
+       if (dmi_check_system(toshiba_alt_keymap_dmi))
+               keymap = toshiba_acpi_alt_keymap;
+       error = sparse_keymap_setup(dev->hotkey_dev, keymap, NULL);
        if (error)
                goto err_free_dev;
Quoted 9 lines

--
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

[2 <text/html; UTF-8 (quoted-printable)>]