aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/da7213.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/da7213.c')
-rw-r--r--sound/soc/codecs/da7213.c151
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
66static const struct soc_enum da7213_dac_voice_hpf_corner = 66static 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
71static const struct soc_enum da7213_adc_voice_hpf_corner = 71static 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 */
77static const char * const da7213_audio_hpf_corner_txt[] = { 77static 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
81static const struct soc_enum da7213_dac_audio_hpf_corner = 81static 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
86static const struct soc_enum da7213_adc_audio_hpf_corner = 86static 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 */
92static const char * const da7213_gain_ramp_rate_txt[] = { 92static 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
97static const struct soc_enum da7213_gain_ramp_rate = 97static 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 */
102static const char * const da7213_dac_ng_setup_time_txt[] = { 103static 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
106static const struct soc_enum da7213_dac_ng_setup_time = 107static 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 */
113static const char * const da7213_dac_ng_rampup_txt[] = { 113static 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
117static const struct soc_enum da7213_dac_ng_rampup_rate = 117static 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 */
124static const char * const da7213_dac_ng_rampdown_txt[] = { 123static 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
128static const struct soc_enum da7213_dac_ng_rampdown_rate = 127static 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 */
135static const char * const da7213_dac_soft_mute_rate_txt[] = { 133static 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
139static const struct soc_enum da7213_dac_soft_mute_rate = 137static 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 */
145static const char * const da7213_alc_attack_rate_txt[] = { 143static 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
150static const struct soc_enum da7213_alc_attack_rate = 148static 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 */
155static const char * const da7213_alc_release_rate_txt[] = { 154static 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
160static const struct soc_enum da7213_alc_release_rate = 159static 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 */
165static const char * const da7213_alc_hold_time_txt[] = { 165static 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
171static const struct soc_enum da7213_alc_hold_time = 171static 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 */
176static const char * const da7213_alc_integ_rate_txt[] = { 177static 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
180static const struct soc_enum da7213_alc_integ_attack_rate = 181static 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
184static const struct soc_enum da7213_alc_integ_release_rate = 186static 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
587static const struct soc_enum da7213_mic_1_amp_in_sel = 590static 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);
590static const struct snd_kcontrol_new da7213_mic_1_amp_in_sel_mux = 594static 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
593static const struct soc_enum da7213_mic_2_amp_in_sel = 597static 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);
596static const struct snd_kcontrol_new da7213_mic_2_amp_in_sel_mux = 601static 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
604static const struct soc_enum da7213_dai_l_src = 609static 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);
607static const struct snd_kcontrol_new da7213_dai_l_src_mux = 613static 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
610static const struct soc_enum da7213_dai_r_src = 616static 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);
613static const struct snd_kcontrol_new da7213_dai_r_src_mux = 620static 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
622static const struct soc_enum da7213_dac_l_src = 629static 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);
625static const struct snd_kcontrol_new da7213_dac_l_src_mux = 633static 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
628static const struct soc_enum da7213_dac_r_src = 636static 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);
631static const struct snd_kcontrol_new da7213_dac_r_src_mux = 640static 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