arm64: dts: qcom: sm8550: add TRNG node
[linux-modified.git] / sound / soc / intel / common / soc-acpi-intel-rpl-match.c
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * soc-apci-intel-rpl-match.c - tables and support for RPL ACPI enumeration.
4  *
5  * Copyright (c) 2022 Intel Corporation.
6  */
7
8 #include <sound/soc-acpi.h>
9 #include <sound/soc-acpi-intel-match.h>
10
11 static const struct snd_soc_acpi_endpoint single_endpoint = {
12         .num = 0,
13         .aggregated = 0,
14         .group_position = 0,
15         .group_id = 0,
16 };
17
18 static const struct snd_soc_acpi_endpoint spk_l_endpoint = {
19         .num = 0,
20         .aggregated = 1,
21         .group_position = 0,
22         .group_id = 1,
23 };
24
25 static const struct snd_soc_acpi_endpoint spk_r_endpoint = {
26         .num = 0,
27         .aggregated = 1,
28         .group_position = 1,
29         .group_id = 1,
30 };
31
32 static const struct snd_soc_acpi_adr_device rt711_0_adr[] = {
33         {
34                 .adr = 0x000020025D071100ull,
35                 .num_endpoints = 1,
36                 .endpoints = &single_endpoint,
37                 .name_prefix = "rt711"
38         }
39 };
40
41 static const struct snd_soc_acpi_link_adr rpl_rvp[] = {
42         {
43                 .mask = BIT(0),
44                 .num_adr = ARRAY_SIZE(rt711_0_adr),
45                 .adr_d = rt711_0_adr,
46         },
47         {}
48 };
49
50 static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = {
51         {
52                 .adr = 0x000030025D071101ull,
53                 .num_endpoints = 1,
54                 .endpoints = &single_endpoint,
55                 .name_prefix = "rt711"
56         }
57 };
58
59 static const struct snd_soc_acpi_adr_device rt711_sdca_2_adr[] = {
60         {
61                 .adr = 0x000230025D071101ull,
62                 .num_endpoints = 1,
63                 .endpoints = &single_endpoint,
64                 .name_prefix = "rt711"
65         }
66 };
67
68 static const struct snd_soc_acpi_adr_device rt1316_1_group1_adr[] = {
69         {
70                 .adr = 0x000131025D131601ull, /* unique ID is set for some reason */
71                 .num_endpoints = 1,
72                 .endpoints = &spk_l_endpoint,
73                 .name_prefix = "rt1316-1"
74         }
75 };
76
77 static const struct snd_soc_acpi_adr_device rt1316_2_group1_adr[] = {
78         {
79                 .adr = 0x000230025D131601ull,
80                 .num_endpoints = 1,
81                 .endpoints = &spk_r_endpoint,
82                 .name_prefix = "rt1316-2"
83         }
84 };
85
86 static const struct snd_soc_acpi_adr_device rt1316_3_group1_adr[] = {
87         {
88                 .adr = 0x000330025D131601ull,
89                 .num_endpoints = 1,
90                 .endpoints = &spk_r_endpoint,
91                 .name_prefix = "rt1316-2"
92         }
93 };
94
95 static const struct snd_soc_acpi_adr_device rt1316_0_group2_adr[] = {
96         {
97                 .adr = 0x000030025D131601ull,
98                 .num_endpoints = 1,
99                 .endpoints = &spk_l_endpoint,
100                 .name_prefix = "rt1316-1"
101         }
102 };
103
104 static const struct snd_soc_acpi_adr_device rt1316_1_group2_adr[] = {
105         {
106                 .adr = 0x000131025D131601ull,
107                 .num_endpoints = 1,
108                 .endpoints = &spk_r_endpoint,
109                 .name_prefix = "rt1316-2"
110         }
111 };
112
113 static const struct snd_soc_acpi_adr_device rt1318_1_group1_adr[] = {
114         {
115                 .adr = 0x000132025D131801ull,
116                 .num_endpoints = 1,
117                 .endpoints = &spk_l_endpoint,
118                 .name_prefix = "rt1318-1"
119         }
120 };
121
122 static const struct snd_soc_acpi_adr_device rt1318_2_group1_adr[] = {
123         {
124                 .adr = 0x000230025D131801ull,
125                 .num_endpoints = 1,
126                 .endpoints = &spk_r_endpoint,
127                 .name_prefix = "rt1318-2"
128         }
129 };
130
131 static const struct snd_soc_acpi_adr_device rt714_0_adr[] = {
132         {
133                 .adr = 0x000030025D071401ull,
134                 .num_endpoints = 1,
135                 .endpoints = &single_endpoint,
136                 .name_prefix = "rt714"
137         }
138 };
139
140 static const struct snd_soc_acpi_adr_device rt714_2_adr[] = {
141         {
142                 .adr = 0x000230025D071401ull,
143                 .num_endpoints = 1,
144                 .endpoints = &single_endpoint,
145                 .name_prefix = "rt714"
146         }
147 };
148
149 static const struct snd_soc_acpi_adr_device rt714_3_adr[] = {
150         {
151                 .adr = 0x000330025D071401ull,
152                 .num_endpoints = 1,
153                 .endpoints = &single_endpoint,
154                 .name_prefix = "rt714"
155         }
156 };
157
158 static const struct snd_soc_acpi_link_adr rpl_sdca_3_in_1[] = {
159         {
160                 .mask = BIT(0),
161                 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
162                 .adr_d = rt711_sdca_0_adr,
163         },
164         {
165                 .mask = BIT(1),
166                 .num_adr = ARRAY_SIZE(rt1316_1_group1_adr),
167                 .adr_d = rt1316_1_group1_adr,
168         },
169         {
170                 .mask = BIT(2),
171                 .num_adr = ARRAY_SIZE(rt714_2_adr),
172                 .adr_d = rt714_2_adr,
173         },
174         {
175                 .mask = BIT(3),
176                 .num_adr = ARRAY_SIZE(rt1316_3_group1_adr),
177                 .adr_d = rt1316_3_group1_adr,
178         },
179         {}
180 };
181
182 static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link0_rt1316_link12_rt714_link3[] = {
183         {
184                 .mask = BIT(0),
185                 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
186                 .adr_d = rt711_sdca_0_adr,
187         },
188         {
189                 .mask = BIT(1),
190                 .num_adr = ARRAY_SIZE(rt1316_1_group1_adr),
191                 .adr_d = rt1316_1_group1_adr,
192         },
193         {
194                 .mask = BIT(2),
195                 .num_adr = ARRAY_SIZE(rt1316_2_group1_adr),
196                 .adr_d = rt1316_2_group1_adr,
197         },
198         {
199                 .mask = BIT(3),
200                 .num_adr = ARRAY_SIZE(rt714_3_adr),
201                 .adr_d = rt714_3_adr,
202         },
203         {}
204 };
205
206 static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link2_rt1316_link01_rt714_link3[] = {
207         {
208                 .mask = BIT(2),
209                 .num_adr = ARRAY_SIZE(rt711_sdca_2_adr),
210                 .adr_d = rt711_sdca_2_adr,
211         },
212         {
213                 .mask = BIT(0),
214                 .num_adr = ARRAY_SIZE(rt1316_0_group2_adr),
215                 .adr_d = rt1316_0_group2_adr,
216         },
217         {
218                 .mask = BIT(1),
219                 .num_adr = ARRAY_SIZE(rt1316_1_group2_adr),
220                 .adr_d = rt1316_1_group2_adr,
221         },
222         {
223                 .mask = BIT(3),
224                 .num_adr = ARRAY_SIZE(rt714_3_adr),
225                 .adr_d = rt714_3_adr,
226         },
227         {}
228 };
229
230 static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link2_rt1316_link01[] = {
231         {
232                 .mask = BIT(2),
233                 .num_adr = ARRAY_SIZE(rt711_sdca_2_adr),
234                 .adr_d = rt711_sdca_2_adr,
235         },
236         {
237                 .mask = BIT(0),
238                 .num_adr = ARRAY_SIZE(rt1316_0_group2_adr),
239                 .adr_d = rt1316_0_group2_adr,
240         },
241         {
242                 .mask = BIT(1),
243                 .num_adr = ARRAY_SIZE(rt1316_1_group2_adr),
244                 .adr_d = rt1316_1_group2_adr,
245         },
246         {}
247 };
248
249 static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link0_rt1316_link12[] = {
250         {
251                 .mask = BIT(0),
252                 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
253                 .adr_d = rt711_sdca_0_adr,
254         },
255         {
256                 .mask = BIT(1),
257                 .num_adr = ARRAY_SIZE(rt1316_1_group1_adr),
258                 .adr_d = rt1316_1_group1_adr,
259         },
260         {
261                 .mask = BIT(2),
262                 .num_adr = ARRAY_SIZE(rt1316_2_group1_adr),
263                 .adr_d = rt1316_2_group1_adr,
264         },
265         {}
266 };
267
268 static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link0_rt1318_link12_rt714_link3[] = {
269         {
270                 .mask = BIT(0),
271                 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
272                 .adr_d = rt711_sdca_0_adr,
273         },
274         {
275                 .mask = BIT(1),
276                 .num_adr = ARRAY_SIZE(rt1318_1_group1_adr),
277                 .adr_d = rt1318_1_group1_adr,
278         },
279         {
280                 .mask = BIT(2),
281                 .num_adr = ARRAY_SIZE(rt1318_2_group1_adr),
282                 .adr_d = rt1318_2_group1_adr,
283         },
284         {
285                 .mask = BIT(3),
286                 .num_adr = ARRAY_SIZE(rt714_3_adr),
287                 .adr_d = rt714_3_adr,
288         },
289         {}
290 };
291
292 static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link0_rt1318_link12[] = {
293         {
294                 .mask = BIT(0),
295                 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
296                 .adr_d = rt711_sdca_0_adr,
297         },
298         {
299                 .mask = BIT(1),
300                 .num_adr = ARRAY_SIZE(rt1318_1_group1_adr),
301                 .adr_d = rt1318_1_group1_adr,
302         },
303         {
304                 .mask = BIT(2),
305                 .num_adr = ARRAY_SIZE(rt1318_2_group1_adr),
306                 .adr_d = rt1318_2_group1_adr,
307         },
308         {}
309 };
310
311 static const struct snd_soc_acpi_link_adr rpl_sdw_rt1316_link12_rt714_link0[] = {
312         {
313                 .mask = BIT(1),
314                 .num_adr = ARRAY_SIZE(rt1316_1_group1_adr),
315                 .adr_d = rt1316_1_group1_adr,
316         },
317         {
318                 .mask = BIT(2),
319                 .num_adr = ARRAY_SIZE(rt1316_2_group1_adr),
320                 .adr_d = rt1316_2_group1_adr,
321         },
322         {
323                 .mask = BIT(0),
324                 .num_adr = ARRAY_SIZE(rt714_0_adr),
325                 .adr_d = rt714_0_adr,
326         },
327         {}
328 };
329
330 static const struct snd_soc_acpi_link_adr rpl_sdca_rvp[] = {
331         {
332                 .mask = BIT(0),
333                 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
334                 .adr_d = rt711_sdca_0_adr,
335         },
336         {}
337 };
338
339 static const struct snd_soc_acpi_link_adr rplp_crb[] = {
340         {
341                 .mask = BIT(2),
342                 .num_adr = ARRAY_SIZE(rt711_sdca_2_adr),
343                 .adr_d = rt711_sdca_2_adr,
344         },
345         {}
346 };
347
348 static const struct snd_soc_acpi_codecs rpl_rt5682_hp = {
349         .num_codecs = 2,
350         .codecs = {"10EC5682", "RTL5682"},
351 };
352
353 static const struct snd_soc_acpi_codecs rpl_essx_83x6 = {
354         .num_codecs = 3,
355         .codecs = { "ESSX8316", "ESSX8326", "ESSX8336"},
356 };
357
358 static const struct snd_soc_acpi_codecs rpl_max98357a_amp = {
359         .num_codecs = 1,
360         .codecs = {"MX98357A"}
361 };
362
363 static const struct snd_soc_acpi_codecs rpl_max98360a_amp = {
364         .num_codecs = 1,
365         .codecs = {"MX98360A"},
366 };
367
368 static const struct snd_soc_acpi_codecs rpl_max98373_amp = {
369         .num_codecs = 1,
370         .codecs = {"MX98373"}
371 };
372
373 static const struct snd_soc_acpi_codecs rpl_lt6911_hdmi = {
374         .num_codecs = 1,
375         .codecs = {"INTC10B0"}
376 };
377
378 static const struct snd_soc_acpi_codecs rpl_nau8318_amp = {
379         .num_codecs = 1,
380         .codecs = {"NVTN2012"}
381 };
382
383 static const struct snd_soc_acpi_codecs rpl_rt1019p_amp = {
384         .num_codecs = 1,
385         .codecs = {"RTL1019"}
386 };
387
388 struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_machines[] = {
389         {
390                 .comp_ids = &rpl_rt5682_hp,
391                 .drv_name = "rpl_mx98357_rt5682",
392                 .machine_quirk = snd_soc_acpi_codec_list,
393                 .quirk_data = &rpl_max98357a_amp,
394                 .sof_tplg_filename = "sof-rpl-max98357a-rt5682.tplg",
395         },
396         {
397                 .comp_ids = &rpl_rt5682_hp,
398                 .drv_name = "rpl_mx98360_rt5682",
399                 .machine_quirk = snd_soc_acpi_codec_list,
400                 .quirk_data = &rpl_max98360a_amp,
401                 .sof_tplg_filename = "sof-rpl-max98360a-rt5682.tplg",
402         },
403         {
404                 .id = "10508825",
405                 .drv_name = "rpl_max98373_8825",
406                 .machine_quirk = snd_soc_acpi_codec_list,
407                 .quirk_data = &rpl_max98373_amp,
408                 .sof_tplg_filename = "sof-rpl-max98373-nau8825.tplg",
409         },
410         {
411                 .id = "10508825",
412                 .drv_name = "rpl_mx98360a_8825",
413                 .machine_quirk = snd_soc_acpi_codec_list,
414                 .quirk_data = &rpl_max98360a_amp,
415                 .sof_tplg_filename = "sof-rpl-max98360a-nau8825.tplg",
416         },
417         {
418                 .id = "10508825",
419                 .drv_name = "rpl_nau8318_8825",
420                 .machine_quirk = snd_soc_acpi_codec_list,
421                 .quirk_data = &rpl_nau8318_amp,
422                 .sof_tplg_filename = "sof-rpl-nau8318-nau8825.tplg",
423         },
424         {
425                 .comp_ids = &rpl_rt5682_hp,
426                 .drv_name = "rpl_rt1019_rt5682",
427                 .machine_quirk = snd_soc_acpi_codec_list,
428                 .quirk_data = &rpl_rt1019p_amp,
429                 .sof_tplg_filename = "sof-rpl-rt1019-rt5682.tplg",
430         },
431         {
432                 .comp_ids = &rpl_rt5682_hp,
433                 .drv_name = "rpl_rt5682_c1_h02",
434                 .machine_quirk = snd_soc_acpi_codec_list,
435                 .quirk_data = &rpl_lt6911_hdmi,
436                 .sof_tplg_filename = "sof-rpl-rt5682-ssp1-hdmi-ssp02.tplg",
437         },
438         {
439                 .comp_ids = &rpl_essx_83x6,
440                 .drv_name = "rpl_es83x6_c1_h02",
441                 .machine_quirk = snd_soc_acpi_codec_list,
442                 .quirk_data = &rpl_lt6911_hdmi,
443                 .sof_tplg_filename = "sof-rpl-es83x6-ssp1-hdmi-ssp02.tplg",
444         },
445         {
446                 .comp_ids = &rpl_essx_83x6,
447                 .drv_name = "sof-essx8336",
448                 .sof_tplg_filename = "sof-rpl-es83x6", /* the tplg suffix is added at run time */
449                 .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER |
450                                         SND_SOC_ACPI_TPLG_INTEL_SSP_MSB |
451                                         SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER,
452         },
453         {
454                 .id = "INTC10B0",
455                 .drv_name = "rpl_lt6911_hdmi_ssp",
456                 .sof_tplg_filename = "sof-rpl-nocodec-hdmi-ssp02.tplg"
457         },
458         {},
459 };
460 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_rpl_machines);
461
462 /* this table is used when there is no I2S codec present */
463 struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_sdw_machines[] = {
464         {
465                 .link_mask = 0xF, /* 4 active links required */
466                 .links = rpl_sdca_3_in_1,
467                 .drv_name = "sof_sdw",
468                 .sof_tplg_filename = "sof-rpl-rt711-l0-rt1316-l13-rt714-l2.tplg",
469         },
470         {
471                 .link_mask = 0xF, /* 4 active links required */
472                 .links = rpl_sdw_rt711_link2_rt1316_link01_rt714_link3,
473                 .drv_name = "sof_sdw",
474                 .sof_tplg_filename = "sof-rpl-rt711-l2-rt1316-l01-rt714-l3.tplg",
475         },
476         {
477                 .link_mask = 0xF, /* 4 active links required */
478                 .links = rpl_sdw_rt711_link0_rt1316_link12_rt714_link3,
479                 .drv_name = "sof_sdw",
480                 .sof_tplg_filename = "sof-rpl-rt711-l0-rt1316-l12-rt714-l3.tplg",
481         },
482         {
483                 .link_mask = 0xF, /* 4 active links required */
484                 .links = rpl_sdw_rt711_link0_rt1318_link12_rt714_link3,
485                 .drv_name = "sof_sdw",
486                 .sof_tplg_filename = "sof-rpl-rt711-l0-rt1318-l12-rt714-l3.tplg",
487         },
488         {
489                 .link_mask = 0x7, /* rt711 on link0 & two rt1316s on link1 and link2 */
490                 .links = rpl_sdw_rt711_link0_rt1316_link12,
491                 .drv_name = "sof_sdw",
492                 .sof_tplg_filename = "sof-rpl-rt711-l0-rt1316-l12.tplg",
493         },
494         {
495                 .link_mask = 0x7, /* rt711 on link0 & two rt1318s on link1 and link2 */
496                 .links = rpl_sdw_rt711_link0_rt1318_link12,
497                 .drv_name = "sof_sdw",
498                 .sof_tplg_filename = "sof-rpl-rt711-l0-rt1318-l12.tplg",
499         },
500         {
501                 .link_mask = 0x7, /* rt714 on link0 & two rt1316s on link1 and link2 */
502                 .links = rpl_sdw_rt1316_link12_rt714_link0,
503                 .drv_name = "sof_sdw",
504                 .sof_tplg_filename = "sof-rpl-rt1316-l12-rt714-l0.tplg",
505         },
506         {
507                 .link_mask = 0x7, /* rt711 on link2 & two rt1316s on link0 and link1 */
508                 .links = rpl_sdw_rt711_link2_rt1316_link01,
509                 .drv_name = "sof_sdw",
510                 .sof_tplg_filename = "sof-rpl-rt711-l2-rt1316-l01.tplg",
511         },
512         {
513                 .link_mask = 0x1, /* link0 required */
514                 .links = rpl_rvp,
515                 .drv_name = "sof_sdw",
516                 .sof_tplg_filename = "sof-rpl-rt711-l0.tplg",
517         },
518         {
519                 .link_mask = 0x1, /* link0 required */
520                 .links = rpl_sdca_rvp,
521                 .drv_name = "sof_sdw",
522                 .sof_tplg_filename = "sof-rpl-rt711-l0.tplg",
523         },
524         {
525                 .link_mask = 0x4, /* link2 required */
526                 .links = rplp_crb,
527                 .drv_name = "sof_sdw",
528                 .sof_tplg_filename = "sof-rpl-rt711-l2.tplg",
529         },
530         {},
531 };
532 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_rpl_sdw_machines);