diff options
-rw-r--r-- | include/sound/soc-dapm.h | 8 | ||||
-rw-r--r-- | sound/soc/codecs/wm8993.c | 88 | ||||
-rw-r--r-- | sound/soc/soc-dapm.c | 58 |
3 files changed, 133 insertions, 21 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 1673f0b2cf58..c1410e3191e3 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -137,6 +137,12 @@ | |||
137 | .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD} | 137 | .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD} |
138 | 138 | ||
139 | /* stream domain */ | 139 | /* stream domain */ |
140 | #define SND_SOC_DAPM_AIF_IN(wname, stname, wslot, wreg, wshift, winvert) \ | ||
141 | { .id = snd_soc_dapm_aif_in, .name = wname, .sname = stname, \ | ||
142 | .reg = wreg, .shift = wshift, .invert = winvert } | ||
143 | #define SND_SOC_DAPM_AIF_OUT(wname, stname, wslot, wreg, wshift, winvert) \ | ||
144 | { .id = snd_soc_dapm_aif_out, .name = wname, .sname = stname, \ | ||
145 | .reg = wreg, .shift = wshift, .invert = winvert } | ||
140 | #define SND_SOC_DAPM_DAC(wname, stname, wreg, wshift, winvert) \ | 146 | #define SND_SOC_DAPM_DAC(wname, stname, wreg, wshift, winvert) \ |
141 | { .id = snd_soc_dapm_dac, .name = wname, .sname = stname, .reg = wreg, \ | 147 | { .id = snd_soc_dapm_dac, .name = wname, .sname = stname, .reg = wreg, \ |
142 | .shift = wshift, .invert = winvert} | 148 | .shift = wshift, .invert = winvert} |
@@ -313,6 +319,8 @@ enum snd_soc_dapm_type { | |||
313 | snd_soc_dapm_pre, /* machine specific pre widget - exec first */ | 319 | snd_soc_dapm_pre, /* machine specific pre widget - exec first */ |
314 | snd_soc_dapm_post, /* machine specific post widget - exec last */ | 320 | snd_soc_dapm_post, /* machine specific post widget - exec last */ |
315 | snd_soc_dapm_supply, /* power/clock supply */ | 321 | snd_soc_dapm_supply, /* power/clock supply */ |
322 | snd_soc_dapm_aif_in, /* audio interface input */ | ||
323 | snd_soc_dapm_aif_out, /* audio interface output */ | ||
316 | }; | 324 | }; |
317 | 325 | ||
318 | /* | 326 | /* |
diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c index 13befa338247..d9987999e92c 100644 --- a/sound/soc/codecs/wm8993.c +++ b/sound/soc/codecs/wm8993.c | |||
@@ -846,18 +846,76 @@ SOC_DAPM_SINGLE("Output Switch", WM8993_SPEAKER_MIXER, 2, 1, 0), | |||
846 | SOC_DAPM_SINGLE("DAC Switch", WM8993_SPEAKER_MIXER, 0, 1, 0), | 846 | SOC_DAPM_SINGLE("DAC Switch", WM8993_SPEAKER_MIXER, 0, 1, 0), |
847 | }; | 847 | }; |
848 | 848 | ||
849 | static const char *aif_text[] = { | ||
850 | "Left", "Right" | ||
851 | }; | ||
852 | |||
853 | static const struct soc_enum aifoutl_enum = | ||
854 | SOC_ENUM_SINGLE(WM8993_AUDIO_INTERFACE_1, 15, 2, aif_text); | ||
855 | |||
856 | static const struct snd_kcontrol_new aifoutl_mux = | ||
857 | SOC_DAPM_ENUM("AIFOUTL Mux", aifoutl_enum); | ||
858 | |||
859 | static const struct soc_enum aifoutr_enum = | ||
860 | SOC_ENUM_SINGLE(WM8993_AUDIO_INTERFACE_1, 14, 2, aif_text); | ||
861 | |||
862 | static const struct snd_kcontrol_new aifoutr_mux = | ||
863 | SOC_DAPM_ENUM("AIFOUTR Mux", aifoutr_enum); | ||
864 | |||
865 | static const struct soc_enum aifinl_enum = | ||
866 | SOC_ENUM_SINGLE(WM8993_AUDIO_INTERFACE_2, 15, 2, aif_text); | ||
867 | |||
868 | static const struct snd_kcontrol_new aifinl_mux = | ||
869 | SOC_DAPM_ENUM("AIFINL Mux", aifinl_enum); | ||
870 | |||
871 | static const struct soc_enum aifinr_enum = | ||
872 | SOC_ENUM_SINGLE(WM8993_AUDIO_INTERFACE_2, 14, 2, aif_text); | ||
873 | |||
874 | static const struct snd_kcontrol_new aifinr_mux = | ||
875 | SOC_DAPM_ENUM("AIFINR Mux", aifinr_enum); | ||
876 | |||
877 | static const char *sidetone_text[] = { | ||
878 | "None", "Left", "Right" | ||
879 | }; | ||
880 | |||
881 | static const struct soc_enum sidetonel_enum = | ||
882 | SOC_ENUM_SINGLE(WM8993_DIGITAL_SIDE_TONE, 2, 3, sidetone_text); | ||
883 | |||
884 | static const struct snd_kcontrol_new sidetonel_mux = | ||
885 | SOC_DAPM_ENUM("Left Sidetone", sidetonel_enum); | ||
886 | |||
887 | static const struct soc_enum sidetoner_enum = | ||
888 | SOC_ENUM_SINGLE(WM8993_DIGITAL_SIDE_TONE, 0, 3, sidetone_text); | ||
889 | |||
890 | static const struct snd_kcontrol_new sidetoner_mux = | ||
891 | SOC_DAPM_ENUM("Right Sidetone", sidetoner_enum); | ||
892 | |||
849 | static const struct snd_soc_dapm_widget wm8993_dapm_widgets[] = { | 893 | static const struct snd_soc_dapm_widget wm8993_dapm_widgets[] = { |
850 | SND_SOC_DAPM_SUPPLY("CLK_SYS", WM8993_BUS_CONTROL_1, 1, 0, clk_sys_event, | 894 | SND_SOC_DAPM_SUPPLY("CLK_SYS", WM8993_BUS_CONTROL_1, 1, 0, clk_sys_event, |
851 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), | 895 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), |
852 | SND_SOC_DAPM_SUPPLY("TOCLK", WM8993_CLOCKING_1, 14, 0, NULL, 0), | 896 | SND_SOC_DAPM_SUPPLY("TOCLK", WM8993_CLOCKING_1, 14, 0, NULL, 0), |
853 | SND_SOC_DAPM_SUPPLY("CLK_DSP", WM8993_CLOCKING_3, 0, 0, NULL, 0), | 897 | SND_SOC_DAPM_SUPPLY("CLK_DSP", WM8993_CLOCKING_3, 0, 0, NULL, 0), |
854 | 898 | ||
899 | SND_SOC_DAPM_ADC("ADCL", NULL, WM8993_POWER_MANAGEMENT_2, 1, 0), | ||
900 | SND_SOC_DAPM_ADC("ADCR", NULL, WM8993_POWER_MANAGEMENT_2, 0, 0), | ||
901 | |||
902 | SND_SOC_DAPM_MUX("AIFOUTL Mux", SND_SOC_NOPM, 0, 0, &aifoutl_mux), | ||
903 | SND_SOC_DAPM_MUX("AIFOUTR Mux", SND_SOC_NOPM, 0, 0, &aifoutr_mux), | ||
904 | |||
905 | SND_SOC_DAPM_AIF_OUT("AIFOUTL", "Capture", 0, SND_SOC_NOPM, 0, 0), | ||
906 | SND_SOC_DAPM_AIF_OUT("AIFOUTR", "Capture", 1, SND_SOC_NOPM, 0, 0), | ||
855 | 907 | ||
856 | SND_SOC_DAPM_ADC("ADCL", "Capture", WM8993_POWER_MANAGEMENT_2, 1, 0), | 908 | SND_SOC_DAPM_AIF_IN("AIFINL", "Playback", 0, SND_SOC_NOPM, 0, 0), |
857 | SND_SOC_DAPM_ADC("ADCR", "Capture", WM8993_POWER_MANAGEMENT_2, 0, 0), | 909 | SND_SOC_DAPM_AIF_IN("AIFINR", "Playback", 1, SND_SOC_NOPM, 0, 0), |
858 | 910 | ||
859 | SND_SOC_DAPM_DAC("DACL", "Playback", WM8993_POWER_MANAGEMENT_3, 1, 0), | 911 | SND_SOC_DAPM_MUX("DACL Mux", SND_SOC_NOPM, 0, 0, &aifinl_mux), |
860 | SND_SOC_DAPM_DAC("DACR", "Playback", WM8993_POWER_MANAGEMENT_3, 0, 0), | 912 | SND_SOC_DAPM_MUX("DACR Mux", SND_SOC_NOPM, 0, 0, &aifinr_mux), |
913 | |||
914 | SND_SOC_DAPM_MUX("DACL Sidetone", SND_SOC_NOPM, 0, 0, &sidetonel_mux), | ||
915 | SND_SOC_DAPM_MUX("DACR Sidetone", SND_SOC_NOPM, 0, 0, &sidetoner_mux), | ||
916 | |||
917 | SND_SOC_DAPM_DAC("DACL", NULL, WM8993_POWER_MANAGEMENT_3, 1, 0), | ||
918 | SND_SOC_DAPM_DAC("DACR", NULL, WM8993_POWER_MANAGEMENT_3, 0, 0), | ||
861 | 919 | ||
862 | SND_SOC_DAPM_MUX("Left Headphone Mux", SND_SOC_NOPM, 0, 0, &hpl_mux), | 920 | SND_SOC_DAPM_MUX("Left Headphone Mux", SND_SOC_NOPM, 0, 0, &hpl_mux), |
863 | SND_SOC_DAPM_MUX("Right Headphone Mux", SND_SOC_NOPM, 0, 0, &hpr_mux), | 921 | SND_SOC_DAPM_MUX("Right Headphone Mux", SND_SOC_NOPM, 0, 0, &hpr_mux), |
@@ -875,10 +933,32 @@ static const struct snd_soc_dapm_route routes[] = { | |||
875 | { "ADCR", NULL, "CLK_SYS" }, | 933 | { "ADCR", NULL, "CLK_SYS" }, |
876 | { "ADCR", NULL, "CLK_DSP" }, | 934 | { "ADCR", NULL, "CLK_DSP" }, |
877 | 935 | ||
936 | { "AIFOUTL Mux", "Left", "ADCL" }, | ||
937 | { "AIFOUTL Mux", "Right", "ADCR" }, | ||
938 | { "AIFOUTR Mux", "Left", "ADCL" }, | ||
939 | { "AIFOUTR Mux", "Right", "ADCR" }, | ||
940 | |||
941 | { "AIFOUTL", NULL, "AIFOUTL Mux" }, | ||
942 | { "AIFOUTR", NULL, "AIFOUTR Mux" }, | ||
943 | |||
944 | { "DACL Mux", "Left", "AIFINL" }, | ||
945 | { "DACL Mux", "Right", "AIFINR" }, | ||
946 | { "DACR Mux", "Left", "AIFINL" }, | ||
947 | { "DACR Mux", "Right", "AIFINR" }, | ||
948 | |||
949 | { "DACL Sidetone", "Left", "ADCL" }, | ||
950 | { "DACL Sidetone", "Right", "ADCR" }, | ||
951 | { "DACR Sidetone", "Left", "ADCL" }, | ||
952 | { "DACR Sidetone", "Right", "ADCR" }, | ||
953 | |||
878 | { "DACL", NULL, "CLK_SYS" }, | 954 | { "DACL", NULL, "CLK_SYS" }, |
879 | { "DACL", NULL, "CLK_DSP" }, | 955 | { "DACL", NULL, "CLK_DSP" }, |
956 | { "DACL", NULL, "DACL Mux" }, | ||
957 | { "DACL", NULL, "DACL Sidetone" }, | ||
880 | { "DACR", NULL, "CLK_SYS" }, | 958 | { "DACR", NULL, "CLK_SYS" }, |
881 | { "DACR", NULL, "CLK_DSP" }, | 959 | { "DACR", NULL, "CLK_DSP" }, |
960 | { "DACR", NULL, "DACR Mux" }, | ||
961 | { "DACR", NULL, "DACR Sidetone" }, | ||
882 | 962 | ||
883 | { "Left Output Mixer", "DAC Switch", "DACL" }, | 963 | { "Left Output Mixer", "DAC Switch", "DACL" }, |
884 | 964 | ||
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 7b74547b56fa..0d8b08ef8731 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -56,17 +56,19 @@ static int dapm_up_seq[] = { | |||
56 | [snd_soc_dapm_pre] = 0, | 56 | [snd_soc_dapm_pre] = 0, |
57 | [snd_soc_dapm_supply] = 1, | 57 | [snd_soc_dapm_supply] = 1, |
58 | [snd_soc_dapm_micbias] = 2, | 58 | [snd_soc_dapm_micbias] = 2, |
59 | [snd_soc_dapm_mic] = 3, | 59 | [snd_soc_dapm_aif_in] = 3, |
60 | [snd_soc_dapm_mux] = 4, | 60 | [snd_soc_dapm_aif_out] = 3, |
61 | [snd_soc_dapm_value_mux] = 4, | 61 | [snd_soc_dapm_mic] = 4, |
62 | [snd_soc_dapm_dac] = 5, | 62 | [snd_soc_dapm_mux] = 5, |
63 | [snd_soc_dapm_mixer] = 6, | 63 | [snd_soc_dapm_value_mux] = 5, |
64 | [snd_soc_dapm_mixer_named_ctl] = 6, | 64 | [snd_soc_dapm_dac] = 6, |
65 | [snd_soc_dapm_pga] = 7, | 65 | [snd_soc_dapm_mixer] = 7, |
66 | [snd_soc_dapm_adc] = 8, | 66 | [snd_soc_dapm_mixer_named_ctl] = 7, |
67 | [snd_soc_dapm_hp] = 9, | 67 | [snd_soc_dapm_pga] = 8, |
68 | [snd_soc_dapm_spk] = 9, | 68 | [snd_soc_dapm_adc] = 9, |
69 | [snd_soc_dapm_post] = 10, | 69 | [snd_soc_dapm_hp] = 10, |
70 | [snd_soc_dapm_spk] = 10, | ||
71 | [snd_soc_dapm_post] = 11, | ||
70 | }; | 72 | }; |
71 | 73 | ||
72 | static int dapm_down_seq[] = { | 74 | static int dapm_down_seq[] = { |
@@ -82,8 +84,10 @@ static int dapm_down_seq[] = { | |||
82 | [snd_soc_dapm_micbias] = 8, | 84 | [snd_soc_dapm_micbias] = 8, |
83 | [snd_soc_dapm_mux] = 9, | 85 | [snd_soc_dapm_mux] = 9, |
84 | [snd_soc_dapm_value_mux] = 9, | 86 | [snd_soc_dapm_value_mux] = 9, |
85 | [snd_soc_dapm_supply] = 10, | 87 | [snd_soc_dapm_aif_in] = 10, |
86 | [snd_soc_dapm_post] = 11, | 88 | [snd_soc_dapm_aif_out] = 10, |
89 | [snd_soc_dapm_supply] = 11, | ||
90 | [snd_soc_dapm_post] = 12, | ||
87 | }; | 91 | }; |
88 | 92 | ||
89 | static void pop_wait(u32 pop_time) | 93 | static void pop_wait(u32 pop_time) |
@@ -229,6 +233,8 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w, | |||
229 | case snd_soc_dapm_micbias: | 233 | case snd_soc_dapm_micbias: |
230 | case snd_soc_dapm_vmid: | 234 | case snd_soc_dapm_vmid: |
231 | case snd_soc_dapm_supply: | 235 | case snd_soc_dapm_supply: |
236 | case snd_soc_dapm_aif_in: | ||
237 | case snd_soc_dapm_aif_out: | ||
232 | p->connect = 1; | 238 | p->connect = 1; |
233 | break; | 239 | break; |
234 | /* does effect routing - dynamically connected */ | 240 | /* does effect routing - dynamically connected */ |
@@ -502,8 +508,14 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget) | |||
502 | if (widget->id == snd_soc_dapm_supply) | 508 | if (widget->id == snd_soc_dapm_supply) |
503 | return 0; | 509 | return 0; |
504 | 510 | ||
505 | if (widget->id == snd_soc_dapm_adc && widget->active) | 511 | switch (widget->id) { |
506 | return 1; | 512 | case snd_soc_dapm_adc: |
513 | case snd_soc_dapm_aif_out: | ||
514 | if (widget->active) | ||
515 | return 1; | ||
516 | default: | ||
517 | break; | ||
518 | } | ||
507 | 519 | ||
508 | if (widget->connected) { | 520 | if (widget->connected) { |
509 | /* connected pin ? */ | 521 | /* connected pin ? */ |
@@ -542,8 +554,14 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget) | |||
542 | return 0; | 554 | return 0; |
543 | 555 | ||
544 | /* active stream ? */ | 556 | /* active stream ? */ |
545 | if (widget->id == snd_soc_dapm_dac && widget->active) | 557 | switch (widget->id) { |
546 | return 1; | 558 | case snd_soc_dapm_dac: |
559 | case snd_soc_dapm_aif_in: | ||
560 | if (widget->active) | ||
561 | return 1; | ||
562 | default: | ||
563 | break; | ||
564 | } | ||
547 | 565 | ||
548 | if (widget->connected) { | 566 | if (widget->connected) { |
549 | /* connected pin ? */ | 567 | /* connected pin ? */ |
@@ -1057,6 +1075,8 @@ static void dbg_dump_dapm(struct snd_soc_codec* codec, const char *action) | |||
1057 | case snd_soc_dapm_mixer: | 1075 | case snd_soc_dapm_mixer: |
1058 | case snd_soc_dapm_mixer_named_ctl: | 1076 | case snd_soc_dapm_mixer_named_ctl: |
1059 | case snd_soc_dapm_supply: | 1077 | case snd_soc_dapm_supply: |
1078 | case snd_soc_dapm_aif_in: | ||
1079 | case snd_soc_dapm_aif_out: | ||
1060 | if (w->name) { | 1080 | if (w->name) { |
1061 | in = is_connected_input_ep(w); | 1081 | in = is_connected_input_ep(w); |
1062 | dapm_clear_walk(w->codec); | 1082 | dapm_clear_walk(w->codec); |
@@ -1433,6 +1453,8 @@ static int snd_soc_dapm_add_route(struct snd_soc_codec *codec, | |||
1433 | case snd_soc_dapm_pre: | 1453 | case snd_soc_dapm_pre: |
1434 | case snd_soc_dapm_post: | 1454 | case snd_soc_dapm_post: |
1435 | case snd_soc_dapm_supply: | 1455 | case snd_soc_dapm_supply: |
1456 | case snd_soc_dapm_aif_in: | ||
1457 | case snd_soc_dapm_aif_out: | ||
1436 | list_add(&path->list, &codec->dapm_paths); | 1458 | list_add(&path->list, &codec->dapm_paths); |
1437 | list_add(&path->list_sink, &wsink->sources); | 1459 | list_add(&path->list_sink, &wsink->sources); |
1438 | list_add(&path->list_source, &wsource->sinks); | 1460 | list_add(&path->list_source, &wsource->sinks); |
@@ -1535,9 +1557,11 @@ int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec) | |||
1535 | dapm_new_mux(codec, w); | 1557 | dapm_new_mux(codec, w); |
1536 | break; | 1558 | break; |
1537 | case snd_soc_dapm_adc: | 1559 | case snd_soc_dapm_adc: |
1560 | case snd_soc_dapm_aif_out: | ||
1538 | w->power_check = dapm_adc_check_power; | 1561 | w->power_check = dapm_adc_check_power; |
1539 | break; | 1562 | break; |
1540 | case snd_soc_dapm_dac: | 1563 | case snd_soc_dapm_dac: |
1564 | case snd_soc_dapm_aif_in: | ||
1541 | w->power_check = dapm_dac_check_power; | 1565 | w->power_check = dapm_dac_check_power; |
1542 | break; | 1566 | break; |
1543 | case snd_soc_dapm_pga: | 1567 | case snd_soc_dapm_pga: |