diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/arizona.c | 201 | ||||
-rw-r--r-- | sound/soc/codecs/arizona.h | 25 | ||||
-rw-r--r-- | sound/soc/codecs/wm5102.c | 216 | ||||
-rw-r--r-- | sound/soc/codecs/wm5110.c | 111 |
4 files changed, 443 insertions, 110 deletions
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c index adf397b9d0e6..6d98cf41f727 100644 --- a/sound/soc/codecs/arizona.c +++ b/sound/soc/codecs/arizona.c | |||
@@ -141,6 +141,30 @@ const char *arizona_mixer_texts[ARIZONA_NUM_MIXER_INPUTS] = { | |||
141 | "ASRC1R", | 141 | "ASRC1R", |
142 | "ASRC2L", | 142 | "ASRC2L", |
143 | "ASRC2R", | 143 | "ASRC2R", |
144 | "ISRC1INT1", | ||
145 | "ISRC1INT2", | ||
146 | "ISRC1INT3", | ||
147 | "ISRC1INT4", | ||
148 | "ISRC1DEC1", | ||
149 | "ISRC1DEC2", | ||
150 | "ISRC1DEC3", | ||
151 | "ISRC1DEC4", | ||
152 | "ISRC2INT1", | ||
153 | "ISRC2INT2", | ||
154 | "ISRC2INT3", | ||
155 | "ISRC2INT4", | ||
156 | "ISRC2DEC1", | ||
157 | "ISRC2DEC2", | ||
158 | "ISRC2DEC3", | ||
159 | "ISRC2DEC4", | ||
160 | "ISRC3INT1", | ||
161 | "ISRC3INT2", | ||
162 | "ISRC3INT3", | ||
163 | "ISRC3INT4", | ||
164 | "ISRC3DEC1", | ||
165 | "ISRC3DEC2", | ||
166 | "ISRC3DEC3", | ||
167 | "ISRC3DEC4", | ||
144 | }; | 168 | }; |
145 | EXPORT_SYMBOL_GPL(arizona_mixer_texts); | 169 | EXPORT_SYMBOL_GPL(arizona_mixer_texts); |
146 | 170 | ||
@@ -220,6 +244,30 @@ int arizona_mixer_values[ARIZONA_NUM_MIXER_INPUTS] = { | |||
220 | 0x91, | 244 | 0x91, |
221 | 0x92, | 245 | 0x92, |
222 | 0x93, | 246 | 0x93, |
247 | 0xa0, /* ISRC1INT1 */ | ||
248 | 0xa1, | ||
249 | 0xa2, | ||
250 | 0xa3, | ||
251 | 0xa4, /* ISRC1DEC1 */ | ||
252 | 0xa5, | ||
253 | 0xa6, | ||
254 | 0xa7, | ||
255 | 0xa8, /* ISRC2DEC1 */ | ||
256 | 0xa9, | ||
257 | 0xaa, | ||
258 | 0xab, | ||
259 | 0xac, /* ISRC2INT1 */ | ||
260 | 0xad, | ||
261 | 0xae, | ||
262 | 0xaf, | ||
263 | 0xb0, /* ISRC3DEC1 */ | ||
264 | 0xb1, | ||
265 | 0xb2, | ||
266 | 0xb3, | ||
267 | 0xb4, /* ISRC3INT1 */ | ||
268 | 0xb5, | ||
269 | 0xb6, | ||
270 | 0xb7, | ||
223 | }; | 271 | }; |
224 | EXPORT_SYMBOL_GPL(arizona_mixer_values); | 272 | EXPORT_SYMBOL_GPL(arizona_mixer_values); |
225 | 273 | ||
@@ -275,6 +323,15 @@ const struct soc_enum arizona_lhpf4_mode = | |||
275 | arizona_lhpf_mode_text); | 323 | arizona_lhpf_mode_text); |
276 | EXPORT_SYMBOL_GPL(arizona_lhpf4_mode); | 324 | EXPORT_SYMBOL_GPL(arizona_lhpf4_mode); |
277 | 325 | ||
326 | static const char *arizona_ng_hold_text[] = { | ||
327 | "30ms", "120ms", "250ms", "500ms", | ||
328 | }; | ||
329 | |||
330 | const struct soc_enum arizona_ng_hold = | ||
331 | SOC_ENUM_SINGLE(ARIZONA_NOISE_GATE_CONTROL, ARIZONA_NGATE_HOLD_SHIFT, | ||
332 | 4, arizona_ng_hold_text); | ||
333 | EXPORT_SYMBOL_GPL(arizona_ng_hold); | ||
334 | |||
278 | int arizona_in_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, | 335 | int arizona_in_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, |
279 | int event) | 336 | int event) |
280 | { | 337 | { |
@@ -446,15 +503,9 @@ static int arizona_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) | |||
446 | case SND_SOC_DAIFMT_DSP_A: | 503 | case SND_SOC_DAIFMT_DSP_A: |
447 | mode = 0; | 504 | mode = 0; |
448 | break; | 505 | break; |
449 | case SND_SOC_DAIFMT_DSP_B: | ||
450 | mode = 1; | ||
451 | break; | ||
452 | case SND_SOC_DAIFMT_I2S: | 506 | case SND_SOC_DAIFMT_I2S: |
453 | mode = 2; | 507 | mode = 2; |
454 | break; | 508 | break; |
455 | case SND_SOC_DAIFMT_LEFT_J: | ||
456 | mode = 3; | ||
457 | break; | ||
458 | default: | 509 | default: |
459 | arizona_aif_err(dai, "Unsupported DAI format %d\n", | 510 | arizona_aif_err(dai, "Unsupported DAI format %d\n", |
460 | fmt & SND_SOC_DAIFMT_FORMAT_MASK); | 511 | fmt & SND_SOC_DAIFMT_FORMAT_MASK); |
@@ -651,17 +702,63 @@ static int arizona_startup(struct snd_pcm_substream *substream, | |||
651 | constraint); | 702 | constraint); |
652 | } | 703 | } |
653 | 704 | ||
705 | static int arizona_hw_params_rate(struct snd_pcm_substream *substream, | ||
706 | struct snd_pcm_hw_params *params, | ||
707 | struct snd_soc_dai *dai) | ||
708 | { | ||
709 | struct snd_soc_codec *codec = dai->codec; | ||
710 | struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); | ||
711 | struct arizona_dai_priv *dai_priv = &priv->dai[dai->id - 1]; | ||
712 | int base = dai->driver->base; | ||
713 | int i, sr_val; | ||
714 | |||
715 | /* | ||
716 | * We will need to be more flexible than this in future, | ||
717 | * currently we use a single sample rate for SYSCLK. | ||
718 | */ | ||
719 | for (i = 0; i < ARRAY_SIZE(arizona_sr_vals); i++) | ||
720 | if (arizona_sr_vals[i] == params_rate(params)) | ||
721 | break; | ||
722 | if (i == ARRAY_SIZE(arizona_sr_vals)) { | ||
723 | arizona_aif_err(dai, "Unsupported sample rate %dHz\n", | ||
724 | params_rate(params)); | ||
725 | return -EINVAL; | ||
726 | } | ||
727 | sr_val = i; | ||
728 | |||
729 | switch (dai_priv->clk) { | ||
730 | case ARIZONA_CLK_SYSCLK: | ||
731 | snd_soc_update_bits(codec, ARIZONA_SAMPLE_RATE_1, | ||
732 | ARIZONA_SAMPLE_RATE_1_MASK, sr_val); | ||
733 | if (base) | ||
734 | snd_soc_update_bits(codec, base + ARIZONA_AIF_RATE_CTRL, | ||
735 | ARIZONA_AIF1_RATE_MASK, 0); | ||
736 | break; | ||
737 | case ARIZONA_CLK_ASYNCCLK: | ||
738 | snd_soc_update_bits(codec, ARIZONA_ASYNC_SAMPLE_RATE_1, | ||
739 | ARIZONA_ASYNC_SAMPLE_RATE_MASK, sr_val); | ||
740 | if (base) | ||
741 | snd_soc_update_bits(codec, base + ARIZONA_AIF_RATE_CTRL, | ||
742 | ARIZONA_AIF1_RATE_MASK, | ||
743 | 8 << ARIZONA_AIF1_RATE_SHIFT); | ||
744 | break; | ||
745 | default: | ||
746 | arizona_aif_err(dai, "Invalid clock %d\n", dai_priv->clk); | ||
747 | return -EINVAL; | ||
748 | } | ||
749 | |||
750 | return 0; | ||
751 | } | ||
752 | |||
654 | static int arizona_hw_params(struct snd_pcm_substream *substream, | 753 | static int arizona_hw_params(struct snd_pcm_substream *substream, |
655 | struct snd_pcm_hw_params *params, | 754 | struct snd_pcm_hw_params *params, |
656 | struct snd_soc_dai *dai) | 755 | struct snd_soc_dai *dai) |
657 | { | 756 | { |
658 | struct snd_soc_codec *codec = dai->codec; | 757 | struct snd_soc_codec *codec = dai->codec; |
659 | struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); | ||
660 | struct arizona_dai_priv *dai_priv = &priv->dai[dai->id - 1]; | ||
661 | int base = dai->driver->base; | 758 | int base = dai->driver->base; |
662 | const int *rates; | 759 | const int *rates; |
663 | int i; | 760 | int i, ret; |
664 | int bclk, lrclk, wl, frame, sr_val; | 761 | int bclk, lrclk, wl, frame; |
665 | 762 | ||
666 | if (params_rate(params) % 8000) | 763 | if (params_rate(params) % 8000) |
667 | rates = &arizona_44k1_bclk_rates[0]; | 764 | rates = &arizona_44k1_bclk_rates[0]; |
@@ -681,16 +778,6 @@ static int arizona_hw_params(struct snd_pcm_substream *substream, | |||
681 | return -EINVAL; | 778 | return -EINVAL; |
682 | } | 779 | } |
683 | 780 | ||
684 | for (i = 0; i < ARRAY_SIZE(arizona_sr_vals); i++) | ||
685 | if (arizona_sr_vals[i] == params_rate(params)) | ||
686 | break; | ||
687 | if (i == ARRAY_SIZE(arizona_sr_vals)) { | ||
688 | arizona_aif_err(dai, "Unsupported sample rate %dHz\n", | ||
689 | params_rate(params)); | ||
690 | return -EINVAL; | ||
691 | } | ||
692 | sr_val = i; | ||
693 | |||
694 | lrclk = snd_soc_params_to_bclk(params) / params_rate(params); | 781 | lrclk = snd_soc_params_to_bclk(params) / params_rate(params); |
695 | 782 | ||
696 | arizona_aif_dbg(dai, "BCLK %dHz LRCLK %dHz\n", | 783 | arizona_aif_dbg(dai, "BCLK %dHz LRCLK %dHz\n", |
@@ -699,27 +786,9 @@ static int arizona_hw_params(struct snd_pcm_substream *substream, | |||
699 | wl = snd_pcm_format_width(params_format(params)); | 786 | wl = snd_pcm_format_width(params_format(params)); |
700 | frame = wl << ARIZONA_AIF1TX_WL_SHIFT | wl; | 787 | frame = wl << ARIZONA_AIF1TX_WL_SHIFT | wl; |
701 | 788 | ||
702 | /* | 789 | ret = arizona_hw_params_rate(substream, params, dai); |
703 | * We will need to be more flexible than this in future, | 790 | if (ret != 0) |
704 | * currently we use a single sample rate for SYSCLK. | 791 | return ret; |
705 | */ | ||
706 | switch (dai_priv->clk) { | ||
707 | case ARIZONA_CLK_SYSCLK: | ||
708 | snd_soc_update_bits(codec, ARIZONA_SAMPLE_RATE_1, | ||
709 | ARIZONA_SAMPLE_RATE_1_MASK, sr_val); | ||
710 | snd_soc_update_bits(codec, base + ARIZONA_AIF_RATE_CTRL, | ||
711 | ARIZONA_AIF1_RATE_MASK, 0); | ||
712 | break; | ||
713 | case ARIZONA_CLK_ASYNCCLK: | ||
714 | snd_soc_update_bits(codec, ARIZONA_ASYNC_SAMPLE_RATE_1, | ||
715 | ARIZONA_ASYNC_SAMPLE_RATE_MASK, sr_val); | ||
716 | snd_soc_update_bits(codec, base + ARIZONA_AIF_RATE_CTRL, | ||
717 | ARIZONA_AIF1_RATE_MASK, 8); | ||
718 | break; | ||
719 | default: | ||
720 | arizona_aif_err(dai, "Invalid clock %d\n", dai_priv->clk); | ||
721 | return -EINVAL; | ||
722 | } | ||
723 | 792 | ||
724 | snd_soc_update_bits(codec, base + ARIZONA_AIF_BCLK_CTRL, | 793 | snd_soc_update_bits(codec, base + ARIZONA_AIF_BCLK_CTRL, |
725 | ARIZONA_AIF1_BCLK_FREQ_MASK, bclk); | 794 | ARIZONA_AIF1_BCLK_FREQ_MASK, bclk); |
@@ -794,11 +863,27 @@ static int arizona_dai_set_sysclk(struct snd_soc_dai *dai, | |||
794 | return snd_soc_dapm_sync(&codec->dapm); | 863 | return snd_soc_dapm_sync(&codec->dapm); |
795 | } | 864 | } |
796 | 865 | ||
866 | static int arizona_set_tristate(struct snd_soc_dai *dai, int tristate) | ||
867 | { | ||
868 | struct snd_soc_codec *codec = dai->codec; | ||
869 | int base = dai->driver->base; | ||
870 | unsigned int reg; | ||
871 | |||
872 | if (tristate) | ||
873 | reg = ARIZONA_AIF1_TRI; | ||
874 | else | ||
875 | reg = 0; | ||
876 | |||
877 | return snd_soc_update_bits(codec, base + ARIZONA_AIF_RATE_CTRL, | ||
878 | ARIZONA_AIF1_TRI, reg); | ||
879 | } | ||
880 | |||
797 | const struct snd_soc_dai_ops arizona_dai_ops = { | 881 | const struct snd_soc_dai_ops arizona_dai_ops = { |
798 | .startup = arizona_startup, | 882 | .startup = arizona_startup, |
799 | .set_fmt = arizona_set_fmt, | 883 | .set_fmt = arizona_set_fmt, |
800 | .hw_params = arizona_hw_params, | 884 | .hw_params = arizona_hw_params, |
801 | .set_sysclk = arizona_dai_set_sysclk, | 885 | .set_sysclk = arizona_dai_set_sysclk, |
886 | .set_tristate = arizona_set_tristate, | ||
802 | }; | 887 | }; |
803 | EXPORT_SYMBOL_GPL(arizona_dai_ops); | 888 | EXPORT_SYMBOL_GPL(arizona_dai_ops); |
804 | 889 | ||
@@ -1091,6 +1176,40 @@ int arizona_init_fll(struct arizona *arizona, int id, int base, int lock_irq, | |||
1091 | } | 1176 | } |
1092 | EXPORT_SYMBOL_GPL(arizona_init_fll); | 1177 | EXPORT_SYMBOL_GPL(arizona_init_fll); |
1093 | 1178 | ||
1179 | /** | ||
1180 | * arizona_set_output_mode - Set the mode of the specified output | ||
1181 | * | ||
1182 | * @codec: Device to configure | ||
1183 | * @output: Output number | ||
1184 | * @diff: True to set the output to differential mode | ||
1185 | * | ||
1186 | * Some systems use external analogue switches to connect more | ||
1187 | * analogue devices to the CODEC than are supported by the device. In | ||
1188 | * some systems this requires changing the switched output from single | ||
1189 | * ended to differential mode dynamically at runtime, an operation | ||
1190 | * supported using this function. | ||
1191 | * | ||
1192 | * Most systems have a single static configuration and should use | ||
1193 | * platform data instead. | ||
1194 | */ | ||
1195 | int arizona_set_output_mode(struct snd_soc_codec *codec, int output, bool diff) | ||
1196 | { | ||
1197 | unsigned int reg, val; | ||
1198 | |||
1199 | if (output < 1 || output > 6) | ||
1200 | return -EINVAL; | ||
1201 | |||
1202 | reg = ARIZONA_OUTPUT_PATH_CONFIG_1L + (output - 1) * 8; | ||
1203 | |||
1204 | if (diff) | ||
1205 | val = ARIZONA_OUT1_MONO; | ||
1206 | else | ||
1207 | val = 0; | ||
1208 | |||
1209 | return snd_soc_update_bits(codec, reg, ARIZONA_OUT1_MONO, val); | ||
1210 | } | ||
1211 | EXPORT_SYMBOL_GPL(arizona_set_output_mode); | ||
1212 | |||
1094 | MODULE_DESCRIPTION("ASoC Wolfson Arizona class device support"); | 1213 | MODULE_DESCRIPTION("ASoC Wolfson Arizona class device support"); |
1095 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); | 1214 | MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); |
1096 | MODULE_LICENSE("GPL"); | 1215 | MODULE_LICENSE("GPL"); |
diff --git a/sound/soc/codecs/arizona.h b/sound/soc/codecs/arizona.h index 41dae1ed3b71..697ff6fcaba4 100644 --- a/sound/soc/codecs/arizona.h +++ b/sound/soc/codecs/arizona.h | |||
@@ -34,15 +34,15 @@ | |||
34 | 34 | ||
35 | #define ARIZONA_FLL_SRC_MCLK1 0 | 35 | #define ARIZONA_FLL_SRC_MCLK1 0 |
36 | #define ARIZONA_FLL_SRC_MCLK2 1 | 36 | #define ARIZONA_FLL_SRC_MCLK2 1 |
37 | #define ARIZONA_FLL_SRC_SLIMCLK 2 | 37 | #define ARIZONA_FLL_SRC_SLIMCLK 3 |
38 | #define ARIZONA_FLL_SRC_FLL1 3 | 38 | #define ARIZONA_FLL_SRC_FLL1 4 |
39 | #define ARIZONA_FLL_SRC_FLL2 4 | 39 | #define ARIZONA_FLL_SRC_FLL2 5 |
40 | #define ARIZONA_FLL_SRC_AIF1BCLK 5 | 40 | #define ARIZONA_FLL_SRC_AIF1BCLK 8 |
41 | #define ARIZONA_FLL_SRC_AIF2BCLK 6 | 41 | #define ARIZONA_FLL_SRC_AIF2BCLK 9 |
42 | #define ARIZONA_FLL_SRC_AIF3BCLK 7 | 42 | #define ARIZONA_FLL_SRC_AIF3BCLK 10 |
43 | #define ARIZONA_FLL_SRC_AIF1LRCLK 8 | 43 | #define ARIZONA_FLL_SRC_AIF1LRCLK 12 |
44 | #define ARIZONA_FLL_SRC_AIF2LRCLK 9 | 44 | #define ARIZONA_FLL_SRC_AIF2LRCLK 13 |
45 | #define ARIZONA_FLL_SRC_AIF3LRCLK 10 | 45 | #define ARIZONA_FLL_SRC_AIF3LRCLK 14 |
46 | 46 | ||
47 | #define ARIZONA_MIXER_VOL_MASK 0x00FE | 47 | #define ARIZONA_MIXER_VOL_MASK 0x00FE |
48 | #define ARIZONA_MIXER_VOL_SHIFT 1 | 48 | #define ARIZONA_MIXER_VOL_SHIFT 1 |
@@ -66,7 +66,7 @@ struct arizona_priv { | |||
66 | struct arizona_dai_priv dai[ARIZONA_MAX_DAI]; | 66 | struct arizona_dai_priv dai[ARIZONA_MAX_DAI]; |
67 | }; | 67 | }; |
68 | 68 | ||
69 | #define ARIZONA_NUM_MIXER_INPUTS 75 | 69 | #define ARIZONA_NUM_MIXER_INPUTS 99 |
70 | 70 | ||
71 | extern const unsigned int arizona_mixer_tlv[]; | 71 | extern const unsigned int arizona_mixer_tlv[]; |
72 | extern const char *arizona_mixer_texts[ARIZONA_NUM_MIXER_INPUTS]; | 72 | extern const char *arizona_mixer_texts[ARIZONA_NUM_MIXER_INPUTS]; |
@@ -176,6 +176,8 @@ extern const struct soc_enum arizona_lhpf2_mode; | |||
176 | extern const struct soc_enum arizona_lhpf3_mode; | 176 | extern const struct soc_enum arizona_lhpf3_mode; |
177 | extern const struct soc_enum arizona_lhpf4_mode; | 177 | extern const struct soc_enum arizona_lhpf4_mode; |
178 | 178 | ||
179 | extern const struct soc_enum arizona_ng_hold; | ||
180 | |||
179 | extern int arizona_in_ev(struct snd_soc_dapm_widget *w, | 181 | extern int arizona_in_ev(struct snd_soc_dapm_widget *w, |
180 | struct snd_kcontrol *kcontrol, | 182 | struct snd_kcontrol *kcontrol, |
181 | int event); | 183 | int event); |
@@ -211,4 +213,7 @@ extern int arizona_set_fll(struct arizona_fll *fll, int source, | |||
211 | 213 | ||
212 | extern int arizona_init_dai(struct arizona_priv *priv, int dai); | 214 | extern int arizona_init_dai(struct arizona_priv *priv, int dai); |
213 | 215 | ||
216 | int arizona_set_output_mode(struct snd_soc_codec *codec, int output, | ||
217 | bool diff); | ||
218 | |||
214 | #endif | 219 | #endif |
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c index 688ade080589..803d6db0eb69 100644 --- a/sound/soc/codecs/wm5102.c +++ b/sound/soc/codecs/wm5102.c | |||
@@ -36,12 +36,16 @@ | |||
36 | struct wm5102_priv { | 36 | struct wm5102_priv { |
37 | struct arizona_priv core; | 37 | struct arizona_priv core; |
38 | struct arizona_fll fll[2]; | 38 | struct arizona_fll fll[2]; |
39 | |||
40 | unsigned int spk_ena:2; | ||
41 | unsigned int spk_ena_pending:1; | ||
39 | }; | 42 | }; |
40 | 43 | ||
41 | static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0); | 44 | static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0); |
42 | static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); | 45 | static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); |
43 | static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0); | 46 | static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0); |
44 | static DECLARE_TLV_DB_SCALE(noise_tlv, 0, 600, 0); | 47 | static DECLARE_TLV_DB_SCALE(noise_tlv, 0, 600, 0); |
48 | static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0); | ||
45 | 49 | ||
46 | static const struct wm_adsp_region wm5102_dsp1_regions[] = { | 50 | static const struct wm_adsp_region wm5102_dsp1_regions[] = { |
47 | { .type = WMFW_ADSP2_PM, .base = 0x100000 }, | 51 | { .type = WMFW_ADSP2_PM, .base = 0x100000 }, |
@@ -600,6 +604,17 @@ static int wm5102_sysclk_ev(struct snd_soc_dapm_widget *w, | |||
600 | return 0; | 604 | return 0; |
601 | } | 605 | } |
602 | 606 | ||
607 | #define WM5102_NG_SRC(name, base) \ | ||
608 | SOC_SINGLE(name " NG HPOUT1L Switch", base, 0, 1, 0), \ | ||
609 | SOC_SINGLE(name " NG HPOUT1R Switch", base, 1, 1, 0), \ | ||
610 | SOC_SINGLE(name " NG HPOUT2L Switch", base, 2, 1, 0), \ | ||
611 | SOC_SINGLE(name " NG HPOUT2R Switch", base, 3, 1, 0), \ | ||
612 | SOC_SINGLE(name " NG EPOUT Switch", base, 4, 1, 0), \ | ||
613 | SOC_SINGLE(name " NG SPKOUTL Switch", base, 6, 1, 0), \ | ||
614 | SOC_SINGLE(name " NG SPKOUTR Switch", base, 7, 1, 0), \ | ||
615 | SOC_SINGLE(name " NG SPKDAT1L Switch", base, 8, 1, 0), \ | ||
616 | SOC_SINGLE(name " NG SPKDAT1R Switch", base, 9, 1, 0) | ||
617 | |||
603 | static const struct snd_kcontrol_new wm5102_snd_controls[] = { | 618 | static const struct snd_kcontrol_new wm5102_snd_controls[] = { |
604 | SOC_SINGLE("IN1 High Performance Switch", ARIZONA_IN1L_CONTROL, | 619 | SOC_SINGLE("IN1 High Performance Switch", ARIZONA_IN1L_CONTROL, |
605 | ARIZONA_IN1_OSR_SHIFT, 1, 0), | 620 | ARIZONA_IN1_OSR_SHIFT, 1, 0), |
@@ -608,32 +623,44 @@ SOC_SINGLE("IN2 High Performance Switch", ARIZONA_IN2L_CONTROL, | |||
608 | SOC_SINGLE("IN3 High Performance Switch", ARIZONA_IN3L_CONTROL, | 623 | SOC_SINGLE("IN3 High Performance Switch", ARIZONA_IN3L_CONTROL, |
609 | ARIZONA_IN3_OSR_SHIFT, 1, 0), | 624 | ARIZONA_IN3_OSR_SHIFT, 1, 0), |
610 | 625 | ||
611 | SOC_DOUBLE_R_RANGE_TLV("IN1 Volume", ARIZONA_IN1L_CONTROL, | 626 | SOC_SINGLE_RANGE_TLV("IN1L Volume", ARIZONA_IN1L_CONTROL, |
612 | ARIZONA_IN1R_CONTROL, | 627 | ARIZONA_IN1L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv), |
613 | ARIZONA_IN1L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv), | 628 | SOC_SINGLE_RANGE_TLV("IN1R Volume", ARIZONA_IN1R_CONTROL, |
614 | SOC_DOUBLE_R_RANGE_TLV("IN2 Volume", ARIZONA_IN2L_CONTROL, | 629 | ARIZONA_IN1R_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv), |
615 | ARIZONA_IN2R_CONTROL, | 630 | SOC_SINGLE_RANGE_TLV("IN2L Volume", ARIZONA_IN2L_CONTROL, |
616 | ARIZONA_IN2L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv), | 631 | ARIZONA_IN2L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv), |
617 | SOC_DOUBLE_R_RANGE_TLV("IN3 Volume", ARIZONA_IN3L_CONTROL, | 632 | SOC_SINGLE_RANGE_TLV("IN2R Volume", ARIZONA_IN2R_CONTROL, |
618 | ARIZONA_IN3R_CONTROL, | 633 | ARIZONA_IN2R_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv), |
619 | ARIZONA_IN3L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv), | 634 | SOC_SINGLE_RANGE_TLV("IN3L Volume", ARIZONA_IN3L_CONTROL, |
620 | 635 | ARIZONA_IN3L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv), | |
621 | SOC_DOUBLE_R("IN1 Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_1L, | 636 | SOC_SINGLE_RANGE_TLV("IN3R Volume", ARIZONA_IN3R_CONTROL, |
622 | ARIZONA_ADC_DIGITAL_VOLUME_1R, ARIZONA_IN1L_MUTE_SHIFT, 1, 1), | 637 | ARIZONA_IN3R_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv), |
623 | SOC_DOUBLE_R("IN2 Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_2L, | 638 | |
624 | ARIZONA_ADC_DIGITAL_VOLUME_2R, ARIZONA_IN2L_MUTE_SHIFT, 1, 1), | 639 | SOC_SINGLE("IN1L Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_1L, |
625 | SOC_DOUBLE_R("IN3 Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_3L, | 640 | ARIZONA_IN1L_MUTE_SHIFT, 1, 1), |
626 | ARIZONA_ADC_DIGITAL_VOLUME_3R, ARIZONA_IN3L_MUTE_SHIFT, 1, 1), | 641 | SOC_SINGLE("IN1R Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_1R, |
627 | 642 | ARIZONA_IN1R_MUTE_SHIFT, 1, 1), | |
628 | SOC_DOUBLE_R_TLV("IN1 Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1L, | 643 | SOC_SINGLE("IN2L Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_2L, |
629 | ARIZONA_ADC_DIGITAL_VOLUME_1R, ARIZONA_IN1L_DIG_VOL_SHIFT, | 644 | ARIZONA_IN2L_MUTE_SHIFT, 1, 1), |
630 | 0xbf, 0, digital_tlv), | 645 | SOC_SINGLE("IN2R Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_2R, |
631 | SOC_DOUBLE_R_TLV("IN2 Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2L, | 646 | ARIZONA_IN2R_MUTE_SHIFT, 1, 1), |
632 | ARIZONA_ADC_DIGITAL_VOLUME_2R, ARIZONA_IN2L_DIG_VOL_SHIFT, | 647 | SOC_SINGLE("IN3L Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_3L, |
633 | 0xbf, 0, digital_tlv), | 648 | ARIZONA_IN3L_MUTE_SHIFT, 1, 1), |
634 | SOC_DOUBLE_R_TLV("IN3 Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_3L, | 649 | SOC_SINGLE("IN3R Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_3R, |
635 | ARIZONA_ADC_DIGITAL_VOLUME_3R, ARIZONA_IN3L_DIG_VOL_SHIFT, | 650 | ARIZONA_IN3R_MUTE_SHIFT, 1, 1), |
636 | 0xbf, 0, digital_tlv), | 651 | |
652 | SOC_SINGLE_TLV("IN1L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1L, | ||
653 | ARIZONA_IN1L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv), | ||
654 | SOC_SINGLE_TLV("IN1R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1R, | ||
655 | ARIZONA_IN1R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv), | ||
656 | SOC_SINGLE_TLV("IN2L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2L, | ||
657 | ARIZONA_IN2L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv), | ||
658 | SOC_SINGLE_TLV("IN2R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2R, | ||
659 | ARIZONA_IN2R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv), | ||
660 | SOC_SINGLE_TLV("IN3L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_3L, | ||
661 | ARIZONA_IN3L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv), | ||
662 | SOC_SINGLE_TLV("IN3R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_3R, | ||
663 | ARIZONA_IN3R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv), | ||
637 | 664 | ||
638 | SOC_ENUM("Input Ramp Up", arizona_in_vi_ramp), | 665 | SOC_ENUM("Input Ramp Up", arizona_in_vi_ramp), |
639 | SOC_ENUM("Input Ramp Down", arizona_in_vd_ramp), | 666 | SOC_ENUM("Input Ramp Down", arizona_in_vd_ramp), |
@@ -771,6 +798,22 @@ SOC_ENUM("Output Ramp Down", arizona_out_vd_ramp), | |||
771 | SOC_DOUBLE("SPKDAT1 Switch", ARIZONA_PDM_SPK1_CTRL_1, ARIZONA_SPK1L_MUTE_SHIFT, | 798 | SOC_DOUBLE("SPKDAT1 Switch", ARIZONA_PDM_SPK1_CTRL_1, ARIZONA_SPK1L_MUTE_SHIFT, |
772 | ARIZONA_SPK1R_MUTE_SHIFT, 1, 1), | 799 | ARIZONA_SPK1R_MUTE_SHIFT, 1, 1), |
773 | 800 | ||
801 | SOC_SINGLE("Noise Gate Switch", ARIZONA_NOISE_GATE_CONTROL, | ||
802 | ARIZONA_NGATE_ENA_SHIFT, 1, 0), | ||
803 | SOC_SINGLE_TLV("Noise Gate Threshold Volume", ARIZONA_NOISE_GATE_CONTROL, | ||
804 | ARIZONA_NGATE_THR_SHIFT, 7, 1, ng_tlv), | ||
805 | SOC_ENUM("Noise Gate Hold", arizona_ng_hold), | ||
806 | |||
807 | WM5102_NG_SRC("HPOUT1L", ARIZONA_NOISE_GATE_SELECT_1L), | ||
808 | WM5102_NG_SRC("HPOUT1R", ARIZONA_NOISE_GATE_SELECT_1R), | ||
809 | WM5102_NG_SRC("HPOUT2L", ARIZONA_NOISE_GATE_SELECT_2L), | ||
810 | WM5102_NG_SRC("HPOUT2R", ARIZONA_NOISE_GATE_SELECT_2R), | ||
811 | WM5102_NG_SRC("EPOUT", ARIZONA_NOISE_GATE_SELECT_3L), | ||
812 | WM5102_NG_SRC("SPKOUTL", ARIZONA_NOISE_GATE_SELECT_4L), | ||
813 | WM5102_NG_SRC("SPKOUTR", ARIZONA_NOISE_GATE_SELECT_4R), | ||
814 | WM5102_NG_SRC("SPKDAT1L", ARIZONA_NOISE_GATE_SELECT_5L), | ||
815 | WM5102_NG_SRC("SPKDAT1R", ARIZONA_NOISE_GATE_SELECT_5R), | ||
816 | |||
774 | ARIZONA_MIXER_CONTROLS("AIF1TX1", ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE), | 817 | ARIZONA_MIXER_CONTROLS("AIF1TX1", ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE), |
775 | ARIZONA_MIXER_CONTROLS("AIF1TX2", ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE), | 818 | ARIZONA_MIXER_CONTROLS("AIF1TX2", ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE), |
776 | ARIZONA_MIXER_CONTROLS("AIF1TX3", ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE), | 819 | ARIZONA_MIXER_CONTROLS("AIF1TX3", ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE), |
@@ -787,6 +830,47 @@ ARIZONA_MIXER_CONTROLS("AIF3TX1", ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE), | |||
787 | ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE), | 830 | ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE), |
788 | }; | 831 | }; |
789 | 832 | ||
833 | static int wm5102_spk_ev(struct snd_soc_dapm_widget *w, | ||
834 | struct snd_kcontrol *kcontrol, | ||
835 | int event) | ||
836 | { | ||
837 | struct snd_soc_codec *codec = w->codec; | ||
838 | struct arizona *arizona = dev_get_drvdata(codec->dev->parent); | ||
839 | struct wm5102_priv *wm5102 = snd_soc_codec_get_drvdata(codec); | ||
840 | |||
841 | if (arizona->rev < 1) | ||
842 | return 0; | ||
843 | |||
844 | switch (event) { | ||
845 | case SND_SOC_DAPM_PRE_PMU: | ||
846 | if (!wm5102->spk_ena) { | ||
847 | snd_soc_write(codec, 0x4f5, 0x25a); | ||
848 | wm5102->spk_ena_pending = true; | ||
849 | } | ||
850 | break; | ||
851 | case SND_SOC_DAPM_POST_PMU: | ||
852 | if (wm5102->spk_ena_pending) { | ||
853 | msleep(75); | ||
854 | snd_soc_write(codec, 0x4f5, 0xda); | ||
855 | wm5102->spk_ena_pending = false; | ||
856 | wm5102->spk_ena++; | ||
857 | } | ||
858 | break; | ||
859 | case SND_SOC_DAPM_PRE_PMD: | ||
860 | wm5102->spk_ena--; | ||
861 | if (!wm5102->spk_ena) | ||
862 | snd_soc_write(codec, 0x4f5, 0x25a); | ||
863 | break; | ||
864 | case SND_SOC_DAPM_POST_PMD: | ||
865 | if (!wm5102->spk_ena) | ||
866 | snd_soc_write(codec, 0x4f5, 0x0da); | ||
867 | break; | ||
868 | } | ||
869 | |||
870 | return 0; | ||
871 | } | ||
872 | |||
873 | |||
790 | ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE); | 874 | ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE); |
791 | ARIZONA_MIXER_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE); | 875 | ARIZONA_MIXER_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE); |
792 | ARIZONA_MIXER_ENUMS(EQ3, ARIZONA_EQ3MIX_INPUT_1_SOURCE); | 876 | ARIZONA_MIXER_ENUMS(EQ3, ARIZONA_EQ3MIX_INPUT_1_SOURCE); |
@@ -836,6 +920,18 @@ ARIZONA_MUX_ENUMS(ASRC1R, ARIZONA_ASRC1RMIX_INPUT_1_SOURCE); | |||
836 | ARIZONA_MUX_ENUMS(ASRC2L, ARIZONA_ASRC2LMIX_INPUT_1_SOURCE); | 920 | ARIZONA_MUX_ENUMS(ASRC2L, ARIZONA_ASRC2LMIX_INPUT_1_SOURCE); |
837 | ARIZONA_MUX_ENUMS(ASRC2R, ARIZONA_ASRC2RMIX_INPUT_1_SOURCE); | 921 | ARIZONA_MUX_ENUMS(ASRC2R, ARIZONA_ASRC2RMIX_INPUT_1_SOURCE); |
838 | 922 | ||
923 | ARIZONA_MUX_ENUMS(ISRC1INT1, ARIZONA_ISRC1INT1MIX_INPUT_1_SOURCE); | ||
924 | ARIZONA_MUX_ENUMS(ISRC1INT2, ARIZONA_ISRC1INT2MIX_INPUT_1_SOURCE); | ||
925 | |||
926 | ARIZONA_MUX_ENUMS(ISRC1DEC1, ARIZONA_ISRC1DEC1MIX_INPUT_1_SOURCE); | ||
927 | ARIZONA_MUX_ENUMS(ISRC1DEC2, ARIZONA_ISRC1DEC2MIX_INPUT_1_SOURCE); | ||
928 | |||
929 | ARIZONA_MUX_ENUMS(ISRC2INT1, ARIZONA_ISRC2INT1MIX_INPUT_1_SOURCE); | ||
930 | ARIZONA_MUX_ENUMS(ISRC2INT2, ARIZONA_ISRC2INT2MIX_INPUT_1_SOURCE); | ||
931 | |||
932 | ARIZONA_MUX_ENUMS(ISRC2DEC1, ARIZONA_ISRC2DEC1MIX_INPUT_1_SOURCE); | ||
933 | ARIZONA_MUX_ENUMS(ISRC2DEC2, ARIZONA_ISRC2DEC2MIX_INPUT_1_SOURCE); | ||
934 | |||
839 | ARIZONA_MIXER_ENUMS(DSP1L, ARIZONA_DSP1LMIX_INPUT_1_SOURCE); | 935 | ARIZONA_MIXER_ENUMS(DSP1L, ARIZONA_DSP1LMIX_INPUT_1_SOURCE); |
840 | ARIZONA_MIXER_ENUMS(DSP1R, ARIZONA_DSP1RMIX_INPUT_1_SOURCE); | 936 | ARIZONA_MIXER_ENUMS(DSP1R, ARIZONA_DSP1RMIX_INPUT_1_SOURCE); |
841 | 937 | ||
@@ -959,6 +1055,26 @@ SND_SOC_DAPM_PGA("ASRC2L", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2L_ENA_SHIFT, 0, | |||
959 | SND_SOC_DAPM_PGA("ASRC2R", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2R_ENA_SHIFT, 0, | 1055 | SND_SOC_DAPM_PGA("ASRC2R", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2R_ENA_SHIFT, 0, |
960 | NULL, 0), | 1056 | NULL, 0), |
961 | 1057 | ||
1058 | SND_SOC_DAPM_PGA("ISRC1INT1", ARIZONA_ISRC_1_CTRL_3, | ||
1059 | ARIZONA_ISRC1_INT0_ENA_SHIFT, 0, NULL, 0), | ||
1060 | SND_SOC_DAPM_PGA("ISRC1INT2", ARIZONA_ISRC_1_CTRL_3, | ||
1061 | ARIZONA_ISRC1_INT1_ENA_SHIFT, 0, NULL, 0), | ||
1062 | |||
1063 | SND_SOC_DAPM_PGA("ISRC1DEC1", ARIZONA_ISRC_1_CTRL_3, | ||
1064 | ARIZONA_ISRC1_DEC0_ENA_SHIFT, 0, NULL, 0), | ||
1065 | SND_SOC_DAPM_PGA("ISRC1DEC2", ARIZONA_ISRC_1_CTRL_3, | ||
1066 | ARIZONA_ISRC1_DEC1_ENA_SHIFT, 0, NULL, 0), | ||
1067 | |||
1068 | SND_SOC_DAPM_PGA("ISRC2INT1", ARIZONA_ISRC_2_CTRL_3, | ||
1069 | ARIZONA_ISRC2_INT0_ENA_SHIFT, 0, NULL, 0), | ||
1070 | SND_SOC_DAPM_PGA("ISRC2INT2", ARIZONA_ISRC_2_CTRL_3, | ||
1071 | ARIZONA_ISRC2_INT1_ENA_SHIFT, 0, NULL, 0), | ||
1072 | |||
1073 | SND_SOC_DAPM_PGA("ISRC2DEC1", ARIZONA_ISRC_2_CTRL_3, | ||
1074 | ARIZONA_ISRC2_DEC0_ENA_SHIFT, 0, NULL, 0), | ||
1075 | SND_SOC_DAPM_PGA("ISRC2DEC2", ARIZONA_ISRC_2_CTRL_3, | ||
1076 | ARIZONA_ISRC2_DEC1_ENA_SHIFT, 0, NULL, 0), | ||
1077 | |||
962 | SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL, 0, | 1078 | SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL, 0, |
963 | ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX1_ENA_SHIFT, 0), | 1079 | ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX1_ENA_SHIFT, 0), |
964 | SND_SOC_DAPM_AIF_OUT("AIF1TX2", NULL, 0, | 1080 | SND_SOC_DAPM_AIF_OUT("AIF1TX2", NULL, 0, |
@@ -1034,10 +1150,10 @@ SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUTPUT_ENABLES_1, | |||
1034 | ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, | 1150 | ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, |
1035 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), | 1151 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), |
1036 | SND_SOC_DAPM_PGA_E("OUT4L", ARIZONA_OUTPUT_ENABLES_1, | 1152 | SND_SOC_DAPM_PGA_E("OUT4L", ARIZONA_OUTPUT_ENABLES_1, |
1037 | ARIZONA_OUT4L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, | 1153 | ARIZONA_OUT4L_ENA_SHIFT, 0, NULL, 0, wm5102_spk_ev, |
1038 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), | 1154 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), |
1039 | SND_SOC_DAPM_PGA_E("OUT4R", ARIZONA_OUTPUT_ENABLES_1, | 1155 | SND_SOC_DAPM_PGA_E("OUT4R", ARIZONA_OUTPUT_ENABLES_1, |
1040 | ARIZONA_OUT4R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, | 1156 | ARIZONA_OUT4R_ENA_SHIFT, 0, NULL, 0, wm5102_spk_ev, |
1041 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), | 1157 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), |
1042 | SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1, | 1158 | SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1, |
1043 | ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, | 1159 | ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, |
@@ -1095,6 +1211,18 @@ ARIZONA_MUX_WIDGETS(ASRC1R, "ASRC1R"), | |||
1095 | ARIZONA_MUX_WIDGETS(ASRC2L, "ASRC2L"), | 1211 | ARIZONA_MUX_WIDGETS(ASRC2L, "ASRC2L"), |
1096 | ARIZONA_MUX_WIDGETS(ASRC2R, "ASRC2R"), | 1212 | ARIZONA_MUX_WIDGETS(ASRC2R, "ASRC2R"), |
1097 | 1213 | ||
1214 | ARIZONA_MUX_WIDGETS(ISRC1DEC1, "ISRC1DEC1"), | ||
1215 | ARIZONA_MUX_WIDGETS(ISRC1DEC2, "ISRC1DEC2"), | ||
1216 | |||
1217 | ARIZONA_MUX_WIDGETS(ISRC1INT1, "ISRC1INT1"), | ||
1218 | ARIZONA_MUX_WIDGETS(ISRC1INT2, "ISRC1INT2"), | ||
1219 | |||
1220 | ARIZONA_MUX_WIDGETS(ISRC2DEC1, "ISRC2DEC1"), | ||
1221 | ARIZONA_MUX_WIDGETS(ISRC2DEC2, "ISRC2DEC2"), | ||
1222 | |||
1223 | ARIZONA_MUX_WIDGETS(ISRC2INT1, "ISRC2INT1"), | ||
1224 | ARIZONA_MUX_WIDGETS(ISRC2INT2, "ISRC2INT2"), | ||
1225 | |||
1098 | WM_ADSP2("DSP1", 0), | 1226 | WM_ADSP2("DSP1", 0), |
1099 | 1227 | ||
1100 | SND_SOC_DAPM_OUTPUT("HPOUT1L"), | 1228 | SND_SOC_DAPM_OUTPUT("HPOUT1L"), |
@@ -1150,6 +1278,14 @@ SND_SOC_DAPM_OUTPUT("SPKDAT1R"), | |||
1150 | { name, "ASRC1R", "ASRC1R" }, \ | 1278 | { name, "ASRC1R", "ASRC1R" }, \ |
1151 | { name, "ASRC2L", "ASRC2L" }, \ | 1279 | { name, "ASRC2L", "ASRC2L" }, \ |
1152 | { name, "ASRC2R", "ASRC2R" }, \ | 1280 | { name, "ASRC2R", "ASRC2R" }, \ |
1281 | { name, "ISRC1DEC1", "ISRC1DEC1" }, \ | ||
1282 | { name, "ISRC1DEC2", "ISRC1DEC2" }, \ | ||
1283 | { name, "ISRC1INT1", "ISRC1INT1" }, \ | ||
1284 | { name, "ISRC1INT2", "ISRC1INT2" }, \ | ||
1285 | { name, "ISRC2DEC1", "ISRC2DEC1" }, \ | ||
1286 | { name, "ISRC2DEC2", "ISRC2DEC2" }, \ | ||
1287 | { name, "ISRC2INT1", "ISRC2INT1" }, \ | ||
1288 | { name, "ISRC2INT2", "ISRC2INT2" }, \ | ||
1153 | { name, "DSP1.1", "DSP1" }, \ | 1289 | { name, "DSP1.1", "DSP1" }, \ |
1154 | { name, "DSP1.2", "DSP1" }, \ | 1290 | { name, "DSP1.2", "DSP1" }, \ |
1155 | { name, "DSP1.3", "DSP1" }, \ | 1291 | { name, "DSP1.3", "DSP1" }, \ |
@@ -1246,6 +1382,18 @@ static const struct snd_soc_dapm_route wm5102_dapm_routes[] = { | |||
1246 | { "ASRC2L", NULL, "ASRC2L Input" }, | 1382 | { "ASRC2L", NULL, "ASRC2L Input" }, |
1247 | { "ASRC2R", NULL, "ASRC2R Input" }, | 1383 | { "ASRC2R", NULL, "ASRC2R Input" }, |
1248 | 1384 | ||
1385 | { "ISRC1DEC1", NULL, "ISRC1DEC1 Input" }, | ||
1386 | { "ISRC1DEC2", NULL, "ISRC1DEC2 Input" }, | ||
1387 | |||
1388 | { "ISRC1INT1", NULL, "ISRC1INT1 Input" }, | ||
1389 | { "ISRC1INT2", NULL, "ISRC1INT2 Input" }, | ||
1390 | |||
1391 | { "ISRC2DEC1", NULL, "ISRC2DEC1 Input" }, | ||
1392 | { "ISRC2DEC2", NULL, "ISRC2DEC2 Input" }, | ||
1393 | |||
1394 | { "ISRC2INT1", NULL, "ISRC2INT1 Input" }, | ||
1395 | { "ISRC2INT2", NULL, "ISRC2INT2 Input" }, | ||
1396 | |||
1249 | ARIZONA_MIXER_ROUTES("OUT1L", "HPOUT1L"), | 1397 | ARIZONA_MIXER_ROUTES("OUT1L", "HPOUT1L"), |
1250 | ARIZONA_MIXER_ROUTES("OUT1R", "HPOUT1R"), | 1398 | ARIZONA_MIXER_ROUTES("OUT1R", "HPOUT1R"), |
1251 | ARIZONA_MIXER_ROUTES("OUT2L", "HPOUT2L"), | 1399 | ARIZONA_MIXER_ROUTES("OUT2L", "HPOUT2L"), |
@@ -1293,6 +1441,18 @@ static const struct snd_soc_dapm_route wm5102_dapm_routes[] = { | |||
1293 | ARIZONA_MUX_ROUTES("ASRC2L"), | 1441 | ARIZONA_MUX_ROUTES("ASRC2L"), |
1294 | ARIZONA_MUX_ROUTES("ASRC2R"), | 1442 | ARIZONA_MUX_ROUTES("ASRC2R"), |
1295 | 1443 | ||
1444 | ARIZONA_MUX_ROUTES("ISRC1INT1"), | ||
1445 | ARIZONA_MUX_ROUTES("ISRC1INT2"), | ||
1446 | |||
1447 | ARIZONA_MUX_ROUTES("ISRC1DEC1"), | ||
1448 | ARIZONA_MUX_ROUTES("ISRC1DEC2"), | ||
1449 | |||
1450 | ARIZONA_MUX_ROUTES("ISRC2INT1"), | ||
1451 | ARIZONA_MUX_ROUTES("ISRC2INT2"), | ||
1452 | |||
1453 | ARIZONA_MUX_ROUTES("ISRC2DEC1"), | ||
1454 | ARIZONA_MUX_ROUTES("ISRC2DEC2"), | ||
1455 | |||
1296 | ARIZONA_DSP_ROUTES("DSP1"), | 1456 | ARIZONA_DSP_ROUTES("DSP1"), |
1297 | 1457 | ||
1298 | { "AEC Loopback", "HPOUT1L", "OUT1L" }, | 1458 | { "AEC Loopback", "HPOUT1L", "OUT1L" }, |
diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c index ae80c8c28536..8f7081e1417a 100644 --- a/sound/soc/codecs/wm5110.c +++ b/sound/soc/codecs/wm5110.c | |||
@@ -41,6 +41,21 @@ static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0); | |||
41 | static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); | 41 | static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); |
42 | static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0); | 42 | static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0); |
43 | static DECLARE_TLV_DB_SCALE(noise_tlv, 0, 600, 0); | 43 | static DECLARE_TLV_DB_SCALE(noise_tlv, 0, 600, 0); |
44 | static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0); | ||
45 | |||
46 | #define WM5110_NG_SRC(name, base) \ | ||
47 | SOC_SINGLE(name " NG HPOUT1L Switch", base, 0, 1, 0), \ | ||
48 | SOC_SINGLE(name " NG HPOUT1R Switch", base, 1, 1, 0), \ | ||
49 | SOC_SINGLE(name " NG HPOUT2L Switch", base, 2, 1, 0), \ | ||
50 | SOC_SINGLE(name " NG HPOUT2R Switch", base, 3, 1, 0), \ | ||
51 | SOC_SINGLE(name " NG HPOUT3L Switch", base, 4, 1, 0), \ | ||
52 | SOC_SINGLE(name " NG HPOUT3R Switch", base, 5, 1, 0), \ | ||
53 | SOC_SINGLE(name " NG SPKOUTL Switch", base, 6, 1, 0), \ | ||
54 | SOC_SINGLE(name " NG SPKOUTR Switch", base, 7, 1, 0), \ | ||
55 | SOC_SINGLE(name " NG SPKDAT1L Switch", base, 8, 1, 0), \ | ||
56 | SOC_SINGLE(name " NG SPKDAT1R Switch", base, 9, 1, 0), \ | ||
57 | SOC_SINGLE(name " NG SPKDAT2L Switch", base, 10, 1, 0), \ | ||
58 | SOC_SINGLE(name " NG SPKDAT2R Switch", base, 11, 1, 0) | ||
44 | 59 | ||
45 | static const struct snd_kcontrol_new wm5110_snd_controls[] = { | 60 | static const struct snd_kcontrol_new wm5110_snd_controls[] = { |
46 | SOC_SINGLE("IN1 High Performance Switch", ARIZONA_IN1L_CONTROL, | 61 | SOC_SINGLE("IN1 High Performance Switch", ARIZONA_IN1L_CONTROL, |
@@ -52,37 +67,52 @@ SOC_SINGLE("IN3 High Performance Switch", ARIZONA_IN3L_CONTROL, | |||
52 | SOC_SINGLE("IN4 High Performance Switch", ARIZONA_IN4L_CONTROL, | 67 | SOC_SINGLE("IN4 High Performance Switch", ARIZONA_IN4L_CONTROL, |
53 | ARIZONA_IN4_OSR_SHIFT, 1, 0), | 68 | ARIZONA_IN4_OSR_SHIFT, 1, 0), |
54 | 69 | ||
55 | SOC_DOUBLE_R_RANGE_TLV("IN1 Volume", ARIZONA_IN1L_CONTROL, | 70 | SOC_SINGLE_RANGE_TLV("IN1L Volume", ARIZONA_IN1L_CONTROL, |
56 | ARIZONA_IN1R_CONTROL, | 71 | ARIZONA_IN1L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv), |
57 | ARIZONA_IN1L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv), | 72 | SOC_SINGLE_RANGE_TLV("IN1R Volume", ARIZONA_IN1R_CONTROL, |
58 | SOC_DOUBLE_R_RANGE_TLV("IN2 Volume", ARIZONA_IN2L_CONTROL, | 73 | ARIZONA_IN1R_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv), |
59 | ARIZONA_IN2R_CONTROL, | 74 | SOC_SINGLE_RANGE_TLV("IN2L Volume", ARIZONA_IN2L_CONTROL, |
60 | ARIZONA_IN2L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv), | 75 | ARIZONA_IN2L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv), |
61 | SOC_DOUBLE_R_RANGE_TLV("IN3 Volume", ARIZONA_IN3L_CONTROL, | 76 | SOC_SINGLE_RANGE_TLV("IN2R Volume", ARIZONA_IN2R_CONTROL, |
62 | ARIZONA_IN3R_CONTROL, | 77 | ARIZONA_IN2R_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv), |
63 | ARIZONA_IN3L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv), | 78 | SOC_SINGLE_RANGE_TLV("IN3L Volume", ARIZONA_IN3L_CONTROL, |
64 | 79 | ARIZONA_IN3L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv), | |
65 | SOC_DOUBLE_R("IN1 Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_1L, | 80 | SOC_SINGLE_RANGE_TLV("IN3R Volume", ARIZONA_IN3R_CONTROL, |
66 | ARIZONA_ADC_DIGITAL_VOLUME_1R, ARIZONA_IN1L_MUTE_SHIFT, 1, 1), | 81 | ARIZONA_IN3R_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv), |
67 | SOC_DOUBLE_R("IN2 Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_2L, | 82 | |
68 | ARIZONA_ADC_DIGITAL_VOLUME_2R, ARIZONA_IN2L_MUTE_SHIFT, 1, 1), | 83 | SOC_SINGLE("IN1L Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_1L, |
69 | SOC_DOUBLE_R("IN3 Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_3L, | 84 | ARIZONA_IN1L_MUTE_SHIFT, 1, 1), |
70 | ARIZONA_ADC_DIGITAL_VOLUME_3R, ARIZONA_IN3L_MUTE_SHIFT, 1, 1), | 85 | SOC_SINGLE("IN1R Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_1R, |
71 | SOC_DOUBLE_R("IN4 Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_4L, | 86 | ARIZONA_IN1R_MUTE_SHIFT, 1, 1), |
72 | ARIZONA_ADC_DIGITAL_VOLUME_4R, ARIZONA_IN4L_MUTE_SHIFT, 1, 1), | 87 | SOC_SINGLE("IN2L Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_2L, |
73 | 88 | ARIZONA_IN2L_MUTE_SHIFT, 1, 1), | |
74 | SOC_DOUBLE_R_TLV("IN1 Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1L, | 89 | SOC_SINGLE("IN2R Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_2R, |
75 | ARIZONA_ADC_DIGITAL_VOLUME_1R, ARIZONA_IN1L_DIG_VOL_SHIFT, | 90 | ARIZONA_IN2R_MUTE_SHIFT, 1, 1), |
76 | 0xbf, 0, digital_tlv), | 91 | SOC_SINGLE("IN3L Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_3L, |
77 | SOC_DOUBLE_R_TLV("IN2 Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2L, | 92 | ARIZONA_IN3L_MUTE_SHIFT, 1, 1), |
78 | ARIZONA_ADC_DIGITAL_VOLUME_2R, ARIZONA_IN2L_DIG_VOL_SHIFT, | 93 | SOC_SINGLE("IN3R Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_3R, |
79 | 0xbf, 0, digital_tlv), | 94 | ARIZONA_IN3R_MUTE_SHIFT, 1, 1), |
80 | SOC_DOUBLE_R_TLV("IN3 Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_3L, | 95 | SOC_SINGLE("IN4L Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_4L, |
81 | ARIZONA_ADC_DIGITAL_VOLUME_3R, ARIZONA_IN3L_DIG_VOL_SHIFT, | 96 | ARIZONA_IN4L_MUTE_SHIFT, 1, 1), |
82 | 0xbf, 0, digital_tlv), | 97 | SOC_SINGLE("IN4R Digital Switch", ARIZONA_ADC_DIGITAL_VOLUME_4R, |
83 | SOC_DOUBLE_R_TLV("IN4 Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_4L, | 98 | ARIZONA_IN4R_MUTE_SHIFT, 1, 1), |
84 | ARIZONA_ADC_DIGITAL_VOLUME_4R, ARIZONA_IN4L_DIG_VOL_SHIFT, | 99 | |
85 | 0xbf, 0, digital_tlv), | 100 | SOC_SINGLE_TLV("IN1L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1L, |
101 | ARIZONA_IN1L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv), | ||
102 | SOC_SINGLE_TLV("IN1R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1R, | ||
103 | ARIZONA_IN1R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv), | ||
104 | SOC_SINGLE_TLV("IN2L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2L, | ||
105 | ARIZONA_IN2L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv), | ||
106 | SOC_SINGLE_TLV("IN2R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2R, | ||
107 | ARIZONA_IN2R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv), | ||
108 | SOC_SINGLE_TLV("IN3L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_3L, | ||
109 | ARIZONA_IN3L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv), | ||
110 | SOC_SINGLE_TLV("IN3R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_3R, | ||
111 | ARIZONA_IN3R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv), | ||
112 | SOC_SINGLE_TLV("IN4L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_4L, | ||
113 | ARIZONA_IN4L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv), | ||
114 | SOC_SINGLE_TLV("IN4R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_4R, | ||
115 | ARIZONA_IN4R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv), | ||
86 | 116 | ||
87 | SOC_ENUM("Input Ramp Up", arizona_in_vi_ramp), | 117 | SOC_ENUM("Input Ramp Up", arizona_in_vi_ramp), |
88 | SOC_ENUM("Input Ramp Down", arizona_in_vd_ramp), | 118 | SOC_ENUM("Input Ramp Down", arizona_in_vd_ramp), |
@@ -263,6 +293,25 @@ SOC_DOUBLE("SPKDAT2 Switch", ARIZONA_PDM_SPK2_CTRL_1, ARIZONA_SPK2L_MUTE_SHIFT, | |||
263 | SOC_ENUM("Output Ramp Up", arizona_out_vi_ramp), | 293 | SOC_ENUM("Output Ramp Up", arizona_out_vi_ramp), |
264 | SOC_ENUM("Output Ramp Down", arizona_out_vd_ramp), | 294 | SOC_ENUM("Output Ramp Down", arizona_out_vd_ramp), |
265 | 295 | ||
296 | SOC_SINGLE("Noise Gate Switch", ARIZONA_NOISE_GATE_CONTROL, | ||
297 | ARIZONA_NGATE_ENA_SHIFT, 1, 0), | ||
298 | SOC_SINGLE_TLV("Noise Gate Threshold Volume", ARIZONA_NOISE_GATE_CONTROL, | ||
299 | ARIZONA_NGATE_THR_SHIFT, 7, 1, ng_tlv), | ||
300 | SOC_ENUM("Noise Gate Hold", arizona_ng_hold), | ||
301 | |||
302 | WM5110_NG_SRC("HPOUT1L", ARIZONA_NOISE_GATE_SELECT_1L), | ||
303 | WM5110_NG_SRC("HPOUT1R", ARIZONA_NOISE_GATE_SELECT_1R), | ||
304 | WM5110_NG_SRC("HPOUT2L", ARIZONA_NOISE_GATE_SELECT_2L), | ||
305 | WM5110_NG_SRC("HPOUT2R", ARIZONA_NOISE_GATE_SELECT_2R), | ||
306 | WM5110_NG_SRC("HPOUT3L", ARIZONA_NOISE_GATE_SELECT_3L), | ||
307 | WM5110_NG_SRC("HPOUT3R", ARIZONA_NOISE_GATE_SELECT_3R), | ||
308 | WM5110_NG_SRC("SPKOUTL", ARIZONA_NOISE_GATE_SELECT_4L), | ||
309 | WM5110_NG_SRC("SPKOUTR", ARIZONA_NOISE_GATE_SELECT_4R), | ||
310 | WM5110_NG_SRC("SPKDAT1L", ARIZONA_NOISE_GATE_SELECT_5L), | ||
311 | WM5110_NG_SRC("SPKDAT1R", ARIZONA_NOISE_GATE_SELECT_5R), | ||
312 | WM5110_NG_SRC("SPKDAT2L", ARIZONA_NOISE_GATE_SELECT_6L), | ||
313 | WM5110_NG_SRC("SPKDAT2R", ARIZONA_NOISE_GATE_SELECT_6R), | ||
314 | |||
266 | ARIZONA_MIXER_CONTROLS("AIF1TX1", ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE), | 315 | ARIZONA_MIXER_CONTROLS("AIF1TX1", ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE), |
267 | ARIZONA_MIXER_CONTROLS("AIF1TX2", ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE), | 316 | ARIZONA_MIXER_CONTROLS("AIF1TX2", ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE), |
268 | ARIZONA_MIXER_CONTROLS("AIF1TX3", ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE), | 317 | ARIZONA_MIXER_CONTROLS("AIF1TX3", ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE), |