요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
========================
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::
#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::
#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));
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
LM3556 flash와 torch mode
1-64Texas 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입니다.
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-107Indicator 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입니다.
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-137Driver는 `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에 등록합니다.
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));
요약·해설
leds-lm3556.rst:1-137LM3556은 flash 16단계, torch·indicator 8단계 current와 네 indicator pattern을 별도 sysfs interface로 제공합니다.