1df3a5710STakashi Iwai================== 2df3a5710STakashi IwaiALSA Jack Controls 3df3a5710STakashi Iwai================== 4df3a5710STakashi Iwai 5df3a5710STakashi IwaiWhy we need Jack kcontrols 6df3a5710STakashi Iwai========================== 7df3a5710STakashi Iwai 8df3a5710STakashi IwaiALSA uses kcontrols to export audio controls(switch, volume, Mux, ...) 9df3a5710STakashi Iwaito user space. This means userspace applications like pulseaudio can 10df3a5710STakashi Iwaiswitch off headphones and switch on speakers when no headphones are 11*ba35c3a5SRandy Dunlapplugged in. 12df3a5710STakashi Iwai 13df3a5710STakashi IwaiThe old ALSA jack code only created input devices for each registered 14df3a5710STakashi Iwaijack. These jack input devices are not readable by userspace devices 15df3a5710STakashi Iwaithat run as non root. 16df3a5710STakashi Iwai 17df3a5710STakashi IwaiThe new jack code creates embedded jack kcontrols for each jack that 18df3a5710STakashi Iwaican be read by any process. 19df3a5710STakashi Iwai 20df3a5710STakashi IwaiThis can be combined with UCM to allow userspace to route audio more 21df3a5710STakashi Iwaiintelligently based on jack insertion or removal events. 22df3a5710STakashi Iwai 23df3a5710STakashi IwaiJack Kcontrol Internals 24df3a5710STakashi Iwai======================= 25df3a5710STakashi Iwai 26df3a5710STakashi IwaiEach jack will have a kcontrol list, so that we can create a kcontrol 27df3a5710STakashi Iwaiand attach it to the jack, at jack creation stage. We can also add a 28df3a5710STakashi Iwaikcontrol to an existing jack, at anytime when required. 29df3a5710STakashi Iwai 30df3a5710STakashi IwaiThose kcontrols will be freed automatically when the Jack is freed. 31df3a5710STakashi Iwai 32df3a5710STakashi IwaiHow to use jack kcontrols 33df3a5710STakashi Iwai========================= 34df3a5710STakashi Iwai 35df3a5710STakashi IwaiIn order to keep compatibility, snd_jack_new() has been modified by 36df3a5710STakashi Iwaiadding two params: 37df3a5710STakashi Iwai 38df3a5710STakashi Iwaiinitial_kctl 39df3a5710STakashi Iwai if true, create a kcontrol and add it to the jack list. 40df3a5710STakashi Iwaiphantom_jack 41df3a5710STakashi Iwai Don't create a input device for phantom jacks. 42df3a5710STakashi Iwai 43df3a5710STakashi IwaiHDA jacks can set phantom_jack to true in order to create a phantom 44df3a5710STakashi Iwaijack and set initial_kctl to true to create an initial kcontrol with 45df3a5710STakashi Iwaithe correct id. 46df3a5710STakashi Iwai 47df3a5710STakashi IwaiASoC jacks should set initial_kctl as false. The pin name will be 48df3a5710STakashi Iwaiassigned as the jack kcontrol name. 49