요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
========================
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)
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
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
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.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
LP5523 개요와 채널 이름 규칙
1-33National 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 정책을 선택할 수 있습니다.
`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-65LP5523에는 여러 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` 절을 따라야 합니다.
상태 전환, 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-104LP5523은 세 개의 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를 뜻합니다.
`123000123` 문자열의 각 자리가 채널 0~8의 fader 번호를 지정합니다.
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 구현에서 그대로 계약이 됩니다.
채널 구성과 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.
요약·해설
leds-lp5523.rst:1-147LP5523은 아홉 채널을 직접 제어하거나 세 program engine으로 구동하며, master fader로 여러 채널의 밝기를 함께 감쇠할 수 있습니다.
이 페이지는 naming 우선순위, legacy·firmware interface, fader mapping, 0.1mA current 단위와 board callback을 실제 sysfs 순서에 맞춰 정리합니다.