aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2015-05-01 12:02:43 -0400
committerMark Brown <broonie@kernel.org>2015-05-06 12:31:02 -0400
commitd714f97c5b8c4c5da56b89a7289acb3f12ef7abb (patch)
tree814ea8f11899bff80e966bb64dfc394742d61de1 /include/sound
parent92fa12426741d52b39ec92ad77c9843d3fc2b3d6 (diff)
ASoC: dapm: Add demux support
A demux is conceptually similar to a mux. Where a mux has multiple input and one output and selects one of the inputs to be connected to the output, the demux has one input and multiple outputs and selects one of the outputs to which the input gets connected. This similarity makes it straight forward to support them in DAPM using the existing mux support, we only need to swap sinks and sources when initially setting up the paths. The only slightly tricky part is that there can only be one control per path. Since mixers/muxes are at the sink of a path and a demux is at the source and both types want a control it is not possible to directly connect a demux output to a mixer/mux input. The patch adds some sanity checks to make sure that this does not happen. Drivers who want to model hardware which directly connects a demux output to a mixer/mux input can do this by inserting a dummy widget between the two. E.g.: { "Dummy", "Demux Control", "Demux" }, { "Mixer", "Mixer Control", "Dummy" }, Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/soc-dapm.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 70216d20e897..96c5e0ec81d1 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -107,6 +107,10 @@ struct device;
107{ .id = snd_soc_dapm_mux, .name = wname, \ 107{ .id = snd_soc_dapm_mux, .name = wname, \
108 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 108 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
109 .kcontrol_news = wcontrols, .num_kcontrols = 1} 109 .kcontrol_news = wcontrols, .num_kcontrols = 1}
110#define SND_SOC_DAPM_DEMUX(wname, wreg, wshift, winvert, wcontrols) \
111{ .id = snd_soc_dapm_demux, .name = wname, \
112 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
113 .kcontrol_news = wcontrols, .num_kcontrols = 1}
110 114
111/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ 115/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */
112#define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\ 116#define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\
@@ -452,6 +456,7 @@ enum snd_soc_dapm_type {
452 snd_soc_dapm_input = 0, /* input pin */ 456 snd_soc_dapm_input = 0, /* input pin */
453 snd_soc_dapm_output, /* output pin */ 457 snd_soc_dapm_output, /* output pin */
454 snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ 458 snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */
459 snd_soc_dapm_demux, /* connects the input to one of multiple outputs */
455 snd_soc_dapm_mixer, /* mixes several analog signals together */ 460 snd_soc_dapm_mixer, /* mixes several analog signals together */
456 snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */ 461 snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */
457 snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ 462 snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */