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

Linux 6.18.37 · LEDs

LM3556 LED Driver

LM3556의 flash·torch·indicator current와 pattern, static I2C board 등록 방식입니다.

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

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

1. 요약·해설

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

요약·해설

leds-lm3556.rst:1-137

LM3556은 flash 16단계, torch·indicator 8단계 current와 네 indicator pattern을 별도 sysfs interface로 제공합니다.

2. 영어 원문 전체

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

원문 전체 펼치기
1 ========================
2 Kernel driver for lm3556
3 ========================
4
5 * Texas Instrument:
6 1.5 A Synchronous Boost LED Flash Driver w/ High-Side Current Source
7 * Datasheet: http://www.national.com/ds/LM/LM3556.pdf
8
9 Authors:
10 - Daniel Jeong
11
12 Contact:Daniel Jeong(daniel.jeong-at-ti.com, gshark.jeong-at-gmail.com)
13
14 Description
15 -----------
16 There are 3 functions in LM3556, Flash, Torch and Indicator.
17
18 Flash Mode
19 ^^^^^^^^^^
20
21 In Flash Mode, the LED current source(LED) provides 16 target current levels
22 from 93.75 mA to 1500 mA.The Flash currents are adjusted via the CURRENT
23 CONTROL REGISTER(0x09).Flash mode is activated by the ENABLE REGISTER(0x0A),
24 or by pulling the STROBE pin HIGH.
25
26 LM3556 Flash can be controlled through /sys/class/leds/flash/brightness file
27
28 * if STROBE pin is enabled, below example control brightness only, and
29 ON / OFF will be controlled by STROBE pin.
30
31 Flash Example:
32
33 OFF::
34
35 #echo 0 > /sys/class/leds/flash/brightness
36
37 93.75 mA::
38
39 #echo 1 > /sys/class/leds/flash/brightness
40
41 ...
42
43 1500 mA::
44
45 #echo 16 > /sys/class/leds/flash/brightness
46
47 Torch Mode
48 ^^^^^^^^^^
49
50 In Torch Mode, the current source(LED) is programmed via the CURRENT CONTROL
51 REGISTER(0x09).Torch Mode is activated by the ENABLE REGISTER(0x0A) or by the
52 hardware TORCH input.
53
54 LM3556 torch can be controlled through /sys/class/leds/torch/brightness file.
55 * if TORCH pin is enabled, below example control brightness only,
56 and ON / OFF will be controlled by TORCH pin.
57
58 Torch Example:
59
60 OFF::
61
62 #echo 0 > /sys/class/leds/torch/brightness
63
64 46.88 mA::
65
66 #echo 1 > /sys/class/leds/torch/brightness
67
68 ...
69
70 375 mA::
71
72 #echo 8 > /sys/class/leds/torch/brightness
73
74 Indicator Mode
75 ^^^^^^^^^^^^^^
76
77 Indicator pattern can be set through /sys/class/leds/indicator/pattern file,
78 and 4 patterns are pre-defined in indicator_pattern array.
79
80 According to N-lank, Pulse time and N Period values, different pattern wiill
81 be generated.If you want new patterns for your own device, change
82 indicator_pattern array with your own values and INDIC_PATTERN_SIZE.
83
84 Please refer datasheet for more detail about N-Blank, Pulse time and N Period.
85
86 Indicator pattern example:
87
88 pattern 0::
89
90 #echo 0 > /sys/class/leds/indicator/pattern
91
92 ...
93
94 pattern 3::
95
96 #echo 3 > /sys/class/leds/indicator/pattern
97
98 Indicator brightness can be controlled through
99 sys/class/leds/indicator/brightness file.
100
101 Example:
102
103 OFF::
104
105 #echo 0 > /sys/class/leds/indicator/brightness
106
107 5.86 mA::
108
109 #echo 1 > /sys/class/leds/indicator/brightness
110
111 ...
112
113 46.875mA::
114
115 #echo 8 > /sys/class/leds/indicator/brightness
116
117 Notes
118 -----
119 Driver expects it is registered using the i2c_board_info mechanism.
120 To register the chip at address 0x63 on specific adapter, set the platform data
121 according to include/linux/platform_data/leds-lm3556.h, set the i2c board info
122
123 Example::
124
125 static struct i2c_board_info board_i2c_ch4[] __initdata = {
126 {
127 I2C_BOARD_INFO(LM3556_NAME, 0x63),
128 .platform_data = &lm3556_pdata,
129 },
130 };
131
132 and register it in the platform init function
133
134 Example::
135
136 board_register_i2c_bus(4, 400,
137 board_i2c_ch4, ARRAY_SIZE(board_i2c_ch4));
138

3. 한국어 전문 번역

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

LM3556 flash와 torch mode

1-64

Texas Instruments LM3556은 high-side current source를 갖춘 1.5A synchronous boost LED flash driver입니다. Flash, torch, indicator 세 기능을 제공합니다.

Flash mode는 `CURRENT CONTROL REGISTER(0x09)`에서 93.75mA부터 1500mA까지 16단계 target current를 설정합니다. `ENABLE REGISTER(0x0A)` 또는 STROBE pin HIGH로 활성화합니다.

Userspace는 `/sys/class/leds/flash/brightness`로 flash를 제어합니다. 값 0은 off, 1은 93.75mA, 16은 1500mA입니다. STROBE pin mode가 켜져 있으면 sysfs 값은 brightness만 바꾸고 on/off는 STROBE pin이 제어합니다.

Torch mode도 register `0x09`에서 current를 program하고 register `0x0A` 또는 hardware TORCH input으로 활성화합니다. `/sys/class/leds/torch/brightness`에서 0은 off, 1은 46.88mA, 8은 375mA입니다.

LM3556 current mode
ModeSysfsStep 범위Hardware enable
Flash`flash/brightness``0~16`, 최대 1500mASTROBE pin 또는 register 0x0A
Torch`torch/brightness``0~8`, 최대 375mATORCH pin 또는 register 0x0A
Indicator`indicator/brightness``0~8`, 최대 46.875mADriver pattern logic

Brightness step과 hardware input의 역할입니다.

========================
Kernel driver for lm3556
========================

* Texas Instrument:
  1.5 A Synchronous Boost LED Flash Driver w/ High-Side Current Source
* Datasheet: http://www.national.com/ds/LM/LM3556.pdf

Authors:
      - Daniel Jeong

        Contact:Daniel Jeong(daniel.jeong-at-ti.com, gshark.jeong-at-gmail.com)

Description
-----------
There are 3 functions in LM3556, Flash, Torch and Indicator.

Flash Mode
^^^^^^^^^^

In Flash Mode, the LED current source(LED) provides 16 target current levels
from 93.75 mA to 1500 mA.The Flash currents are adjusted via the CURRENT
CONTROL REGISTER(0x09).Flash mode is activated by the ENABLE REGISTER(0x0A),
or by pulling the STROBE pin HIGH.

LM3556 Flash can be controlled through /sys/class/leds/flash/brightness file

* if STROBE pin is enabled, below example control brightness only, and
  ON / OFF will be controlled by STROBE pin.

Flash Example:

OFF::

        #echo 0 > /sys/class/leds/flash/brightness

93.75 mA::

        #echo 1 > /sys/class/leds/flash/brightness

...

1500  mA::

        #echo 16 > /sys/class/leds/flash/brightness

Torch Mode
^^^^^^^^^^

In Torch Mode, the current source(LED) is programmed via the CURRENT CONTROL
REGISTER(0x09).Torch Mode is activated by the ENABLE REGISTER(0x0A) or by the
hardware TORCH input.

LM3556 torch can be controlled through /sys/class/leds/torch/brightness file.
* if TORCH pin is enabled, below example control brightness only,
and ON / OFF will be controlled by TORCH pin.

Torch Example:

OFF::

        #echo 0 > /sys/class/leds/torch/brightness

46.88 mA::

Indicator pattern과 brightness

65-107

Indicator pattern은 `/sys/class/leds/indicator/pattern`에서 선택합니다. `indicator_pattern` array에 pattern 0부터 3까지 네 개가 미리 정의되어 있습니다.

N-Blank, pulse time, N period 값의 조합으로 pattern을 생성합니다. Device-specific pattern이 필요하면 `indicator_pattern` array와 `INDIC_PATTERN_SIZE`를 수정하며 세 parameter의 의미는 datasheet를 참조합니다.

Pattern file에 0 또는 3 같은 index를 써서 선택합니다. Indicator brightness는 `/sys/class/leds/indicator/brightness`에서 제어하며 0은 off, 1은 5.86mA, 8은 46.875mA입니다.

Indicator 설정
`indicator/pattern`에 0~3 pattern index 기록Driver가 N-Blank·pulse time·N period 적용`indicator/brightness`에 0~8 current step 기록값 0이면 off, 값 8이면 최대 46.875mA

Pattern shape와 current를 독립적으로 선택합니다.


        #echo 1 > /sys/class/leds/torch/brightness

...

375 mA::

        #echo 8 > /sys/class/leds/torch/brightness

Indicator Mode
^^^^^^^^^^^^^^

Indicator pattern can be set through /sys/class/leds/indicator/pattern file,
and 4 patterns are pre-defined in indicator_pattern array.

According to N-lank, Pulse time and N Period values, different pattern wiill
be generated.If you want new patterns for your own device, change
indicator_pattern array with your own values and INDIC_PATTERN_SIZE.

Please refer datasheet for more detail about N-Blank, Pulse time and N Period.

Indicator pattern example:

pattern 0::

        #echo 0 > /sys/class/leds/indicator/pattern

...

pattern 3::

        #echo 3 > /sys/class/leds/indicator/pattern

Indicator brightness can be controlled through
sys/class/leds/indicator/brightness file.

Example:

OFF::

        #echo 0 > /sys/class/leds/indicator/brightness

5.86 mA::

I2C board 등록

108-137

Driver는 `i2c_board_info` mechanism으로 등록된다고 가정합니다. 특정 adapter에서 address `0x63`의 chip을 등록하려면 `include/linux/platform_data/leds-lm3556.h`에 맞춰 platform data를 구성하고 I2C board info를 선언합니다.

예제는 `I2C_BOARD_INFO(LM3556_NAME, 0x63)`와 `.platform_data = &lm3556_pdata`를 사용합니다. Platform init function에서 `board_register_i2c_bus(4, 400, board_i2c_ch4, ARRAY_SIZE(board_i2c_ch4))`로 bus 4에 등록합니다.

LM3556 platform 등록
`lm3556_pdata` platform data 준비Address `0x63`의 `i2c_board_info` 선언Board info에 platform data pointer 연결Platform init에서 adapter·speed와 함께 board info 등록

Static board 정보로 I2C client를 생성합니다.


        #echo 1 > /sys/class/leds/indicator/brightness

...

46.875mA::

        #echo 8 > /sys/class/leds/indicator/brightness

Notes
-----
Driver expects it is registered using the i2c_board_info mechanism.
To register the chip at address 0x63 on specific adapter, set the platform data
according to include/linux/platform_data/leds-lm3556.h, set the i2c board info

Example::

        static struct i2c_board_info board_i2c_ch4[] __initdata = {
                {
                         I2C_BOARD_INFO(LM3556_NAME, 0x63),
                         .platform_data = &lm3556_pdata,
                 },
        };

and register it in the platform init function

Example::

        board_register_i2c_bus(4, 400,
                                board_i2c_ch4, ARRAY_SIZE(board_i2c_ch4));