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

TOMOYO Linux Cross Reference
Linux/Documentation/sound/soc/dapm.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/soc/dapm.rst (Version linux-6.12-rc7) and /Documentation/sound/soc/dapm.rst (Version linux-4.10.17)


  1 ==============================================      1 ===================================================
  2 Dynamic Audio Power Management for Portable De      2 Dynamic Audio Power Management for Portable Devices
  3 ==============================================      3 ===================================================
  4                                                     4 
  5 Description                                         5 Description
  6 ===========                                         6 ===========
  7                                                     7 
  8 Dynamic Audio Power Management (DAPM) is desig      8 Dynamic Audio Power Management (DAPM) is designed to allow portable
  9 Linux devices to use the minimum amount of pow      9 Linux devices to use the minimum amount of power within the audio
 10 subsystem at all times. It is independent of o !!  10 subsystem at all times. It is independent of other kernel PM and as
 11 management frameworks and, as such, can easily !!  11 such, can easily co-exist with the other PM systems.
 12                                                    12 
 13 DAPM is also completely transparent to all use     13 DAPM is also completely transparent to all user space applications as
 14 all power switching is done within the ASoC co     14 all power switching is done within the ASoC core. No code changes or
 15 recompiling are required for user space applic     15 recompiling are required for user space applications. DAPM makes power
 16 switching decisions based upon any audio strea     16 switching decisions based upon any audio stream (capture/playback)
 17 activity and audio mixer settings within the d     17 activity and audio mixer settings within the device.
 18                                                    18 
 19 DAPM is based on two basic elements, called wi !!  19 DAPM spans the whole machine. It covers power control within the entire
                                                   >>  20 audio subsystem, this includes internal codec power blocks and machine
                                                   >>  21 level power systems.
 20                                                    22 
 21  * a **widget** is every part of the audio har !!  23 There are 4 power domains within DAPM
 22    software when in use and disabled to save p << 
 23  * a **route** is an interconnection between w << 
 24    can flow from one widget to the other       << 
 25                                                << 
 26 All DAPM power switching decisions are made au << 
 27 audio routing graph. This graph is specific to << 
 28 the whole sound card, so some DAPM routes conn << 
 29 different components (e.g. the LINE OUT pin of << 
 30 an amplifier).                                 << 
 31                                                << 
 32 The graph for the STM32MP1-DK1 sound card is s << 
 33                                                << 
 34 .. kernel-figure:: dapm-graph.svg              << 
 35     :alt:   Example DAPM graph                 << 
 36     :align: center                             << 
 37                                                << 
 38 DAPM power domains                             << 
 39 ==================                             << 
 40                                                << 
 41 There are 4 power domains within DAPM:         << 
 42                                                    24 
 43 Codec bias domain                                  25 Codec bias domain
 44       VREF, VMID (core codec and audio power)      26       VREF, VMID (core codec and audio power)
 45                                                    27 
 46       Usually controlled at codec probe/remove     28       Usually controlled at codec probe/remove and suspend/resume, although
 47       can be set at stream time if power is no     29       can be set at stream time if power is not needed for sidetone, etc.
 48                                                    30 
 49 Platform/Machine domain                            31 Platform/Machine domain
 50       physically connected inputs and outputs      32       physically connected inputs and outputs
 51                                                    33 
 52       Is platform/machine and user action spec     34       Is platform/machine and user action specific, is configured by the
 53       machine driver and responds to asynchron     35       machine driver and responds to asynchronous events e.g when HP
 54       are inserted                                 36       are inserted
 55                                                    37 
 56 Path domain                                        38 Path domain
 57       audio subsystem signal paths                 39       audio subsystem signal paths
 58                                                    40 
 59       Automatically set when mixer and mux set     41       Automatically set when mixer and mux settings are changed by the user.
 60       e.g. alsamixer, amixer.                      42       e.g. alsamixer, amixer.
 61                                                    43 
 62 Stream domain                                      44 Stream domain
 63       DACs and ADCs.                               45       DACs and ADCs.
 64                                                    46 
 65       Enabled and disabled when stream playbac     47       Enabled and disabled when stream playback/capture is started and
 66       stopped respectively. e.g. aplay, arecor     48       stopped respectively. e.g. aplay, arecord.
 67                                                    49 
                                                   >>  50 All DAPM power switching decisions are made automatically by consulting an audio
                                                   >>  51 routing map of the whole machine. This map is specific to each machine and
                                                   >>  52 consists of the interconnections between every audio component (including
                                                   >>  53 internal codec components). All audio components that effect power are called
                                                   >>  54 widgets hereafter.
                                                   >>  55 
 68                                                    56 
 69 DAPM Widgets                                       57 DAPM Widgets
 70 ============                                       58 ============
 71                                                    59 
 72 Audio DAPM widgets fall into a number of types !!  60 Audio DAPM widgets fall into a number of types:-
 73                                                    61 
 74 Mixer                                              62 Mixer
 75         Mixes several analog signals into a si     63         Mixes several analog signals into a single analog signal.
 76 Mux                                                64 Mux
 77         An analog switch that outputs only one     65         An analog switch that outputs only one of many inputs.
 78 PGA                                                66 PGA
 79         A programmable gain amplifier or atten     67         A programmable gain amplifier or attenuation widget.
 80 ADC                                                68 ADC
 81         Analog to Digital Converter                69         Analog to Digital Converter
 82 DAC                                                70 DAC
 83         Digital to Analog Converter                71         Digital to Analog Converter
 84 Switch                                             72 Switch
 85         An analog switch                           73         An analog switch
 86 Input                                              74 Input
 87         A codec input pin                          75         A codec input pin
 88 Output                                             76 Output
 89         A codec output pin                         77         A codec output pin
 90 Headphone                                          78 Headphone
 91         Headphone (and optional Jack)              79         Headphone (and optional Jack)
 92 Mic                                                80 Mic
 93         Mic (and optional Jack)                    81         Mic (and optional Jack)
 94 Line                                               82 Line
 95         Line Input/Output (and optional Jack)      83         Line Input/Output (and optional Jack)
 96 Speaker                                            84 Speaker
 97         Speaker                                    85         Speaker
 98 Supply                                             86 Supply
 99         Power or clock supply widget used by o     87         Power or clock supply widget used by other widgets.
100 Regulator                                          88 Regulator
101         External regulator that supplies power     89         External regulator that supplies power to audio components.
102 Clock                                              90 Clock
103         External clock that supplies clock to      91         External clock that supplies clock to audio components.
104 AIF IN                                             92 AIF IN
105         Audio Interface Input (with TDM slot m     93         Audio Interface Input (with TDM slot mask).
106 AIF OUT                                            94 AIF OUT
107         Audio Interface Output (with TDM slot      95         Audio Interface Output (with TDM slot mask).
108 Siggen                                             96 Siggen
109         Signal Generator.                          97         Signal Generator.
110 DAI IN                                             98 DAI IN
111         Digital Audio Interface Input.             99         Digital Audio Interface Input.
112 DAI OUT                                           100 DAI OUT
113         Digital Audio Interface Output.           101         Digital Audio Interface Output.
114 DAI Link                                          102 DAI Link
115         DAI Link between two DAI structures       103         DAI Link between two DAI structures
116 Pre                                               104 Pre
117         Special PRE widget (exec before all ot    105         Special PRE widget (exec before all others)
118 Post                                              106 Post
119         Special POST widget (exec after all ot    107         Special POST widget (exec after all others)
120 Buffer                                         << 
121         Inter widget audio data buffer within  << 
122 Scheduler                                      << 
123         DSP internal scheduler that schedules  << 
124         work.                                  << 
125 Effect                                         << 
126         Widget that performs an audio processi << 
127 SRC                                            << 
128         Sample Rate Converter within DSP or CO << 
129 ASRC                                           << 
130         Asynchronous Sample Rate Converter wit << 
131 Encoder                                        << 
132         Widget that encodes audio data from on << 
133         usually more compressed format.        << 
134 Decoder                                        << 
135         Widget that decodes audio data from a  << 
136         uncompressed format like PCM.          << 
137                                                << 
138                                                   108 
139 (Widgets are defined in include/sound/soc-dapm    109 (Widgets are defined in include/sound/soc-dapm.h)
140                                                   110 
141 Widgets can be added to the sound card by any     111 Widgets can be added to the sound card by any of the component driver types.
142 There are convenience macros defined in soc-da    112 There are convenience macros defined in soc-dapm.h that can be used to quickly
143 build a list of widgets of the codecs and mach    113 build a list of widgets of the codecs and machines DAPM widgets.
144                                                   114 
145 Most widgets have a name, register, shift and     115 Most widgets have a name, register, shift and invert. Some widgets have extra
146 parameters for stream name and kcontrols.         116 parameters for stream name and kcontrols.
147                                                   117 
148                                                   118 
149 Stream Domain Widgets                             119 Stream Domain Widgets
150 ---------------------                             120 ---------------------
151                                                   121 
152 Stream Widgets relate to the stream power doma    122 Stream Widgets relate to the stream power domain and only consist of ADCs
153 (analog to digital converters), DACs (digital     123 (analog to digital converters), DACs (digital to analog converters),
154 AIF IN and AIF OUT.                               124 AIF IN and AIF OUT.
155                                                   125 
156 Stream widgets have the following format:      !! 126 Stream widgets have the following format:-
157 ::                                                127 ::
158                                                   128 
159   SND_SOC_DAPM_DAC(name, stream name, reg, shi    129   SND_SOC_DAPM_DAC(name, stream name, reg, shift, invert),
160   SND_SOC_DAPM_AIF_IN(name, stream, slot, reg,    130   SND_SOC_DAPM_AIF_IN(name, stream, slot, reg, shift, invert)
161                                                   131 
162 NOTE: the stream name must match the correspon    132 NOTE: the stream name must match the corresponding stream name in your codec
163 snd_soc_dai_driver.                            !! 133 snd_soc_codec_dai.
164                                                   134 
165 e.g. stream widgets for HiFi playback and capt    135 e.g. stream widgets for HiFi playback and capture
166 ::                                                136 ::
167                                                   137 
168   SND_SOC_DAPM_DAC("HiFi DAC", "HiFi Playback"    138   SND_SOC_DAPM_DAC("HiFi DAC", "HiFi Playback", REG, 3, 1),
169   SND_SOC_DAPM_ADC("HiFi ADC", "HiFi Capture",    139   SND_SOC_DAPM_ADC("HiFi ADC", "HiFi Capture", REG, 2, 1),
170                                                   140 
171 e.g. stream widgets for AIF                       141 e.g. stream widgets for AIF
172 ::                                                142 ::
173                                                   143 
174   SND_SOC_DAPM_AIF_IN("AIF1RX", "AIF1 Playback    144   SND_SOC_DAPM_AIF_IN("AIF1RX", "AIF1 Playback", 0, SND_SOC_NOPM, 0, 0),
175   SND_SOC_DAPM_AIF_OUT("AIF1TX", "AIF1 Capture    145   SND_SOC_DAPM_AIF_OUT("AIF1TX", "AIF1 Capture", 0, SND_SOC_NOPM, 0, 0),
176                                                   146 
177                                                   147 
178 Path Domain Widgets                               148 Path Domain Widgets
179 -------------------                               149 -------------------
180                                                   150 
181 Path domain widgets have a ability to control     151 Path domain widgets have a ability to control or affect the audio signal or
182 audio paths within the audio subsystem. They h !! 152 audio paths within the audio subsystem. They have the following form:-
183 ::                                                153 ::
184                                                   154 
185   SND_SOC_DAPM_PGA(name, reg, shift, invert, c    155   SND_SOC_DAPM_PGA(name, reg, shift, invert, controls, num_controls)
186                                                   156 
187 Any widget kcontrols can be set using the cont    157 Any widget kcontrols can be set using the controls and num_controls members.
188                                                   158 
189 e.g. Mixer widget (the kcontrols are declared     159 e.g. Mixer widget (the kcontrols are declared first)
190 ::                                                160 ::
191                                                   161 
192   /* Output Mixer */                              162   /* Output Mixer */
193   static const snd_kcontrol_new_t wm8731_outpu    163   static const snd_kcontrol_new_t wm8731_output_mixer_controls[] = {
194   SOC_DAPM_SINGLE("Line Bypass Switch", WM8731    164   SOC_DAPM_SINGLE("Line Bypass Switch", WM8731_APANA, 3, 1, 0),
195   SOC_DAPM_SINGLE("Mic Sidetone Switch", WM873    165   SOC_DAPM_SINGLE("Mic Sidetone Switch", WM8731_APANA, 5, 1, 0),
196   SOC_DAPM_SINGLE("HiFi Playback Switch", WM87    166   SOC_DAPM_SINGLE("HiFi Playback Switch", WM8731_APANA, 4, 1, 0),
197   };                                              167   };
198                                                   168 
199   SND_SOC_DAPM_MIXER("Output Mixer", WM8731_PW    169   SND_SOC_DAPM_MIXER("Output Mixer", WM8731_PWR, 4, 1, wm8731_output_mixer_controls,
200         ARRAY_SIZE(wm8731_output_mixer_control    170         ARRAY_SIZE(wm8731_output_mixer_controls)),
201                                                   171 
202 If you don't want the mixer elements prefixed     172 If you don't want the mixer elements prefixed with the name of the mixer widget,
203 you can use SND_SOC_DAPM_MIXER_NAMED_CTL inste    173 you can use SND_SOC_DAPM_MIXER_NAMED_CTL instead. the parameters are the same
204 as for SND_SOC_DAPM_MIXER.                        174 as for SND_SOC_DAPM_MIXER.
205                                                   175 
206                                                   176 
207 Machine domain Widgets                            177 Machine domain Widgets
208 ----------------------                            178 ----------------------
209                                                   179 
210 Machine widgets are different from codec widge    180 Machine widgets are different from codec widgets in that they don't have a
211 codec register bit associated with them. A mac    181 codec register bit associated with them. A machine widget is assigned to each
212 machine audio component (non codec or DSP) tha    182 machine audio component (non codec or DSP) that can be independently
213 powered. e.g.                                     183 powered. e.g.
214                                                   184 
215 * Speaker Amp                                     185 * Speaker Amp
216 * Microphone Bias                                 186 * Microphone Bias
217 * Jack connectors                                 187 * Jack connectors
218                                                   188 
219 A machine widget can have an optional call bac    189 A machine widget can have an optional call back.
220                                                   190 
221 e.g. Jack connector widget for an external Mic    191 e.g. Jack connector widget for an external Mic that enables Mic Bias
222 when the Mic is inserted::                     !! 192 when the Mic is inserted:-::
223                                                   193 
224   static int spitz_mic_bias(struct snd_soc_dap    194   static int spitz_mic_bias(struct snd_soc_dapm_widget* w, int event)
225   {                                               195   {
226         gpio_set_value(SPITZ_GPIO_MIC_BIAS, SN    196         gpio_set_value(SPITZ_GPIO_MIC_BIAS, SND_SOC_DAPM_EVENT_ON(event));
227         return 0;                                 197         return 0;
228   }                                               198   }
229                                                   199 
230   SND_SOC_DAPM_MIC("Mic Jack", spitz_mic_bias)    200   SND_SOC_DAPM_MIC("Mic Jack", spitz_mic_bias),
231                                                   201 
232                                                   202 
233 Codec (BIAS) Domain                               203 Codec (BIAS) Domain
234 -------------------                               204 -------------------
235                                                   205 
236 The codec bias power domain has no widgets and !! 206 The codec bias power domain has no widgets and is handled by the codecs DAPM
237 event handler. This handler is called when the    207 event handler. This handler is called when the codec powerstate is changed wrt
238 to any stream event or by kernel PM events.       208 to any stream event or by kernel PM events.
239                                                   209 
240                                                   210 
241 Virtual Widgets                                   211 Virtual Widgets
242 ---------------                                   212 ---------------
243                                                   213 
244 Sometimes widgets exist in the codec or machin !! 214 Sometimes widgets exist in the codec or machine audio map that don't have any
245 corresponding soft power control. In this case    215 corresponding soft power control. In this case it is necessary to create
246 a virtual widget - a widget with no control bi    216 a virtual widget - a widget with no control bits e.g.
247 ::                                                217 ::
248                                                   218 
249   SND_SOC_DAPM_MIXER("AC97 Mixer", SND_SOC_NOP !! 219   SND_SOC_DAPM_MIXER("AC97 Mixer", SND_SOC_DAPM_NOPM, 0, 0, NULL, 0),
250                                                << 
251 This can be used to merge two signal paths tog << 
252                                                   220 
253 Registering DAPM controls                      !! 221 This can be used to merge to signal paths together in software.
254 =========================                      << 
255                                                   222 
256 In many cases the DAPM widgets are implemented !! 223 After all the widgets have been defined, they can then be added to the DAPM
257 const struct snd_soc_dapm_widget`` array in a  !! 224 subsystem individually with a call to snd_soc_dapm_new_control().
258 declared via the ``dapm_widgets`` and ``num_da << 
259 ``struct snd_soc_component_driver``.           << 
260                                                << 
261 Similarly, routes connecting them are implemen << 
262 const struct snd_soc_dapm_route`` array and de << 
263 ``dapm_routes`` and ``num_dapm_routes`` fields << 
264                                                << 
265 With the above declared, the driver registrati << 
266 populating them::                              << 
267                                                << 
268   static const struct snd_soc_dapm_widget wm20 << 
269         SND_SOC_DAPM_OUTPUT("SPKN"),           << 
270         SND_SOC_DAPM_OUTPUT("SPKP"),           << 
271         ...                                    << 
272   };                                           << 
273                                                << 
274   /* Target, Path, Source */                   << 
275   static const struct snd_soc_dapm_route wm200 << 
276         { "SPKN", NULL, "ANC Engine" },        << 
277         { "SPKP", NULL, "ANC Engine" },        << 
278         ...                                    << 
279   };                                           << 
280                                                << 
281   static const struct snd_soc_component_driver << 
282         ...                                    << 
283         .dapm_widgets           = wm2000_dapm_ << 
284         .num_dapm_widgets       = ARRAY_SIZE(w << 
285         .dapm_routes            = wm2000_audio << 
286         .num_dapm_routes        = ARRAY_SIZE(w << 
287         ...                                    << 
288   };                                           << 
289                                                << 
290 In more complex cases the list of DAPM widgets << 
291 known at probe time. This happens for example  << 
292 different models having a different set of fea << 
293 separate widgets and routes arrays implementin << 
294 can be registered programmatically by calling  << 
295 and snd_soc_dapm_add_routes().                 << 
296                                                   225 
297                                                   226 
298 Codec/DSP Widget Interconnections                 227 Codec/DSP Widget Interconnections
299 =================================                 228 =================================
300                                                   229 
301 Widgets are connected to each other within the    230 Widgets are connected to each other within the codec, platform and machine by
302 audio paths (called interconnections). Each in    231 audio paths (called interconnections). Each interconnection must be defined in
303 order to create a graph of all audio paths bet !! 232 order to create a map of all audio paths between widgets.
304                                                   233 
305 This is easiest with a diagram of the codec or    234 This is easiest with a diagram of the codec or DSP (and schematic of the machine
306 audio system), as it requires joining widgets     235 audio system), as it requires joining widgets together via their audio signal
307 paths.                                            236 paths.
308                                                   237 
309 For example the WM8731 output mixer (wm8731.c) !! 238 e.g., from the WM8731 output mixer (wm8731.c)
                                                   >> 239 
                                                   >> 240 The WM8731 output mixer has 3 inputs (sources)
310                                                   241 
311 1. Line Bypass Input                              242 1. Line Bypass Input
312 2. DAC (HiFi playback)                            243 2. DAC (HiFi playback)
313 3. Mic Sidetone Input                             244 3. Mic Sidetone Input
314                                                   245 
315 Each input in this example has a kcontrol asso !! 246 Each input in this example has a kcontrol associated with it (defined in example
316 the example above) and is connected to the out !! 247 above) and is connected to the output mixer via its kcontrol name. We can now
317 name. We can now connect the destination widge !! 248 connect the destination widget (wrt audio signal) with its source widgets.
318 source widgets.  ::                            !! 249 ::
319                                                   250 
320         /* output mixer */                        251         /* output mixer */
321         {"Output Mixer", "Line Bypass Switch",    252         {"Output Mixer", "Line Bypass Switch", "Line Input"},
322         {"Output Mixer", "HiFi Playback Switch    253         {"Output Mixer", "HiFi Playback Switch", "DAC"},
323         {"Output Mixer", "Mic Sidetone Switch"    254         {"Output Mixer", "Mic Sidetone Switch", "Mic Bias"},
324                                                   255 
325 So we have:                                    !! 256 So we have :-
326                                                   257 
327 * Destination Widget  <=== Path Name <=== Sour    258 * Destination Widget  <=== Path Name <=== Source Widget, or
328 * Sink, Path, Source, or                          259 * Sink, Path, Source, or
329 * ``Output Mixer`` is connected to the ``DAC``    260 * ``Output Mixer`` is connected to the ``DAC`` via the ``HiFi Playback Switch``.
330                                                   261 
331 When there is no path name connecting widgets     262 When there is no path name connecting widgets (e.g. a direct connection) we
332 pass NULL for the path name.                      263 pass NULL for the path name.
333                                                   264 
334 Interconnections are created with a call to::  !! 265 Interconnections are created with a call to:-
                                                   >> 266 ::
335                                                   267 
336   snd_soc_dapm_connect_input(codec, sink, path    268   snd_soc_dapm_connect_input(codec, sink, path, source);
337                                                   269 
338 Finally, snd_soc_dapm_new_widgets() must be ca !! 270 Finally, snd_soc_dapm_new_widgets(codec) must be called after all widgets and
339 interconnections have been registered with the    271 interconnections have been registered with the core. This causes the core to
340 scan the codec and machine so that the interna    272 scan the codec and machine so that the internal DAPM state matches the
341 physical state of the machine.                    273 physical state of the machine.
342                                                   274 
343                                                   275 
344 Machine Widget Interconnections                   276 Machine Widget Interconnections
345 -------------------------------                   277 -------------------------------
346 Machine widget interconnections are created in    278 Machine widget interconnections are created in the same way as codec ones and
347 directly connect the codec pins to machine lev    279 directly connect the codec pins to machine level widgets.
348                                                   280 
349 e.g. connects the speaker out codec pins to th    281 e.g. connects the speaker out codec pins to the internal speaker.
350 ::                                                282 ::
351                                                   283 
352         /* ext speaker connected to codec pins    284         /* ext speaker connected to codec pins LOUT2, ROUT2  */
353         {"Ext Spk", NULL , "ROUT2"},              285         {"Ext Spk", NULL , "ROUT2"},
354         {"Ext Spk", NULL , "LOUT2"},              286         {"Ext Spk", NULL , "LOUT2"},
355                                                   287 
356 This allows the DAPM to power on and off pins     288 This allows the DAPM to power on and off pins that are connected (and in use)
357 and pins that are NC respectively.                289 and pins that are NC respectively.
358                                                   290 
359                                                   291 
360 Endpoint Widgets                                  292 Endpoint Widgets
361 ================                                  293 ================
362 An endpoint is a start or end point (widget) o    294 An endpoint is a start or end point (widget) of an audio signal within the
363 machine and includes the codec. e.g.              295 machine and includes the codec. e.g.
364                                                   296 
365 * Headphone Jack                                  297 * Headphone Jack
366 * Internal Speaker                                298 * Internal Speaker
367 * Internal Mic                                    299 * Internal Mic
368 * Mic Jack                                        300 * Mic Jack
369 * Codec Pins                                      301 * Codec Pins
370                                                   302 
371 Endpoints are added to the DAPM graph so that     303 Endpoints are added to the DAPM graph so that their usage can be determined in
372 order to save power. e.g. NC codecs pins will     304 order to save power. e.g. NC codecs pins will be switched OFF, unconnected
373 jacks can also be switched OFF.                   305 jacks can also be switched OFF.
374                                                   306 
375                                                   307 
376 DAPM Widget Events                                308 DAPM Widget Events
377 ==================                                309 ==================
378                                                   310 
379 Widgets needing to implement a more complex be !! 311 Some widgets can register their interest with the DAPM core in PM events.
380 can set a custom "event handler" by setting a  !! 312 e.g. A Speaker with an amplifier registers a widget so the amplifier can be
381 is a power supply needing to enable a GPIO::   !! 313 powered only when the spk is in use.
                                                   >> 314 ::
382                                                   315 
383   static int sof_es8316_speaker_power_event(st !! 316   /* turn speaker amplifier on/off depending on use */
384                                           stru !! 317   static int corgi_amp_event(struct snd_soc_dapm_widget *w, int event)
385   {                                               318   {
386         if (SND_SOC_DAPM_EVENT_ON(event))      !! 319         gpio_set_value(CORGI_GPIO_APM_ON, SND_SOC_DAPM_EVENT_ON(event));
387                 gpiod_set_value_cansleep(gpio_ !! 320         return 0;
388         else                                   << 
389                 gpiod_set_value_cansleep(gpio_ << 
390                                                << 
391         return 0;                              << 
392   }                                               321   }
393                                                   322 
394   static const struct snd_soc_dapm_widget st_w !! 323   /* corgi machine dapm widgets */
395         ...                                    !! 324   static const struct snd_soc_dapm_widget wm8731_dapm_widgets =
396         SND_SOC_DAPM_SUPPLY("Speaker Power", S !! 325         SND_SOC_DAPM_SPK("Ext Spk", corgi_amp_event);
397                             sof_es8316_speaker << 
398                             SND_SOC_DAPM_PRE_P << 
399   };                                           << 
400                                                   326 
401 See soc-dapm.h for all other widgets that supp !! 327 Please see soc-dapm.h for all other widgets that support events.
402                                                   328 
403                                                   329 
404 Event types                                       330 Event types
405 -----------                                       331 -----------
406                                                   332 
407 The following event types are supported by eve !! 333 The following event types are supported by event widgets.
                                                   >> 334 ::
408                                                   335 
409   /* dapm event types */                          336   /* dapm event types */
410   #define SND_SOC_DAPM_PRE_PMU          0x1    !! 337   #define SND_SOC_DAPM_PRE_PMU  0x1     /* before widget power up */
411   #define SND_SOC_DAPM_POST_PMU         0x2    !! 338   #define SND_SOC_DAPM_POST_PMU 0x2             /* after widget power up */
412   #define SND_SOC_DAPM_PRE_PMD          0x4    !! 339   #define SND_SOC_DAPM_PRE_PMD  0x4     /* before widget power down */
413   #define SND_SOC_DAPM_POST_PMD         0x8    !! 340   #define SND_SOC_DAPM_POST_PMD 0x8             /* after widget power down */
414   #define SND_SOC_DAPM_PRE_REG          0x10   !! 341   #define SND_SOC_DAPM_PRE_REG  0x10    /* before audio path setup */
415   #define SND_SOC_DAPM_POST_REG         0x20   !! 342   #define SND_SOC_DAPM_POST_REG 0x20    /* after audio path setup */
416   #define SND_SOC_DAPM_WILL_PMU         0x40   << 
417   #define SND_SOC_DAPM_WILL_PMD         0x80   << 
418   #define SND_SOC_DAPM_PRE_POST_PMD     (SND_S << 
419   #define SND_SOC_DAPM_PRE_POST_PMU     (SND_S << 
                                                      

~ [ 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