diff options
Diffstat (limited to 'sound/soc/codecs/da7213.c')
-rw-r--r-- | sound/soc/codecs/da7213.c | 151 |
1 files changed, 80 insertions, 71 deletions
diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c index 0c77e7ad7423..439d10387f10 100644 --- a/sound/soc/codecs/da7213.c +++ b/sound/soc/codecs/da7213.c | |||
@@ -63,30 +63,30 @@ static const char * const da7213_voice_hpf_corner_txt[] = { | |||
63 | "2.5Hz", "25Hz", "50Hz", "100Hz", "150Hz", "200Hz", "300Hz", "400Hz" | 63 | "2.5Hz", "25Hz", "50Hz", "100Hz", "150Hz", "200Hz", "300Hz", "400Hz" |
64 | }; | 64 | }; |
65 | 65 | ||
66 | static const struct soc_enum da7213_dac_voice_hpf_corner = | 66 | static SOC_ENUM_SINGLE_DECL(da7213_dac_voice_hpf_corner, |
67 | SOC_ENUM_SINGLE(DA7213_DAC_FILTERS1, DA7213_VOICE_HPF_CORNER_SHIFT, | 67 | DA7213_DAC_FILTERS1, |
68 | DA7213_VOICE_HPF_CORNER_MAX, | 68 | DA7213_VOICE_HPF_CORNER_SHIFT, |
69 | da7213_voice_hpf_corner_txt); | 69 | da7213_voice_hpf_corner_txt); |
70 | 70 | ||
71 | static const struct soc_enum da7213_adc_voice_hpf_corner = | 71 | static SOC_ENUM_SINGLE_DECL(da7213_adc_voice_hpf_corner, |
72 | SOC_ENUM_SINGLE(DA7213_ADC_FILTERS1, DA7213_VOICE_HPF_CORNER_SHIFT, | 72 | DA7213_ADC_FILTERS1, |
73 | DA7213_VOICE_HPF_CORNER_MAX, | 73 | DA7213_VOICE_HPF_CORNER_SHIFT, |
74 | da7213_voice_hpf_corner_txt); | 74 | da7213_voice_hpf_corner_txt); |
75 | 75 | ||
76 | /* ADC and DAC high pass filter cutoff value */ | 76 | /* ADC and DAC high pass filter cutoff value */ |
77 | static const char * const da7213_audio_hpf_corner_txt[] = { | 77 | static const char * const da7213_audio_hpf_corner_txt[] = { |
78 | "Fs/24000", "Fs/12000", "Fs/6000", "Fs/3000" | 78 | "Fs/24000", "Fs/12000", "Fs/6000", "Fs/3000" |
79 | }; | 79 | }; |
80 | 80 | ||
81 | static const struct soc_enum da7213_dac_audio_hpf_corner = | 81 | static SOC_ENUM_SINGLE_DECL(da7213_dac_audio_hpf_corner, |
82 | SOC_ENUM_SINGLE(DA7213_DAC_FILTERS1, DA7213_AUDIO_HPF_CORNER_SHIFT, | 82 | DA7213_DAC_FILTERS1 |
83 | DA7213_AUDIO_HPF_CORNER_MAX, | 83 | , DA7213_AUDIO_HPF_CORNER_SHIFT, |
84 | da7213_audio_hpf_corner_txt); | 84 | da7213_audio_hpf_corner_txt); |
85 | 85 | ||
86 | static const struct soc_enum da7213_adc_audio_hpf_corner = | 86 | static SOC_ENUM_SINGLE_DECL(da7213_adc_audio_hpf_corner, |
87 | SOC_ENUM_SINGLE(DA7213_ADC_FILTERS1, DA7213_AUDIO_HPF_CORNER_SHIFT, | 87 | DA7213_ADC_FILTERS1, |
88 | DA7213_AUDIO_HPF_CORNER_MAX, | 88 | DA7213_AUDIO_HPF_CORNER_SHIFT, |
89 | da7213_audio_hpf_corner_txt); | 89 | da7213_audio_hpf_corner_txt); |
90 | 90 | ||
91 | /* Gain ramping rate value */ | 91 | /* Gain ramping rate value */ |
92 | static const char * const da7213_gain_ramp_rate_txt[] = { | 92 | static const char * const da7213_gain_ramp_rate_txt[] = { |
@@ -94,52 +94,50 @@ static const char * const da7213_gain_ramp_rate_txt[] = { | |||
94 | "nominal rate / 32" | 94 | "nominal rate / 32" |
95 | }; | 95 | }; |
96 | 96 | ||
97 | static const struct soc_enum da7213_gain_ramp_rate = | 97 | static SOC_ENUM_SINGLE_DECL(da7213_gain_ramp_rate, |
98 | SOC_ENUM_SINGLE(DA7213_GAIN_RAMP_CTRL, DA7213_GAIN_RAMP_RATE_SHIFT, | 98 | DA7213_GAIN_RAMP_CTRL, |
99 | DA7213_GAIN_RAMP_RATE_MAX, da7213_gain_ramp_rate_txt); | 99 | DA7213_GAIN_RAMP_RATE_SHIFT, |
100 | da7213_gain_ramp_rate_txt); | ||
100 | 101 | ||
101 | /* DAC noise gate setup time value */ | 102 | /* DAC noise gate setup time value */ |
102 | static const char * const da7213_dac_ng_setup_time_txt[] = { | 103 | static const char * const da7213_dac_ng_setup_time_txt[] = { |
103 | "256 samples", "512 samples", "1024 samples", "2048 samples" | 104 | "256 samples", "512 samples", "1024 samples", "2048 samples" |
104 | }; | 105 | }; |
105 | 106 | ||
106 | static const struct soc_enum da7213_dac_ng_setup_time = | 107 | static SOC_ENUM_SINGLE_DECL(da7213_dac_ng_setup_time, |
107 | SOC_ENUM_SINGLE(DA7213_DAC_NG_SETUP_TIME, | 108 | DA7213_DAC_NG_SETUP_TIME, |
108 | DA7213_DAC_NG_SETUP_TIME_SHIFT, | 109 | DA7213_DAC_NG_SETUP_TIME_SHIFT, |
109 | DA7213_DAC_NG_SETUP_TIME_MAX, | 110 | da7213_dac_ng_setup_time_txt); |
110 | da7213_dac_ng_setup_time_txt); | ||
111 | 111 | ||
112 | /* DAC noise gate rampup rate value */ | 112 | /* DAC noise gate rampup rate value */ |
113 | static const char * const da7213_dac_ng_rampup_txt[] = { | 113 | static const char * const da7213_dac_ng_rampup_txt[] = { |
114 | "0.02 ms/dB", "0.16 ms/dB" | 114 | "0.02 ms/dB", "0.16 ms/dB" |
115 | }; | 115 | }; |
116 | 116 | ||
117 | static const struct soc_enum da7213_dac_ng_rampup_rate = | 117 | static SOC_ENUM_SINGLE_DECL(da7213_dac_ng_rampup_rate, |
118 | SOC_ENUM_SINGLE(DA7213_DAC_NG_SETUP_TIME, | 118 | DA7213_DAC_NG_SETUP_TIME, |
119 | DA7213_DAC_NG_RAMPUP_RATE_SHIFT, | 119 | DA7213_DAC_NG_RAMPUP_RATE_SHIFT, |
120 | DA7213_DAC_NG_RAMP_RATE_MAX, | 120 | da7213_dac_ng_rampup_txt); |
121 | da7213_dac_ng_rampup_txt); | ||
122 | 121 | ||
123 | /* DAC noise gate rampdown rate value */ | 122 | /* DAC noise gate rampdown rate value */ |
124 | static const char * const da7213_dac_ng_rampdown_txt[] = { | 123 | static const char * const da7213_dac_ng_rampdown_txt[] = { |
125 | "0.64 ms/dB", "20.48 ms/dB" | 124 | "0.64 ms/dB", "20.48 ms/dB" |
126 | }; | 125 | }; |
127 | 126 | ||
128 | static const struct soc_enum da7213_dac_ng_rampdown_rate = | 127 | static SOC_ENUM_SINGLE_DECL(da7213_dac_ng_rampdown_rate, |
129 | SOC_ENUM_SINGLE(DA7213_DAC_NG_SETUP_TIME, | 128 | DA7213_DAC_NG_SETUP_TIME, |
130 | DA7213_DAC_NG_RAMPDN_RATE_SHIFT, | 129 | DA7213_DAC_NG_RAMPDN_RATE_SHIFT, |
131 | DA7213_DAC_NG_RAMP_RATE_MAX, | 130 | da7213_dac_ng_rampdown_txt); |
132 | da7213_dac_ng_rampdown_txt); | ||
133 | 131 | ||
134 | /* DAC soft mute rate value */ | 132 | /* DAC soft mute rate value */ |
135 | static const char * const da7213_dac_soft_mute_rate_txt[] = { | 133 | static const char * const da7213_dac_soft_mute_rate_txt[] = { |
136 | "1", "2", "4", "8", "16", "32", "64" | 134 | "1", "2", "4", "8", "16", "32", "64" |
137 | }; | 135 | }; |
138 | 136 | ||
139 | static const struct soc_enum da7213_dac_soft_mute_rate = | 137 | static SOC_ENUM_SINGLE_DECL(da7213_dac_soft_mute_rate, |
140 | SOC_ENUM_SINGLE(DA7213_DAC_FILTERS5, DA7213_DAC_SOFTMUTE_RATE_SHIFT, | 138 | DA7213_DAC_FILTERS5, |
141 | DA7213_DAC_SOFTMUTE_RATE_MAX, | 139 | DA7213_DAC_SOFTMUTE_RATE_SHIFT, |
142 | da7213_dac_soft_mute_rate_txt); | 140 | da7213_dac_soft_mute_rate_txt); |
143 | 141 | ||
144 | /* ALC Attack Rate select */ | 142 | /* ALC Attack Rate select */ |
145 | static const char * const da7213_alc_attack_rate_txt[] = { | 143 | static const char * const da7213_alc_attack_rate_txt[] = { |
@@ -147,9 +145,10 @@ static const char * const da7213_alc_attack_rate_txt[] = { | |||
147 | "5632/fs", "11264/fs", "22528/fs", "45056/fs", "90112/fs", "180224/fs" | 145 | "5632/fs", "11264/fs", "22528/fs", "45056/fs", "90112/fs", "180224/fs" |
148 | }; | 146 | }; |
149 | 147 | ||
150 | static const struct soc_enum da7213_alc_attack_rate = | 148 | static SOC_ENUM_SINGLE_DECL(da7213_alc_attack_rate, |
151 | SOC_ENUM_SINGLE(DA7213_ALC_CTRL2, DA7213_ALC_ATTACK_SHIFT, | 149 | DA7213_ALC_CTRL2, |
152 | DA7213_ALC_ATTACK_MAX, da7213_alc_attack_rate_txt); | 150 | DA7213_ALC_ATTACK_SHIFT, |
151 | da7213_alc_attack_rate_txt); | ||
153 | 152 | ||
154 | /* ALC Release Rate select */ | 153 | /* ALC Release Rate select */ |
155 | static const char * const da7213_alc_release_rate_txt[] = { | 154 | static const char * const da7213_alc_release_rate_txt[] = { |
@@ -157,9 +156,10 @@ static const char * const da7213_alc_release_rate_txt[] = { | |||
157 | "11264/fs", "22528/fs", "45056/fs", "90112/fs", "180224/fs" | 156 | "11264/fs", "22528/fs", "45056/fs", "90112/fs", "180224/fs" |
158 | }; | 157 | }; |
159 | 158 | ||
160 | static const struct soc_enum da7213_alc_release_rate = | 159 | static SOC_ENUM_SINGLE_DECL(da7213_alc_release_rate, |
161 | SOC_ENUM_SINGLE(DA7213_ALC_CTRL2, DA7213_ALC_RELEASE_SHIFT, | 160 | DA7213_ALC_CTRL2, |
162 | DA7213_ALC_RELEASE_MAX, da7213_alc_release_rate_txt); | 161 | DA7213_ALC_RELEASE_SHIFT, |
162 | da7213_alc_release_rate_txt); | ||
163 | 163 | ||
164 | /* ALC Hold Time select */ | 164 | /* ALC Hold Time select */ |
165 | static const char * const da7213_alc_hold_time_txt[] = { | 165 | static const char * const da7213_alc_hold_time_txt[] = { |
@@ -168,22 +168,25 @@ static const char * const da7213_alc_hold_time_txt[] = { | |||
168 | "253952/fs", "507904/fs", "1015808/fs", "2031616/fs" | 168 | "253952/fs", "507904/fs", "1015808/fs", "2031616/fs" |
169 | }; | 169 | }; |
170 | 170 | ||
171 | static const struct soc_enum da7213_alc_hold_time = | 171 | static SOC_ENUM_SINGLE_DECL(da7213_alc_hold_time, |
172 | SOC_ENUM_SINGLE(DA7213_ALC_CTRL3, DA7213_ALC_HOLD_SHIFT, | 172 | DA7213_ALC_CTRL3, |
173 | DA7213_ALC_HOLD_MAX, da7213_alc_hold_time_txt); | 173 | DA7213_ALC_HOLD_SHIFT, |
174 | da7213_alc_hold_time_txt); | ||
174 | 175 | ||
175 | /* ALC Input Signal Tracking rate select */ | 176 | /* ALC Input Signal Tracking rate select */ |
176 | static const char * const da7213_alc_integ_rate_txt[] = { | 177 | static const char * const da7213_alc_integ_rate_txt[] = { |
177 | "1/4", "1/16", "1/256", "1/65536" | 178 | "1/4", "1/16", "1/256", "1/65536" |
178 | }; | 179 | }; |
179 | 180 | ||
180 | static const struct soc_enum da7213_alc_integ_attack_rate = | 181 | static SOC_ENUM_SINGLE_DECL(da7213_alc_integ_attack_rate, |
181 | SOC_ENUM_SINGLE(DA7213_ALC_CTRL3, DA7213_ALC_INTEG_ATTACK_SHIFT, | 182 | DA7213_ALC_CTRL3, |
182 | DA7213_ALC_INTEG_MAX, da7213_alc_integ_rate_txt); | 183 | DA7213_ALC_INTEG_ATTACK_SHIFT, |
184 | da7213_alc_integ_rate_txt); | ||
183 | 185 | ||
184 | static const struct soc_enum da7213_alc_integ_release_rate = | 186 | static SOC_ENUM_SINGLE_DECL(da7213_alc_integ_release_rate, |
185 | SOC_ENUM_SINGLE(DA7213_ALC_CTRL3, DA7213_ALC_INTEG_RELEASE_SHIFT, | 187 | DA7213_ALC_CTRL3, |
186 | DA7213_ALC_INTEG_MAX, da7213_alc_integ_rate_txt); | 188 | DA7213_ALC_INTEG_RELEASE_SHIFT, |
189 | da7213_alc_integ_rate_txt); | ||
187 | 190 | ||
188 | 191 | ||
189 | /* | 192 | /* |
@@ -584,15 +587,17 @@ static const char * const da7213_mic_amp_in_sel_txt[] = { | |||
584 | "Differential", "MIC_P", "MIC_N" | 587 | "Differential", "MIC_P", "MIC_N" |
585 | }; | 588 | }; |
586 | 589 | ||
587 | static const struct soc_enum da7213_mic_1_amp_in_sel = | 590 | static SOC_ENUM_SINGLE_DECL(da7213_mic_1_amp_in_sel, |
588 | SOC_ENUM_SINGLE(DA7213_MIC_1_CTRL, DA7213_MIC_AMP_IN_SEL_SHIFT, | 591 | DA7213_MIC_1_CTRL, |
589 | DA7213_MIC_AMP_IN_SEL_MAX, da7213_mic_amp_in_sel_txt); | 592 | DA7213_MIC_AMP_IN_SEL_SHIFT, |
593 | da7213_mic_amp_in_sel_txt); | ||
590 | static const struct snd_kcontrol_new da7213_mic_1_amp_in_sel_mux = | 594 | static const struct snd_kcontrol_new da7213_mic_1_amp_in_sel_mux = |
591 | SOC_DAPM_ENUM("Mic 1 Amp Source MUX", da7213_mic_1_amp_in_sel); | 595 | SOC_DAPM_ENUM("Mic 1 Amp Source MUX", da7213_mic_1_amp_in_sel); |
592 | 596 | ||
593 | static const struct soc_enum da7213_mic_2_amp_in_sel = | 597 | static SOC_ENUM_SINGLE_DECL(da7213_mic_2_amp_in_sel, |
594 | SOC_ENUM_SINGLE(DA7213_MIC_2_CTRL, DA7213_MIC_AMP_IN_SEL_SHIFT, | 598 | DA7213_MIC_2_CTRL, |
595 | DA7213_MIC_AMP_IN_SEL_MAX, da7213_mic_amp_in_sel_txt); | 599 | DA7213_MIC_AMP_IN_SEL_SHIFT, |
600 | da7213_mic_amp_in_sel_txt); | ||
596 | static const struct snd_kcontrol_new da7213_mic_2_amp_in_sel_mux = | 601 | static const struct snd_kcontrol_new da7213_mic_2_amp_in_sel_mux = |
597 | SOC_DAPM_ENUM("Mic 2 Amp Source MUX", da7213_mic_2_amp_in_sel); | 602 | SOC_DAPM_ENUM("Mic 2 Amp Source MUX", da7213_mic_2_amp_in_sel); |
598 | 603 | ||
@@ -601,15 +606,17 @@ static const char * const da7213_dai_src_txt[] = { | |||
601 | "ADC Left", "ADC Right", "DAI Input Left", "DAI Input Right" | 606 | "ADC Left", "ADC Right", "DAI Input Left", "DAI Input Right" |
602 | }; | 607 | }; |
603 | 608 | ||
604 | static const struct soc_enum da7213_dai_l_src = | 609 | static SOC_ENUM_SINGLE_DECL(da7213_dai_l_src, |
605 | SOC_ENUM_SINGLE(DA7213_DIG_ROUTING_DAI, DA7213_DAI_L_SRC_SHIFT, | 610 | DA7213_DIG_ROUTING_DAI, |
606 | DA7213_DAI_SRC_MAX, da7213_dai_src_txt); | 611 | DA7213_DAI_L_SRC_SHIFT, |
612 | da7213_dai_src_txt); | ||
607 | static const struct snd_kcontrol_new da7213_dai_l_src_mux = | 613 | static const struct snd_kcontrol_new da7213_dai_l_src_mux = |
608 | SOC_DAPM_ENUM("DAI Left Source MUX", da7213_dai_l_src); | 614 | SOC_DAPM_ENUM("DAI Left Source MUX", da7213_dai_l_src); |
609 | 615 | ||
610 | static const struct soc_enum da7213_dai_r_src = | 616 | static SOC_ENUM_SINGLE_DECL(da7213_dai_r_src, |
611 | SOC_ENUM_SINGLE(DA7213_DIG_ROUTING_DAI, DA7213_DAI_R_SRC_SHIFT, | 617 | DA7213_DIG_ROUTING_DAI, |
612 | DA7213_DAI_SRC_MAX, da7213_dai_src_txt); | 618 | DA7213_DAI_R_SRC_SHIFT, |
619 | da7213_dai_src_txt); | ||
613 | static const struct snd_kcontrol_new da7213_dai_r_src_mux = | 620 | static const struct snd_kcontrol_new da7213_dai_r_src_mux = |
614 | SOC_DAPM_ENUM("DAI Right Source MUX", da7213_dai_r_src); | 621 | SOC_DAPM_ENUM("DAI Right Source MUX", da7213_dai_r_src); |
615 | 622 | ||
@@ -619,15 +626,17 @@ static const char * const da7213_dac_src_txt[] = { | |||
619 | "DAI Input Right" | 626 | "DAI Input Right" |
620 | }; | 627 | }; |
621 | 628 | ||
622 | static const struct soc_enum da7213_dac_l_src = | 629 | static SOC_ENUM_SINGLE_DECL(da7213_dac_l_src, |
623 | SOC_ENUM_SINGLE(DA7213_DIG_ROUTING_DAC, DA7213_DAC_L_SRC_SHIFT, | 630 | DA7213_DIG_ROUTING_DAC, |
624 | DA7213_DAC_SRC_MAX, da7213_dac_src_txt); | 631 | DA7213_DAC_L_SRC_SHIFT, |
632 | da7213_dac_src_txt); | ||
625 | static const struct snd_kcontrol_new da7213_dac_l_src_mux = | 633 | static const struct snd_kcontrol_new da7213_dac_l_src_mux = |
626 | SOC_DAPM_ENUM("DAC Left Source MUX", da7213_dac_l_src); | 634 | SOC_DAPM_ENUM("DAC Left Source MUX", da7213_dac_l_src); |
627 | 635 | ||
628 | static const struct soc_enum da7213_dac_r_src = | 636 | static SOC_ENUM_SINGLE_DECL(da7213_dac_r_src, |
629 | SOC_ENUM_SINGLE(DA7213_DIG_ROUTING_DAC, DA7213_DAC_R_SRC_SHIFT, | 637 | DA7213_DIG_ROUTING_DAC, |
630 | DA7213_DAC_SRC_MAX, da7213_dac_src_txt); | 638 | DA7213_DAC_R_SRC_SHIFT, |
639 | da7213_dac_src_txt); | ||
631 | static const struct snd_kcontrol_new da7213_dac_r_src_mux = | 640 | static const struct snd_kcontrol_new da7213_dac_r_src_mux = |
632 | SOC_DAPM_ENUM("DAC Right Source MUX", da7213_dac_r_src); | 641 | SOC_DAPM_ENUM("DAC Right Source MUX", da7213_dac_r_src); |
633 | 642 | ||