요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
========================
Kernel driver for lp5562
========================
* TI LP5562 LED Driver
Author: Milo(Woogyom) Kim <[email protected]>
Description
===========
LP5562 can drive up to 4 channels. R/G/B and White.
LEDs can be controlled directly via the led class control interface.
All four channels can be also controlled using the engine micro programs.
LP5562 has the internal program memory for running various LED patterns.
For the details, please refer to 'firmware' section in leds-lp55xx.txt
Device attribute
================
engine_mux
3 Engines are allocated in LP5562, but the number of channel is 4.
Therefore each channel should be mapped to the engine number.
Value: RGB or W
This attribute is used for programming LED data with the firmware interface.
Unlike the LP5521/LP5523/55231, LP5562 has unique feature for the engine mux,
so additional sysfs is required
LED Map
===== === ===============================
Red ... Engine 1 (fixed)
Green ... Engine 2 (fixed)
Blue ... Engine 3 (fixed)
White ... Engine 1 or 2 or 3 (selective)
===== === ===============================
How to load the program data using engine_mux
=============================================
Before loading the LP5562 program data, engine_mux should be written between
the engine selection and loading the firmware.
Engine mux has two different mode, RGB and W.
RGB is used for loading RGB program data, W is used for W program data.
For example, run blinking green channel pattern::
echo 2 > /sys/bus/i2c/devices/xxxx/select_engine # 2 is for green channel
echo "RGB" > /sys/bus/i2c/devices/xxxx/engine_mux # engine mux for RGB
echo 1 > /sys/class/firmware/lp5562/loading
echo "4000600040FF6000" > /sys/class/firmware/lp5562/data
echo 0 > /sys/class/firmware/lp5562/loading
echo 1 > /sys/bus/i2c/devices/xxxx/run_engine
To run a blinking white pattern::
echo 1 or 2 or 3 > /sys/bus/i2c/devices/xxxx/select_engine
echo "W" > /sys/bus/i2c/devices/xxxx/engine_mux
echo 1 > /sys/class/firmware/lp5562/loading
echo "4000600040FF6000" > /sys/class/firmware/lp5562/data
echo 0 > /sys/class/firmware/lp5562/loading
echo 1 > /sys/bus/i2c/devices/xxxx/run_engine
How to load the predefined patterns
===================================
Please refer to 'leds-lp55xx.txt"
Setting Current of Each Channel
===============================
Like LP5521 and LP5523/55231, LP5562 provides LED current settings.
The 'led_current' and 'max_current' are used.
Example of Platform data
========================
::
static struct lp55xx_led_config lp5562_led_config[] = {
{
.name = "R",
.chan_nr = 0,
.led_current = 20,
.max_current = 40,
},
{
.name = "G",
.chan_nr = 1,
.led_current = 20,
.max_current = 40,
},
{
.name = "B",
.chan_nr = 2,
.led_current = 20,
.max_current = 40,
},
{
.name = "W",
.chan_nr = 3,
.led_current = 20,
.max_current = 40,
},
};
static int lp5562_setup(void)
{
/* setup HW resources */
}
static void lp5562_release(void)
{
/* Release HW resources */
}
static void lp5562_enable(bool state)
{
/* Control of chip enable signal */
}
static struct lp55xx_platform_data lp5562_platform_data = {
.led_config = lp5562_led_config,
.num_channels = ARRAY_SIZE(lp5562_led_config),
.setup_resources = lp5562_setup,
.release_resources = lp5562_release,
.enable = lp5562_enable,
};
To configure the platform specific data, lp55xx_platform_data structure is used
If the current is set to 0 in the platform data, that channel is
disabled and it is not visible in the sysfs.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
LP5562 채널과 engine mux
1-40TI LP5562는 Red, Green, Blue, White의 최대 4개 채널을 구동합니다. LED class interface로 직접 제어할 수 있고, 네 채널 모두 내부 program memory의 engine micro-program으로 pattern을 실행할 수 있습니다.
Chip에는 engine이 세 개뿐이므로 네 채널을 engine에 연결하기 위한 `engine_mux` device attribute가 필요합니다. 값은 `RGB` 또는 `W`이며 firmware interface로 LED program data를 적재할 때 사용합니다.
Red는 engine 1, Green은 engine 2, Blue는 engine 3에 고정됩니다. White 채널만 engine 1·2·3 중 하나를 선택할 수 있습니다. 이 고유한 mux 구조 때문에 LP5521, LP5523, LP55231과 달리 추가 sysfs attribute가 존재합니다.
RGB는 고정 mapping이고 White는 선택한 engine을 공유합니다.
========================
Kernel driver for lp5562
========================
* TI LP5562 LED Driver
Author: Milo(Woogyom) Kim <[email protected]>
Description
===========
LP5562 can drive up to 4 channels. R/G/B and White.
LEDs can be controlled directly via the led class control interface.
All four channels can be also controlled using the engine micro programs.
LP5562 has the internal program memory for running various LED patterns.
For the details, please refer to 'firmware' section in leds-lp55xx.txt
Device attribute
================
engine_mux
3 Engines are allocated in LP5562, but the number of channel is 4.
Therefore each channel should be mapped to the engine number.
Value: RGB or W
This attribute is used for programming LED data with the firmware interface.
Unlike the LP5521/LP5523/55231, LP5562 has unique feature for the engine mux,
so additional sysfs is required
LED Map
===== === ===============================
Red ... Engine 1 (fixed)
Green ... Engine 2 (fixed)
Blue ... Engine 3 (fixed)
White ... Engine 1 or 2 or 3 (selective)
===== === ===============================
engine_mux를 이용한 program 적재
41-77Program data를 적재하기 전에 engine을 선택한 다음 firmware를 loading하기 전 사이에 `engine_mux`를 써야 합니다. RGB channel용 data에는 `RGB`, White channel용 data에는 `W`를 선택합니다.
Green blink 예제는 `select_engine`에 `2`, `engine_mux`에 `RGB`를 쓴 뒤 `/sys/class/firmware/lp5562/loading`을 `1`로 열고 `data`에 `4000600040FF6000`을 기록합니다. `loading`을 `0`으로 닫고 `run_engine`을 `1`로 설정해야 실행됩니다.
White blink는 engine 1·2·3 중 하나를 먼저 선택하고 `engine_mux`에 `W`를 쓴다는 점만 다르며, firmware loading과 실행 순서는 같습니다. Predefined pattern의 적재 방식은 원문이 가리키는 `leds-lp55xx.txt`를 참조합니다.
LP5521 및 LP5523/55231과 마찬가지로 채널별 전류는 `led_current`와 `max_current`로 설정합니다.
Engine 선택과 mux 설정은 data 적재 전에 완료해야 합니다.
How to load the program data using engine_mux
=============================================
Before loading the LP5562 program data, engine_mux should be written between
the engine selection and loading the firmware.
Engine mux has two different mode, RGB and W.
RGB is used for loading RGB program data, W is used for W program data.
For example, run blinking green channel pattern::
echo 2 > /sys/bus/i2c/devices/xxxx/select_engine # 2 is for green channel
echo "RGB" > /sys/bus/i2c/devices/xxxx/engine_mux # engine mux for RGB
echo 1 > /sys/class/firmware/lp5562/loading
echo "4000600040FF6000" > /sys/class/firmware/lp5562/data
echo 0 > /sys/class/firmware/lp5562/loading
echo 1 > /sys/bus/i2c/devices/xxxx/run_engine
To run a blinking white pattern::
echo 1 or 2 or 3 > /sys/bus/i2c/devices/xxxx/select_engine
echo "W" > /sys/bus/i2c/devices/xxxx/engine_mux
echo 1 > /sys/class/firmware/lp5562/loading
echo "4000600040FF6000" > /sys/class/firmware/lp5562/data
echo 0 > /sys/class/firmware/lp5562/loading
echo 1 > /sys/bus/i2c/devices/xxxx/run_engine
How to load the predefined patterns
===================================
Please refer to 'leds-lp55xx.txt"
Setting Current of Each Channel
===============================
Like LP5521 and LP5523/55231, LP5562 provides LED current settings.
The 'led_current' and 'max_current' are used.
LP5562 platform data와 채널 비활성화
78-137Platform data 예제는 `lp55xx_led_config` 배열에 R·G·B·W를 각각 channel 0·1·2·3으로 정의합니다. 각 항목의 `led_current`는 20, `max_current`는 40입니다.
`lp5562_setup()`, `lp5562_release()`, `lp5562_enable(bool state)` callback은 hardware resource 준비·해제와 chip enable 신호 제어를 담당합니다.
`lp55xx_platform_data`는 LED config 배열과 `ARRAY_SIZE(lp5562_led_config)`로 계산한 채널 수, 세 resource callback을 연결합니다. Platform별 설정에는 이 `lp55xx_platform_data` 구조체를 사용합니다.
Platform data에서 어떤 채널의 current를 0으로 설정하면 해당 채널은 비활성화되고 sysfs에도 나타나지 않습니다. 따라서 0은 단순히 현재 밝기가 꺼진 상태가 아니라 채널 자체를 노출하지 않는 구성 값입니다.
예제의 채널 번호와 current 설정입니다.
Example of Platform data
========================
::
static struct lp55xx_led_config lp5562_led_config[] = {
{
.name = "R",
.chan_nr = 0,
.led_current = 20,
.max_current = 40,
},
{
.name = "G",
.chan_nr = 1,
.led_current = 20,
.max_current = 40,
},
{
.name = "B",
.chan_nr = 2,
.led_current = 20,
.max_current = 40,
},
{
.name = "W",
.chan_nr = 3,
.led_current = 20,
.max_current = 40,
},
};
static int lp5562_setup(void)
{
/* setup HW resources */
}
static void lp5562_release(void)
{
/* Release HW resources */
}
static void lp5562_enable(bool state)
{
/* Control of chip enable signal */
}
static struct lp55xx_platform_data lp5562_platform_data = {
.led_config = lp5562_led_config,
.num_channels = ARRAY_SIZE(lp5562_led_config),
.setup_resources = lp5562_setup,
.release_resources = lp5562_release,
.enable = lp5562_enable,
};
To configure the platform specific data, lp55xx_platform_data structure is used
If the current is set to 0 in the platform data, that channel is
disabled and it is not visible in the sysfs.
요약·해설
leds-lp5562.rst:1-137LP5562의 핵심은 RGB 고정 engine과 White 선택 engine을 `engine_mux`로 구분한 뒤 firmware data를 적재하는 순서입니다.
Platform data에서 current 0은 채널을 sysfs에서 완전히 숨기는 구성이라는 점도 함께 확인해야 합니다.