aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/input
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-09 22:52:01 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-09 22:52:01 -0500
commitfa395aaec823b9d1a5800913a6b5d0e6d1c5ced2 (patch)
treed599abe9f4f48f1737da50fa9a48dadfd08100e3 /include/linux/input
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 'include/linux/input')
-rw-r--r--include/linux/input/matrix_keypad.h3
-rw-r--r--include/linux/input/sparse-keymap.h62
2 files changed, 65 insertions, 0 deletions
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h
index b3cd42d50e16..3bd018baae20 100644
--- a/include/linux/input/matrix_keypad.h
+++ b/include/linux/input/matrix_keypad.h
@@ -41,6 +41,9 @@ struct matrix_keymap_data {
41 * @col_scan_delay_us: delay, measured in microseconds, that is 41 * @col_scan_delay_us: delay, measured in microseconds, that is
42 * needed before we can keypad after activating column gpio 42 * needed before we can keypad after activating column gpio
43 * @debounce_ms: debounce interval in milliseconds 43 * @debounce_ms: debounce interval in milliseconds
44 * @active_low: gpio polarity
45 * @wakeup: controls whether the device should be set up as wakeup
46 * source
44 * 47 *
45 * This structure represents platform-specific data that use used by 48 * This structure represents platform-specific data that use used by
46 * matrix_keypad driver to perform proper initialization. 49 * matrix_keypad driver to perform proper initialization.
diff --git a/include/linux/input/sparse-keymap.h b/include/linux/input/sparse-keymap.h
new file mode 100644
index 000000000000..52db62064c6e
--- /dev/null
+++ b/include/linux/input/sparse-keymap.h
@@ -0,0 +1,62 @@
1#ifndef _SPARSE_KEYMAP_H
2#define _SPARSE_KEYMAP_H
3
4/*
5 * Copyright (c) 2009 Dmitry Torokhov
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11
12#define KE_END 0 /* Indicates end of keymap */
13#define KE_KEY 1 /* Ordinary key/button */
14#define KE_SW 2 /* Switch (predetermined value) */
15#define KE_VSW 3 /* Switch (value supplied at runtime) */
16#define KE_IGNORE 4 /* Known entry that should be ignored */
17#define KE_LAST KE_IGNORE
18
19/**
20 * struct key_entry - keymap entry for use in sparse keymap
21 * @type: Type of the key entry (KE_KEY, KE_SW, KE_VSW, KE_END);
22 * drivers are allowed to extend the list with their own
23 * private definitions.
24 * @code: Device-specific data identifying the button/switch
25 * @keycode: KEY_* code assigned to a key/button
26 * @sw.code: SW_* code assigned to a switch
27 * @sw.value: Value that should be sent in an input even when KE_SW
28 * switch is toggled. KE_VSW switches ignore this field and
29 * expect driver to supply value for the event.
30 *
31 * This structure defines an entry in a sparse keymap used by some
32 * input devices for which traditional table-based approach is not
33 * suitable.
34 */
35struct key_entry {
36 int type; /* See KE_* above */
37 u32 code;
38 union {
39 u16 keycode; /* For KE_KEY */
40 struct { /* For KE_SW, KE_VSW */
41 u8 code;
42 u8 value; /* For KE_SW, ignored by KE_VSW */
43 } sw;
44 };
45};
46
47struct key_entry *sparse_keymap_entry_from_scancode(struct input_dev *dev,
48 unsigned int code);
49struct key_entry *sparse_keymap_entry_from_keycode(struct input_dev *dev,
50 unsigned int code);
51int sparse_keymap_setup(struct input_dev *dev,
52 const struct key_entry *keymap,
53 int (*setup)(struct input_dev *, struct key_entry *));
54void sparse_keymap_free(struct input_dev *dev);
55
56void sparse_keymap_report_entry(struct input_dev *dev, const struct key_entry *ke,
57 unsigned int value, bool autorelease);
58
59bool sparse_keymap_report_event(struct input_dev *dev, unsigned int code,
60 unsigned int value, bool autorelease);
61
62#endif /* _SPARSE_KEYMAP_H */