요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
==================
ALSA Jack Controls
==================
Why we need Jack kcontrols
==========================
ALSA uses kcontrols to export audio controls(switch, volume, Mux, ...)
to user space. This means userspace applications like pulseaudio can
switch off headphones and switch on speakers when no headphones are
plugged in.
The old ALSA jack code only created input devices for each registered
jack. These jack input devices are not readable by userspace devices
that run as non root.
The new jack code creates embedded jack kcontrols for each jack that
can be read by any process.
This can be combined with UCM to allow userspace to route audio more
intelligently based on jack insertion or removal events.
Jack Kcontrol Internals
=======================
Each jack will have a kcontrol list, so that we can create a kcontrol
and attach it to the jack, at jack creation stage. We can also add a
kcontrol to an existing jack, at anytime when required.
Those kcontrols will be freed automatically when the Jack is freed.
How to use jack kcontrols
=========================
In order to keep compatibility, snd_jack_new() has been modified by
adding two params:
initial_kctl
if true, create a kcontrol and add it to the jack list.
phantom_jack
Don't create a input device for phantom jacks.
HDA jacks can set phantom_jack to true in order to create a phantom
jack and set initial_kctl to true to create an initial kcontrol with
the correct id.
ASoC jacks should set initial_kctl as false. The pin name will be
assigned as the jack kcontrol name.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Jack kcontrol이 필요한 이유
1-22ALSA는 switch, volume, Mux 같은 audio control을 kcontrol로 사용자 공간에 공개한다. PulseAudio 같은 응용 프로그램은 이를 이용해 headphone이 꽂혀 있지 않을 때 headphone 출력을 끄고 speaker를 켤 수 있다.
옛 ALSA jack code는 등록한 jack마다 input device만 만들었다. 이 jack input device는 root가 아닌 권한으로 실행하는 사용자 공간 process가 읽을 수 없었다.
새 jack code는 jack마다 내장 jack kcontrol을 만들며 모든 process가 읽을 수 있다. UCM과 결합하면 사용자 공간이 jack 삽입·제거 event에 따라 audio route를 더 지능적으로 선택할 수 있다.
권한 제약이 있던 input device 대신 readable kcontrol을 제공한다.
==================
ALSA Jack Controls
==================
Why we need Jack kcontrols
==========================
ALSA uses kcontrols to export audio controls(switch, volume, Mux, ...)
to user space. This means userspace applications like pulseaudio can
switch off headphones and switch on speakers when no headphones are
plugged in.
The old ALSA jack code only created input devices for each registered
jack. These jack input devices are not readable by userspace devices
that run as non root.
The new jack code creates embedded jack kcontrols for each jack that
can be read by any process.
This can be combined with UCM to allow userspace to route audio more
intelligently based on jack insertion or removal events.
Jack kcontrol 내부 생명주기
23-31각 jack은 kcontrol list를 가진다. Jack 생성 시 kcontrol을 만들어 list에 연결할 수 있고, 필요하면 기존 jack에도 언제든 kcontrol을 추가할 수 있다. Jack을 해제하면 연결된 kcontrol도 자동으로 해제된다.
생성·추가·해제의 소유 관계다.
Jack Kcontrol Internals
=======================
Each jack will have a kcontrol list, so that we can create a kcontrol
and attach it to the jack, at jack creation stage. We can also add a
kcontrol to an existing jack, at anytime when required.
Those kcontrols will be freed automatically when the Jack is freed.
snd_jack_new() 매개변수와 HDA·ASoC
32-48호환성을 유지하기 위해 `snd_jack_new()`에 `initial_kctl`과 `phantom_jack` 두 매개변수를 추가했다. `initial_kctl`이 true면 kcontrol을 만들고 jack list에 추가한다. `phantom_jack`이 true면 phantom jack용 input device를 만들지 않는다.
HDA jack은 `phantom_jack=true`로 phantom jack을 만들고 `initial_kctl=true`로 올바른 ID의 초기 kcontrol을 만들 수 있다. ASoC jack은 `initial_kctl=false`를 사용해야 하며 pin 이름이 jack kcontrol 이름으로 지정된다.
HDA와 ASoC의 권장 조합이다.
How to use jack kcontrols
=========================
In order to keep compatibility, snd_jack_new() has been modified by
adding two params:
initial_kctl
if true, create a kcontrol and add it to the jack list.
phantom_jack
Don't create a input device for phantom jacks.
HDA jacks can set phantom_jack to true in order to create a phantom
jack and set initial_kctl to true to create an initial kcontrol with
the correct id.
ASoC jacks should set initial_kctl as false. The pin name will be
assigned as the jack kcontrol name.
요약·해설
jack-controls.rst:1-48모든 process가 jack 상태를 읽도록 embedded kcontrol을 제공하는 이유와 snd_jack_new()의 initial_kctl·phantom_jack 규칙을 설명합니다.