~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/sound/designs/jack-injection.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/sound/designs/jack-injection.rst (Version linux-6.12-rc7) and /Documentation/sound/designs/jack-injection.rst (Version linux-6.8.12)


  1 ============================                        1 ============================
  2 ALSA Jack Software Injection                        2 ALSA Jack Software Injection
  3 ============================                        3 ============================
  4                                                     4 
  5 Simple Introduction On Jack Injection               5 Simple Introduction On Jack Injection
  6 =====================================               6 =====================================
  7                                                     7 
  8 Here jack injection means users could inject p      8 Here jack injection means users could inject plugin or plugout events
  9 to the audio jacks through debugfs interface,       9 to the audio jacks through debugfs interface, it is helpful to
 10 validate ALSA userspace changes. For example,      10 validate ALSA userspace changes. For example, we change the audio
 11 profile switching code in the pulseaudio, and      11 profile switching code in the pulseaudio, and we want to verify if the
 12 change works as expected and if the change int     12 change works as expected and if the change introduce the regression,
 13 in this case, we could inject plugin or plugou     13 in this case, we could inject plugin or plugout events to an audio
 14 jack or to some audio jacks, we don't need to      14 jack or to some audio jacks, we don't need to physically access the
 15 machine and plug/unplug physical devices to th     15 machine and plug/unplug physical devices to the audio jack.
 16                                                    16 
 17 In this design, an audio jack doesn't equal to     17 In this design, an audio jack doesn't equal to a physical audio jack.
 18 Sometimes a physical audio jack contains multi     18 Sometimes a physical audio jack contains multi functions, and the
 19 ALSA driver creates multi ``jack_kctl`` for a      19 ALSA driver creates multi ``jack_kctl`` for a ``snd_jack``, here the
 20 ``snd_jack`` represents a physical audio jack      20 ``snd_jack`` represents a physical audio jack and the ``jack_kctl``
 21 represents a function, for example a physical      21 represents a function, for example a physical jack has two functions:
 22 headphone and mic_in, the ALSA ASoC driver wil     22 headphone and mic_in, the ALSA ASoC driver will build 2 ``jack_kctl``
 23 for this jack. The jack injection is implement     23 for this jack. The jack injection is implemented based on the
 24 ``jack_kctl`` instead of ``snd_jack``.             24 ``jack_kctl`` instead of ``snd_jack``.
 25                                                    25 
 26 To inject events to audio jacks, we need to en     26 To inject events to audio jacks, we need to enable the jack injection
 27 via ``sw_inject_enable`` first, once it is ena     27 via ``sw_inject_enable`` first, once it is enabled, this jack will not
 28 change the state by hardware events anymore, w     28 change the state by hardware events anymore, we could inject plugin or
 29 plugout events via ``jackin_inject`` and check     29 plugout events via ``jackin_inject`` and check the jack state via
 30 ``status``, after we finish our test, we need      30 ``status``, after we finish our test, we need to disable the jack
 31 injection via ``sw_inject_enable`` too, once i     31 injection via ``sw_inject_enable`` too, once it is disabled, the jack
 32 state will be restored according to the last r     32 state will be restored according to the last reported hardware events
 33 and will change by future hardware events.         33 and will change by future hardware events.
 34                                                    34 
 35 The Layout of Jack Injection Interface             35 The Layout of Jack Injection Interface
 36 ======================================             36 ======================================
 37                                                    37 
 38 If users enable the SND_JACK_INJECTION_DEBUG i     38 If users enable the SND_JACK_INJECTION_DEBUG in the kernel, the audio
 39 jack injection interface will be created as be     39 jack injection interface will be created as below:
 40 ::                                                 40 ::
 41                                                    41 
 42    $debugfs_mount_dir/sound                        42    $debugfs_mount_dir/sound
 43    |-- card0                                       43    |-- card0
 44    |-- |-- HDMI_DP_pcm_10_Jack                     44    |-- |-- HDMI_DP_pcm_10_Jack
 45    |-- |-- |-- jackin_inject                       45    |-- |-- |-- jackin_inject
 46    |-- |-- |-- kctl_id                             46    |-- |-- |-- kctl_id
 47    |-- |-- |-- mask_bits                           47    |-- |-- |-- mask_bits
 48    |-- |-- |-- status                              48    |-- |-- |-- status
 49    |-- |-- |-- sw_inject_enable                    49    |-- |-- |-- sw_inject_enable
 50    |-- |-- |-- type                                50    |-- |-- |-- type
 51    ...                                             51    ...
 52    |-- |-- HDMI_DP_pcm_9_Jack                      52    |-- |-- HDMI_DP_pcm_9_Jack
 53    |--     |-- jackin_inject                       53    |--     |-- jackin_inject
 54    |--     |-- kctl_id                             54    |--     |-- kctl_id
 55    |--     |-- mask_bits                           55    |--     |-- mask_bits
 56    |--     |-- status                              56    |--     |-- status
 57    |--     |-- sw_inject_enable                    57    |--     |-- sw_inject_enable
 58    |--     |-- type                                58    |--     |-- type
 59    |-- card1                                       59    |-- card1
 60        |-- HDMI_DP_pcm_5_Jack                      60        |-- HDMI_DP_pcm_5_Jack
 61        |-- |-- jackin_inject                       61        |-- |-- jackin_inject
 62        |-- |-- kctl_id                             62        |-- |-- kctl_id
 63        |-- |-- mask_bits                           63        |-- |-- mask_bits
 64        |-- |-- status                              64        |-- |-- status
 65        |-- |-- sw_inject_enable                    65        |-- |-- sw_inject_enable
 66        |-- |-- type                                66        |-- |-- type
 67        ...                                         67        ...
 68        |-- Headphone_Jack                          68        |-- Headphone_Jack
 69        |-- |-- jackin_inject                       69        |-- |-- jackin_inject
 70        |-- |-- kctl_id                             70        |-- |-- kctl_id
 71        |-- |-- mask_bits                           71        |-- |-- mask_bits
 72        |-- |-- status                              72        |-- |-- status
 73        |-- |-- sw_inject_enable                    73        |-- |-- sw_inject_enable
 74        |-- |-- type                                74        |-- |-- type
 75        |-- Headset_Mic_Jack                        75        |-- Headset_Mic_Jack
 76            |-- jackin_inject                       76            |-- jackin_inject
 77            |-- kctl_id                             77            |-- kctl_id
 78            |-- mask_bits                           78            |-- mask_bits
 79            |-- status                              79            |-- status
 80            |-- sw_inject_enable                    80            |-- sw_inject_enable
 81            |-- type                                81            |-- type
 82                                                    82 
 83 The Explanation Of The Nodes                       83 The Explanation Of The Nodes
 84 ======================================             84 ======================================
 85                                                    85 
 86 kctl_id                                            86 kctl_id
 87   read-only, get jack_kctl->kctl's id              87   read-only, get jack_kctl->kctl's id
 88   ::                                               88   ::
 89                                                    89 
 90      sound/card1/Headphone_Jack# cat kctl_id       90      sound/card1/Headphone_Jack# cat kctl_id
 91      Headphone Jack                                91      Headphone Jack
 92                                                    92 
 93 mask_bits                                          93 mask_bits
 94   read-only, get jack_kctl's supported events      94   read-only, get jack_kctl's supported events mask_bits
 95   ::                                               95   ::
 96                                                    96 
 97      sound/card1/Headphone_Jack# cat mask_bits     97      sound/card1/Headphone_Jack# cat mask_bits
 98      0x0001 HEADPHONE(0x0001)                      98      0x0001 HEADPHONE(0x0001)
 99                                                    99 
100 status                                            100 status
101   read-only, get jack_kctl's current status       101   read-only, get jack_kctl's current status
102                                                   102 
103 - headphone unplugged:                            103 - headphone unplugged:
104                                                   104 
105   ::                                              105   ::
106                                                   106 
107      sound/card1/Headphone_Jack# cat status       107      sound/card1/Headphone_Jack# cat status
108      Unplugged                                    108      Unplugged
109                                                   109 
110 - headphone plugged:                              110 - headphone plugged:
111                                                   111 
112   ::                                              112   ::
113                                                   113 
114      sound/card1/Headphone_Jack# cat status       114      sound/card1/Headphone_Jack# cat status
115      Plugged                                      115      Plugged
116                                                   116 
117 type                                              117 type
118   read-only, get snd_jack's supported events f    118   read-only, get snd_jack's supported events from type (all supported events on the physical audio jack)
119   ::                                              119   ::
120                                                   120 
121      sound/card1/Headphone_Jack# cat type         121      sound/card1/Headphone_Jack# cat type
122      0x7803 HEADPHONE(0x0001) MICROPHONE(0x000    122      0x7803 HEADPHONE(0x0001) MICROPHONE(0x0002) BTN_3(0x0800) BTN_2(0x1000) BTN_1(0x2000) BTN_0(0x4000)
123                                                   123 
124 sw_inject_enable                                  124 sw_inject_enable
125   read-write, enable or disable injection         125   read-write, enable or disable injection
126                                                   126 
127 - injection disabled:                             127 - injection disabled:
128                                                   128 
129   ::                                              129   ::
130                                                   130 
131      sound/card1/Headphone_Jack# cat sw_inject    131      sound/card1/Headphone_Jack# cat sw_inject_enable
132      Jack: Headphone Jack               Inject    132      Jack: Headphone Jack               Inject Enabled: 0
133                                                   133 
134 - injection enabled:                              134 - injection enabled:
135                                                   135 
136   ::                                              136   ::
137                                                   137 
138      sound/card1/Headphone_Jack# cat sw_inject    138      sound/card1/Headphone_Jack# cat sw_inject_enable
139      Jack: Headphone Jack               Inject    139      Jack: Headphone Jack               Inject Enabled: 1
140                                                   140 
141 - to enable jack injection:                       141 - to enable jack injection:
142                                                   142 
143   ::                                              143   ::
144                                                   144 
145      sound/card1/Headphone_Jack# echo 1 > sw_i    145      sound/card1/Headphone_Jack# echo 1 > sw_inject_enable
146                                                   146 
147 - to disable jack injection:                      147 - to disable jack injection:
148                                                   148 
149   ::                                              149   ::
150                                                   150 
151      sound/card1/Headphone_Jack# echo 0 > sw_i    151      sound/card1/Headphone_Jack# echo 0 > sw_inject_enable
152                                                   152 
153 jackin_inject                                     153 jackin_inject
154   write-only, inject plugin or plugout            154   write-only, inject plugin or plugout
155                                                   155 
156 - to inject plugin:                               156 - to inject plugin:
157                                                   157 
158   ::                                              158   ::
159                                                   159 
160      sound/card1/Headphone_Jack# echo 1 > jack    160      sound/card1/Headphone_Jack# echo 1 > jackin_inject
161                                                   161 
162 - to inject plugout:                              162 - to inject plugout:
163                                                   163 
164   ::                                              164   ::
165                                                   165 
166      sound/card1/Headphone_Jack# echo 0 > jack    166      sound/card1/Headphone_Jack# echo 0 > jackin_inject
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php