요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
==============
Audio Clocking
==============
This text describes the audio clocking terms in ASoC and digital audio in
general. Note: Audio clocking can be complex!
Master Clock
------------
Every audio subsystem is driven by a master clock (sometimes referred to as MCLK
or SYSCLK). This audio master clock can be derived from a number of sources
(e.g. crystal, PLL, CPU clock) and is responsible for producing the correct
audio playback and capture sample rates.
Some master clocks (e.g. PLLs and CPU based clocks) are configurable in that
their speed can be altered by software (depending on the system use and to save
power). Other master clocks are fixed at a set frequency (i.e. crystals).
DAI Clocks
----------
The Digital Audio Interface is usually driven by a Bit Clock (often referred to
as BCLK). This clock is used to drive the digital audio data across the link
between the codec and CPU.
The DAI also has a frame clock to signal the start of each audio frame. This
clock is sometimes referred to as LRC (left right clock) or FRAME. This clock
runs at exactly the sample rate (LRC = Rate).
Bit Clock can be generated as follows:-
- BCLK = MCLK / x, or
- BCLK = LRC * x, or
- BCLK = LRC * Channels * Word Size
This relationship depends on the codec or SoC CPU in particular. In general
it is best to configure BCLK to the lowest possible speed (depending on your
rate, number of channels and word size) to save on power.
It is also desirable to use the codec (if possible) to drive (or master) the
audio clocks as it usually gives more accurate sample rates than the CPU.
ASoC provided clock APIs
------------------------
.. kernel-doc:: sound/soc/soc-dai.c
:identifiers: snd_soc_dai_set_sysclk
.. kernel-doc:: sound/soc/soc-dai.c
:identifiers: snd_soc_dai_set_clkdiv
.. kernel-doc:: sound/soc/soc-dai.c
:identifiers: snd_soc_dai_set_pll
.. kernel-doc:: sound/soc/soc-dai.c
:identifiers: snd_soc_dai_set_bclk_ratio
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
ASoC 오디오 클록 용어
1-8이 문서는 ASoC와 일반적인 디지털 오디오에서 사용하는 클로킹 용어를 설명한다. 오디오 클로킹은 여러 클록의 주파수와 주종 관계를 함께 맞춰야 하므로 복잡할 수 있다.
==============
Audio Clocking
==============
This text describes the audio clocking terms in ASoC and digital audio in
general. Note: Audio clocking can be complex!
마스터 클록
9-21모든 오디오 서브시스템은 마스터 클록으로 구동된다. 이 클록은 `MCLK` 또는 `SYSCLK`라고도 하며 crystal, PLL, CPU clock 같은 여러 소스에서 얻을 수 있다. 마스터 클록은 올바른 재생 및 캡처 sample rate를 만들어 내는 기준이 된다.
PLL이나 CPU 기반 클록처럼 일부 마스터 클록은 시스템 사용 조건과 절전을 위해 소프트웨어로 속도를 바꿀 수 있다. 반면 crystal처럼 정해진 주파수로만 동작하는 고정 마스터 클록도 있다.
MCLK 또는 SYSCLK를 만드는 대표 소스와 설정 가능성을 구분한다.
Master Clock
------------
Every audio subsystem is driven by a master clock (sometimes referred to as MCLK
or SYSCLK). This audio master clock can be derived from a number of sources
(e.g. crystal, PLL, CPU clock) and is responsible for producing the correct
audio playback and capture sample rates.
Some master clocks (e.g. PLLs and CPU based clocks) are configurable in that
their speed can be altered by software (depending on the system use and to save
power). Other master clocks are fixed at a set frequency (i.e. crystals).
DAI의 비트 클록과 프레임 클록
22-44Digital Audio Interface인 DAI는 보통 `BCLK`라고 부르는 Bit Clock으로 구동된다. BCLK는 codec과 CPU 사이의 링크에서 디지털 오디오 데이터를 전송하는 타이밍을 제공한다.
DAI에는 각 오디오 프레임의 시작을 알리는 frame clock도 있다. 이 클록은 `LRC`(left right clock) 또는 `FRAME`이라고도 하며 sample rate와 정확히 같은 주파수로 동작한다. 따라서 `LRC = Rate`이다.
BCLK는 `MCLK / x`, `LRC * x`, 또는 `LRC * Channels * Word Size` 관계로 생성할 수 있다. 실제 관계는 해당 codec이나 SoC CPU 구현에 따라 달라진다.
전력을 줄이려면 sample rate, channel 수, word size가 허용하는 범위에서 BCLK를 가능한 한 낮게 설정하는 것이 일반적으로 좋다. 가능하다면 codec이 오디오 클록을 구동하는 master 역할을 맡는 편이 CPU보다 더 정확한 sample rate를 제공하는 경우가 많다.
오디오 링크의 세 주요 클록과 주파수 관계를 정리한다.
하드웨어가 지원하는 방식에 따라 x는 divider 또는 ratio가 된다.
기준 클록과 프레임 조건으로 링크 전송 클록을 결정한다.
DAI Clocks
----------
The Digital Audio Interface is usually driven by a Bit Clock (often referred to
as BCLK). This clock is used to drive the digital audio data across the link
between the codec and CPU.
The DAI also has a frame clock to signal the start of each audio frame. This
clock is sometimes referred to as LRC (left right clock) or FRAME. This clock
runs at exactly the sample rate (LRC = Rate).
Bit Clock can be generated as follows:-
- BCLK = MCLK / x, or
- BCLK = LRC * x, or
- BCLK = LRC * Channels * Word Size
This relationship depends on the codec or SoC CPU in particular. In general
it is best to configure BCLK to the lowest possible speed (depending on your
rate, number of channels and word size) to save on power.
It is also desirable to use the codec (if possible) to drive (or master) the
audio clocks as it usually gives more accurate sample rates than the CPU.
ASoC 클록 API
45-58이 절의 `kernel-doc` 지시문은 `sound/soc/soc-dai.c`에서 네 클록 API의 설명을 가져온다. `snd_soc_dai_set_sysclk()`는 DAI system clock을 설정하고, `snd_soc_dai_set_clkdiv()`는 clock divider를 설정한다.
`snd_soc_dai_set_pll()`은 DAI의 PLL을 구성하며, `snd_soc_dai_set_bclk_ratio()`는 한 frame에 대응하는 BCLK 비율을 설정한다. 구체적인 지원 값과 동작은 각 DAI driver 구현에 달려 있다.
원문이 kernel-doc으로 포함하는 함수와 설정 대상을 연결한다.
ASoC provided clock APIs
------------------------
.. kernel-doc:: sound/soc/soc-dai.c
:identifiers: snd_soc_dai_set_sysclk
.. kernel-doc:: sound/soc/soc-dai.c
:identifiers: snd_soc_dai_set_clkdiv
.. kernel-doc:: sound/soc/soc-dai.c
:identifiers: snd_soc_dai_set_pll
.. kernel-doc:: sound/soc/soc-dai.c
:identifiers: snd_soc_dai_set_bclk_ratio
요약·해설
clocking.rst:1-58ASoC 디지털 오디오 링크의 MCLK·SYSCLK, BCLK, LRC·FRAME 용어와 주파수 관계를 설명하고, codec과 CPU의 clock master 선택 및 절전 관점의 BCLK 설정 원칙을 정리합니다. `snd_soc_dai_set_sysclk()` 등 네 DAI 클록 API도 원문 좌표와 함께 연결합니다.