diff options
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r-- | sound/soc/soc-dapm.c | 57 |
1 files changed, 41 insertions, 16 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 493a4e8aa273..3a759c2872a8 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -54,14 +54,15 @@ | |||
54 | static int dapm_up_seq[] = { | 54 | static int dapm_up_seq[] = { |
55 | snd_soc_dapm_pre, snd_soc_dapm_micbias, snd_soc_dapm_mic, | 55 | snd_soc_dapm_pre, snd_soc_dapm_micbias, snd_soc_dapm_mic, |
56 | snd_soc_dapm_mux, snd_soc_dapm_value_mux, snd_soc_dapm_dac, | 56 | snd_soc_dapm_mux, snd_soc_dapm_value_mux, snd_soc_dapm_dac, |
57 | snd_soc_dapm_mixer, snd_soc_dapm_pga, snd_soc_dapm_adc, snd_soc_dapm_hp, | 57 | snd_soc_dapm_mixer, snd_soc_dapm_mixer_named_ctl, snd_soc_dapm_pga, |
58 | snd_soc_dapm_spk, snd_soc_dapm_post | 58 | snd_soc_dapm_adc, snd_soc_dapm_hp, snd_soc_dapm_spk, snd_soc_dapm_post |
59 | }; | 59 | }; |
60 | |||
60 | static int dapm_down_seq[] = { | 61 | static int dapm_down_seq[] = { |
61 | snd_soc_dapm_pre, snd_soc_dapm_adc, snd_soc_dapm_hp, snd_soc_dapm_spk, | 62 | snd_soc_dapm_pre, snd_soc_dapm_adc, snd_soc_dapm_hp, snd_soc_dapm_spk, |
62 | snd_soc_dapm_pga, snd_soc_dapm_mixer, snd_soc_dapm_dac, snd_soc_dapm_mic, | 63 | snd_soc_dapm_pga, snd_soc_dapm_mixer_named_ctl, snd_soc_dapm_mixer, |
63 | snd_soc_dapm_micbias, snd_soc_dapm_mux, snd_soc_dapm_value_mux, | 64 | snd_soc_dapm_dac, snd_soc_dapm_mic, snd_soc_dapm_micbias, |
64 | snd_soc_dapm_post | 65 | snd_soc_dapm_mux, snd_soc_dapm_value_mux, snd_soc_dapm_post |
65 | }; | 66 | }; |
66 | 67 | ||
67 | static int dapm_status = 1; | 68 | static int dapm_status = 1; |
@@ -101,7 +102,8 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w, | |||
101 | { | 102 | { |
102 | switch (w->id) { | 103 | switch (w->id) { |
103 | case snd_soc_dapm_switch: | 104 | case snd_soc_dapm_switch: |
104 | case snd_soc_dapm_mixer: { | 105 | case snd_soc_dapm_mixer: |
106 | case snd_soc_dapm_mixer_named_ctl: { | ||
105 | int val; | 107 | int val; |
106 | struct soc_mixer_control *mc = (struct soc_mixer_control *) | 108 | struct soc_mixer_control *mc = (struct soc_mixer_control *) |
107 | w->kcontrols[i].private_value; | 109 | w->kcontrols[i].private_value; |
@@ -323,15 +325,33 @@ static int dapm_new_mixer(struct snd_soc_codec *codec, | |||
323 | if (path->name != (char*)w->kcontrols[i].name) | 325 | if (path->name != (char*)w->kcontrols[i].name) |
324 | continue; | 326 | continue; |
325 | 327 | ||
326 | /* add dapm control with long name */ | 328 | /* add dapm control with long name. |
327 | name_len = 2 + strlen(w->name) | 329 | * for dapm_mixer this is the concatenation of the |
328 | + strlen(w->kcontrols[i].name); | 330 | * mixer and kcontrol name. |
331 | * for dapm_mixer_named_ctl this is simply the | ||
332 | * kcontrol name. | ||
333 | */ | ||
334 | name_len = strlen(w->kcontrols[i].name) + 1; | ||
335 | if (w->id == snd_soc_dapm_mixer) | ||
336 | name_len += 1 + strlen(w->name); | ||
337 | |||
329 | path->long_name = kmalloc(name_len, GFP_KERNEL); | 338 | path->long_name = kmalloc(name_len, GFP_KERNEL); |
339 | |||
330 | if (path->long_name == NULL) | 340 | if (path->long_name == NULL) |
331 | return -ENOMEM; | 341 | return -ENOMEM; |
332 | 342 | ||
333 | snprintf(path->long_name, name_len, "%s %s", | 343 | switch (w->id) { |
334 | w->name, w->kcontrols[i].name); | 344 | case snd_soc_dapm_mixer: |
345 | default: | ||
346 | snprintf(path->long_name, name_len, "%s %s", | ||
347 | w->name, w->kcontrols[i].name); | ||
348 | break; | ||
349 | case snd_soc_dapm_mixer_named_ctl: | ||
350 | snprintf(path->long_name, name_len, "%s", | ||
351 | w->kcontrols[i].name); | ||
352 | break; | ||
353 | } | ||
354 | |||
335 | path->long_name[name_len - 1] = '\0'; | 355 | path->long_name[name_len - 1] = '\0'; |
336 | 356 | ||
337 | path->kcontrol = snd_soc_cnew(&w->kcontrols[i], w, | 357 | path->kcontrol = snd_soc_cnew(&w->kcontrols[i], w, |
@@ -687,6 +707,7 @@ static void dbg_dump_dapm(struct snd_soc_codec* codec, const char *action) | |||
687 | case snd_soc_dapm_adc: | 707 | case snd_soc_dapm_adc: |
688 | case snd_soc_dapm_pga: | 708 | case snd_soc_dapm_pga: |
689 | case snd_soc_dapm_mixer: | 709 | case snd_soc_dapm_mixer: |
710 | case snd_soc_dapm_mixer_named_ctl: | ||
690 | if (w->name) { | 711 | if (w->name) { |
691 | in = is_connected_input_ep(w); | 712 | in = is_connected_input_ep(w); |
692 | dapm_clear_walk(w->codec); | 713 | dapm_clear_walk(w->codec); |
@@ -759,6 +780,7 @@ static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget, | |||
759 | int found = 0; | 780 | int found = 0; |
760 | 781 | ||
761 | if (widget->id != snd_soc_dapm_mixer && | 782 | if (widget->id != snd_soc_dapm_mixer && |
783 | widget->id != snd_soc_dapm_mixer_named_ctl && | ||
762 | widget->id != snd_soc_dapm_switch) | 784 | widget->id != snd_soc_dapm_switch) |
763 | return -ENODEV; | 785 | return -ENODEV; |
764 | 786 | ||
@@ -812,6 +834,7 @@ static ssize_t dapm_widget_show(struct device *dev, | |||
812 | case snd_soc_dapm_adc: | 834 | case snd_soc_dapm_adc: |
813 | case snd_soc_dapm_pga: | 835 | case snd_soc_dapm_pga: |
814 | case snd_soc_dapm_mixer: | 836 | case snd_soc_dapm_mixer: |
837 | case snd_soc_dapm_mixer_named_ctl: | ||
815 | if (w->name) | 838 | if (w->name) |
816 | count += sprintf(buf + count, "%s: %s\n", | 839 | count += sprintf(buf + count, "%s: %s\n", |
817 | w->name, w->power ? "On":"Off"); | 840 | w->name, w->power ? "On":"Off"); |
@@ -875,7 +898,7 @@ static void dapm_free_widgets(struct snd_soc_codec *codec) | |||
875 | } | 898 | } |
876 | 899 | ||
877 | static int snd_soc_dapm_set_pin(struct snd_soc_codec *codec, | 900 | static int snd_soc_dapm_set_pin(struct snd_soc_codec *codec, |
878 | char *pin, int status) | 901 | const char *pin, int status) |
879 | { | 902 | { |
880 | struct snd_soc_dapm_widget *w; | 903 | struct snd_soc_dapm_widget *w; |
881 | 904 | ||
@@ -990,6 +1013,7 @@ static int snd_soc_dapm_add_route(struct snd_soc_codec *codec, | |||
990 | break; | 1013 | break; |
991 | case snd_soc_dapm_switch: | 1014 | case snd_soc_dapm_switch: |
992 | case snd_soc_dapm_mixer: | 1015 | case snd_soc_dapm_mixer: |
1016 | case snd_soc_dapm_mixer_named_ctl: | ||
993 | ret = dapm_connect_mixer(codec, wsource, wsink, path, control); | 1017 | ret = dapm_connect_mixer(codec, wsource, wsink, path, control); |
994 | if (ret != 0) | 1018 | if (ret != 0) |
995 | goto err; | 1019 | goto err; |
@@ -1067,6 +1091,7 @@ int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec) | |||
1067 | switch(w->id) { | 1091 | switch(w->id) { |
1068 | case snd_soc_dapm_switch: | 1092 | case snd_soc_dapm_switch: |
1069 | case snd_soc_dapm_mixer: | 1093 | case snd_soc_dapm_mixer: |
1094 | case snd_soc_dapm_mixer_named_ctl: | ||
1070 | dapm_new_mixer(codec, w); | 1095 | dapm_new_mixer(codec, w); |
1071 | break; | 1096 | break; |
1072 | case snd_soc_dapm_mux: | 1097 | case snd_soc_dapm_mux: |
@@ -1548,7 +1573,7 @@ int snd_soc_dapm_set_bias_level(struct snd_soc_device *socdev, | |||
1548 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | 1573 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to |
1549 | * do any widget power switching. | 1574 | * do any widget power switching. |
1550 | */ | 1575 | */ |
1551 | int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, char *pin) | 1576 | int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, const char *pin) |
1552 | { | 1577 | { |
1553 | return snd_soc_dapm_set_pin(codec, pin, 1); | 1578 | return snd_soc_dapm_set_pin(codec, pin, 1); |
1554 | } | 1579 | } |
@@ -1563,7 +1588,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin); | |||
1563 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | 1588 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to |
1564 | * do any widget power switching. | 1589 | * do any widget power switching. |
1565 | */ | 1590 | */ |
1566 | int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, char *pin) | 1591 | int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, const char *pin) |
1567 | { | 1592 | { |
1568 | return snd_soc_dapm_set_pin(codec, pin, 0); | 1593 | return snd_soc_dapm_set_pin(codec, pin, 0); |
1569 | } | 1594 | } |
@@ -1583,7 +1608,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin); | |||
1583 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to | 1608 | * NOTE: snd_soc_dapm_sync() needs to be called after this for DAPM to |
1584 | * do any widget power switching. | 1609 | * do any widget power switching. |
1585 | */ | 1610 | */ |
1586 | int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, char *pin) | 1611 | int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, const char *pin) |
1587 | { | 1612 | { |
1588 | return snd_soc_dapm_set_pin(codec, pin, 0); | 1613 | return snd_soc_dapm_set_pin(codec, pin, 0); |
1589 | } | 1614 | } |
@@ -1598,7 +1623,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_nc_pin); | |||
1598 | * | 1623 | * |
1599 | * Returns 1 for connected otherwise 0. | 1624 | * Returns 1 for connected otherwise 0. |
1600 | */ | 1625 | */ |
1601 | int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, char *pin) | 1626 | int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, const char *pin) |
1602 | { | 1627 | { |
1603 | struct snd_soc_dapm_widget *w; | 1628 | struct snd_soc_dapm_widget *w; |
1604 | 1629 | ||