← Documents Documentation/devicetree/bindings/input/pxa27x-keypad.txt GitHub 원문 ↗

Linux 6.18.37 · Devicetree Bindings

Marvell PXA27x Keypad

Matrix, direct key와 두 rotary encoder를 지원하는 keypad 바인딩입니다.

Source pathDocumentation/devicetree/bindings/input/pxa27x-keypad.txt
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약과 해설

pxa27x-keypad.txt:1-60

Packed debounce/keycode field와 3x5 matrix 예제를 설명합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 * Marvell PXA Keypad controller
2
3 Required Properties
4 - compatible : should be "marvell,pxa27x-keypad"
5 - reg : Address and length of the register set for the device
6 - interrupts : The interrupt for the keypad controller
7 - marvell,debounce-interval : How long time the key will be
8 recognized when it is pressed. It is a u32 value, and bit[31:16]
9 is debounce interval for direct key and bit[15:0] is debounce
10 interval for matrix key. The value is in binary number of 2ms
11
12 Optional Properties For Matrix Keyes
13 Please refer to matrix-keymap.txt
14
15 Optional Properties for Direct Keyes
16 - marvell,direct-key-count : How many direct keyes are used.
17 - marvell,direct-key-mask : The mask indicates which keyes
18 are used. If bit[X] of the mask is set, the direct key X
19 is used.
20 - marvell,direct-key-low-active : Direct key status register
21 tells the level of pins that connects to the direct keyes.
22 When this property is set, it means that when the pin level
23 is low, the key is pressed(active).
24 - marvell,direct-key-map : It is a u16 array. Each item indicates
25 the linux key-code for the direct key.
26
27 Optional Properties For Rotary
28 - marvell,rotary0 : It is a u32 value. Bit[31:16] is the
29 linux key-code for rotary up. Bit[15:0] is the linux key-code
30 for rotary down. It is for rotary 0.
31 - marvell,rotary1 : Same as marvell,rotary0. It is for rotary 1.
32 - marvell,rotary-rel-key : When rotary is used for relative axes
33 in the device, the value indicates the key-code for relative
34 axes measurement in the device. It is a u32 value. Bit[31:16]
35 is for rotary 1, and Bit[15:0] is for rotary 0.
36
37 Examples:
38 keypad: keypad@d4012000 {
39 keypad,num-rows = <3>;
40 keypad,num-columns = <5>;
41 linux,keymap = <0x0000000e /* KEY_BACKSPACE */
42 0x0001006b /* KEY_END */
43 0x00020061 /* KEY_RIGHTCTRL */
44 0x0003000b /* KEY_0 */
45 0x00040002 /* KEY_1 */
46 0x0100008b /* KEY_MENU */
47 0x01010066 /* KEY_HOME */
48 0x010200e7 /* KEY_SEND */
49 0x01030009 /* KEY_8 */
50 0x0104000a /* KEY_9 */
51 0x02000160 /* KEY_OK */
52 0x02010003 /* KEY_2 */
53 0x02020004 /* KEY_3 */
54 0x02030005 /* KEY_4 */
55 0x02040006>; /* KEY_5 */
56 marvell,rotary0 = <0x006c0067>; /* KEY_UP & KEY_DOWN */
57 marvell,direct-key-count = <1>;
58 marvell,direct-key-map = <0x001c>;
59 marvell,debounce-interval = <0x001e001e>;
60 };
61

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

PXA matrix/direct/rotary key 속성

1-36

Marvell PXA keypad controller의 필수 `compatible`은 `marvell,pxa27x-keypad`, `reg`는 register set address와 length, `interrupts`는 keypad controller interrupt입니다.

`marvell,debounce-interval`은 key press를 인식할 시간입니다. U32의 bit[31:16]은 direct key, bit[15:0]은 matrix key debounce interval이며 값은 2 ms 단위의 binary number입니다. Matrix key 선택 property는 `matrix-keymap.txt`를 참조합니다.

Direct key의 `marvell,direct-key-count`는 사용 key 수, `marvell,direct-key-mask`는 bit X가 direct key X 사용 여부를 나타내는 mask입니다. `marvell,direct-key-low-active`가 있으면 direct-key pin level이 low일 때 pressed(active)입니다. `marvell,direct-key-map`은 각 direct key의 Linux keycode를 담은 u16 array입니다.

Rotary의 `marvell,rotary0` u32는 bit[31:16]에 rotary-up, bit[15:0]에 rotary-down Linux keycode를 넣으며 rotary 0에 적용합니다. `marvell,rotary1`은 rotary 1에 같은 형식을 씁니다. `marvell,rotary-rel-key`는 rotary를 relative axis로 사용할 때 measurement keycode를 지정하며 상위 16 bit는 rotary 1, 하위 16 bit는 rotary 0입니다.

PXA packed keypad values
PropertyBits 31:16Bits 15:0
debounce-intervalDirect-key intervalMatrix-key interval
rotary0/1Up keycodeDown keycode
rotary-rel-keyRotary 1 keycodeRotary 0 keycode

32-bit property의 상위/하위 field 의미를 정리합니다.

3x5 matrix와 rotary 예제

37-60

예제는 3 row x 5 column matrix에 15개 Linux keycode를 mapping합니다. Rotary 0의 up/down을 `KEY_UP`/`KEY_DOWN`으로 지정하고 direct key 하나를 keycode `0x001c`에 mapping하며 direct와 matrix debounce interval을 모두 `0x001e`로 설정합니다.

keypad: keypad@d4012000 {
        keypad,num-rows = <3>;
        keypad,num-columns = <5>;
        linux,keymap = <0x0000000e        /* KEY_BACKSPACE */
                        0x0001006b        /* KEY_END */
                        0x00020061        /* KEY_RIGHTCTRL */
                        0x0003000b        /* KEY_0 */
                        0x00040002        /* KEY_1 */
                        0x0100008b        /* KEY_MENU */
                        0x01010066        /* KEY_HOME */
                        0x010200e7        /* KEY_SEND */
                        0x01030009        /* KEY_8 */
                        0x0104000a        /* KEY_9 */
                        0x02000160        /* KEY_OK */
                        0x02010003        /* KEY_2 */
                        0x02020004        /* KEY_3 */
                        0x02030005        /* KEY_4 */
                        0x02040006>;        /* KEY_5 */
        marvell,rotary0 = <0x006c0067>;        /* KEY_UP & KEY_DOWN */
        marvell,direct-key-count = <1>;
        marvell,direct-key-map = <0x001c>;
        marvell,debounce-interval = <0x001e001e>;
};