요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
Specifying PWM information for devices
======================================
1) PWM user nodes
-----------------
PWM users should specify a list of PWM devices that they want to use
with a property containing a 'pwm-list':
pwm-list ::= <single-pwm> [pwm-list]
single-pwm ::= <pwm-phandle> <pwm-specifier>
pwm-phandle : phandle to PWM controller node
pwm-specifier : array of #pwm-cells specifying the given PWM
(controller specific)
PWM properties should be named "pwms". The exact meaning of each pwms
property must be documented in the device tree binding for each device.
An optional property "pwm-names" may contain a list of strings to label
each of the PWM devices listed in the "pwms" property. If no "pwm-names"
property is given, the name of the user node will be used as fallback.
Drivers for devices that use more than a single PWM device can use the
"pwm-names" property to map the name of the PWM device requested by the
pwm_get() call to an index into the list given by the "pwms" property.
The following example could be used to describe a PWM-based backlight
device:
pwm: pwm {
#pwm-cells = <2>;
};
[...]
bl: backlight {
pwms = <&pwm 0 5000000>;
pwm-names = "backlight";
};
Note that in the example above, specifying the "pwm-names" is redundant
because the name "backlight" would be used as fallback anyway.
pwm-specifier typically encodes the chip-relative PWM number and the PWM
period in nanoseconds.
Optionally, the pwm-specifier can encode a number of flags (defined in
<dt-bindings/pwm/pwm.h>) in a third cell:
- PWM_POLARITY_INVERTED: invert the PWM signal polarity
Example with optional PWM specifier for inverse polarity
bl: backlight {
pwms = <&pwm 0 5000000 PWM_POLARITY_INVERTED>;
pwm-names = "backlight";
};
2) PWM controller nodes
-----------------------
See pwm.yaml.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
PWM 목록 문법
1-15PWM consumer node는 사용할 PWM device 목록을 `pwm-list` 형식의 property로 지정합니다. 각 `single-pwm`은 PWM controller node의 `pwm-phandle`과 controller별 `#pwm-cells` 배열인 `pwm-specifier`로 구성됩니다.
pwm-list ::= <single-pwm> [pwm-list]
single-pwm ::= <pwm-phandle> <pwm-specifier>
pwm-phandle : phandle to PWM controller node
pwm-specifier : array of #pwm-cells specifying the given PWM
(controller specific)
`pwms`와 `pwm-names`
16-24PWM property 이름은 `pwms`여야 하며 각 cell의 정확한 의미는 해당 device binding에 문서화해야 합니다. 선택 property `pwm-names`는 `pwms`의 PWM device마다 label을 붙입니다. 생략하면 consumer node 이름을 fallback으로 사용합니다.
여러 PWM device를 쓰는 driver는 `pwm_get()`에 요청한 이름을 `pwm-names`에서 찾아 `pwms` 목록의 index로 대응시킬 수 있습니다.
Backlight 예제
25-41PWM 기반 backlight는 controller의 `#pwm-cells`와 consumer의 `pwms`를 연결합니다. 아래 예제의 `pwm-names = "backlight"`는 node 이름도 `backlight`이므로 생략해도 같은 fallback 이름을 얻습니다.
pwm: pwm {
#pwm-cells = <2>;
};
[...]
bl: backlight {
pwms = <&pwm 0 5000000>;
pwm-names = "backlight";
};
Specifier와 polarity flag
42-55일반적인 `pwm-specifier`는 chip-relative PWM 번호와 ns 단위 PWM period를 담습니다. 선택적인 세 번째 cell에는 `<dt-bindings/pwm/pwm.h>`가 정의한 flag를 넣을 수 있으며 `PWM_POLARITY_INVERTED`는 PWM signal polarity를 반전합니다.
bl: backlight {
pwms = <&pwm 0 5000000 PWM_POLARITY_INVERTED>;
pwm-names = "backlight";
};
PWM controller node
56-60PWM controller node의 공통 형식은 같은 directory의 `pwm.yaml`을 참조합니다.
요약과 해설
pwm.txt:1-60필수·선택 property의 의미와 원문의 실제 선언 예제를 함께 읽을 수 있습니다.