← Documents Documentation/devicetree/bindings/input/brcm,bcm-keypad.txt GitHub 원문 ↗

Linux 6.18.37 · Devicetree Bindings

Broadcom Matrix Keypad

Broadcom row/column keypad와 debounce filter 바인딩입니다.

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

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

1. 요약·해설

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

요약과 해설

brcm,bcm-keypad.txt:1-107

5x5 keymap과 scan mode 설정을 설명합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 * Broadcom Keypad Controller device tree bindings
2
3 Broadcom Keypad controller is used to interface a SoC with a matrix-type
4 keypad device. The keypad controller supports multiple row and column lines.
5 A key can be placed at each intersection of a unique row and a unique column.
6 The keypad controller can sense a key-press and key-release and report the
7 event using a interrupt to the cpu.
8
9 This binding is based on the matrix-keymap binding with the following
10 changes:
11
12 keypad,num-rows and keypad,num-columns are required.
13
14 Required SoC Specific Properties:
15 - compatible: should be "brcm,bcm-keypad"
16
17 - reg: physical base address of the controller and length of memory mapped
18 region.
19
20 - interrupts: The interrupt number to the cpu.
21
22 Board Specific Properties:
23 - keypad,num-rows: Number of row lines connected to the keypad
24 controller.
25
26 - keypad,num-columns: Number of column lines connected to the
27 keypad controller.
28
29 - col-debounce-filter-period: The debounce period for the Column filter.
30
31 KEYPAD_DEBOUNCE_1_ms = 0
32 KEYPAD_DEBOUNCE_2_ms = 1
33 KEYPAD_DEBOUNCE_4_ms = 2
34 KEYPAD_DEBOUNCE_8_ms = 3
35 KEYPAD_DEBOUNCE_16_ms = 4
36 KEYPAD_DEBOUNCE_32_ms = 5
37 KEYPAD_DEBOUNCE_64_ms = 6
38 KEYPAD_DEBOUNCE_128_ms = 7
39
40 - status-debounce-filter-period: The debounce period for the Status filter.
41
42 KEYPAD_DEBOUNCE_1_ms = 0
43 KEYPAD_DEBOUNCE_2_ms = 1
44 KEYPAD_DEBOUNCE_4_ms = 2
45 KEYPAD_DEBOUNCE_8_ms = 3
46 KEYPAD_DEBOUNCE_16_ms = 4
47 KEYPAD_DEBOUNCE_32_ms = 5
48 KEYPAD_DEBOUNCE_64_ms = 6
49 KEYPAD_DEBOUNCE_128_ms = 7
50
51 - row-output-enabled: An optional property indicating whether the row or
52 column is being used as output. If specified the row is being used
53 as the output. Else defaults to column.
54
55 - pull-up-enabled: An optional property indicating the Keypad scan mode.
56 If specified implies the keypad scan pull-up has been enabled.
57
58 - autorepeat: Boolean, Enable auto repeat feature of Linux input
59 subsystem (optional).
60
61 - linux,keymap: The keymap for keys as described in the binding document
62 devicetree/bindings/input/matrix-keymap.txt.
63
64 Example:
65 #include "dt-bindings/input/input.h"
66
67 / {
68 keypad: keypad@180ac000 {
69 /* Required SoC specific properties */
70 compatible = "brcm,bcm-keypad";
71
72 /* Required Board specific properties */
73 keypad,num-rows = <5>;
74 keypad,num-columns = <5>;
75
76 linux,keymap = <MATRIX_KEY(0x00, 0x02, KEY_F) /* key_forward */
77 MATRIX_KEY(0x00, 0x03, KEY_HOME) /* key_home */
78 MATRIX_KEY(0x00, 0x04, KEY_M) /* key_message */
79 MATRIX_KEY(0x01, 0x00, KEY_A) /* key_contacts */
80 MATRIX_KEY(0x01, 0x01, KEY_1) /* key_1 */
81 MATRIX_KEY(0x01, 0x02, KEY_2) /* key_2 */
82 MATRIX_KEY(0x01, 0x03, KEY_3) /* key_3 */
83 MATRIX_KEY(0x01, 0x04, KEY_S) /* key_speaker */
84 MATRIX_KEY(0x02, 0x00, KEY_P) /* key_phone */
85 MATRIX_KEY(0x02, 0x01, KEY_4) /* key_4 */
86 MATRIX_KEY(0x02, 0x02, KEY_5) /* key_5 */
87 MATRIX_KEY(0x02, 0x03, KEY_6) /* key_6 */
88 MATRIX_KEY(0x02, 0x04, KEY_VOLUMEUP) /* key_vol_up */
89 MATRIX_KEY(0x03, 0x00, KEY_C) /* key_call_log */
90 MATRIX_KEY(0x03, 0x01, KEY_7) /* key_7 */
91 MATRIX_KEY(0x03, 0x02, KEY_8) /* key_8 */
92 MATRIX_KEY(0x03, 0x03, KEY_9) /* key_9 */
93 MATRIX_KEY(0x03, 0x04, KEY_VOLUMEDOWN) /* key_vol_down */
94 MATRIX_KEY(0x04, 0x00, KEY_H) /* key_headset */
95 MATRIX_KEY(0x04, 0x01, KEY_KPASTERISK) /* key_* */
96 MATRIX_KEY(0x04, 0x02, KEY_0) /* key_0 */
97 MATRIX_KEY(0x04, 0x03, KEY_GRAVE) /* key_# */
98 MATRIX_KEY(0x04, 0x04, KEY_MUTE) /* key_mute */
99 >;
100
101 /* Optional board specific properties */
102 col-debounce-filter-period = <5>;
103 row-output-enabled;
104 pull-up-enabled;
105
106 };
107 };
108

3. 한국어 전문 번역

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

Broadcom matrix keypad 구조

1-20

Broadcom Keypad controller는 SoC와 matrix형 keypad를 연결합니다. 여러 row와 column line을 지원하며, 고유 row와 column의 교차점마다 key 하나를 둘 수 있습니다. Controller는 key press와 release를 감지하고 CPU interrupt로 event를 보고합니다.

이 binding은 `matrix-keymap`을 바탕으로 하지만 `keypad,num-rows`와 `keypad,num-columns`가 필수라는 차이가 있습니다. SoC 필수 `compatible`은 `brcm,bcm-keypad`, `reg`는 controller physical base와 memory-mapped length, `interrupts`는 CPU interrupt number입니다.

Board row/column과 debounce 설정

21-63

Board property `keypad,num-rows`와 `keypad,num-columns`는 controller에 연결한 row와 column line 수입니다. `col-debounce-filter-period`는 column filter, `status-debounce-filter-period`는 status filter의 debounce period입니다. 두 property 모두 enum 0~7을 1, 2, 4, 8, 16, 32, 64, 128 ms에 대응시킵니다.

선택 `row-output-enabled`가 있으면 row를 output으로 사용하고, 없으면 기본으로 column을 output으로 사용합니다. `pull-up-enabled`는 keypad scan pull-up을 활성화했음을 나타냅니다. Boolean `autorepeat`는 Linux input subsystem의 auto-repeat를 켭니다. `linux,keymap`은 `devicetree/bindings/input/matrix-keymap.txt`가 설명하는 key map입니다.

Broadcom debounce encoding
EnumPeriod
01 ms
12 ms
24 ms
38 ms
416 ms
532 ms
664 ms
7128 ms

Column과 status filter가 공통으로 사용하는 debounce enum입니다.

5x5 Broadcom keypad 예제

64-107

예제는 input key symbol header를 include하고 5 row x 5 column keypad를 정의합니다. `MATRIX_KEY(row, column, keycode)`로 forward, home, message, contact, 숫자, volume, headset, star, hash, mute 등 23개 key를 mapping합니다. Column debounce enum 5, 즉 32 ms를 사용하고 row output과 pull-up scan mode를 활성화합니다.

#include "dt-bindings/input/input.h"

/ {
        keypad: keypad@180ac000 {
                /* Required SoC specific properties */
                compatible = "brcm,bcm-keypad";

                /* Required Board specific properties */
                keypad,num-rows = <5>;
                keypad,num-columns = <5>;

                linux,keymap = <MATRIX_KEY(0x00, 0x02, KEY_F) /* key_forward */
                MATRIX_KEY(0x00, 0x03, KEY_HOME) /* key_home */
                MATRIX_KEY(0x00, 0x04, KEY_M) /* key_message */
                MATRIX_KEY(0x01, 0x00, KEY_A) /* key_contacts */
                MATRIX_KEY(0x01, 0x01, KEY_1) /* key_1 */
                MATRIX_KEY(0x01, 0x02, KEY_2) /* key_2 */
                MATRIX_KEY(0x01, 0x03, KEY_3) /* key_3 */
                MATRIX_KEY(0x01, 0x04, KEY_S) /* key_speaker */
                MATRIX_KEY(0x02, 0x00, KEY_P) /* key_phone */
                MATRIX_KEY(0x02, 0x01, KEY_4) /* key_4 */
                MATRIX_KEY(0x02, 0x02, KEY_5) /* key_5 */
                MATRIX_KEY(0x02, 0x03, KEY_6) /* key_6 */
                MATRIX_KEY(0x02, 0x04, KEY_VOLUMEUP) /* key_vol_up */
                MATRIX_KEY(0x03, 0x00, KEY_C) /* key_call_log */
                MATRIX_KEY(0x03, 0x01, KEY_7) /* key_7 */
                MATRIX_KEY(0x03, 0x02, KEY_8) /* key_8 */
                MATRIX_KEY(0x03, 0x03, KEY_9) /* key_9 */
                MATRIX_KEY(0x03, 0x04, KEY_VOLUMEDOWN) /* key_vol_down */
                MATRIX_KEY(0x04, 0x00, KEY_H) /* key_headset */
                MATRIX_KEY(0x04, 0x01, KEY_KPASTERISK) /* key_* */
                MATRIX_KEY(0x04, 0x02, KEY_0) /* key_0 */
                MATRIX_KEY(0x04, 0x03, KEY_GRAVE) /* key_# */
                MATRIX_KEY(0x04, 0x04, KEY_MUTE) /* key_mute */
                >;

                /* Optional board specific properties */
                col-debounce-filter-period = <5>;
                row-output-enabled;
                pull-up-enabled;

        };
};