← Documents Documentation/ABI/testing/sysfs-class-led GitHub 원문 ↗

Linux 6.18.37 · ABI / testing

LED class brightness and trigger sysfs ABI

LED brightness·maximum, hardware autonomous change polling, kernel trigger 선택과 GPIO·backlight state inversion을 설명합니다.

Source pathDocumentation/ABI/testing/sysfs-class-led
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

Brightness and multicolor scaling

sysfs-class-led:1-60

Brightness range와 multicolor intensity 공식, trigger top brightness, hardware brightness change의 poll·ENODATA 동작을 정의합니다.

Trigger selection and inversion

sysfs-class-led:62-89

Kernel event trigger의 none·default 값과 GPIO·backlight trigger의 state inversion을 설명합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 What: /sys/class/leds/<led>/brightness
2 Date: March 2006
3 KernelVersion: 2.6.17
4 Contact: Richard Purdie <[email protected]>
5 Description:
6 Set the brightness of the LED.
7
8 Most LEDs don't have hardware brightness support, so will
9 just be turned on for non-zero brightness settings.
10
11 .. Note::
12
13 For multicolor LEDs, writing to this file will update all
14 LEDs within the group to a calculated percentage of what
15 each color LED intensity is set to.
16
17 The percentage is calculated for each grouped LED via
18 the equation below::
19
20 led_brightness = brightness * multi_intensity/max_brightness
21
22 For additional details please refer to
23 Documentation/leds/leds-class-multicolor.rst.
24
25 The value is between 0 and
26 /sys/class/leds/<led>/max_brightness.
27
28 Writing 0 to this file clears active trigger.
29
30 Writing non-zero to this file while trigger is active changes the
31 top brightness trigger is going to use.
32
33
34
35 What: /sys/class/leds/<led>/max_brightness
36 Date: March 2006
37 KernelVersion: 2.6.17
38 Contact: Richard Purdie <[email protected]>
39 Description:
40 Maximum brightness level for this LED, default is 255 (LED_FULL).
41
42 If the LED does not support different brightness levels, this
43 should be 1.
44
45 What: /sys/class/leds/<led>/brightness_hw_changed
46 Date: January 2017
47 KernelVersion: 4.11
48 Description:
49 Last hardware set brightness level for this LED. Some LEDs
50 may be changed autonomously by hardware/firmware. Only LEDs
51 where this happens and the driver can detect this, will have
52 this file.
53
54 This file supports poll() to detect when the hardware changes
55 the brightness.
56
57 Reading this file will return the last brightness level set
58 by the hardware, this may be different from the current
59 brightness. Reading this file when no hw brightness change
60 event has happened will return an ENODATA error.
61
62 What: /sys/class/leds/<led>/trigger
63 Date: March 2006
64 KernelVersion: 2.6.17
65 Contact: Richard Purdie <[email protected]>
66 Description:
67 Set the trigger for this LED. A trigger is a kernel based source
68 of LED events.
69
70 You can change triggers in a similar manner to the way an IO
71 scheduler is chosen. Trigger specific parameters can appear in
72 /sys/class/leds/<led> once a given trigger is selected. For
73 their documentation see `sysfs-class-led-trigger-*`.
74
75 Writing "none" removes the trigger for this LED.
76
77 Writing "default" sets the trigger to the LED's default trigger
78 (which would often be configured in the device tree for the
79 hardware).
80
81 What: /sys/class/leds/<led>/inverted
82 Date: January 2011
83 KernelVersion: 2.6.38
84 Contact: Richard Purdie <[email protected]>
85 Description:
86 Invert the LED on/off state. This parameter is specific to
87 gpio and backlight triggers. In case of the backlight trigger,
88 it is useful when driving a LED which is intended to indicate
89 a device in a standby like state.
90

3. 한국어 전문 번역

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

LED brightness control

1-31
항목한국어 전문 번역
What/sys/class/leds/<led>/brightness
Date2006년 3월
KernelVersion2.6.17
ContactRichard Purdie <[email protected]>
DescriptionLED brightness를 설정합니다. 대부분의 LED는 hardware brightness를 지원하지 않으므로 0이 아닌 값을 쓰면 단순히 켜집니다. Multicolor LED에서는 이 file에 쓴 값으로 group의 모든 color LED를 각 multi_intensity에 대한 계산 비율로 갱신합니다. 자세한 내용은 Documentation/leds/leds-class-multicolor.rst를 참조하십시오. 값 범위는 0에서 /sys/class/leds/<led>/max_brightness입니다. 0을 쓰면 active trigger를 clear합니다. Trigger가 active일 때 0이 아닌 값을 쓰면 trigger가 사용할 최고 brightness가 바뀝니다.
led_brightness = brightness * multi_intensity/max_brightness
brightness write 동작
상황동작
Hardware level 미지원0이 아니면 LED on
Multicolor LEDColor별 multi_intensity 비율 적용
0 쓰기Active trigger clear
Active trigger에 non-zero 쓰기Trigger의 top brightness 변경

일반 LED, multicolor group과 active trigger에서의 동작입니다.

LED maximum brightness

35-43
항목한국어 전문 번역
What/sys/class/leds/<led>/max_brightness
Date2006년 3월
KernelVersion2.6.17
ContactRichard Purdie <[email protected]>
Description이 LED의 maximum brightness level입니다. 기본값은 255(LED_FULL)입니다. 서로 다른 brightness level을 지원하지 않는 LED는 1이어야 합니다.

Hardware가 설정한 마지막 brightness

45-60
항목한국어 전문 번역
What/sys/class/leds/<led>/brightness_hw_changed
Date2017년 1월
KernelVersion4.11
DescriptionHardware가 이 LED에 마지막으로 설정한 brightness level입니다. 일부 LED는 hardware·firmware가 자율적으로 변경할 수 있으며, 이 동작을 driver가 감지할 수 있는 LED에만 file이 존재합니다. poll()로 hardware brightness 변경을 감지할 수 있습니다. 읽으면 hardware가 마지막으로 설정한 level을 반환하며 현재 brightness와 다를 수 있습니다. Hardware brightness change event가 한 번도 없었을 때 읽으면 ENODATA를 반환합니다.

Kernel LED trigger 선택

62-79
항목한국어 전문 번역
What/sys/class/leds/<led>/trigger
Date2006년 3월
KernelVersion2.6.17
ContactRichard Purdie <[email protected]>
DescriptionLED trigger를 설정합니다. Trigger는 kernel 기반 LED event source입니다. IO scheduler를 고르는 방식과 비슷하게 trigger를 변경할 수 있습니다. 특정 trigger를 선택하면 /sys/class/leds/<led>에 trigger 전용 parameter가 나타날 수 있으며 sysfs-class-led-trigger-* 문서를 참조합니다. "none"을 쓰면 trigger를 제거하고 "default"를 쓰면 흔히 device tree에서 구성한 LED 기본 trigger를 설정합니다.
trigger special value
동작
none현재 LED trigger 제거
defaultLED의 default trigger 설정

Trigger 제거와 hardware 기본 trigger 복원을 구분합니다.

LED on/off state inversion

81-89
항목한국어 전문 번역
What/sys/class/leds/<led>/inverted
Date2011년 1월
KernelVersion2.6.38
ContactRichard Purdie <[email protected]>
DescriptionLED on/off 상태를 반전합니다. GPIO와 backlight trigger 전용 parameter입니다. Backlight trigger에서는 standby와 비슷한 device 상태를 표시하도록 설계된 LED를 구동할 때 유용합니다.