aboutsummaryrefslogtreecommitdiff
path: root/drivers/input/misc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-09 19:52:01 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-09 19:52:01 -0800
commitfa395aaec823b9d1a5800913a6b5d0e6d1c5ced2 (patch)
treed599abe9f4f48f1737da50fa9a48dadfd08100e3 /drivers/input/misc
parent3e7468313758913c5e4d372f35b271b96bad1298 (diff)
parent1f26978afd123deb22dd3c7dc75771a02f6e03f6 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (51 commits) Input: appletouch - give up maintainership Input: dm355evm_kbd - switch to using sparse keymap library Input: wistron_btns - switch to using sparse keymap library Input: add generic support for sparse keymaps Input: fix memory leak in force feedback core Input: wistron - remove identification strings from DMI table Input: psmouse - remove identification strings from DMI tables Input: atkbd - remove identification strings from DMI table Input: i8042 - remove identification strings from DMI tables DMI: allow omitting ident strings in DMI tables Input: psmouse - do not carry DMI data around Input: matrix-keypad - switch to using dev_pm_ops Input: keyboard - fix lack of locking when traversing handler->h_list Input: gpio_keys - scan gpio state at probe and resume time Input: keyboard - add locking around event handling Input: usbtouchscreen - add support for ET&T TC5UH touchscreen controller Input: xpad - add two new Xbox 360 devices Input: polled device - do not start polling if interval is zero Input: polled device - schedule first poll immediately Input: add S3C24XX touchscreen driver ...
Diffstat (limited to 'drivers/input/misc')
-rw-r--r--drivers/input/misc/Kconfig2
-rw-r--r--drivers/input/misc/ati_remote.c2
-rw-r--r--drivers/input/misc/dm355evm_keys.c150
-rw-r--r--drivers/input/misc/powermate.c2
-rw-r--r--drivers/input/misc/wistron_btns.c256
5 files changed, 143 insertions, 269 deletions
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index a9bb2544b2d..16ec5233441 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -80,6 +80,7 @@ config INPUT_WISTRON_BTNS
tristate "x86 Wistron laptop button interface"
depends on X86 && !X86_64
select INPUT_POLLDEV
+ select INPUT_SPARSEKMAP
select NEW_LEDS
select LEDS_CLASS
select CHECK_SIGNATURE
@@ -281,6 +282,7 @@ config INPUT_RB532_BUTTON
config INPUT_DM355EVM
tristate "TI DaVinci DM355 EVM Keypad and IR Remote"
depends on MFD_DM355EVM_MSP
+ select INPUT_SPARSEKMAP
help
Supports the pushbuttons and IR remote used with
the DM355 EVM board.
diff --git a/drivers/input/misc/ati_remote.c b/drivers/input/misc/ati_remote.c
index e290fde35e7..614b65d78fe 100644
--- a/drivers/input/misc/ati_remote.c
+++ b/drivers/input/misc/ati_remote.c
@@ -766,7 +766,7 @@ static int ati_remote_probe(struct usb_interface *interface, const struct usb_de
ati_remote->interface = interface;
usb_make_path(udev, ati_remote->phys, sizeof(ati_remote->phys));
- strlcpy(ati_remote->phys, "/input0", sizeof(ati_remote->phys));
+ strlcat(ati_remote->phys, "/input0", sizeof(ati_remote->phys));
if (udev->manufacturer)
strlcpy(ati_remote->name, udev->manufacturer, sizeof(ati_remote->name));
diff --git a/drivers/input/misc/dm355evm_keys.c b/drivers/input/misc/dm355evm_keys.c
index f2b67dc81d8..766c06911f4 100644
--- a/drivers/input/misc/dm355evm_keys.c
+++ b/drivers/input/misc/dm355evm_keys.c
@@ -11,6 +11,7 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/input.h>
+#include <linux/input/sparse-keymap.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
@@ -33,12 +34,8 @@ struct dm355evm_keys {
int irq;
};
-/* These initial keycodes can be remapped by dm355evm_setkeycode(). */
-static struct {
- u16 event;
- u16 keycode;
-} dm355evm_keys[] = {
-
+/* These initial keycodes can be remapped */
+static const struct key_entry dm355evm_keys[] = {
/*
* Pushbuttons on the EVM board ... note that the labels for these
* are SW10/SW11/etc on the PC board. The left/right orientation
@@ -47,11 +44,11 @@ static struct {
* is to the right. (That is, rotate the board counter-clockwise
* by 90 degrees from the SW10/etc and "DM355 EVM" labels.)
*/
- { 0x00d8, KEY_OK, }, /* SW12 */
- { 0x00b8, KEY_UP, }, /* SW13 */
- { 0x00e8, KEY_DOWN, }, /* SW11 */
- { 0x0078, KEY_LEFT, }, /* SW14 */
- { 0x00f0, KEY_RIGHT, }, /* SW10 */
+ { KE_KEY, 0x00d8, { KEY_OK } }, /* SW12 */
+ { KE_KEY, 0x00b8, { KEY_UP } }, /* SW13 */
+ { KE_KEY, 0x00e8, { KEY_DOWN } }, /* SW11 */
+ { KE_KEY, 0x0078, { KEY_LEFT } }, /* SW14 */
+ { KE_KEY, 0x00f0, { KEY_RIGHT } }, /* SW10 */
/*
* IR buttons ... codes assigned to match the universal remote
@@ -65,35 +62,35 @@ static struct {
* RC5 codes are 14 bits, with two start bits (0x3 prefix)
* and a toggle bit (masked out below).
*/
- { 0x300c, KEY_POWER, }, /* NOTE: docs omit this */
- { 0x3000, KEY_NUMERIC_0, },
- { 0x3001, KEY_NUMERIC_1, },
- { 0x3002, KEY_NUMERIC_2, },
- { 0x3003, KEY_NUMERIC_3, },
- { 0x3004, KEY_NUMERIC_4, },
- { 0x3005, KEY_NUMERIC_5, },
- { 0x3006, KEY_NUMERIC_6, },
- { 0x3007, KEY_NUMERIC_7, },
- { 0x3008, KEY_NUMERIC_8, },
- { 0x3009, KEY_NUMERIC_9, },
- { 0x3022, KEY_ENTER, },
- { 0x30ec, KEY_MODE, }, /* "tv/vcr/..." */
- { 0x300f, KEY_SELECT, }, /* "info" */
- { 0x3020, KEY_CHANNELUP, }, /* "up" */
- { 0x302e, KEY_MENU, }, /* "in/out" */
- { 0x3011, KEY_VOLUMEDOWN, }, /* "left" */
- { 0x300d, KEY_MUTE, }, /* "ok" */
- { 0x3010, KEY_VOLUMEUP, }, /* "right" */
- { 0x301e, KEY_SUBTITLE, }, /* "cc" */
- { 0x3021, KEY_CHANNELDOWN, }, /* "down" */
- { 0x3022, KEY_PREVIOUS, },
- { 0x3026, KEY_SLEEP, },
- { 0x3172, KEY_REWIND, }, /* NOTE: docs wrongly say 0x30ca */
- { 0x3175, KEY_PLAY, },
- { 0x3174, KEY_FASTFORWARD, },
- { 0x3177, KEY_RECORD, },
- { 0x3176, KEY_STOP, },
- { 0x3169, KEY_PAUSE, },
+ { KE_KEY, 0x300c, { KEY_POWER } }, /* NOTE: docs omit this */
+ { KE_KEY, 0x3000, { KEY_NUMERIC_0 } },
+ { KE_KEY, 0x3001, { KEY_NUMERIC_1 } },
+ { KE_KEY, 0x3002, { KEY_NUMERIC_2 } },
+ { KE_KEY, 0x3003, { KEY_NUMERIC_3 } },
+ { KE_KEY, 0x3004, { KEY_NUMERIC_4 } },
+ { KE_KEY, 0x3005, { KEY_NUMERIC_5 } },
+ { KE_KEY, 0x3006, { KEY_NUMERIC_6 } },
+ { KE_KEY, 0x3007, { KEY_NUMERIC_7 } },
+ { KE_KEY, 0x3008, { KEY_NUMERIC_8 } },
+ { KE_KEY, 0x3009, { KEY_NUMERIC_9 } },
+ { KE_KEY, 0x3022, { KEY_ENTER } },
+ { KE_KEY, 0x30ec, { KEY_MODE } }, /* "tv/vcr/..." */
+ { KE_KEY, 0x300f, { KEY_SELECT } }, /* "info" */
+ { KE_KEY, 0x3020, { KEY_CHANNELUP } }, /* "up" */
+ { KE_KEY, 0x302e, { KEY_MENU } }, /* "in/out" */
+ { KE_KEY, 0x3011, { KEY_VOLUMEDOWN } }, /* "left" */
+ { KE_KEY, 0x300d, { KEY_MUTE } }, /* "ok" */
+ { KE_KEY, 0x3010, { KEY_VOLUMEUP } }, /* "right" */
+ { KE_KEY, 0x301e, { KEY_SUBTITLE } }, /* "cc" */
+ { KE_KEY, 0x3021, { KEY_CHANNELDOWN } },/* "down" */
+ { KE_KEY, 0x3022, { KEY_PREVIOUS } },
+ { KE_KEY, 0x3026, { KEY_SLEEP } },
+ { KE_KEY, 0x3172, { KEY_REWIND } }, /* NOTE: docs wrongly say 0x30ca */
+ { KE_KEY, 0x3175, { KEY_PLAY } },
+ { KE_KEY, 0x3174, { KEY_FASTFORWARD } },
+ { KE_KEY, 0x3177, { KEY_RECORD } },
+ { KE_KEY, 0x3176, { KEY_STOP } },
+ { KE_KEY, 0x3169, { KEY_PAUSE } },
};
/*
@@ -105,19 +102,18 @@ static struct {
*/
static irqreturn_t dm355evm_keys_irq(int irq, void *_keys)
{
- struct dm355evm_keys *keys = _keys;
- int status;
+ static u16 last_event;
+ struct dm355evm_keys *keys = _keys;
+ const struct key_entry *ke;
+ unsigned int keycode;
+ int status;
+ u16 event;
/* For simplicity we ignore INPUT_COUNT and just read
* events until we get the "queue empty" indicator.
* Reading INPUT_LOW decrements the count.
*/
for (;;) {
- static u16 last_event;
- u16 event;
- int keycode;
- int i;
-
status = dm355evm_msp_read(DM355EVM_MSP_INPUT_HIGH);
if (status < 0) {
dev_dbg(keys->dev, "input high err %d\n",
@@ -156,14 +152,9 @@ static irqreturn_t dm355evm_keys_irq(int irq, void *_keys)
/* ignore the RC5 toggle bit */
event &= ~0x0800;
- /* find the key, or leave it as unknown */
- keycode = KEY_UNKNOWN;
- for (i = 0; i < ARRAY_SIZE(dm355evm_keys); i++) {
- if (dm355evm_keys[i].event != event)
- continue;
- keycode = dm355evm_keys[i].keycode;
- break;
- }
+ /* find the key, or report it as unknown */
+ ke = sparse_keymap_entry_from_scancode(keys->input, event);
+ keycode = ke ? ke->keycode : KEY_UNKNOWN;
dev_dbg(keys->dev,
"input event 0x%04x--> keycode %d\n",
event, keycode);
@@ -174,36 +165,8 @@ static irqreturn_t dm355evm_keys_irq(int irq, void *_keys)
input_report_key(keys->input, keycode, 0);
input_sync(keys->input);
}
- return IRQ_HANDLED;
-}
-static int dm355evm_setkeycode(struct input_dev *dev, int index, int keycode)
-{
- u16 old_keycode;
- unsigned i;
-
- if (((unsigned)index) >= ARRAY_SIZE(dm355evm_keys))
- return -EINVAL;
-
- old_keycode = dm355evm_keys[index].keycode;
- dm355evm_keys[index].keycode = keycode;
- set_bit(keycode, dev->keybit);
-
- for (i = 0; i < ARRAY_SIZE(dm355evm_keys); i++) {
- if (dm355evm_keys[index].keycode == old_keycode)
- goto done;
- }
- clear_bit(old_keycode, dev->keybit);
-done:
- return 0;
-}
-
-static int dm355evm_getkeycode(struct input_dev *dev, int index, int *keycode)
-{
- if (((unsigned)index) >= ARRAY_SIZE(dm355evm_keys))
- return -EINVAL;
-
- return dm355evm_keys[index].keycode;
+ return IRQ_HANDLED;
}
/*----------------------------------------------------------------------*/
@@ -213,7 +176,6 @@ static int __devinit dm355evm_keys_probe(struct platform_device *pdev)
struct dm355evm_keys *keys;
struct input_dev *input;
int status;
- int i;
/* allocate instance struct and input dev */
keys = kzalloc(sizeof *keys, GFP_KERNEL);
@@ -242,31 +204,30 @@ static int __devinit dm355evm_keys_probe(struct platform_device *pdev)
input->id.product = 0x0355;
input->id.version = dm355evm_msp_read(DM355EVM_MSP_FIRMREV);
- input->evbit[0] = BIT(EV_KEY);
- for (i = 0; i < ARRAY_SIZE(dm355evm_keys); i++)
- __set_bit(dm355evm_keys[i].keycode, input->keybit);
-
- input->setkeycode = dm355evm_setkeycode;
- input->getkeycode = dm355evm_getkeycode;
+ status = sparse_keymap_setup(input, dm355evm_keys, NULL);
+ if (status)
+ goto fail1;
/* REVISIT: flush the event queue? */
status = request_threaded_irq(keys->irq, NULL, dm355evm_keys_irq,
IRQF_TRIGGER_FALLING, dev_name(&pdev->dev), keys);
if (status < 0)
- goto fail1;
+ goto fail2;
/* register */
status = input_register_device(input);
if (status < 0)
- goto fail2;
+ goto fail3;
platform_set_drvdata(pdev, keys);
return 0;
-fail2:
+fail3:
free_irq(keys->irq, keys);
+fail2:
+ sparse_keymap_free(input);
fail1:
input_free_device(input);
kfree(keys);
@@ -280,6 +241,7 @@ static int __devexit dm355evm_keys_remove(struct platform_device *pdev)
struct dm355evm_keys *keys = platform_get_drvdata(pdev);
free_irq(keys->irq, keys);
+ sparse_keymap_free(keys->input);
input_unregister_device(keys->input);
kfree(keys);
diff --git a/drivers/input/misc/powermate.c b/drivers/input/misc/powermate.c
index a53c4885fba..668913d1204 100644
--- a/drivers/input/misc/powermate.c
+++ b/drivers/input/misc/powermate.c
@@ -338,7 +338,7 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
pm->input = input_dev;
usb_make_path(udev, pm->phys, sizeof(pm->phys));
- strlcpy(pm->phys, "/input0", sizeof(pm->phys));
+ strlcat(pm->phys, "/input0", sizeof(pm->phys));
spin_lock_init(&pm->lock);
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
index a932179c4c9..38da6ab0438 100644
--- a/drivers/input/misc/wistron_btns.c
+++ b/drivers/input/misc/wistron_btns.c
@@ -21,6 +21,7 @@
#include <linux/dmi.h>
#include <linux/init.h>
#include <linux/input-polldev.h>
+#include <linux/input/sparse-keymap.h>
#include <linux/interrupt.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
@@ -224,19 +225,8 @@ static void bios_set_state(u8 subsys, int enable)
/* Hardware database */
-struct key_entry {
- char type; /* See KE_* below */
- u8 code;
- union {
- u16 keycode; /* For KE_KEY */
- struct { /* For KE_SW */
- u8 code;
- u8 value;
- } sw;
- };
-};
-
-enum { KE_END, KE_KEY, KE_SW, KE_WIFI, KE_BLUETOOTH };
+#define KE_WIFI (KE_LAST + 1)
+#define KE_BLUETOOTH (KE_LAST + 2)
#define FE_MAIL_LED 0x01
#define FE_WIFI_LED 0x02
@@ -644,10 +634,10 @@ static struct key_entry keymap_prestigio[] __initdata = {
* a list of buttons and their key codes (reported when loading this module
* with force=1) and the output of dmidecode to $MODULE_AUTHOR.
*/
-static struct dmi_system_id dmi_ids[] __initdata = {
+static const struct dmi_system_id __initconst dmi_ids[] = {
{
+ /* Fujitsu-Siemens Amilo Pro V2000 */
.callback = dmi_matched,
- .ident = "Fujitsu-Siemens Amilo Pro V2000",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2000"),
@@ -655,8 +645,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_fs_amilo_pro_v2000
},
{
+ /* Fujitsu-Siemens Amilo Pro Edition V3505 */
.callback = dmi_matched,
- .ident = "Fujitsu-Siemens Amilo Pro Edition V3505",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro Edition V3505"),
@@ -664,8 +654,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_fs_amilo_pro_v3505
},
{
+ /* Fujitsu-Siemens Amilo M7400 */
.callback = dmi_matched,
- .ident = "Fujitsu-Siemens Amilo M7400",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
DMI_MATCH(DMI_PRODUCT_NAME, "AMILO M "),
@@ -673,8 +663,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_fs_amilo_pro_v2000
},
{
+ /* Maxdata Pro 7000 DX */
.callback = dmi_matched,
- .ident = "Maxdata Pro 7000 DX",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "MAXDATA"),
DMI_MATCH(DMI_PRODUCT_NAME, "Pro 7000"),
@@ -682,8 +672,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_fs_amilo_pro_v2000
},
{
+ /* Fujitsu N3510 */
.callback = dmi_matched,
- .ident = "Fujitsu N3510",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
DMI_MATCH(DMI_PRODUCT_NAME, "N3510"),
@@ -691,8 +681,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_fujitsu_n3510
},
{
+ /* Acer Aspire 1500 */
.callback = dmi_matched,
- .ident = "Acer Aspire 1500",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1500"),
@@ -700,8 +690,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_acer_aspire_1500
},
{
+ /* Acer Aspire 1600 */
.callback = dmi_matched,
- .ident = "Acer Aspire 1600",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1600"),
@@ -709,8 +699,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_acer_aspire_1600
},
{
+ /* Acer Aspire 3020 */
.callback = dmi_matched,
- .ident = "Acer Aspire 3020",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 3020"),
@@ -718,8 +708,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_acer_aspire_5020
},
{
+ /* Acer Aspire 5020 */
.callback = dmi_matched,
- .ident = "Acer Aspire 5020",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5020"),
@@ -727,8 +717,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_acer_aspire_5020
},
{
+ /* Acer TravelMate 2100 */
.callback = dmi_matched,
- .ident = "Acer TravelMate 2100",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2100"),
@@ -736,8 +726,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_acer_aspire_5020
},
{
+ /* Acer TravelMate 2410 */
.callback = dmi_matched,
- .ident = "Acer TravelMate 2410",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2410"),
@@ -745,8 +735,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_acer_travelmate_2410
},
{
+ /* Acer TravelMate C300 */
.callback = dmi_matched,
- .ident = "Acer TravelMate C300",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate C300"),
@@ -754,8 +744,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_acer_travelmate_300
},
{
+ /* Acer TravelMate C100 */
.callback = dmi_matched,
- .ident = "Acer TravelMate C100",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate C100"),
@@ -763,8 +753,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_acer_travelmate_300
},
{
+ /* Acer TravelMate C110 */
.callback = dmi_matched,
- .ident = "Acer TravelMate C110",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate C110"),
@@ -772,8 +762,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_acer_travelmate_110
},
{
+ /* Acer TravelMate 380 */
.callback = dmi_matched,
- .ident = "Acer TravelMate 380",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 380"),
@@ -781,8 +771,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_acer_travelmate_380
},
{
+ /* Acer TravelMate 370 */
.callback = dmi_matched,
- .ident = "Acer TravelMate 370",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 370"),
@@ -790,8 +780,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_acer_travelmate_380 /* keyboard minus 1 key */
},
{
+ /* Acer TravelMate 220 */
.callback = dmi_matched,
- .ident = "Acer TravelMate 220",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 220"),
@@ -799,8 +789,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_acer_travelmate_220
},
{
+ /* Acer TravelMate 260 */
.callback = dmi_matched,
- .ident = "Acer TravelMate 260",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 260"),
@@ -808,8 +798,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_acer_travelmate_220
},
{
+ /* Acer TravelMate 230 */
.callback = dmi_matched,
- .ident = "Acer TravelMate 230",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 230"),
@@ -818,8 +808,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_acer_travelmate_230
},
{
+ /* Acer TravelMate 280 */
.callback = dmi_matched,
- .ident = "Acer TravelMate 280",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 280"),
@@ -827,8 +817,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_acer_travelmate_230
},
{
+ /* Acer TravelMate 240 */
.callback = dmi_matched,
- .ident = "Acer TravelMate 240",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 240"),
@@ -836,8 +826,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_acer_travelmate_240
},
{
+ /* Acer TravelMate 250 */
.callback = dmi_matched,
- .ident = "Acer TravelMate 250",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 250"),
@@ -845,8 +835,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_acer_travelmate_240
},
{
+ /* Acer TravelMate 2424NWXCi */
.callback = dmi_matched,
- .ident = "Acer TravelMate 2424NWXCi",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2420"),
@@ -854,8 +844,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_acer_travelmate_240
},
{
+ /* Acer TravelMate 350 */
.callback = dmi_matched,
- .ident = "Acer TravelMate 350",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 350"),
@@ -863,8 +853,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_acer_travelmate_350
},
{
+ /* Acer TravelMate 360 */
.callback = dmi_matched,
- .ident = "Acer TravelMate 360",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 360"),
@@ -872,8 +862,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_acer_travelmate_360
},
{
+ /* Acer TravelMate 610 */
.callback = dmi_matched,
- .ident = "Acer TravelMate 610",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ACER"),
DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 610"),
@@ -881,8 +871,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_acer_travelmate_610
},
{
+ /* Acer TravelMate 620 */
.callback = dmi_matched,
- .ident = "Acer TravelMate 620",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 620"),
@@ -890,8 +880,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_acer_travelmate_630
},
{
+ /* Acer TravelMate 630 */
.callback = dmi_matched,
- .ident = "Acer TravelMate 630",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 630"),
@@ -899,8 +889,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_acer_travelmate_630
},
{
+ /* AOpen 1559AS */
.callback = dmi_matched,
- .ident = "AOpen 1559AS",
.matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "E2U"),
DMI_MATCH(DMI_BOARD_NAME, "E2U"),
@@ -908,8 +898,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_aopen_1559as
},
{
+ /* Medion MD 9783 */
.callback = dmi_matched,
- .ident = "Medion MD 9783",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "MEDIONNB"),
DMI_MATCH(DMI_PRODUCT_NAME, "MD 9783"),
@@ -917,8 +907,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_wistron_ms2111
},
{
+ /* Medion MD 40100 */
.callback = dmi_matched,
- .ident = "Medion MD 40100",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "MEDIONNB"),
DMI_MATCH(DMI_PRODUCT_NAME, "WID2000"),
@@ -926,8 +916,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_wistron_md40100
},
{
+ /* Medion MD 2900 */
.callback = dmi_matched,
- .ident = "Medion MD 2900",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "MEDIONNB"),
DMI_MATCH(DMI_PRODUCT_NAME, "WIM 2000"),
@@ -935,8 +925,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_wistron_md2900
},
{
+ /* Medion MD 42200 */
.callback = dmi_matched,
- .ident = "Medion MD 42200",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Medion"),
DMI_MATCH(DMI_PRODUCT_NAME, "WIM 2030"),
@@ -944,8 +934,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_fs_amilo_pro_v2000
},
{
+ /* Medion MD 96500 */
.callback = dmi_matched,
- .ident = "Medion MD 96500",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "MEDIONPC"),
DMI_MATCH(DMI_PRODUCT_NAME, "WIM 2040"),
@@ -953,8 +943,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_wistron_md96500
},
{
+ /* Medion MD 95400 */
.callback = dmi_matched,
- .ident = "Medion MD 95400",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "MEDIONPC"),
DMI_MATCH(DMI_PRODUCT_NAME, "WIM 2050"),
@@ -962,8 +952,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_wistron_md96500
},
{
+ /* Fujitsu Siemens Amilo D7820 */
.callback = dmi_matched,
- .ident = "Fujitsu Siemens Amilo D7820",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), /* not sure */
DMI_MATCH(DMI_PRODUCT_NAME, "Amilo D"),
@@ -971,8 +961,8 @@ static struct dmi_system_id dmi_ids[] __initdata = {
.driver_data = keymap_fs_amilo_d88x0
},
{
+ /* Fujitsu Siemens Amilo D88x0 */
.callback = dmi_matched,
- .ident = "Fujitsu Siemens Amilo D88x0",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
DMI_MATCH(DMI_PRODUCT_NAME, "AMILO D"),
@@ -1037,21 +1027,6 @@ static unsigned long jiffies_last_press;
static bool wifi_enabled;
static bool bluetooth_enabled;
-static void report_key(struct input_dev *dev, unsigned int keycode)
-{
- input_report_key(dev, keycode, 1);
- input_sync(dev);
- input_report_key(dev, keycode, 0);
- input_sync(dev);
-}
-
-static void report_switch(struct input_dev *dev, unsigned int code, int value)
-{
- input_report_switch(dev, code, value);
- input_sync(dev);
-}
-
-
/* led management */
static void wistron_mail_led_set(struct led_classdev *led_cdev,
enum led_brightness value)
@@ -1128,43 +1103,13 @@ static inline void wistron_led_resume(void)
led_classdev_resume(&wistron_wifi_led);
}
-static struct key_entry *wistron_get_entry_by_scancode(int code)
-{
- struct key_entry *key;
-
- for (key = keymap; key->type != KE_END; key++)
- if (code == key->code)
- return key;
-
- return NULL;
-}
-
-static struct key_entry *wistron_get_entry_by_keycode(int keycode)
-{
- struct key_entry *key;
-
- for (key = keymap; key->type != KE_END; key++)
- if (key->type == KE_KEY && keycode == key->keycode)
- return key;
-
- return NULL;
-}
-
static void handle_key(u8 code)
{
- const struct key_entry *key = wistron_get_entry_by_scancode(code);
+ const struct key_entry *key =
+ sparse_keymap_entry_from_scancode(wistron_idev->input, code);
if (key) {
switch (key->type) {
- case KE_KEY:
- report_key(wistron_idev->input, key->keycode);
- break;
-
- case KE_SW:
- report_switch(wistron_idev->input,
- key->sw.code, key->sw.value);
- break;
-
case KE_WIFI:
if (have_wifi) {
wifi_enabled = !wifi_enabled;
@@ -1180,7 +1125,9 @@ static void handle_key(u8 code)
break;
default:
- BUG();
+ sparse_keymap_report_entry(wistron_idev->input,
+ key, 1, true);
+ break;
}
jiffies_last_press = jiffies;
} else
@@ -1220,42 +1167,39 @@ static void wistron_poll(struct input_polled_dev *dev)
dev->poll_interval = POLL_INTERVAL_DEFAULT;
}
-static int wistron_getkeycode(struct input_dev *dev, int scancode, int *keycode)
+static int __devinit wistron_setup_keymap(struct input_dev *dev,
+ struct key_entry *entry)
{
- const struct key_entry *key = wistron_get_entry_by_scancode(scancode);
+ switch (entry->type) {
- if (key && key->type == KE_KEY) {
- *keycode = key->keycode;
- return 0;
- }
-
- return -EINVAL;
-}
+ /* if wifi or bluetooth are not available, create normal keys */
+ case KE_WIFI:
+ if (!have_wifi) {
+ entry->type = KE_KEY;
+ entry->keycode = KEY_WLAN;
+ }
+ break;
-static int wistron_setkeycode(struct input_dev *dev, int scancode, int keycode)
-{
- struct key_entry *key;
- int old_keycode;
-
- if (keycode < 0 || keycode > KEY_MAX)
- return -EINVAL;
-
- key = wistron_get_entry_by_scancode(scancode);
- if (key && key->type == KE_KEY) {
- old_keycode = key->keycode;
- key->keycode = keycode;
- set_bit(keycode, dev->keybit);
- if (!wistron_get_entry_by_keycode(old_keycode))
- clear_bit(old_keycode, dev->keybit);
- return 0;
+ case KE_BLUETOOTH:
+ if (!have_bluetooth) {
+ entry->type = KE_KEY;
+ entry->keycode = KEY_BLUETOOTH;
+ }
+ break;
+
+ case KE_END:
+ if (entry->code & FE_UNTESTED)
+ printk(KERN_WARNING "Untested laptop multimedia keys, "
+ "please report success or failure to "
+ "eric.piel@tremplin-utc.net\n");
+ break;
}
- return -EINVAL;
+ return 0;
}
static int __devinit setup_input_dev(void)
{
- struct key_entry *key;
struct input_dev *input_dev;
int error;
@@ -1263,7 +1207,7 @@ static int __devinit setup_input_dev(void)
if (!wistron_idev)
return -ENOMEM;
- wistron_idev->flush = wistron_flush;
+ wistron_idev->open = wistron_flush;
wistron_idev->poll = wistron_poll;
wistron_idev->poll_interval = POLL_INTERVAL_DEFAULT;
@@ -1273,56 +1217,21 @@ static int __devinit setup_input_dev(void)
input_dev->id.bustype = BUS_HOST;
input_dev->dev.parent = &wistron_device->dev;
- input_dev->getkeycode = wistron_getkeycode;
- input_dev->setkeycode = wistron_setkeycode;
-
- for (key = keymap; key->type != KE_END; key++) {
- switch (key->type) {
- case KE_KEY:
- set_bit(EV_KEY, input_dev->evbit);
- set_bit(key->keycode, input_dev->keybit);
- break;
-
- case KE_SW:
- set_bit(EV_SW, input_dev->evbit);
- set_bit(key->sw.code, input_dev->swbit);
- break;
-
- /* if wifi or bluetooth are not available, create normal keys */
- case KE_WIFI:
- if (!have_wifi) {
- key->type = KE_KEY;
- key->keycode = KEY_WLAN;
- key--;
- }
- break;
-
- case KE_BLUETOOTH:
- if (!have_bluetooth) {
- key->type = KE_KEY;
- key->keycode = KEY_BLUETOOTH;
- key--;
- }
- break;
-
- default:
- break;
- }
- }
-
- /* reads information flags on KE_END */
- if (key->code & FE_UNTESTED)
- printk(KERN_WARNING "Untested laptop multimedia keys, "
- "please report success or failure to eric.piel"
- "@tremplin-utc.net\n");
+ error = sparse_keymap_setup(input_dev, keymap, wistron_setup_keymap);
+ if (error)
+ goto err_free_dev;
error = input_register_polled_device(wistron_idev);
- if (error) {
- input_free_polled_device(wistron_idev);
- return error;
- }
+ if (error)
+ goto err_free_keymap;
return 0;
+
+ err_free_keymap:
+ sparse_keymap_free(input_dev);
+ err_free_dev:
+ input_free_polled_device(wistron_idev);
+ return error;
}
/* Driver core */
@@ -1371,6 +1280,7 @@ static int __devexit wistron_remove(struct platform_device *dev)
{
wistron_led_remove();
input_unregister_polled_device(wistron_idev);
+ sparse_keymap_free(wistron_idev->input);
input_free_polled_device(wistron_idev);
bios_detach();