Skip to content

Commit d40e821

Browse files
lucaceresolibroonie
authored andcommitted
ASoC: doc: dapm: fix and improve section "Registering DAPM controls"
Extend the first paragraph to mention the {,num_}dapm_routes fields just like the widget conterparts. Mention the route fields also in the code example. Fix "at build time", this really means "at probe time". Reviewed-by: Alexandre Belloni <[email protected]> Reviewed-by: Bagas Sanjaya <[email protected]> Signed-off-by: Luca Ceresoli <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 36de8c0 commit d40e821

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

Documentation/sound/soc/dapm.rst

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,17 @@ This can be used to merge two signal paths together in software.
253253
Registering DAPM controls
254254
=========================
255255

256-
In many cases the DAPM widgets implemented statically in a ``static const
257-
struct snd_soc_dapm_widget`` array and the routes connecting them in a
258-
``static const struct snd_soc_dapm_route`` array in a codec driver, and
259-
simply declared via the ``dapm_widgets`` and ``num_dapm_widgets`` fields of
260-
the ``struct snd_soc_component_driver`` so the driver registration will
261-
take care of populating them::
256+
In many cases the DAPM widgets are implemented statically in a ``static
257+
const struct snd_soc_dapm_widget`` array in a codec driver, and simply
258+
declared via the ``dapm_widgets`` and ``num_dapm_widgets`` fields of the
259+
``struct snd_soc_component_driver``.
260+
261+
Similarly, routes connecting them are implemented statically in a ``static
262+
const struct snd_soc_dapm_route`` array and declared via the
263+
``dapm_routes`` and ``num_dapm_routes`` fields of the same struct.
264+
265+
With the above declared, the driver registration will take care of
266+
populating them::
262267

263268
static const struct snd_soc_dapm_widget wm2000_dapm_widgets[] = {
264269
SND_SOC_DAPM_OUTPUT("SPKN"),
@@ -277,11 +282,13 @@ take care of populating them::
277282
...
278283
.dapm_widgets = wm2000_dapm_widgets,
279284
.num_dapm_widgets = ARRAY_SIZE(wm2000_dapm_widgets),
285+
.dapm_routes = wm2000_audio_map,
286+
.num_dapm_routes = ARRAY_SIZE(wm2000_audio_map),
280287
...
281288
};
282289

283290
In more complex cases the list of DAPM widgets and/or routes can be only
284-
known at build time. This happens for example when a driver supports
291+
known at probe time. This happens for example when a driver supports
285292
different models having a different set of features. In those cases
286293
separate widgets and routes arrays implementing the case-specific features
287294
can be registered programmatically by calling snd_soc_dapm_new_controls()

0 commit comments

Comments
 (0)