diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-01-09 06:03:55 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-01-09 06:03:55 -0500 |
commit | 5852973c129cf7c7e6c229abb7250673fc2a50c9 (patch) | |
tree | ce61401fc06a086309d496ae2e015d7d3b504ab8 /sound/soc/soc-dapm.c | |
parent | 3e8e1952e3a3dd59b11233a532ca68e6471742d9 (diff) | |
parent | c6d1662b229410e64092fe3a9caed6535fb3dc65 (diff) |
Merge branch 'for-2.6.29' into for-2.6.30
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r-- | sound/soc/soc-dapm.c | 80 |
1 files changed, 5 insertions, 75 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index a35ce69d9d78..3a759c2872a8 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -139,7 +139,7 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w, | |||
139 | } | 139 | } |
140 | break; | 140 | break; |
141 | case snd_soc_dapm_value_mux: { | 141 | case snd_soc_dapm_value_mux: { |
142 | struct soc_value_enum *e = (struct soc_value_enum *) | 142 | struct soc_enum *e = (struct soc_enum *) |
143 | w->kcontrols[i].private_value; | 143 | w->kcontrols[i].private_value; |
144 | int val, item; | 144 | int val, item; |
145 | 145 | ||
@@ -202,30 +202,6 @@ static int dapm_connect_mux(struct snd_soc_codec *codec, | |||
202 | return -ENODEV; | 202 | return -ENODEV; |
203 | } | 203 | } |
204 | 204 | ||
205 | /* connect value_mux widget to it's interconnecting audio paths */ | ||
206 | static int dapm_connect_value_mux(struct snd_soc_codec *codec, | ||
207 | struct snd_soc_dapm_widget *src, struct snd_soc_dapm_widget *dest, | ||
208 | struct snd_soc_dapm_path *path, const char *control_name, | ||
209 | const struct snd_kcontrol_new *kcontrol) | ||
210 | { | ||
211 | struct soc_value_enum *e = (struct soc_value_enum *) | ||
212 | kcontrol->private_value; | ||
213 | int i; | ||
214 | |||
215 | for (i = 0; i < e->max; i++) { | ||
216 | if (!(strcmp(control_name, e->texts[i]))) { | ||
217 | list_add(&path->list, &codec->dapm_paths); | ||
218 | list_add(&path->list_sink, &dest->sources); | ||
219 | list_add(&path->list_source, &src->sinks); | ||
220 | path->name = (char *)e->texts[i]; | ||
221 | dapm_set_path_status(dest, path, 0); | ||
222 | return 0; | ||
223 | } | ||
224 | } | ||
225 | |||
226 | return -ENODEV; | ||
227 | } | ||
228 | |||
229 | /* connect mixer widget to it's interconnecting audio paths */ | 205 | /* connect mixer widget to it's interconnecting audio paths */ |
230 | static int dapm_connect_mixer(struct snd_soc_codec *codec, | 206 | static int dapm_connect_mixer(struct snd_soc_codec *codec, |
231 | struct snd_soc_dapm_widget *src, struct snd_soc_dapm_widget *dest, | 207 | struct snd_soc_dapm_widget *src, struct snd_soc_dapm_widget *dest, |
@@ -795,45 +771,6 @@ static int dapm_mux_update_power(struct snd_soc_dapm_widget *widget, | |||
795 | return 0; | 771 | return 0; |
796 | } | 772 | } |
797 | 773 | ||
798 | /* test and update the power status of a value_mux widget */ | ||
799 | static int dapm_value_mux_update_power(struct snd_soc_dapm_widget *widget, | ||
800 | struct snd_kcontrol *kcontrol, int mask, | ||
801 | int mux, int val, struct soc_value_enum *e) | ||
802 | { | ||
803 | struct snd_soc_dapm_path *path; | ||
804 | int found = 0; | ||
805 | |||
806 | if (widget->id != snd_soc_dapm_value_mux) | ||
807 | return -ENODEV; | ||
808 | |||
809 | if (!snd_soc_test_bits(widget->codec, e->reg, mask, val)) | ||
810 | return 0; | ||
811 | |||
812 | /* find dapm widget path assoc with kcontrol */ | ||
813 | list_for_each_entry(path, &widget->codec->dapm_paths, list) { | ||
814 | if (path->kcontrol != kcontrol) | ||
815 | continue; | ||
816 | |||
817 | if (!path->name || !e->texts[mux]) | ||
818 | continue; | ||
819 | |||
820 | found = 1; | ||
821 | /* we now need to match the string in the enum to the path */ | ||
822 | if (!(strcmp(path->name, e->texts[mux]))) | ||
823 | path->connect = 1; /* new connection */ | ||
824 | else | ||
825 | path->connect = 0; /* old connection must be | ||
826 | powered down */ | ||
827 | } | ||
828 | |||
829 | if (found) { | ||
830 | dapm_power_widgets(widget->codec, SND_SOC_DAPM_STREAM_NOP); | ||
831 | dump_dapm(widget->codec, "mux power update"); | ||
832 | } | ||
833 | |||
834 | return 0; | ||
835 | } | ||
836 | |||
837 | /* test and update the power status of a mixer or switch widget */ | 774 | /* test and update the power status of a mixer or switch widget */ |
838 | static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget, | 775 | static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget, |
839 | struct snd_kcontrol *kcontrol, int reg, | 776 | struct snd_kcontrol *kcontrol, int reg, |
@@ -1068,17 +1005,12 @@ static int snd_soc_dapm_add_route(struct snd_soc_codec *codec, | |||
1068 | path->connect = 1; | 1005 | path->connect = 1; |
1069 | return 0; | 1006 | return 0; |
1070 | case snd_soc_dapm_mux: | 1007 | case snd_soc_dapm_mux: |
1008 | case snd_soc_dapm_value_mux: | ||
1071 | ret = dapm_connect_mux(codec, wsource, wsink, path, control, | 1009 | ret = dapm_connect_mux(codec, wsource, wsink, path, control, |
1072 | &wsink->kcontrols[0]); | 1010 | &wsink->kcontrols[0]); |
1073 | if (ret != 0) | 1011 | if (ret != 0) |
1074 | goto err; | 1012 | goto err; |
1075 | break; | 1013 | break; |
1076 | case snd_soc_dapm_value_mux: | ||
1077 | ret = dapm_connect_value_mux(codec, wsource, wsink, path, | ||
1078 | control, &wsink->kcontrols[0]); | ||
1079 | if (ret != 0) | ||
1080 | goto err; | ||
1081 | break; | ||
1082 | case snd_soc_dapm_switch: | 1014 | case snd_soc_dapm_switch: |
1083 | case snd_soc_dapm_mixer: | 1015 | case snd_soc_dapm_mixer: |
1084 | case snd_soc_dapm_mixer_named_ctl: | 1016 | case snd_soc_dapm_mixer_named_ctl: |
@@ -1407,8 +1339,7 @@ int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol, | |||
1407 | struct snd_ctl_elem_value *ucontrol) | 1339 | struct snd_ctl_elem_value *ucontrol) |
1408 | { | 1340 | { |
1409 | struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); | 1341 | struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); |
1410 | struct soc_value_enum *e = (struct soc_value_enum *) | 1342 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
1411 | kcontrol->private_value; | ||
1412 | unsigned short reg_val, val, mux; | 1343 | unsigned short reg_val, val, mux; |
1413 | 1344 | ||
1414 | reg_val = snd_soc_read(widget->codec, e->reg); | 1345 | reg_val = snd_soc_read(widget->codec, e->reg); |
@@ -1448,8 +1379,7 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, | |||
1448 | struct snd_ctl_elem_value *ucontrol) | 1379 | struct snd_ctl_elem_value *ucontrol) |
1449 | { | 1380 | { |
1450 | struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); | 1381 | struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); |
1451 | struct soc_value_enum *e = (struct soc_value_enum *) | 1382 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
1452 | kcontrol->private_value; | ||
1453 | unsigned short val, mux; | 1383 | unsigned short val, mux; |
1454 | unsigned short mask; | 1384 | unsigned short mask; |
1455 | int ret = 0; | 1385 | int ret = 0; |
@@ -1468,7 +1398,7 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, | |||
1468 | 1398 | ||
1469 | mutex_lock(&widget->codec->mutex); | 1399 | mutex_lock(&widget->codec->mutex); |
1470 | widget->value = val; | 1400 | widget->value = val; |
1471 | dapm_value_mux_update_power(widget, kcontrol, mask, mux, val, e); | 1401 | dapm_mux_update_power(widget, kcontrol, mask, mux, val, e); |
1472 | if (widget->event) { | 1402 | if (widget->event) { |
1473 | if (widget->event_flags & SND_SOC_DAPM_PRE_REG) { | 1403 | if (widget->event_flags & SND_SOC_DAPM_PRE_REG) { |
1474 | ret = widget->event(widget, | 1404 | ret = widget->event(widget, |