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

Linux 6.18.37 · LEDs

LP5562 LED Driver

RGBW 네 채널과 세 engine 사이의 mux, firmware loading, platform data 계약입니다.

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

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

1. 요약·해설

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

요약·해설

leds-lp5562.rst:1-137

LP5562의 핵심은 RGB 고정 engine과 White 선택 engine을 `engine_mux`로 구분한 뒤 firmware data를 적재하는 순서입니다.

Platform data에서 current 0은 채널을 sysfs에서 완전히 숨기는 구성이라는 점도 함께 확인해야 합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 ========================
2 Kernel driver for lp5562
3 ========================
4
5 * TI LP5562 LED Driver
6
7 Author: Milo(Woogyom) Kim <milo.kim@ti.com>
8
9 Description
10 ===========
11
12 LP5562 can drive up to 4 channels. R/G/B and White.
13 LEDs can be controlled directly via the led class control interface.
14
15 All four channels can be also controlled using the engine micro programs.
16 LP5562 has the internal program memory for running various LED patterns.
17 For the details, please refer to 'firmware' section in leds-lp55xx.txt
18
19 Device attribute
20 ================
21
22 engine_mux
23 3 Engines are allocated in LP5562, but the number of channel is 4.
24 Therefore each channel should be mapped to the engine number.
25
26 Value: RGB or W
27
28 This attribute is used for programming LED data with the firmware interface.
29 Unlike the LP5521/LP5523/55231, LP5562 has unique feature for the engine mux,
30 so additional sysfs is required
31
32 LED Map
33
34 ===== === ===============================
35 Red ... Engine 1 (fixed)
36 Green ... Engine 2 (fixed)
37 Blue ... Engine 3 (fixed)
38 White ... Engine 1 or 2 or 3 (selective)
39 ===== === ===============================
40
41 How to load the program data using engine_mux
42 =============================================
43
44 Before loading the LP5562 program data, engine_mux should be written between
45 the engine selection and loading the firmware.
46 Engine mux has two different mode, RGB and W.
47 RGB is used for loading RGB program data, W is used for W program data.
48
49 For example, run blinking green channel pattern::
50
51 echo 2 > /sys/bus/i2c/devices/xxxx/select_engine # 2 is for green channel
52 echo "RGB" > /sys/bus/i2c/devices/xxxx/engine_mux # engine mux for RGB
53 echo 1 > /sys/class/firmware/lp5562/loading
54 echo "4000600040FF6000" > /sys/class/firmware/lp5562/data
55 echo 0 > /sys/class/firmware/lp5562/loading
56 echo 1 > /sys/bus/i2c/devices/xxxx/run_engine
57
58 To run a blinking white pattern::
59
60 echo 1 or 2 or 3 > /sys/bus/i2c/devices/xxxx/select_engine
61 echo "W" > /sys/bus/i2c/devices/xxxx/engine_mux
62 echo 1 > /sys/class/firmware/lp5562/loading
63 echo "4000600040FF6000" > /sys/class/firmware/lp5562/data
64 echo 0 > /sys/class/firmware/lp5562/loading
65 echo 1 > /sys/bus/i2c/devices/xxxx/run_engine
66
67 How to load the predefined patterns
68 ===================================
69
70 Please refer to 'leds-lp55xx.txt"
71
72 Setting Current of Each Channel
73 ===============================
74
75 Like LP5521 and LP5523/55231, LP5562 provides LED current settings.
76 The 'led_current' and 'max_current' are used.
77
78 Example of Platform data
79 ========================
80
81 ::
82
83 static struct lp55xx_led_config lp5562_led_config[] = {
84 {
85 .name = "R",
86 .chan_nr = 0,
87 .led_current = 20,
88 .max_current = 40,
89 },
90 {
91 .name = "G",
92 .chan_nr = 1,
93 .led_current = 20,
94 .max_current = 40,
95 },
96 {
97 .name = "B",
98 .chan_nr = 2,
99 .led_current = 20,
100 .max_current = 40,
101 },
102 {
103 .name = "W",
104 .chan_nr = 3,
105 .led_current = 20,
106 .max_current = 40,
107 },
108 };
109
110 static int lp5562_setup(void)
111 {
112 /* setup HW resources */
113 }
114
115 static void lp5562_release(void)
116 {
117 /* Release HW resources */
118 }
119
120 static void lp5562_enable(bool state)
121 {
122 /* Control of chip enable signal */
123 }
124
125 static struct lp55xx_platform_data lp5562_platform_data = {
126 .led_config = lp5562_led_config,
127 .num_channels = ARRAY_SIZE(lp5562_led_config),
128 .setup_resources = lp5562_setup,
129 .release_resources = lp5562_release,
130 .enable = lp5562_enable,
131 };
132
133 To configure the platform specific data, lp55xx_platform_data structure is used
134
135
136 If the current is set to 0 in the platform data, that channel is
137 disabled and it is not visible in the sysfs.
138

3. 한국어 전문 번역

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

LP5562 채널과 engine mux

1-40

TI 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가 존재합니다.

LP5562 LED와 engine mapping
채널Engine선택 가능 여부
RedEngine 1고정
GreenEngine 2고정
BlueEngine 3고정
WhiteEngine 1, 2 또는 3선택

RGB는 고정 mapping이고 White는 선택한 engine을 공유합니다.

========================
Kernel driver for lp5562
========================

* TI LP5562 LED Driver

Author: Milo(Woogyom) Kim <milo.kim@ti.com>

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-77

Program 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`로 설정합니다.

LP5562 firmware loading
`select_engine`에 engine 1·2·3 중 대상 번호 기록RGB 채널이면 `engine_mux = RGB`, White면 `engine_mux = W``/sys/class/firmware/lp5562/loading`에 `1` 기록`data`에 `4000600040FF6000` 같은 program byte string 기록`loading`에 `0`을 기록해 적재 완료`run_engine`에 `1`을 기록해 실행

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-137

Platform 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은 단순히 현재 밝기가 꺼진 상태가 아니라 채널 자체를 노출하지 않는 구성 값입니다.

LP5562 platform data 채널
이름`chan_nr``led_current``max_current`
R02040
G12040
B22040
W32040

예제의 채널 번호와 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.