aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-04-13 14:37:23 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-13 14:37:23 -0400
commitb534d388c268ad051c72b187106a3c99021be006 (patch)
treeccfe40792b52366ce237c2043256d28916a0122e /Documentation
parentc751085943362143f84346d274e0011419c84202 (diff)
parentba28f22e7cf16cb310bb491cbb3f7d0d5d1f5c5d (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: (22 commits) Input: i8042 - add HP DV9700 to the noloop list Input: arrange drivers/input/misc/Makefile in alphabetical order Input: add AD7879 Touchscreen driver Input: add AD7877 touchscreen driver Input: bf54x-keys - fix typo in warning Input: add driver for S1 button of rb532 Input: generic driver for rotary encoders on GPIOs Input: hilkbd - fix crash when removing hilkbd module Input: atkbd - add quirk for Fujitsu Siemens Amilo PA 1510 Input: atkbd - consolidate force release quirk setup Input: add accelerated touchscreen support for Marvell Zylonite Input: ucb1400_ts, mainstone-wm97xx - add BTN_TOUCH events Input: wm97xx - use disable_irq_nosync() for Mainstone Input: wm97xx - add BTN_TOUCH event to wm97xx to use it with Android Input: fix polling of /proc/bus/input/devices Input: psmouse - add newline to OLPC HGPK touchpad debugging Input: ati_remote2 - check module params Input: ati_remote2 - add per device attrs Input: ati_remote2 - complete suspend support Input: stop autorepeat timer on key release ...
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/input/rotary-encoder.txt101
1 files changed, 101 insertions, 0 deletions
diff --git a/Documentation/input/rotary-encoder.txt b/Documentation/input/rotary-encoder.txt
new file mode 100644
index 000000000000..435102a26d96
--- /dev/null
+++ b/Documentation/input/rotary-encoder.txt
@@ -0,0 +1,101 @@
1rotary-encoder - a generic driver for GPIO connected devices
2Daniel Mack <daniel@caiaq.de>, Feb 2009
3
40. Function
5-----------
6
7Rotary encoders are devices which are connected to the CPU or other
8peripherals with two wires. The outputs are phase-shifted by 90 degrees
9and by triggering on falling and rising edges, the turn direction can
10be determined.
11
12The phase diagram of these two outputs look like this:
13
14 _____ _____ _____
15 | | | | | |
16 Channel A ____| |_____| |_____| |____
17
18 : : : : : : : : : : : :
19 __ _____ _____ _____
20 | | | | | | |
21 Channel B |_____| |_____| |_____| |__
22
23 : : : : : : : : : : : :
24 Event a b c d a b c d a b c d
25
26 |<-------->|
27 one step
28
29
30For more information, please see
31 http://en.wikipedia.org/wiki/Rotary_encoder
32
33
341. Events / state machine
35-------------------------
36
37a) Rising edge on channel A, channel B in low state
38 This state is used to recognize a clockwise turn
39
40b) Rising edge on channel B, channel A in high state
41 When entering this state, the encoder is put into 'armed' state,
42 meaning that there it has seen half the way of a one-step transition.
43
44c) Falling edge on channel A, channel B in high state
45 This state is used to recognize a counter-clockwise turn
46
47d) Falling edge on channel B, channel A in low state
48 Parking position. If the encoder enters this state, a full transition
49 should have happend, unless it flipped back on half the way. The
50 'armed' state tells us about that.
51
522. Platform requirements
53------------------------
54
55As there is no hardware dependent call in this driver, the platform it is
56used with must support gpiolib. Another requirement is that IRQs must be
57able to fire on both edges.
58
59
603. Board integration
61--------------------
62
63To use this driver in your system, register a platform_device with the
64name 'rotary-encoder' and associate the IRQs and some specific platform
65data with it.
66
67struct rotary_encoder_platform_data is declared in
68include/linux/rotary-encoder.h and needs to be filled with the number of
69steps the encoder has and can carry information about externally inverted
70signals (because of used invertig buffer or other reasons).
71
72Because GPIO to IRQ mapping is platform specific, this information must
73be given in seperately to the driver. See the example below.
74
75---------<snip>---------
76
77/* board support file example */
78
79#include <linux/input.h>
80#include <linux/rotary_encoder.h>
81
82#define GPIO_ROTARY_A 1
83#define GPIO_ROTARY_B 2
84
85static struct rotary_encoder_platform_data my_rotary_encoder_info = {
86 .steps = 24,
87 .axis = ABS_X,
88 .gpio_a = GPIO_ROTARY_A,
89 .gpio_b = GPIO_ROTARY_B,
90 .inverted_a = 0,
91 .inverted_b = 0,
92};
93
94static struct platform_device rotary_encoder_device = {
95 .name = "rotary-encoder",
96 .id = 0,
97 .dev = {
98 .platform_data = &my_rotary_encoder_info,
99 }
100};
101