Lines Matching +full:0 +full:x2184
47 #define RT5645_DEVICE_ID 0x6308
48 #define RT5650_DEVICE_ID 0x6419
50 #define RT5645_PR_RANGE_BASE (0xff + 1)
51 #define RT5645_PR_SPACING 0x100
53 #define RT5645_PR_BASE (RT5645_PR_RANGE_BASE + (0 * RT5645_PR_SPACING))
63 .range_max = RT5645_PR_BASE + 0xf8,
65 .selector_mask = 0xff,
66 .selector_shift = 0x0,
68 .window_len = 0x1,
73 {RT5645_PR_BASE + 0x3d, 0x3600},
74 {RT5645_PR_BASE + 0x1c, 0xfd70},
75 {RT5645_PR_BASE + 0x20, 0x611f},
76 {RT5645_PR_BASE + 0x21, 0x4040},
77 {RT5645_PR_BASE + 0x23, 0x0004},
78 {RT5645_ASRC_4, 0x0120},
82 {0xf6, 0x0100},
83 {RT5645_PWR_ANLG1, 0x02},
84 {RT5645_IL_CMD3, 0x6728},
88 { 0x00, 0x0000 },
89 { 0x01, 0xc8c8 },
90 { 0x02, 0xc8c8 },
91 { 0x03, 0xc8c8 },
92 { 0x0a, 0x0002 },
93 { 0x0b, 0x2827 },
94 { 0x0c, 0xe000 },
95 { 0x0d, 0x0000 },
96 { 0x0e, 0x0000 },
97 { 0x0f, 0x0808 },
98 { 0x14, 0x3333 },
99 { 0x16, 0x4b00 },
100 { 0x18, 0x018b },
101 { 0x19, 0xafaf },
102 { 0x1a, 0xafaf },
103 { 0x1b, 0x0001 },
104 { 0x1c, 0x2f2f },
105 { 0x1d, 0x2f2f },
106 { 0x1e, 0x0000 },
107 { 0x20, 0x0000 },
108 { 0x27, 0x7060 },
109 { 0x28, 0x7070 },
110 { 0x29, 0x8080 },
111 { 0x2a, 0x5656 },
112 { 0x2b, 0x5454 },
113 { 0x2c, 0xaaa0 },
114 { 0x2d, 0x0000 },
115 { 0x2f, 0x1002 },
116 { 0x31, 0x5000 },
117 { 0x32, 0x0000 },
118 { 0x33, 0x0000 },
119 { 0x34, 0x0000 },
120 { 0x35, 0x0000 },
121 { 0x3b, 0x0000 },
122 { 0x3c, 0x007f },
123 { 0x3d, 0x0000 },
124 { 0x3e, 0x007f },
125 { 0x3f, 0x0000 },
126 { 0x40, 0x001f },
127 { 0x41, 0x0000 },
128 { 0x42, 0x001f },
129 { 0x45, 0x6000 },
130 { 0x46, 0x003e },
131 { 0x47, 0x003e },
132 { 0x48, 0xf807 },
133 { 0x4a, 0x0004 },
134 { 0x4d, 0x0000 },
135 { 0x4e, 0x0000 },
136 { 0x4f, 0x01ff },
137 { 0x50, 0x0000 },
138 { 0x51, 0x0000 },
139 { 0x52, 0x01ff },
140 { 0x53, 0xf000 },
141 { 0x56, 0x0111 },
142 { 0x57, 0x0064 },
143 { 0x58, 0xef0e },
144 { 0x59, 0xf0f0 },
145 { 0x5a, 0xef0e },
146 { 0x5b, 0xf0f0 },
147 { 0x5c, 0xef0e },
148 { 0x5d, 0xf0f0 },
149 { 0x5e, 0xf000 },
150 { 0x5f, 0x0000 },
151 { 0x61, 0x0300 },
152 { 0x62, 0x0000 },
153 { 0x63, 0x00c2 },
154 { 0x64, 0x0000 },
155 { 0x65, 0x0000 },
156 { 0x66, 0x0000 },
157 { 0x6a, 0x0000 },
158 { 0x6c, 0x0aaa },
159 { 0x70, 0x8000 },
160 { 0x71, 0x8000 },
161 { 0x72, 0x8000 },
162 { 0x73, 0x7770 },
163 { 0x74, 0x3e00 },
164 { 0x75, 0x2409 },
165 { 0x76, 0x000a },
166 { 0x77, 0x0c00 },
167 { 0x78, 0x0000 },
168 { 0x79, 0x0123 },
169 { 0x80, 0x0000 },
170 { 0x81, 0x0000 },
171 { 0x82, 0x0000 },
172 { 0x83, 0x0000 },
173 { 0x84, 0x0000 },
174 { 0x85, 0x0000 },
175 { 0x8a, 0x0120 },
176 { 0x8e, 0x0004 },
177 { 0x8f, 0x1100 },
178 { 0x90, 0x0646 },
179 { 0x91, 0x0c06 },
180 { 0x93, 0x0000 },
181 { 0x94, 0x0200 },
182 { 0x95, 0x0000 },
183 { 0x9a, 0x2184 },
184 { 0x9b, 0x010a },
185 { 0x9c, 0x0aea },
186 { 0x9d, 0x000c },
187 { 0x9e, 0x0400 },
188 { 0xa0, 0xa0a8 },
189 { 0xa1, 0x0059 },
190 { 0xa2, 0x0001 },
191 { 0xae, 0x6000 },
192 { 0xaf, 0x0000 },
193 { 0xb0, 0x6000 },
194 { 0xb1, 0x0000 },
195 { 0xb2, 0x0000 },
196 { 0xb3, 0x001f },
197 { 0xb4, 0x020c },
198 { 0xb5, 0x1f00 },
199 { 0xb6, 0x0000 },
200 { 0xbb, 0x0000 },
201 { 0xbc, 0x0000 },
202 { 0xbd, 0x0000 },
203 { 0xbe, 0x0000 },
204 { 0xbf, 0x3100 },
205 { 0xc0, 0x0000 },
206 { 0xc1, 0x0000 },
207 { 0xc2, 0x0000 },
208 { 0xc3, 0x2000 },
209 { 0xcd, 0x0000 },
210 { 0xce, 0x0000 },
211 { 0xcf, 0x1813 },
212 { 0xd0, 0x0690 },
213 { 0xd1, 0x1c17 },
214 { 0xd3, 0xb320 },
215 { 0xd4, 0x0000 },
216 { 0xd6, 0x0400 },
217 { 0xd9, 0x0809 },
218 { 0xda, 0x0000 },
219 { 0xdb, 0x0003 },
220 { 0xdc, 0x0049 },
221 { 0xdd, 0x001b },
222 { 0xdf, 0x0008 },
223 { 0xe0, 0x4000 },
224 { 0xe6, 0x8000 },
225 { 0xe7, 0x0200 },
226 { 0xec, 0xb300 },
227 { 0xed, 0x0000 },
228 { 0xf0, 0x001f },
229 { 0xf1, 0x020c },
230 { 0xf2, 0x1f00 },
231 { 0xf3, 0x0000 },
232 { 0xf4, 0x4000 },
233 { 0xf8, 0x0000 },
234 { 0xf9, 0x0000 },
235 { 0xfa, 0x2060 },
236 { 0xfb, 0x4040 },
237 { 0xfc, 0x0000 },
238 { 0xfd, 0x0002 },
239 { 0xfe, 0x10ec },
240 { 0xff, 0x6308 },
244 { 0x00, 0x0000 },
245 { 0x01, 0xc8c8 },
246 { 0x02, 0xc8c8 },
247 { 0x03, 0xc8c8 },
248 { 0x0a, 0x0002 },
249 { 0x0b, 0x2827 },
250 { 0x0c, 0xe000 },
251 { 0x0d, 0x0000 },
252 { 0x0e, 0x0000 },
253 { 0x0f, 0x0808 },
254 { 0x14, 0x3333 },
255 { 0x16, 0x4b00 },
256 { 0x18, 0x018b },
257 { 0x19, 0xafaf },
258 { 0x1a, 0xafaf },
259 { 0x1b, 0x0001 },
260 { 0x1c, 0x2f2f },
261 { 0x1d, 0x2f2f },
262 { 0x1e, 0x0000 },
263 { 0x20, 0x0000 },
264 { 0x27, 0x7060 },
265 { 0x28, 0x7070 },
266 { 0x29, 0x8080 },
267 { 0x2a, 0x5656 },
268 { 0x2b, 0x5454 },
269 { 0x2c, 0xaaa0 },
270 { 0x2d, 0x0000 },
271 { 0x2f, 0x5002 },
272 { 0x31, 0x5000 },
273 { 0x32, 0x0000 },
274 { 0x33, 0x0000 },
275 { 0x34, 0x0000 },
276 { 0x35, 0x0000 },
277 { 0x3b, 0x0000 },
278 { 0x3c, 0x007f },
279 { 0x3d, 0x0000 },
280 { 0x3e, 0x007f },
281 { 0x3f, 0x0000 },
282 { 0x40, 0x001f },
283 { 0x41, 0x0000 },
284 { 0x42, 0x001f },
285 { 0x45, 0x6000 },
286 { 0x46, 0x003e },
287 { 0x47, 0x003e },
288 { 0x48, 0xf807 },
289 { 0x4a, 0x0004 },
290 { 0x4d, 0x0000 },
291 { 0x4e, 0x0000 },
292 { 0x4f, 0x01ff },
293 { 0x50, 0x0000 },
294 { 0x51, 0x0000 },
295 { 0x52, 0x01ff },
296 { 0x53, 0xf000 },
297 { 0x56, 0x0111 },
298 { 0x57, 0x0064 },
299 { 0x58, 0xef0e },
300 { 0x59, 0xf0f0 },
301 { 0x5a, 0xef0e },
302 { 0x5b, 0xf0f0 },
303 { 0x5c, 0xef0e },
304 { 0x5d, 0xf0f0 },
305 { 0x5e, 0xf000 },
306 { 0x5f, 0x0000 },
307 { 0x61, 0x0300 },
308 { 0x62, 0x0000 },
309 { 0x63, 0x00c2 },
310 { 0x64, 0x0000 },
311 { 0x65, 0x0000 },
312 { 0x66, 0x0000 },
313 { 0x6a, 0x0000 },
314 { 0x6c, 0x0aaa },
315 { 0x70, 0x8000 },
316 { 0x71, 0x8000 },
317 { 0x72, 0x8000 },
318 { 0x73, 0x7770 },
319 { 0x74, 0x3e00 },
320 { 0x75, 0x2409 },
321 { 0x76, 0x000a },
322 { 0x77, 0x0c00 },
323 { 0x78, 0x0000 },
324 { 0x79, 0x0123 },
325 { 0x7a, 0x0123 },
326 { 0x80, 0x0000 },
327 { 0x81, 0x0000 },
328 { 0x82, 0x0000 },
329 { 0x83, 0x0000 },
330 { 0x84, 0x0000 },
331 { 0x85, 0x0000 },
332 { 0x8a, 0x0120 },
333 { 0x8e, 0x0004 },
334 { 0x8f, 0x1100 },
335 { 0x90, 0x0646 },
336 { 0x91, 0x0c06 },
337 { 0x93, 0x0000 },
338 { 0x94, 0x0200 },
339 { 0x95, 0x0000 },
340 { 0x9a, 0x2184 },
341 { 0x9b, 0x010a },
342 { 0x9c, 0x0aea },
343 { 0x9d, 0x000c },
344 { 0x9e, 0x0400 },
345 { 0xa0, 0xa0a8 },
346 { 0xa1, 0x0059 },
347 { 0xa2, 0x0001 },
348 { 0xae, 0x6000 },
349 { 0xaf, 0x0000 },
350 { 0xb0, 0x6000 },
351 { 0xb1, 0x0000 },
352 { 0xb2, 0x0000 },
353 { 0xb3, 0x001f },
354 { 0xb4, 0x020c },
355 { 0xb5, 0x1f00 },
356 { 0xb6, 0x0000 },
357 { 0xbb, 0x0000 },
358 { 0xbc, 0x0000 },
359 { 0xbd, 0x0000 },
360 { 0xbe, 0x0000 },
361 { 0xbf, 0x3100 },
362 { 0xc0, 0x0000 },
363 { 0xc1, 0x0000 },
364 { 0xc2, 0x0000 },
365 { 0xc3, 0x2000 },
366 { 0xcd, 0x0000 },
367 { 0xce, 0x0000 },
368 { 0xcf, 0x1813 },
369 { 0xd0, 0x0690 },
370 { 0xd1, 0x1c17 },
371 { 0xd3, 0xb320 },
372 { 0xd4, 0x0000 },
373 { 0xd6, 0x0400 },
374 { 0xd9, 0x0809 },
375 { 0xda, 0x0000 },
376 { 0xdb, 0x0003 },
377 { 0xdc, 0x0049 },
378 { 0xdd, 0x001b },
379 { 0xdf, 0x0008 },
380 { 0xe0, 0x4000 },
381 { 0xe6, 0x8000 },
382 { 0xe7, 0x0200 },
383 { 0xec, 0xb300 },
384 { 0xed, 0x0000 },
385 { 0xf0, 0x001f },
386 { 0xf1, 0x020c },
387 { 0xf2, 0x1f00 },
388 { 0xf3, 0x0000 },
389 { 0xf4, 0x4000 },
390 { 0xf8, 0x0000 },
391 { 0xf9, 0x0000 },
392 { 0xfa, 0x2060 },
393 { 0xfb, 0x4040 },
394 { 0xfc, 0x0000 },
395 { 0xfd, 0x0002 },
396 { 0xfe, 0x10ec },
397 { 0xff, 0x6308 },
420 /* 0 = IN2N; 1 = GPIO5; 2 = GPIO11 */
422 /* 0 = IN2P; 1 = GPIO6; 2 = GPIO10; 3 = GPIO12 */
476 return snd_soc_component_write(component, RT5645_RESET, 0);
483 for (i = 0; i < ARRAY_SIZE(rt5645_ranges); i++) {
519 for (i = 0; i < ARRAY_SIZE(rt5645_ranges); i++) {
670 static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -4650, 150, 0);
671 static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -6525, 75, 0);
672 static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0);
673 static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -1725, 75, 0);
674 static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0);
676 /* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */
678 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0),
679 1, 1, TLV_DB_SCALE_ITEM(2000, 0, 0),
680 2, 2, TLV_DB_SCALE_ITEM(2400, 0, 0),
681 3, 5, TLV_DB_SCALE_ITEM(3000, 500, 0),
682 6, 6, TLV_DB_SCALE_ITEM(4400, 0, 0),
683 7, 7, TLV_DB_SCALE_ITEM(5000, 0, 0),
684 8, 8, TLV_DB_SCALE_ITEM(5200, 0, 0)
687 /* {-6, -4.5, -3, -1.5, 0, 0.82, 1.58, 2.28} dB */
689 0, 4, TLV_DB_SCALE_ITEM(-600, 150, 0),
690 5, 5, TLV_DB_SCALE_ITEM(82, 0, 0),
691 6, 6, TLV_DB_SCALE_ITEM(158, 0, 0),
692 7, 7, TLV_DB_SCALE_ITEM(228, 0, 0)
701 return 0;
713 for (i = 0; i < RT5645_HWEQ_NUM; i++) {
718 return 0;
723 if ((reg >= 0x1a4 && reg <= 0x1cd) || (reg >= 0x1e5 && reg <= 0x1f8) ||
739 for (i = 0; i < RT5645_HWEQ_NUM; i++) {
745 for (i = RT5645_HWEQ_NUM - 1; i >= 0; i--) {
746 if (rt5645->eq_param[i].reg == 0)
749 return 0;
754 for (i = 0; i < RT5645_HWEQ_NUM; i++) {
756 rt5645->eq_param[i].reg != 0)
757 return 0;
758 else if (rt5645->eq_param[i].reg == 0)
762 return 0;
808 RT5645_SPK_G_CLSD_SFT, 7, 0, spk_clsd_tlv),
828 RT5645_L_VOL_SFT + 1, RT5645_R_VOL_SFT + 1, 87, 0, dac_vol_tlv),
830 RT5645_L_VOL_SFT + 1, RT5645_R_VOL_SFT + 1, 87, 0, dac_vol_tlv),
834 RT5645_BST_SFT1, 12, 0, bst_tlv),
836 RT5645_BST_SFT2, 8, 0, bst_tlv),
846 RT5645_L_VOL_SFT + 1, RT5645_R_VOL_SFT + 1, 63, 0, adc_vol_tlv),
850 RT5645_L_VOL_SFT + 1, RT5645_R_VOL_SFT + 1, 63, 0, adc_vol_tlv),
854 RT5645_STO1_ADC_L_BST_SFT, RT5645_STO1_ADC_R_BST_SFT, 3, 0,
857 RT5645_MONO_ADC_L_BST_SFT, RT5645_MONO_ADC_R_BST_SFT, 3, 0,
887 if (idx < 0)
906 return 0;
916 case 0:
918 shift = 0;
926 shift = 0;
941 return 0;
944 val = (snd_soc_component_read(component, reg) >> shift) & 0xf;
952 return 0;
962 for (i = 0; i < RT5645_HWEQ_NUM; i++) {
970 return 0;
990 unsigned int asrc2_mask = 0;
991 unsigned int asrc2_value = 0;
992 unsigned int asrc3_mask = 0;
993 unsigned int asrc3_value = 0;
1050 return 0;
1299 /*DAC2 L/R source*/ /* MX-1B [6:4] [2:0] */
1394 /* MX-28 [1:0] */
1437 /* MX-78 [4:0] */
1470 0, rt5650_if1_adc_in_src);
1517 /* MX-79 [14:12][10:8][6:4][2:0] */
1541 RT5645_TDM_CTRL_3, 0, rt5645_tdm_dac_swap_select);
1546 /* MX-7a [14:12][10:8][6:4][2:0] */
1566 RT5650_TDM_CTRL_4, 0, rt5645_tdm_dac_swap_select);
1590 /* MX-2d [1] [0] */
1683 if (hp_amp_power_count <= 0) {
1685 snd_soc_component_write(component, RT5645_DEPOP_M2, 0x3100);
1687 0x0e06);
1688 snd_soc_component_write(component, RT5645_DEPOP_M1, 0x000d);
1690 RT5645_HP_DCC_INT1, 0x9f01);
1691 for (i = 0; i < 20; i++) {
1695 if (!(val & 0x8000))
1701 0x3e, 0x7400);
1702 snd_soc_component_write(component, RT5645_DEPOP_M3, 0x0737);
1704 RT5645_MAMP_INT_REG2, 0xfc00);
1705 snd_soc_component_write(component, RT5645_DEPOP_M2, 0x1140);
1714 snd_soc_component_write(component, RT5645_DEPOP_M1, 0x000d);
1716 RT5645_HP_DCC_INT1, 0x9f01);
1720 RT5645_PWR_FV1 | RT5645_PWR_FV2, 0);
1738 0x14, 0x1aaa);
1740 0x24, 0x0430);
1746 if (hp_amp_power_count <= 0) {
1749 0x3e, 0x7400);
1750 snd_soc_component_write(component, RT5645_DEPOP_M3, 0x0737);
1752 RT5645_MAMP_INT_REG2, 0xfc00);
1753 snd_soc_component_write(component, RT5645_DEPOP_M2, 0x1140);
1755 snd_soc_component_write(component, RT5645_DEPOP_M1, 0x0001);
1757 RT5645_PWR_HP_L | RT5645_PWR_HP_R, 0);
1767 snd_soc_component_write(component, RT5645_DEPOP_M1, 0x0000);
1770 RT5645_PWR_HA, 0);
1772 RT5645_DEPOP_MASK, 0);
1796 RT5645_MAMP_INT_REG2, 0xfc00);
1823 RT5645_MAMP_INT_REG2, 0xfc00);
1834 hp_amp_power(component, 0);
1838 return 0;
1841 return 0;
1864 snd_soc_component_write(component, RT5645_EQ_CTRL2, 0);
1867 RT5645_PWR_CLS_D_L, 0);
1871 return 0;
1874 return 0;
1888 RT5645_L_MUTE | RT5645_R_MUTE, 0);
1896 RT5645_PWR_LM, 0);
1897 hp_amp_power(component, 0);
1901 return 0;
1904 return 0;
1920 RT5645_PWR_BST2_P, 0);
1924 return 0;
1927 return 0;
1949 return 0;
1952 return 0;
1974 return 0;
1977 return 0;
1982 RT5645_PWR_LDO2_BIT, 0, NULL, 0),
1984 RT5645_PWR_PLL_BIT, 0, NULL, 0),
1987 RT5645_PWR_JD1_BIT, 0, NULL, 0),
1989 RT5645_PWR_MIC_DET_BIT, 0, NULL, 0),
1993 11, 0, NULL, 0),
1995 12, 0, NULL, 0),
1997 10, 0, NULL, 0),
1999 9, 0, NULL, 0),
2001 8, 0, NULL, 0),
2003 7, 0, NULL, 0),
2005 5, 0, NULL, 0),
2007 4, 0, NULL, 0),
2009 3, 0, NULL, 0),
2011 1, 0, NULL, 0),
2013 0, 0, NULL, 0),
2018 RT5645_PWR_MB1_BIT, 0, rt5645_set_micbias1_event,
2021 RT5645_PWR_MB2_BIT, 0, rt5645_set_micbias2_event,
2036 SND_SOC_DAPM_PGA("DMIC1", SND_SOC_NOPM, 0, 0, NULL, 0),
2037 SND_SOC_DAPM_PGA("DMIC2", SND_SOC_NOPM, 0, 0, NULL, 0),
2038 SND_SOC_DAPM_SUPPLY("DMIC CLK", SND_SOC_NOPM, 0, 0,
2041 RT5645_DMIC_1_EN_SFT, 0, NULL, 0),
2043 RT5645_DMIC_2_EN_SFT, 0, NULL, 0),
2046 RT5645_PWR_BST1_BIT, 0, NULL, 0),
2048 RT5645_PWR_BST2_BIT, 0, NULL, 0, rt5645_bst2_event,
2052 RT5645_PWR_IN_L_BIT, 0, NULL, 0),
2054 RT5645_PWR_IN_R_BIT, 0, NULL, 0),
2057 0, rt5645_rec_l_mix, ARRAY_SIZE(rt5645_rec_l_mix)),
2059 0, rt5645_rec_r_mix, ARRAY_SIZE(rt5645_rec_r_mix)),
2061 SND_SOC_DAPM_ADC("ADC L", NULL, SND_SOC_NOPM, 0, 0),
2062 SND_SOC_DAPM_ADC("ADC R", NULL, SND_SOC_NOPM, 0, 0),
2065 RT5645_PWR_ADC_L_BIT, 0, NULL, 0),
2067 RT5645_PWR_ADC_R_BIT, 0, NULL, 0),
2070 SND_SOC_DAPM_MUX("Stereo1 DMIC Mux", SND_SOC_NOPM, 0, 0,
2072 SND_SOC_DAPM_MUX("Stereo1 ADC L2 Mux", SND_SOC_NOPM, 0, 0,
2074 SND_SOC_DAPM_MUX("Stereo1 ADC R2 Mux", SND_SOC_NOPM, 0, 0,
2076 SND_SOC_DAPM_MUX("Stereo1 ADC L1 Mux", SND_SOC_NOPM, 0, 0,
2078 SND_SOC_DAPM_MUX("Stereo1 ADC R1 Mux", SND_SOC_NOPM, 0, 0,
2080 SND_SOC_DAPM_MUX("Mono DMIC L Mux", SND_SOC_NOPM, 0, 0,
2082 SND_SOC_DAPM_MUX("Mono DMIC R Mux", SND_SOC_NOPM, 0, 0,
2084 SND_SOC_DAPM_MUX("Mono ADC L2 Mux", SND_SOC_NOPM, 0, 0,
2086 SND_SOC_DAPM_MUX("Mono ADC L1 Mux", SND_SOC_NOPM, 0, 0,
2088 SND_SOC_DAPM_MUX("Mono ADC R1 Mux", SND_SOC_NOPM, 0, 0,
2090 SND_SOC_DAPM_MUX("Mono ADC R2 Mux", SND_SOC_NOPM, 0, 0,
2095 RT5645_PWR_ADC_S1F_BIT, 0, NULL, 0),
2096 SND_SOC_DAPM_MIXER_E("Sto1 ADC MIXL", SND_SOC_NOPM, 0, 0,
2098 NULL, 0),
2099 SND_SOC_DAPM_MIXER_E("Sto1 ADC MIXR", SND_SOC_NOPM, 0, 0,
2101 NULL, 0),
2103 RT5645_PWR_ADC_MF_L_BIT, 0, NULL, 0),
2104 SND_SOC_DAPM_MIXER_E("Mono ADC MIXL", SND_SOC_NOPM, 0, 0,
2106 NULL, 0),
2108 RT5645_PWR_ADC_MF_R_BIT, 0, NULL, 0),
2109 SND_SOC_DAPM_MIXER_E("Mono ADC MIXR", SND_SOC_NOPM, 0, 0,
2111 NULL, 0),
2114 SND_SOC_DAPM_PGA("Stereo1 ADC MIXL", SND_SOC_NOPM, 0, 0, NULL, 0),
2115 SND_SOC_DAPM_PGA("Stereo1 ADC MIXR", SND_SOC_NOPM, 0, 0, NULL, 0),
2116 SND_SOC_DAPM_PGA("Sto2 ADC LR MIX", SND_SOC_NOPM, 0, 0, NULL, 0),
2117 SND_SOC_DAPM_PGA("VAD_ADC", SND_SOC_NOPM, 0, 0, NULL, 0),
2118 SND_SOC_DAPM_PGA("IF_ADC1", SND_SOC_NOPM, 0, 0, NULL, 0),
2119 SND_SOC_DAPM_PGA("IF_ADC2", SND_SOC_NOPM, 0, 0, NULL, 0),
2120 SND_SOC_DAPM_PGA("IF1_ADC1", SND_SOC_NOPM, 0, 0, NULL, 0),
2121 SND_SOC_DAPM_PGA("IF1_ADC2", SND_SOC_NOPM, 0, 0, NULL, 0),
2122 SND_SOC_DAPM_PGA("IF1_ADC3", SND_SOC_NOPM, 0, 0, NULL, 0),
2123 SND_SOC_DAPM_PGA("IF1_ADC4", SND_SOC_NOPM, 0, 0, NULL, 0),
2127 0, 0, &rt5645_if2_adc_in_mux),
2131 RT5645_PWR_I2S1_BIT, 0, NULL, 0),
2132 SND_SOC_DAPM_PGA("IF1 DAC0", SND_SOC_NOPM, 0, 0, NULL, 0),
2133 SND_SOC_DAPM_PGA("IF1 DAC1", SND_SOC_NOPM, 0, 0, NULL, 0),
2134 SND_SOC_DAPM_PGA("IF1 DAC2", SND_SOC_NOPM, 0, 0, NULL, 0),
2135 SND_SOC_DAPM_PGA("IF1 DAC3", SND_SOC_NOPM, 0, 0, NULL, 0),
2136 SND_SOC_DAPM_PGA("IF1 ADC", SND_SOC_NOPM, 0, 0, NULL, 0),
2137 SND_SOC_DAPM_PGA("IF1 ADC L", SND_SOC_NOPM, 0, 0, NULL, 0),
2138 SND_SOC_DAPM_PGA("IF1 ADC R", SND_SOC_NOPM, 0, 0, NULL, 0),
2140 RT5645_PWR_I2S2_BIT, 0, NULL, 0),
2141 SND_SOC_DAPM_PGA("IF2 DAC", SND_SOC_NOPM, 0, 0, NULL, 0),
2142 SND_SOC_DAPM_PGA("IF2 DAC L", SND_SOC_NOPM, 0, 0, NULL, 0),
2143 SND_SOC_DAPM_PGA("IF2 DAC R", SND_SOC_NOPM, 0, 0, NULL, 0),
2144 SND_SOC_DAPM_PGA("IF2 ADC", SND_SOC_NOPM, 0, 0, NULL, 0),
2148 0, 0, &rt5645_vad_adc_mux),
2151 SND_SOC_DAPM_AIF_IN("AIF1RX", "AIF1 Playback", 0, SND_SOC_NOPM, 0, 0),
2152 SND_SOC_DAPM_AIF_OUT("AIF1TX", "AIF1 Capture", 0, SND_SOC_NOPM, 0, 0),
2153 SND_SOC_DAPM_AIF_IN("AIF2RX", "AIF2 Playback", 0, SND_SOC_NOPM, 0, 0),
2154 SND_SOC_DAPM_AIF_OUT("AIF2TX", "AIF2 Capture", 0, SND_SOC_NOPM, 0, 0),
2158 SND_SOC_DAPM_MIXER("DAC1 MIXL", SND_SOC_NOPM, 0, 0,
2160 SND_SOC_DAPM_MIXER("DAC1 MIXR", SND_SOC_NOPM, 0, 0,
2164 SND_SOC_DAPM_MUX("DAC L2 Mux", SND_SOC_NOPM, 0, 0, &rt5645_dac_l2_mux),
2165 SND_SOC_DAPM_MUX("DAC R2 Mux", SND_SOC_NOPM, 0, 0, &rt5645_dac_r2_mux),
2167 RT5645_PWR_DAC_L2_BIT, 0, NULL, 0),
2169 RT5645_PWR_DAC_R2_BIT, 0, NULL, 0),
2171 SND_SOC_DAPM_MUX("DAC1 L Mux", SND_SOC_NOPM, 0, 0, &rt5645_dac1l_mux),
2172 SND_SOC_DAPM_MUX("DAC1 R Mux", SND_SOC_NOPM, 0, 0, &rt5645_dac1r_mux),
2176 RT5645_PWR_DAC_S1F_BIT, 0, NULL, 0),
2178 RT5645_PWR_DAC_MF_L_BIT, 0, NULL, 0),
2180 RT5645_PWR_DAC_MF_R_BIT, 0, NULL, 0),
2181 SND_SOC_DAPM_MIXER("Stereo DAC MIXL", SND_SOC_NOPM, 0, 0,
2183 SND_SOC_DAPM_MIXER("Stereo DAC MIXR", SND_SOC_NOPM, 0, 0,
2185 SND_SOC_DAPM_MIXER("Mono DAC MIXL", SND_SOC_NOPM, 0, 0,
2187 SND_SOC_DAPM_MIXER("Mono DAC MIXR", SND_SOC_NOPM, 0, 0,
2189 SND_SOC_DAPM_MIXER("DAC MIXL", SND_SOC_NOPM, 0, 0,
2191 SND_SOC_DAPM_MIXER("DAC MIXR", SND_SOC_NOPM, 0, 0,
2196 0),
2198 0),
2200 0),
2202 0),
2205 0, rt5645_spk_l_mix, ARRAY_SIZE(rt5645_spk_l_mix)),
2207 0, rt5645_spk_r_mix, ARRAY_SIZE(rt5645_spk_r_mix)),
2209 0, rt5645_out_l_mix, ARRAY_SIZE(rt5645_out_l_mix)),
2211 0, rt5645_out_r_mix, ARRAY_SIZE(rt5645_out_r_mix)),
2213 SND_SOC_DAPM_SWITCH("SPKVOL L", RT5645_PWR_VOL, RT5645_PWR_SV_L_BIT, 0,
2215 SND_SOC_DAPM_SWITCH("SPKVOL R", RT5645_PWR_VOL, RT5645_PWR_SV_R_BIT, 0,
2218 0, rt5645_hpvoll_mix, ARRAY_SIZE(rt5645_hpvoll_mix)),
2220 0, rt5645_hpvolr_mix, ARRAY_SIZE(rt5645_hpvolr_mix)),
2222 RT5645_PWR_HM_L_BIT, 0, NULL, 0),
2224 RT5645_PWR_HM_R_BIT, 0, NULL, 0),
2225 SND_SOC_DAPM_PGA("DAC 1", SND_SOC_NOPM, 0, 0, NULL, 0),
2226 SND_SOC_DAPM_PGA("DAC 2", SND_SOC_NOPM, 0, 0, NULL, 0),
2227 SND_SOC_DAPM_PGA("HPOVOL", SND_SOC_NOPM, 0, 0, NULL, 0),
2228 SND_SOC_DAPM_SWITCH("HPOVOL L", SND_SOC_NOPM, 0, 0, &hp_l_vol_control),
2229 SND_SOC_DAPM_SWITCH("HPOVOL R", SND_SOC_NOPM, 0, 0, &hp_r_vol_control),
2232 SND_SOC_DAPM_MIXER("SPOL MIX", SND_SOC_NOPM, 0, 0, rt5645_spo_l_mix,
2234 SND_SOC_DAPM_MIXER("SPOR MIX", SND_SOC_NOPM, 0, 0, rt5645_spo_r_mix,
2236 SND_SOC_DAPM_MIXER("HPO MIX", SND_SOC_NOPM, 0, 0, rt5645_hpo_mix,
2238 SND_SOC_DAPM_MIXER("LOUT MIX", SND_SOC_NOPM, 0, 0, rt5645_lout_mix,
2241 SND_SOC_DAPM_PGA_S("HP amp", 1, SND_SOC_NOPM, 0, 0, rt5645_hp_event,
2243 SND_SOC_DAPM_PGA_S("LOUT amp", 1, SND_SOC_NOPM, 0, 0, rt5645_lout_event,
2245 SND_SOC_DAPM_PGA_S("SPK amp", 2, SND_SOC_NOPM, 0, 0, rt5645_spk_event,
2250 0, NULL, 0),
2251 SND_SOC_DAPM_MUX("PDM1 L Mux", SND_SOC_NOPM, 0, 0, &rt5645_pdm1_l_mux),
2252 SND_SOC_DAPM_MUX("PDM1 R Mux", SND_SOC_NOPM, 0, 0, &rt5645_pdm1_r_mux),
2254 SND_SOC_DAPM_SWITCH("PDM1 L", SND_SOC_NOPM, 0, 0, &pdm1_l_vol_control),
2255 SND_SOC_DAPM_SWITCH("PDM1 R", SND_SOC_NOPM, 0, 0, &pdm1_r_vol_control),
2269 SND_SOC_DAPM_MUX("RT5645 IF1 DAC1 L Mux", SND_SOC_NOPM, 0, 0,
2271 SND_SOC_DAPM_MUX("RT5645 IF1 DAC1 R Mux", SND_SOC_NOPM, 0, 0,
2273 SND_SOC_DAPM_MUX("RT5645 IF1 DAC2 L Mux", SND_SOC_NOPM, 0, 0,
2275 SND_SOC_DAPM_MUX("RT5645 IF1 DAC2 R Mux", SND_SOC_NOPM, 0, 0,
2278 0, 0, &rt5645_if1_adc_in_mux),
2280 0, 0, &rt5645_if1_adc1_in_mux),
2282 0, 0, &rt5645_if1_adc2_in_mux),
2284 0, 0, &rt5645_if1_adc3_in_mux),
2289 0, 0, &rt5650_a_dac1_l_mux),
2291 0, 0, &rt5650_a_dac1_r_mux),
2293 0, 0, &rt5650_a_dac2_l_mux),
2295 0, 0, &rt5650_a_dac2_r_mux),
2298 0, 0, &rt5650_if1_adc1_in_mux),
2300 0, 0, &rt5650_if1_adc2_in_mux),
2302 0, 0, &rt5650_if1_adc3_in_mux),
2304 0, 0, &rt5650_if1_adc_in_mux),
2306 SND_SOC_DAPM_MUX("RT5650 IF1 DAC1 L Mux", SND_SOC_NOPM, 0, 0,
2308 SND_SOC_DAPM_MUX("RT5650 IF1 DAC1 R Mux", SND_SOC_NOPM, 0, 0,
2310 SND_SOC_DAPM_MUX("RT5650 IF1 DAC2 L Mux", SND_SOC_NOPM, 0, 0,
2312 SND_SOC_DAPM_MUX("RT5650 IF1 DAC2 R Mux", SND_SOC_NOPM, 0, 0,
2756 unsigned int val_len = 0, val_clk, mask_clk, dl_sft;
2761 if (pre_div < 0) {
2766 if (frame_size < 0) {
2792 val_len = 0x1;
2795 val_len = 0x2;
2798 val_len = 0x3;
2809 (0x3 << dl_sft), (val_len << dl_sft));
2817 (0x3 << dl_sft), (val_len << dl_sft));
2825 return 0;
2832 unsigned int reg_val = 0, pol_sft;
2849 rt5645->master[dai->id] = 0;
2895 return 0;
2903 unsigned int reg_val = 0;
2906 return 0;
2929 return 0;
2942 return 0;
2947 rt5645->pll_in = 0;
2948 rt5645->pll_out = 0;
2951 return 0;
2981 if (ret < 0) {
2987 pll_code.m_bp, (pll_code.m_bp ? 0 : pll_code.m_code),
2993 ((pll_code.m_bp ? 0 : pll_code.m_code) << RT5645_PLL_M_SFT) |
3000 return 0;
3009 unsigned int mask, val = 0;
3018 mask = 0x8ff0;
3024 mask = 0x7c00;
3066 return 0;
3102 snd_soc_component_write(component, RT5645_DEPOP_M2, 0x1140);
3107 msecs_to_jiffies(0));
3112 snd_soc_component_write(component, RT5645_DEPOP_M2, 0x1100);
3115 RT5645_DIG_GATE_CTRL, 0);
3119 RT5645_PWR_FV1 | RT5645_PWR_FV2, 0x0);
3126 return 0;
3156 snd_soc_component_update_bits(component, RT5650_4BTN_IL_CMD1, 0x3, 0x3);
3158 RT5645_INT_IRQ_ST, 0x8, 0x8);
3160 snd_soc_component_update_bits(component, RT5650_4BTN_IL_CMD2, 0x8000, 0x0);
3161 snd_soc_component_update_bits(component, RT5645_INT_IRQ_ST, 0x8, 0x0);
3176 regmap_write(rt5645->regmap, RT5645_CHARGE_PUMP, 0x0206);
3194 regmap_write(rt5645->regmap, RT5645_JD_CTRL3, 0x00f0);
3201 RT5645_CBJ_MN_JD, 0);
3208 val &= 0x7;
3223 gpiod_set_value(rt5645->gpiod_cbj_sleeve, 0);
3229 regmap_write(rt5645->regmap, RT5645_CHARGE_PUMP, 0x0e06);
3231 rt5645->jack_type = 0;
3239 RT5645_CBJ_BST1_EN, 0);
3244 if (rt5645->pdata.jd_mode == 0)
3253 gpiod_set_value(rt5645->gpiod_cbj_sleeve, 0);
3264 pr_debug("val=0x%x\n", val);
3265 btn_type = val & 0xfff0;
3291 rt5645_irq(0, rt5645);
3293 return 0;
3321 int val, btn_type, gpio_state = 0, report = 0;
3329 case 0: /* Not using rt5645 JD */
3345 val = snd_soc_component_read(rt5645->component, RT5645_A_JD_CTRL1) & 0x0020;
3348 val = snd_soc_component_read(rt5645->component, RT5645_INT_IRQ_ST) & 0x1000;
3353 if (!val && (rt5645->jack_type == 0)) { /* jack in */
3357 btn_type = 0;
3358 if (snd_soc_component_read(rt5645->component, RT5645_INT_IRQ_ST) & 0x4) {
3368 case 0x8000:
3369 case 0x4000:
3370 case 0x2000:
3373 case 0x1000:
3374 case 0x0800:
3375 case 0x0400:
3378 case 0x0200:
3379 case 0x0100:
3380 case 0x0080:
3383 case 0x0040:
3384 case 0x0020:
3385 case 0x0010:
3388 case 0x0000: /* unpressed */
3392 "Unexpected button code 0x%04x\n",
3397 if (btn_type == 0)/* button release */
3405 report = 0;
3407 RT5645_INT_IRQ_ST, 0x1, 0x0);
3408 rt5645_jack_detect(rt5645->component, 0);
3498 return 0;
3514 return 0;
3524 return 0;
3663 { "10EC5645", 0 },
3664 { "10EC5648", 0 },
3665 { "10EC5650", 0 },
3666 { "10EC5640", 0 },
3667 { "10EC3270", 0 },
3744 static const struct acpi_gpio_params ef20_hp_detect = { 1, 0, false };
4047 for (i = 0; i < ARRAY_SIZE(rt5645->supplies); i++)
4079 if (ret < 0) {
4080 dev_err(&i2c->dev, "Failed to read: 0x%02X\n, ret = %d", RT5645_VENDOR_ID2, ret);
4108 regmap_write(rt5645->regmap, RT5645_RESET, 0);
4111 rt5645->v_id = val & 0xff;
4113 regmap_write(rt5645->regmap, RT5645_AD_DA_MIXER, 0x8080);
4117 if (ret != 0)
4123 if (ret != 0)
4128 regmap_update_bits(rt5645->regmap, RT5645_CLSD_OUT_CTRL, 0xc0, 0xc0);
4247 timer_setup(&rt5645->btn_check_timer, rt5645_btn_check_callback, 0);
4268 return 0;
4295 gpiod_set_value(rt5645->gpiod_cbj_sleeve, 0);
4309 0);
4311 regmap_write(rt5645->regmap, RT5645_RESET, 0);
4314 gpiod_set_value(rt5645->gpiod_cbj_sleeve, 0);
4327 return 0;
4338 rt5645->jack_type = 0;
4341 return 0;