← Documents Documentation/leds/leds-lp5523.rst GitHub 원문 ↗

Linux 6.18.37 · LEDs

LP5523 LED Driver

9채널 LP5523의 이름 규칙, engine program, master fader, current와 platform data입니다.

Source pathDocumentation/leds/leds-lp5523.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

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

1. 요약·해설

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

요약·해설

leds-lp5523.rst:1-147

LP5523은 아홉 채널을 직접 제어하거나 세 program engine으로 구동하며, master fader로 여러 채널의 밝기를 함께 감쇠할 수 있습니다.

이 페이지는 naming 우선순위, legacy·firmware interface, fader mapping, 0.1mA current 단위와 board callback을 실제 sysfs 순서에 맞춰 정리합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 ========================
2 Kernel driver for lp5523
3 ========================
4
5 * National Semiconductor LP5523 led driver chip
6 * Datasheet: http://www.national.com/pf/LP/LP5523.html
7
8 Authors: Mathias Nyman, Yuri Zaporozhets, Samu Onkalo
9 Contact: Samu Onkalo (samu.p.onkalo-at-nokia.com)
10
11 Description
12 -----------
13 LP5523 can drive up to 9 channels. Leds can be controlled directly via
14 the led class control interface.
15 The name of each channel is configurable in the platform data - name and label.
16 There are three options to make the channel name.
17
18 a) Define the 'name' in the platform data
19
20 To make specific channel name, then use 'name' platform data.
21
22 - /sys/class/leds/R1 (name: 'R1')
23 - /sys/class/leds/B1 (name: 'B1')
24
25 b) Use the 'label' with no 'name' field
26
27 For one device name with channel number, then use 'label'.
28 - /sys/class/leds/RGB:channelN (label: 'RGB', N: 0 ~ 8)
29
30 c) Default
31
32 If both fields are NULL, 'lp5523' is used by default.
33 - /sys/class/leds/lp5523:channelN (N: 0 ~ 8)
34
35 LP5523 has the internal program memory for running various LED patterns.
36 There are two ways to run LED patterns.
37
38 1) Legacy interface - enginex_mode, enginex_load and enginex_leds
39
40 Control interface for the engines:
41
42 x is 1 .. 3
43
44 enginex_mode:
45 disabled, load, run
46 enginex_load:
47 microcode load
48 enginex_leds:
49 led mux control
50
51 ::
52
53 cd /sys/class/leds/lp5523:channel2/device
54 echo "load" > engine3_mode
55 echo "9d80400004ff05ff437f0000" > engine3_load
56 echo "111111111" > engine3_leds
57 echo "run" > engine3_mode
58
59 To stop the engine::
60
61 echo "disabled" > engine3_mode
62
63 2) Firmware interface - LP55xx common interface
64
65 For the details, please refer to 'firmware' section in leds-lp55xx.txt
66
67 LP5523 has three master faders. If a channel is mapped to one of
68 the master faders, its output is dimmed based on the value of the master
69 fader.
70
71 For example::
72
73 echo "123000123" > master_fader_leds
74
75 creates the following channel-fader mappings::
76
77 channel 0,6 to master_fader1
78 channel 1,7 to master_fader2
79 channel 2,8 to master_fader3
80
81 Then, to have 25% of the original output on channel 0,6::
82
83 echo 64 > master_fader1
84
85 To have 0% of the original output (i.e. no output) channel 1,7::
86
87 echo 0 > master_fader2
88
89 To have 100% of the original output (i.e. no dimming) on channel 2,8::
90
91 echo 255 > master_fader3
92
93 To clear all master fader controls::
94
95 echo "000000000" > master_fader_leds
96
97 Selftest uses always the current from the platform data.
98
99 Each channel contains led current settings.
100 - /sys/class/leds/lp5523:channel2/led_current - RW
101 - /sys/class/leds/lp5523:channel2/max_current - RO
102
103 Format: 10x mA i.e 10 means 1.0 mA
104
105 Example platform data::
106
107 static struct lp55xx_led_config lp5523_led_config[] = {
108 {
109 .name = "D1",
110 .chan_nr = 0,
111 .led_current = 50,
112 .max_current = 130,
113 },
114 ...
115 {
116 .chan_nr = 8,
117 .led_current = 50,
118 .max_current = 130,
119 }
120 };
121
122 static int lp5523_setup(void)
123 {
124 /* Setup HW resources */
125 }
126
127 static void lp5523_release(void)
128 {
129 /* Release HW resources */
130 }
131
132 static void lp5523_enable(bool state)
133 {
134 /* Control chip enable signal */
135 }
136
137 static struct lp55xx_platform_data lp5523_platform_data = {
138 .led_config = lp5523_led_config,
139 .num_channels = ARRAY_SIZE(lp5523_led_config),
140 .clock_mode = LP55XX_CLOCK_EXT,
141 .setup_resources = lp5523_setup,
142 .release_resources = lp5523_release,
143 .enable = lp5523_enable,
144 };
145
146 Note
147 chan_nr can have values between 0 and 8.
148

3. 한국어 전문 번역

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

LP5523 개요와 채널 이름 규칙

1-33

National Semiconductor LP5523 LED 드라이버는 최대 9개 채널을 구동하며, 각 LED는 LED class 제어 인터페이스에서 직접 제어할 수 있습니다. 문서는 Mathias Nyman, Yuri Zaporozhets, Samu Onkalo가 작성했으며 Samu Onkalo의 연락처와 원문 datasheet URL을 함께 제시합니다.

채널 이름은 platform data의 `name`과 `label`로 결정합니다. 개별 `name`을 지정하면 `/sys/class/leds/R1`처럼 그 이름을 그대로 사용하고, `name` 없이 `label`만 지정하면 `/sys/class/leds/RGB:channelN` 형식으로 장치 label과 0~8 채널 번호를 결합합니다.

두 field가 모두 `NULL`이면 기본 label `lp5523`을 사용하여 `/sys/class/leds/lp5523:channelN`을 만듭니다. 따라서 board 설계자는 개별 기능명, 장치 공통 label, driver 기본명 가운데 필요한 naming 정책을 선택할 수 있습니다.

LP5523 채널 이름 결정
Platform data생성 경로용도
`name = "R1"``/sys/class/leds/R1`채널마다 고유한 이름
`label = "RGB"`, `name = NULL``/sys/class/leds/RGB:channelN`한 장치 아래 번호 채널
`name = NULL`, `label = NULL``/sys/class/leds/lp5523:channelN`driver 기본 이름

`name`과 `label`의 조합에 따라 LED class 경로가 결정됩니다.

========================
Kernel driver for lp5523
========================

* National Semiconductor LP5523 led driver chip
* Datasheet: http://www.national.com/pf/LP/LP5523.html

Authors: Mathias Nyman, Yuri Zaporozhets, Samu Onkalo
Contact: Samu Onkalo (samu.p.onkalo-at-nokia.com)

Description
-----------
LP5523 can drive up to 9 channels. Leds can be controlled directly via
the led class control interface.
The name of each channel is configurable in the platform data - name and label.
There are three options to make the channel name.

a) Define the 'name' in the platform data

To make specific channel name, then use 'name' platform data.

- /sys/class/leds/R1               (name: 'R1')
- /sys/class/leds/B1               (name: 'B1')

b) Use the 'label' with no 'name' field

For one device name with channel number, then use 'label'.
- /sys/class/leds/RGB:channelN     (label: 'RGB', N: 0 ~ 8)

c) Default

If both fields are NULL, 'lp5523' is used by default.
- /sys/class/leds/lp5523:channelN  (N: 0 ~ 8)

내부 program engine과 두 실행 인터페이스

34-65

LP5523에는 여러 LED pattern을 실행하는 내부 program memory가 있으며 legacy interface와 LP55xx 공통 firmware interface 두 방식으로 pattern을 실행할 수 있습니다.

Legacy interface는 engine 1~3마다 `enginex_mode`, `enginex_load`, `enginex_leds`를 제공합니다. `enginex_mode`는 `disabled`, `load`, `run` 상태를 선택하고, `enginex_load`는 microcode를 적재하며, `enginex_leds`는 해당 engine이 구동할 LED mux를 정합니다.

예제는 channel 2의 device directory에서 engine 3을 `load`로 전환하고 `9d80400004ff05ff437f0000`을 적재한 뒤 `111111111`로 아홉 출력을 모두 선택하여 `run`합니다. 중지할 때는 `engine3_mode`에 `disabled`를 씁니다.

두 번째 방식은 LP55xx 공통 firmware interface입니다. 세부 절차는 원문이 가리키는 `leds-lp55xx.txt`의 `firmware` 절을 따라야 합니다.

LP5523 legacy engine 실행
`/sys/class/leds/lp5523:channel2/device`로 이동`engine3_mode`에 `load` 기록`engine3_load`에 `9d80400004ff05ff437f0000` 기록`engine3_leds`에 `111111111` 기록`engine3_mode`에 `run` 기록중지할 때 `engine3_mode`에 `disabled` 기록

상태 전환, microcode 적재, 출력 mux 선택 순서를 보존한 절차입니다.


LP5523 has the internal program memory for running various LED patterns.
There are two ways to run LED patterns.

1) Legacy interface - enginex_mode, enginex_load and enginex_leds

  Control interface for the engines:

  x is 1 .. 3

  enginex_mode:
        disabled, load, run
  enginex_load:
        microcode load
  enginex_leds:
        led mux control

  ::

        cd /sys/class/leds/lp5523:channel2/device
        echo "load" > engine3_mode
        echo "9d80400004ff05ff437f0000" > engine3_load
        echo "111111111" > engine3_leds
        echo "run" > engine3_mode

  To stop the engine::

        echo "disabled" > engine3_mode

2) Firmware interface - LP55xx common interface

For the details, please refer to 'firmware' section in leds-lp55xx.txt

Master fader, selftest, 채널 전류

66-104

LP5523은 세 개의 master fader를 제공합니다. 채널을 fader 하나에 연결하면 해당 채널 출력은 master fader 값에 비례해 감쇠됩니다.

`master_fader_leds`에 `123000123`을 쓰면 채널 0·6은 `master_fader1`, 채널 1·7은 `master_fader2`, 채널 2·8은 `master_fader3`에 연결됩니다. 숫자 `0`인 채널 3·4·5는 이 mapping에서 master fader를 사용하지 않습니다.

원래 출력의 25%를 얻으려면 fader 1에 `64`, 출력을 완전히 끄려면 fader 2에 `0`, 감쇠 없이 100%를 유지하려면 fader 3에 `255`를 씁니다. 모든 fader 제어를 해제할 때는 `master_fader_leds`에 `000000000`을 기록합니다.

Selftest는 항상 platform data에 설정된 current를 사용합니다. 각 채널의 `led_current`는 읽기·쓰기가 가능하고 `max_current`는 읽기 전용입니다. 값의 단위는 0.1mA이므로 `10`은 1.0mA를 뜻합니다.

Master fader mapping 예제
채널Master fader예제 값출력
0, 6`master_fader1``64`원래 출력의 약 25%
1, 7`master_fader2``0`0%, 출력 없음
2, 8`master_fader3``255`100%, 감쇠 없음
전체`master_fader_leds``000000000`모든 mapping 해제

`123000123` 문자열의 각 자리가 채널 0~8의 fader 번호를 지정합니다.

LP5523 current attribute
Attribute접근의미
`led_current`읽기·쓰기현재 채널 구동 전류
`max_current`읽기 전용채널의 최대 허용 전류
값 `10`-1.0mA

Current 값은 0.1mA 단위이며 selftest도 platform data의 current를 사용합니다.


LP5523 has three master faders. If a channel is mapped to one of
the master faders, its output is dimmed based on the value of the master
fader.

For example::

  echo "123000123" > master_fader_leds

creates the following channel-fader mappings::

  channel 0,6 to master_fader1
  channel 1,7 to master_fader2
  channel 2,8 to master_fader3

Then, to have 25% of the original output on channel 0,6::

  echo 64 > master_fader1

To have 0% of the original output (i.e. no output) channel 1,7::

  echo 0 > master_fader2

To have 100% of the original output (i.e. no dimming) on channel 2,8::

  echo 255 > master_fader3

To clear all master fader controls::

  echo "000000000" > master_fader_leds

Selftest uses always the current from the platform data.

Each channel contains led current settings.
- /sys/class/leds/lp5523:channel2/led_current - RW
- /sys/class/leds/lp5523:channel2/max_current - RO

Format: 10x mA i.e 10 means 1.0 mA

LP5523 platform data 예제

105-147

예제 `lp55xx_led_config` 배열은 channel 0에 이름 `D1`, `led_current = 50`, `max_current = 130`을 지정하고 channel 8까지 같은 형식으로 구성합니다. `chan_nr`의 유효 범위는 0~8입니다.

Board code는 `lp5523_setup()`에서 hardware resource를 준비하고 `lp5523_release()`에서 해제하며, `lp5523_enable(bool state)`에서 chip enable 신호를 제어합니다.

`lp55xx_platform_data`에는 LED config 배열, `ARRAY_SIZE(lp5523_led_config)`로 계산한 채널 수, external clock을 나타내는 `LP55XX_CLOCK_EXT`, setup·release·enable callback을 연결합니다. 이 예제의 symbol과 callback signature는 board 구현에서 그대로 계약이 됩니다.

LP5523 platform data 구성
Field 또는 symbol역할
`lp5523_led_config`채널 이름·번호·current·max current
`num_channels`LED config 배열 크기
`LP55XX_CLOCK_EXT`External clock 선택
`setup_resources`Hardware resource 준비
`release_resources`Hardware resource 해제
`enable`Chip enable 신호 제어

채널 구성과 board-level resource callback을 한 구조체에 연결합니다.

Example platform data::

        static struct lp55xx_led_config lp5523_led_config[] = {
                {
                        .name                = "D1",
                        .chan_nr        = 0,
                        .led_current    = 50,
                        .max_current    = 130,
                },
        ...
                {
                        .chan_nr        = 8,
                        .led_current    = 50,
                        .max_current    = 130,
                }
        };

        static int lp5523_setup(void)
        {
                /* Setup HW resources */
        }

        static void lp5523_release(void)
        {
                /* Release HW resources */
        }

        static void lp5523_enable(bool state)
        {
                /* Control chip enable signal */
        }

        static struct lp55xx_platform_data lp5523_platform_data = {
                .led_config     = lp5523_led_config,
                .num_channels   = ARRAY_SIZE(lp5523_led_config),
                .clock_mode     = LP55XX_CLOCK_EXT,
                .setup_resources   = lp5523_setup,
                .release_resources = lp5523_release,
                .enable            = lp5523_enable,
        };

Note
  chan_nr can have values between 0 and 8.