요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
==============================
Kernel driver for Qualcomm LPG
==============================
Description
-----------
The Qualcomm LPG can be found in a variety of Qualcomm PMICs and consists of a
number of PWM channels, a programmable pattern lookup table and a RGB LED
current sink.
To facilitate the various use cases, the LPG channels can be exposed as
individual LEDs, grouped together as RGB LEDs or otherwise be accessed as PWM
channels. The output of each PWM channel is routed to other hardware
blocks, such as the RGB current sink, GPIO pins etc.
The each PWM channel can operate with a period between 27us and 384 seconds and
has a 9 bit resolution of the duty cycle.
In order to provide support for status notifications with the CPU subsystem in
deeper idle states the LPG provides pattern support. This consists of a shared
lookup table of brightness values and per channel properties to select the
range within the table to use, the rate and if the pattern should repeat.
The pattern for a channel can be programmed using the "pattern" trigger, using
the hw_pattern attribute.
/sys/class/leds/<led>/hw_pattern
--------------------------------
Specify a hardware pattern for a Qualcomm LPG LED.
The pattern is a series of brightness and hold-time pairs, with the hold-time
expressed in milliseconds. The hold time is a property of the pattern and must
therefore be identical for each element in the pattern (except for the pauses
described below). As the LPG hardware is not able to perform the linear
transitions expected by the leds-trigger-pattern format, each entry in the
pattern must be followed a zero-length entry of the same brightness.
Simple pattern::
"255 500 255 0 0 500 0 0"
^
|
255 +----+ +----+
| | | | ...
0 | +----+ +----
+---------------------->
0 5 10 15 time (100ms)
The LPG supports specifying a longer hold-time for the first and last element
in the pattern, the so called "low pause" and "high pause".
Low-pause pattern::
"255 1000 255 0 0 500 0 0 255 500 255 0 0 500 0 0"
^
|
255 +--------+ +----+ +----+ +--------+
| | | | | | | | ...
0 | +----+ +----+ +----+ +----
+----------------------------->
0 5 10 15 20 25 time (100ms)
Similarly, the last entry can be stretched by using a higher hold-time on the
last entry.
In order to save space in the shared lookup table the LPG supports "ping-pong"
mode, in which case each run through the pattern is performed by first running
the pattern forward, then backwards. This mode is automatically used by the
driver when the given pattern is a palindrome. In this case the "high pause"
denotes the wait time before the pattern is run in reverse and as such the
specified hold-time of the middle item in the pattern is allowed to have a
different hold-time.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Qualcomm LPG 구조
1-27Qualcomm LPG는 여러 Qualcomm PMIC에 포함되며 다수의 PWM channel, program 가능한 pattern lookup table, RGB LED current sink로 구성됩니다.
LPG channel은 개별 LED로 노출하거나 RGB LED로 묶을 수 있고, 일반 PWM channel로 접근할 수도 있습니다. 각 PWM output은 RGB current sink, GPIO pin 등 다른 hardware block으로 routing됩니다.
각 PWM channel은 27us에서 384초 사이의 period와 9-bit duty-cycle resolution을 지원합니다.
CPU subsystem이 deep idle 상태일 때도 status notification을 유지하도록 shared brightness lookup table과 channel별 range·rate·repeat 설정으로 hardware pattern을 실행합니다. Pattern은 `pattern` trigger의 `hw_pattern` attribute로 program합니다.
공유 lookup table과 channel별 선택 정보가 pattern을 만듭니다.
.. SPDX-License-Identifier: GPL-2.0
==============================
Kernel driver for Qualcomm LPG
==============================
Description
-----------
The Qualcomm LPG can be found in a variety of Qualcomm PMICs and consists of a
number of PWM channels, a programmable pattern lookup table and a RGB LED
current sink.
To facilitate the various use cases, the LPG channels can be exposed as
individual LEDs, grouped together as RGB LEDs or otherwise be accessed as PWM
channels. The output of each PWM channel is routed to other hardware
blocks, such as the RGB current sink, GPIO pins etc.
The each PWM channel can operate with a period between 27us and 384 seconds and
has a 9 bit resolution of the duty cycle.
In order to provide support for status notifications with the CPU subsystem in
deeper idle states the LPG provides pattern support. This consists of a shared
lookup table of brightness values and per channel properties to select the
range within the table to use, the rate and if the pattern should repeat.
The pattern for a channel can be programmed using the "pattern" trigger, using
기본 hardware pattern
28-52`/sys/class/leds/<led>/hw_pattern`은 brightness와 millisecond hold-time 쌍의 연속입니다. Pause를 제외하면 hold-time은 pattern 전체의 속성이므로 각 element에서 같아야 합니다.
LPG hardware는 LED pattern 형식이 기대하는 linear transition을 만들 수 없습니다. 따라서 각 brightness entry 뒤에 같은 brightness와 zero-length를 갖는 entry를 반드시 이어 붙입니다.
예제 `255 500 255 0 0 500 0 0`은 255 brightness를 500ms 유지하고 zero-length duplicate로 전환을 닫은 뒤, 0 brightness를 500ms 유지하고 다시 zero-length duplicate를 둡니다. 이 high·low cycle이 반복됩니다.
원문 ASCII 파형과 같은 500ms high·low 반복입니다.
the hw_pattern attribute.
/sys/class/leds/<led>/hw_pattern
--------------------------------
Specify a hardware pattern for a Qualcomm LPG LED.
The pattern is a series of brightness and hold-time pairs, with the hold-time
expressed in milliseconds. The hold time is a property of the pattern and must
therefore be identical for each element in the pattern (except for the pauses
described below). As the LPG hardware is not able to perform the linear
transitions expected by the leds-trigger-pattern format, each entry in the
pattern must be followed a zero-length entry of the same brightness.
Simple pattern::
"255 500 255 0 0 500 0 0"
^
|
255 +----+ +----+
| | | | ...
0 | +----+ +----
+---------------------->
0 5 10 15 time (100ms)
Low·high pause와 ping-pong
53-78LPG는 pattern의 첫 element와 마지막 element에 더 긴 hold-time을 줄 수 있으며 이를 각각 `low pause`, `high pause`라고 부릅니다. Low-pause 예제는 첫 high state를 1000ms로 늘리고 나머지 state는 500ms로 유지합니다.
마지막 entry의 hold-time을 더 크게 지정하면 마지막 state를 늘리는 high pause를 만들 수 있습니다.
Shared lookup table 공간을 절약하는 `ping-pong` mode에서는 pattern을 정방향으로 실행한 다음 역방향으로 실행합니다. Driver는 전달된 pattern이 palindrome이면 이 mode를 자동으로 사용합니다.
Ping-pong에서는 `high pause`가 역방향 실행 전 대기 시간입니다. 따라서 palindrome의 가운데 item은 다른 hold-time을 가질 수 있습니다.
Palindrome pattern을 lookup table에 한 번만 저장해 양방향으로 실행합니다.
The LPG supports specifying a longer hold-time for the first and last element
in the pattern, the so called "low pause" and "high pause".
Low-pause pattern::
"255 1000 255 0 0 500 0 0 255 500 255 0 0 500 0 0"
^
|
255 +--------+ +----+ +----+ +--------+
| | | | | | | | ...
0 | +----+ +----+ +----+ +----
+----------------------------->
0 5 10 15 20 25 time (100ms)
Similarly, the last entry can be stretched by using a higher hold-time on the
last entry.
In order to save space in the shared lookup table the LPG supports "ping-pong"
mode, in which case each run through the pattern is performed by first running
the pattern forward, then backwards. This mode is automatically used by the
driver when the given pattern is a palindrome. In this case the "high pause"
denotes the wait time before the pattern is run in reverse and as such the
specified hold-time of the middle item in the pattern is allowed to have a
different hold-time.
요약·해설
leds-qcom-lpg.rst:1-78LPG pattern은 linear transition 대신 같은 brightness의 zero-length entry를 요구합니다.
Palindrome을 이용한 ping-pong과 첫·마지막 pause가 shared table 공간을 절약합니다.