Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Input: rotary-encoder - convert documentation into to ReST format

This file require minimum adjustments to be a valid ReST file.
Do it, in order to be able to parse it with Sphinx.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Mauro Carvalho Chehab and committed by
Dmitry Torokhov
42f2309b 7b11fdc3

+38 -36
+38 -36
Documentation/input/rotary-encoder.txt
··· 1 + ============================================================ 1 2 rotary-encoder - a generic driver for GPIO connected devices 2 - Daniel Mack <daniel@caiaq.de>, Feb 2009 3 + ============================================================ 3 4 4 - 0. Function 5 - ----------- 5 + :Author: Daniel Mack <daniel@caiaq.de>, Feb 2009 6 + 7 + Function 8 + -------- 6 9 7 10 Rotary encoders are devices which are connected to the CPU or other 8 11 peripherals with two wires. The outputs are phase-shifted by 90 degrees ··· 16 13 a stable state with both outputs high (half-period mode) and some have 17 14 a stable state in all steps (quarter-period mode). 18 15 19 - The phase diagram of these two outputs look like this: 16 + The phase diagram of these two outputs look like this:: 20 17 21 18 _____ _____ _____ 22 19 | | | | | | ··· 43 40 https://en.wikipedia.org/wiki/Rotary_encoder 44 41 45 42 46 - 1. Events / state machine 47 - ------------------------- 43 + Events / state machine 44 + ---------------------- 48 45 49 46 In half-period mode, state a) and c) above are used to determine the 50 47 rotational direction based on the last stable state. Events are reported in ··· 68 65 should have happened, unless it flipped back on half the way. The 69 66 'armed' state tells us about that. 70 67 71 - 2. Platform requirements 72 - ------------------------ 68 + Platform requirements 69 + --------------------- 73 70 74 71 As there is no hardware dependent call in this driver, the platform it is 75 72 used with must support gpiolib. Another requirement is that IRQs must be 76 73 able to fire on both edges. 77 74 78 75 79 - 3. Board integration 80 - -------------------- 76 + Board integration 77 + ----------------- 81 78 82 79 To use this driver in your system, register a platform_device with the 83 80 name 'rotary-encoder' and associate the IRQs and some specific platform ··· 96 93 Because GPIO to IRQ mapping is platform specific, this information must 97 94 be given in separately to the driver. See the example below. 98 95 99 - ---------<snip>--------- 96 + :: 100 97 101 - /* board support file example */ 98 + /* board support file example */ 102 99 103 - #include <linux/input.h> 104 - #include <linux/rotary_encoder.h> 100 + #include <linux/input.h> 101 + #include <linux/rotary_encoder.h> 105 102 106 - #define GPIO_ROTARY_A 1 107 - #define GPIO_ROTARY_B 2 103 + #define GPIO_ROTARY_A 1 104 + #define GPIO_ROTARY_B 2 108 105 109 - static struct rotary_encoder_platform_data my_rotary_encoder_info = { 110 - .steps = 24, 111 - .axis = ABS_X, 112 - .relative_axis = false, 113 - .rollover = false, 114 - .gpio_a = GPIO_ROTARY_A, 115 - .gpio_b = GPIO_ROTARY_B, 116 - .inverted_a = 0, 117 - .inverted_b = 0, 118 - .half_period = false, 119 - .wakeup_source = false, 120 - }; 106 + static struct rotary_encoder_platform_data my_rotary_encoder_info = { 107 + .steps = 24, 108 + .axis = ABS_X, 109 + .relative_axis = false, 110 + .rollover = false, 111 + .gpio_a = GPIO_ROTARY_A, 112 + .gpio_b = GPIO_ROTARY_B, 113 + .inverted_a = 0, 114 + .inverted_b = 0, 115 + .half_period = false, 116 + .wakeup_source = false, 117 + }; 121 118 122 - static struct platform_device rotary_encoder_device = { 123 - .name = "rotary-encoder", 124 - .id = 0, 125 - .dev = { 126 - .platform_data = &my_rotary_encoder_info, 127 - } 128 - }; 129 - 119 + static struct platform_device rotary_encoder_device = { 120 + .name = "rotary-encoder", 121 + .id = 0, 122 + .dev = { 123 + .platform_data = &my_rotary_encoder_info, 124 + } 125 + };