blob: fe1c5e0c8555e0c2564071190eada3dd551ed3dd [file] [log] [blame]
Jie Yang12e180a2015-04-27 21:21:02 +08001Why we need Jack kcontrols
2==========================
3
4ALSA uses kcontrols to export audio controls(switch, volume, Mux, ...)
5to user space. This means userspace applications like pulseaudio can
6switch off headphones and switch on speakers when no headphones are
7pluged in.
8
9The old ALSA jack code only created input devices for each registered
10jack. These jack input devices are not readable by userspace devices
11that run as non root.
12
13The new jack code creates embedded jack kcontrols for each jack that
14can be read by any process.
15
16This can be combined with UCM to allow userspace to route audio more
17intelligently based on jack insertion or removal events.
18
19Jack Kcontrol Internals
20=======================
21
22Each jack will have a kcontrol list, so that we can create a kcontrol
23and attach it to the jack, at jack creation stage. We can also add a
24kcontrol to an existing jack, at anytime when required.
25
26Those kcontrols will be freed automatically when the Jack is freed.
27
28How to use jack kcontrols
29=========================
30
31In order to keep compatibility, snd_jack_new() has been modified by
32adding two params :-
33
34 - @initial_kctl: if true, create a kcontrol and add it to the jack
35 list.
36 - @phantom_jack: Don't create a input device for phantom jacks.
37
38HDA jacks can set phantom_jack to true in order to create a phantom
39jack and set initial_kctl to true to create an initial kcontrol with
40the correct id.
41
42ASoC jacks should set initial_kctl as false. The pin name will be
43assigned as the jack kcontrol name.