jack-controls.rst 1.5 KB

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