← Documents Documentation/devicetree/bindings/input/gpio-decoder.txt GitHub 원문 ↗

Linux 6.18.37 · Devicetree Bindings

GPIO Decoder

여러 GPIO bit를 Linux absolute axis 값으로 변환하는 바인딩입니다.

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

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

1. 요약·해설

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

요약과 해설

gpio-decoder.txt:1-23

MSB-first GPIO ordering과 최대값 제한을 설명합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 * GPIO Decoder DT bindings
2
3 Required Properties:
4 - compatible: should be "gpio-decoder"
5 - gpios: a spec of gpios (at least two) to be decoded to a number with
6 first entry representing the MSB.
7
8 Optional Properties:
9 - decoder-max-value: Maximum possible value that can be reported by
10 the gpios.
11 - linux,axis: the input subsystem axis to map to (ABS_X/ABS_Y).
12 Defaults to 0 (ABS_X).
13
14 Example:
15 gpio-decoder0 {
16 compatible = "gpio-decoder";
17 gpios = <&pca9536 3 GPIO_ACTIVE_HIGH>,
18 <&pca9536 2 GPIO_ACTIVE_HIGH>,
19 <&pca9536 1 GPIO_ACTIVE_HIGH>,
20 <&pca9536 0 GPIO_ACTIVE_HIGH>;
21 linux,axis = <0>; /* ABS_X */
22 decoder-max-value = <9>;
23 };
24

3. 한국어 전문 번역

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

GPIO bit vector decoder

1-13

GPIO Decoder의 필수 `compatible`은 `gpio-decoder`입니다. `gpios`에는 number로 decode할 GPIO specifier를 최소 두 개 넣으며 첫 entry가 MSB입니다. 선택 `decoder-max-value`는 GPIO가 보고할 수 있는 최대값입니다. `linux,axis`는 mapping할 input subsystem axis인 `ABS_X` 또는 `ABS_Y`이며 기본값 0은 `ABS_X`입니다.

GPIO decoder bit order
GPIO entry 0MSB
Remaining GPIOsDescending bit significance
Binary decodeClamp to decoder-max-value
linux,axisABS_X or ABS_Y

첫 GPIO를 MSB로 해석해 여러 digital line을 하나의 axis value로 만듭니다.

4-bit ABS_X 예제

14-23

예제는 PCA9536 GPIO 3, 2, 1, 0을 active-high 4-bit 값으로 decode합니다. `linux,axis = <0>`으로 ABS_X에 mapping하고 보고 가능한 최대값을 9로 제한합니다.

gpio-decoder0 {
        compatible = "gpio-decoder";
        gpios = <&pca9536 3 GPIO_ACTIVE_HIGH>,
                <&pca9536 2 GPIO_ACTIVE_HIGH>,
                <&pca9536 1 GPIO_ACTIVE_HIGH>,
                <&pca9536 0 GPIO_ACTIVE_HIGH>;
        linux,axis = <0>; /* ABS_X */
        decoder-max-value = <9>;
};