aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorDimitris Papastamos <dp@opensource.wolfsonmicro.com>2010-12-16 10:53:39 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-12-17 12:36:28 -0500
commit24ff33ac696802e478714480f505c00a50a89c75 (patch)
tree3b2e9d3232331b556b2f4cb423dae1ead5565e0c /sound/soc/soc-dapm.c
parent1ec9bc35a6a01555836fa1e4d0f00a3501835b0b (diff)
ASoC: soc-dapm: Introduce the new snd_soc_dapm_virt_mux type
This new type is a virtual version of snd_soc_dapm_mux. It is used when a backing register value is not necessary for deciding which input path to connect. A simple virtual enumeration control e.g. SOC_DAPM_ENUM_VIRT() can be exposed to userspace which will be used to choose which path to connect. The snd_soc_dapm_virt_mux type ensures that during the initial path setup, the first (which is also the default) input path will be connected. Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 1debc3b05665..50f5c785cb61 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -56,6 +56,7 @@ static int dapm_up_seq[] = {
56 [snd_soc_dapm_aif_out] = 3, 56 [snd_soc_dapm_aif_out] = 3,
57 [snd_soc_dapm_mic] = 4, 57 [snd_soc_dapm_mic] = 4,
58 [snd_soc_dapm_mux] = 5, 58 [snd_soc_dapm_mux] = 5,
59 [snd_soc_dapm_virt_mux] = 5,
59 [snd_soc_dapm_value_mux] = 5, 60 [snd_soc_dapm_value_mux] = 5,
60 [snd_soc_dapm_dac] = 6, 61 [snd_soc_dapm_dac] = 6,
61 [snd_soc_dapm_mixer] = 7, 62 [snd_soc_dapm_mixer] = 7,
@@ -81,6 +82,7 @@ static int dapm_down_seq[] = {
81 [snd_soc_dapm_mic] = 7, 82 [snd_soc_dapm_mic] = 7,
82 [snd_soc_dapm_micbias] = 8, 83 [snd_soc_dapm_micbias] = 8,
83 [snd_soc_dapm_mux] = 9, 84 [snd_soc_dapm_mux] = 9,
85 [snd_soc_dapm_virt_mux] = 9,
84 [snd_soc_dapm_value_mux] = 9, 86 [snd_soc_dapm_value_mux] = 9,
85 [snd_soc_dapm_aif_in] = 10, 87 [snd_soc_dapm_aif_in] = 10,
86 [snd_soc_dapm_aif_out] = 10, 88 [snd_soc_dapm_aif_out] = 10,
@@ -216,6 +218,20 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w,
216 } 218 }
217 } 219 }
218 break; 220 break;
221 case snd_soc_dapm_virt_mux: {
222 struct soc_enum *e = (struct soc_enum *)w->kcontrols[i].private_value;
223
224 p->connect = 0;
225 /* since a virtual mux has no backing registers to
226 * decide which path to connect, it will try to match
227 * with the first enumeration. This is to ensure
228 * that the default mux choice (the first) will be
229 * correctly powered up during initialization.
230 */
231 if (!strcmp(p->name, e->texts[0]))
232 p->connect = 1;
233 }
234 break;
219 case snd_soc_dapm_value_mux: { 235 case snd_soc_dapm_value_mux: {
220 struct soc_enum *e = (struct soc_enum *) 236 struct soc_enum *e = (struct soc_enum *)
221 w->kcontrols[i].private_value; 237 w->kcontrols[i].private_value;
@@ -1228,6 +1244,7 @@ static int dapm_mux_update_power(struct snd_soc_dapm_widget *widget,
1228 int found = 0; 1244 int found = 0;
1229 1245
1230 if (widget->id != snd_soc_dapm_mux && 1246 if (widget->id != snd_soc_dapm_mux &&
1247 widget->id != snd_soc_dapm_virt_mux &&
1231 widget->id != snd_soc_dapm_value_mux) 1248 widget->id != snd_soc_dapm_value_mux)
1232 return -ENODEV; 1249 return -ENODEV;
1233 1250
@@ -1534,6 +1551,7 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
1534 path->connect = 1; 1551 path->connect = 1;
1535 return 0; 1552 return 0;
1536 case snd_soc_dapm_mux: 1553 case snd_soc_dapm_mux:
1554 case snd_soc_dapm_virt_mux:
1537 case snd_soc_dapm_value_mux: 1555 case snd_soc_dapm_value_mux:
1538 ret = dapm_connect_mux(dapm, wsource, wsink, path, control, 1556 ret = dapm_connect_mux(dapm, wsource, wsink, path, control,
1539 &wsink->kcontrols[0]); 1557 &wsink->kcontrols[0]);
@@ -1623,6 +1641,7 @@ int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm)
1623 dapm_new_mixer(dapm, w); 1641 dapm_new_mixer(dapm, w);
1624 break; 1642 break;
1625 case snd_soc_dapm_mux: 1643 case snd_soc_dapm_mux:
1644 case snd_soc_dapm_virt_mux:
1626 case snd_soc_dapm_value_mux: 1645 case snd_soc_dapm_value_mux:
1627 w->power_check = dapm_generic_check_power; 1646 w->power_check = dapm_generic_check_power;
1628 dapm_new_mux(dapm, w); 1647 dapm_new_mux(dapm, w);