diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/soc-core.c | 37 | ||||
-rw-r--r-- | sound/soc/soc-dapm.c | 80 |
2 files changed, 7 insertions, 110 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 6cbe7e82f238..55fdb4abb179 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1585,37 +1585,6 @@ int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol, | |||
1585 | EXPORT_SYMBOL_GPL(snd_soc_put_enum_double); | 1585 | EXPORT_SYMBOL_GPL(snd_soc_put_enum_double); |
1586 | 1586 | ||
1587 | /** | 1587 | /** |
1588 | * snd_soc_info_value_enum_double - semi enumerated double mixer info callback | ||
1589 | * @kcontrol: mixer control | ||
1590 | * @uinfo: control element information | ||
1591 | * | ||
1592 | * Callback to provide information about a double semi enumerated | ||
1593 | * mixer control. | ||
1594 | * | ||
1595 | * Semi enumerated mixer: the enumerated items are referred as values. Can be | ||
1596 | * used for handling bitfield coded enumeration for example. | ||
1597 | * | ||
1598 | * Returns 0 for success. | ||
1599 | */ | ||
1600 | int snd_soc_info_value_enum_double(struct snd_kcontrol *kcontrol, | ||
1601 | struct snd_ctl_elem_info *uinfo) | ||
1602 | { | ||
1603 | struct soc_value_enum *e = (struct soc_value_enum *) | ||
1604 | kcontrol->private_value; | ||
1605 | |||
1606 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
1607 | uinfo->count = e->shift_l == e->shift_r ? 1 : 2; | ||
1608 | uinfo->value.enumerated.items = e->max; | ||
1609 | |||
1610 | if (uinfo->value.enumerated.item > e->max - 1) | ||
1611 | uinfo->value.enumerated.item = e->max - 1; | ||
1612 | strcpy(uinfo->value.enumerated.name, | ||
1613 | e->texts[uinfo->value.enumerated.item]); | ||
1614 | return 0; | ||
1615 | } | ||
1616 | EXPORT_SYMBOL_GPL(snd_soc_info_value_enum_double); | ||
1617 | |||
1618 | /** | ||
1619 | * snd_soc_get_value_enum_double - semi enumerated double mixer get callback | 1588 | * snd_soc_get_value_enum_double - semi enumerated double mixer get callback |
1620 | * @kcontrol: mixer control | 1589 | * @kcontrol: mixer control |
1621 | * @ucontrol: control element information | 1590 | * @ucontrol: control element information |
@@ -1631,8 +1600,7 @@ int snd_soc_get_value_enum_double(struct snd_kcontrol *kcontrol, | |||
1631 | struct snd_ctl_elem_value *ucontrol) | 1600 | struct snd_ctl_elem_value *ucontrol) |
1632 | { | 1601 | { |
1633 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 1602 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
1634 | struct soc_value_enum *e = (struct soc_value_enum *) | 1603 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
1635 | kcontrol->private_value; | ||
1636 | unsigned short reg_val, val, mux; | 1604 | unsigned short reg_val, val, mux; |
1637 | 1605 | ||
1638 | reg_val = snd_soc_read(codec, e->reg); | 1606 | reg_val = snd_soc_read(codec, e->reg); |
@@ -1671,8 +1639,7 @@ int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol, | |||
1671 | struct snd_ctl_elem_value *ucontrol) | 1639 | struct snd_ctl_elem_value *ucontrol) |
1672 | { | 1640 | { |
1673 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 1641 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
1674 | struct soc_value_enum *e = (struct soc_value_enum *) | 1642 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
1675 | kcontrol->private_value; | ||
1676 | unsigned short val; | 1643 | unsigned short val; |
1677 | unsigned short mask; | 1644 | unsigned short mask; |
1678 | 1645 | ||
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index ad0d801677c1..493a4e8aa273 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -137,7 +137,7 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w, | |||
137 | } | 137 | } |
138 | break; | 138 | break; |
139 | case snd_soc_dapm_value_mux: { | 139 | case snd_soc_dapm_value_mux: { |
140 | struct soc_value_enum *e = (struct soc_value_enum *) | 140 | struct soc_enum *e = (struct soc_enum *) |
141 | w->kcontrols[i].private_value; | 141 | w->kcontrols[i].private_value; |
142 | int val, item; | 142 | int val, item; |
143 | 143 | ||
@@ -200,30 +200,6 @@ static int dapm_connect_mux(struct snd_soc_codec *codec, | |||
200 | return -ENODEV; | 200 | return -ENODEV; |
201 | } | 201 | } |
202 | 202 | ||
203 | /* connect value_mux widget to it's interconnecting audio paths */ | ||
204 | static int dapm_connect_value_mux(struct snd_soc_codec *codec, | ||
205 | struct snd_soc_dapm_widget *src, struct snd_soc_dapm_widget *dest, | ||
206 | struct snd_soc_dapm_path *path, const char *control_name, | ||
207 | const struct snd_kcontrol_new *kcontrol) | ||
208 | { | ||
209 | struct soc_value_enum *e = (struct soc_value_enum *) | ||
210 | kcontrol->private_value; | ||
211 | int i; | ||
212 | |||
213 | for (i = 0; i < e->max; i++) { | ||
214 | if (!(strcmp(control_name, e->texts[i]))) { | ||
215 | list_add(&path->list, &codec->dapm_paths); | ||
216 | list_add(&path->list_sink, &dest->sources); | ||
217 | list_add(&path->list_source, &src->sinks); | ||
218 | path->name = (char *)e->texts[i]; | ||
219 | dapm_set_path_status(dest, path, 0); | ||
220 | return 0; | ||
221 | } | ||
222 | } | ||
223 | |||
224 | return -ENODEV; | ||
225 | } | ||
226 | |||
227 | /* connect mixer widget to it's interconnecting audio paths */ | 203 | /* connect mixer widget to it's interconnecting audio paths */ |
228 | static int dapm_connect_mixer(struct snd_soc_codec *codec, | 204 | static int dapm_connect_mixer(struct snd_soc_codec *codec, |
229 | struct snd_soc_dapm_widget *src, struct snd_soc_dapm_widget *dest, | 205 | struct snd_soc_dapm_widget *src, struct snd_soc_dapm_widget *dest, |
@@ -774,45 +750,6 @@ static int dapm_mux_update_power(struct snd_soc_dapm_widget *widget, | |||
774 | return 0; | 750 | return 0; |
775 | } | 751 | } |
776 | 752 | ||
777 | /* test and update the power status of a value_mux widget */ | ||
778 | static int dapm_value_mux_update_power(struct snd_soc_dapm_widget *widget, | ||
779 | struct snd_kcontrol *kcontrol, int mask, | ||
780 | int mux, int val, struct soc_value_enum *e) | ||
781 | { | ||
782 | struct snd_soc_dapm_path *path; | ||
783 | int found = 0; | ||
784 | |||
785 | if (widget->id != snd_soc_dapm_value_mux) | ||
786 | return -ENODEV; | ||
787 | |||
788 | if (!snd_soc_test_bits(widget->codec, e->reg, mask, val)) | ||
789 | return 0; | ||
790 | |||
791 | /* find dapm widget path assoc with kcontrol */ | ||
792 | list_for_each_entry(path, &widget->codec->dapm_paths, list) { | ||
793 | if (path->kcontrol != kcontrol) | ||
794 | continue; | ||
795 | |||
796 | if (!path->name || !e->texts[mux]) | ||
797 | continue; | ||
798 | |||
799 | found = 1; | ||
800 | /* we now need to match the string in the enum to the path */ | ||
801 | if (!(strcmp(path->name, e->texts[mux]))) | ||
802 | path->connect = 1; /* new connection */ | ||
803 | else | ||
804 | path->connect = 0; /* old connection must be | ||
805 | powered down */ | ||
806 | } | ||
807 | |||
808 | if (found) { | ||
809 | dapm_power_widgets(widget->codec, SND_SOC_DAPM_STREAM_NOP); | ||
810 | dump_dapm(widget->codec, "mux power update"); | ||
811 | } | ||
812 | |||
813 | return 0; | ||
814 | } | ||
815 | |||
816 | /* test and update the power status of a mixer or switch widget */ | 753 | /* test and update the power status of a mixer or switch widget */ |
817 | static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget, | 754 | static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget, |
818 | struct snd_kcontrol *kcontrol, int reg, | 755 | struct snd_kcontrol *kcontrol, int reg, |
@@ -1045,17 +982,12 @@ static int snd_soc_dapm_add_route(struct snd_soc_codec *codec, | |||
1045 | path->connect = 1; | 982 | path->connect = 1; |
1046 | return 0; | 983 | return 0; |
1047 | case snd_soc_dapm_mux: | 984 | case snd_soc_dapm_mux: |
985 | case snd_soc_dapm_value_mux: | ||
1048 | ret = dapm_connect_mux(codec, wsource, wsink, path, control, | 986 | ret = dapm_connect_mux(codec, wsource, wsink, path, control, |
1049 | &wsink->kcontrols[0]); | 987 | &wsink->kcontrols[0]); |
1050 | if (ret != 0) | 988 | if (ret != 0) |
1051 | goto err; | 989 | goto err; |
1052 | break; | 990 | break; |
1053 | case snd_soc_dapm_value_mux: | ||
1054 | ret = dapm_connect_value_mux(codec, wsource, wsink, path, | ||
1055 | control, &wsink->kcontrols[0]); | ||
1056 | if (ret != 0) | ||
1057 | goto err; | ||
1058 | break; | ||
1059 | case snd_soc_dapm_switch: | 991 | case snd_soc_dapm_switch: |
1060 | case snd_soc_dapm_mixer: | 992 | case snd_soc_dapm_mixer: |
1061 | ret = dapm_connect_mixer(codec, wsource, wsink, path, control); | 993 | ret = dapm_connect_mixer(codec, wsource, wsink, path, control); |
@@ -1382,8 +1314,7 @@ int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol, | |||
1382 | struct snd_ctl_elem_value *ucontrol) | 1314 | struct snd_ctl_elem_value *ucontrol) |
1383 | { | 1315 | { |
1384 | struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); | 1316 | struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); |
1385 | struct soc_value_enum *e = (struct soc_value_enum *) | 1317 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
1386 | kcontrol->private_value; | ||
1387 | unsigned short reg_val, val, mux; | 1318 | unsigned short reg_val, val, mux; |
1388 | 1319 | ||
1389 | reg_val = snd_soc_read(widget->codec, e->reg); | 1320 | reg_val = snd_soc_read(widget->codec, e->reg); |
@@ -1423,8 +1354,7 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, | |||
1423 | struct snd_ctl_elem_value *ucontrol) | 1354 | struct snd_ctl_elem_value *ucontrol) |
1424 | { | 1355 | { |
1425 | struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); | 1356 | struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); |
1426 | struct soc_value_enum *e = (struct soc_value_enum *) | 1357 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
1427 | kcontrol->private_value; | ||
1428 | unsigned short val, mux; | 1358 | unsigned short val, mux; |
1429 | unsigned short mask; | 1359 | unsigned short mask; |
1430 | int ret = 0; | 1360 | int ret = 0; |
@@ -1443,7 +1373,7 @@ int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol, | |||
1443 | 1373 | ||
1444 | mutex_lock(&widget->codec->mutex); | 1374 | mutex_lock(&widget->codec->mutex); |
1445 | widget->value = val; | 1375 | widget->value = val; |
1446 | dapm_value_mux_update_power(widget, kcontrol, mask, mux, val, e); | 1376 | dapm_mux_update_power(widget, kcontrol, mask, mux, val, e); |
1447 | if (widget->event) { | 1377 | if (widget->event) { |
1448 | if (widget->event_flags & SND_SOC_DAPM_PRE_REG) { | 1378 | if (widget->event_flags & SND_SOC_DAPM_PRE_REG) { |
1449 | ret = widget->event(widget, | 1379 | ret = widget->event(widget, |