1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * soc-apci-intel-adl-match.c - tables and support for ADL ACPI enumeration. 4 * 5 * Copyright (c) 2020, 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_codecs essx_83x6 = { 12 .num_codecs = 3, 13 .codecs = { "ESSX8316", "ESSX8326", "ESSX8336"}, 14 }; 15 16 static const struct snd_soc_acpi_endpoint single_endpoint = { 17 .num = 0, 18 .aggregated = 0, 19 .group_position = 0, 20 .group_id = 0, 21 }; 22 23 static const struct snd_soc_acpi_endpoint spk_l_endpoint = { 24 .num = 0, 25 .aggregated = 1, 26 .group_position = 0, 27 .group_id = 1, 28 }; 29 30 static const struct snd_soc_acpi_endpoint spk_r_endpoint = { 31 .num = 0, 32 .aggregated = 1, 33 .group_position = 1, 34 .group_id = 1, 35 }; 36 37 static const struct snd_soc_acpi_adr_device rt711_0_adr[] = { 38 { 39 .adr = 0x000020025D071100ull, 40 .num_endpoints = 1, 41 .endpoints = &single_endpoint, 42 .name_prefix = "rt711" 43 } 44 }; 45 46 static const struct snd_soc_acpi_adr_device rt1308_1_group1_adr[] = { 47 { 48 .adr = 0x000120025D130800ull, 49 .num_endpoints = 1, 50 .endpoints = &spk_l_endpoint, 51 .name_prefix = "rt1308-1" 52 } 53 }; 54 55 static const struct snd_soc_acpi_adr_device rt1308_2_group1_adr[] = { 56 { 57 .adr = 0x000220025D130800ull, 58 .num_endpoints = 1, 59 .endpoints = &spk_r_endpoint, 60 .name_prefix = "rt1308-2" 61 } 62 }; 63 64 static const struct snd_soc_acpi_adr_device rt715_3_adr[] = { 65 { 66 .adr = 0x000320025D071500ull, 67 .num_endpoints = 1, 68 .endpoints = &single_endpoint, 69 .name_prefix = "rt715" 70 } 71 }; 72 73 static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = { 74 { 75 .adr = 0x000030025D071101ull, 76 .num_endpoints = 1, 77 .endpoints = &single_endpoint, 78 .name_prefix = "rt711" 79 } 80 }; 81 82 static const struct snd_soc_acpi_adr_device rt711_sdca_2_adr[] = { 83 { 84 .adr = 0x000230025D071101ull, 85 .num_endpoints = 1, 86 .endpoints = &single_endpoint, 87 .name_prefix = "rt711" 88 } 89 }; 90 91 static const struct snd_soc_acpi_adr_device rt1316_1_group1_adr[] = { 92 { 93 .adr = 0x000131025D131601ull, /* unique ID is set for some reason */ 94 .num_endpoints = 1, 95 .endpoints = &spk_l_endpoint, 96 .name_prefix = "rt1316-1" 97 } 98 }; 99 100 static const struct snd_soc_acpi_adr_device rt1316_2_group1_adr[] = { 101 { 102 .adr = 0x000230025D131601ull, 103 .num_endpoints = 1, 104 .endpoints = &spk_r_endpoint, 105 .name_prefix = "rt1316-2" 106 } 107 }; 108 109 static const struct snd_soc_acpi_adr_device rt1316_3_group1_adr[] = { 110 { 111 .adr = 0x000330025D131601ull, 112 .num_endpoints = 1, 113 .endpoints = &spk_r_endpoint, 114 .name_prefix = "rt1316-2" 115 } 116 }; 117 118 static const struct snd_soc_acpi_adr_device rt1316_0_group2_adr[] = { 119 { 120 .adr = 0x000031025D131601ull, 121 .num_endpoints = 1, 122 .endpoints = &spk_l_endpoint, 123 .name_prefix = "rt1316-1" 124 } 125 }; 126 127 static const struct snd_soc_acpi_adr_device rt1316_1_group2_adr[] = { 128 { 129 .adr = 0x000130025D131601ull, 130 .num_endpoints = 1, 131 .endpoints = &spk_r_endpoint, 132 .name_prefix = "rt1316-2" 133 } 134 }; 135 136 static const struct snd_soc_acpi_adr_device rt1316_2_single_adr[] = { 137 { 138 .adr = 0x000230025D131601ull, 139 .num_endpoints = 1, 140 .endpoints = &single_endpoint, 141 .name_prefix = "rt1316-1" 142 } 143 }; 144 145 static const struct snd_soc_acpi_adr_device rt1316_3_single_adr[] = { 146 { 147 .adr = 0x000330025D131601ull, 148 .num_endpoints = 1, 149 .endpoints = &single_endpoint, 150 .name_prefix = "rt1316-1" 151 } 152 }; 153 154 static const struct snd_soc_acpi_adr_device rt714_0_adr[] = { 155 { 156 .adr = 0x000030025D071401ull, 157 .num_endpoints = 1, 158 .endpoints = &single_endpoint, 159 .name_prefix = "rt714" 160 } 161 }; 162 163 static const struct snd_soc_acpi_adr_device rt714_2_adr[] = { 164 { 165 .adr = 0x000230025D071401ull, 166 .num_endpoints = 1, 167 .endpoints = &single_endpoint, 168 .name_prefix = "rt714" 169 } 170 }; 171 172 static const struct snd_soc_acpi_adr_device rt714_3_adr[] = { 173 { 174 .adr = 0x000330025D071401ull, 175 .num_endpoints = 1, 176 .endpoints = &single_endpoint, 177 .name_prefix = "rt714" 178 } 179 }; 180 181 static const struct snd_soc_acpi_link_adr adl_default[] = { 182 { 183 .mask = BIT(0), 184 .num_adr = ARRAY_SIZE(rt711_0_adr), 185 .adr_d = rt711_0_adr, 186 }, 187 { 188 .mask = BIT(1), 189 .num_adr = ARRAY_SIZE(rt1308_1_group1_adr), 190 .adr_d = rt1308_1_group1_adr, 191 }, 192 { 193 .mask = BIT(2), 194 .num_adr = ARRAY_SIZE(rt1308_2_group1_adr), 195 .adr_d = rt1308_2_group1_adr, 196 }, 197 { 198 .mask = BIT(3), 199 .num_adr = ARRAY_SIZE(rt715_3_adr), 200 .adr_d = rt715_3_adr, 201 }, 202 {} 203 }; 204 205 static const struct snd_soc_acpi_link_adr adl_sdca_default[] = { 206 { 207 .mask = BIT(0), 208 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr), 209 .adr_d = rt711_sdca_0_adr, 210 }, 211 { 212 .mask = BIT(1), 213 .num_adr = ARRAY_SIZE(rt1316_1_group1_adr), 214 .adr_d = rt1316_1_group1_adr, 215 }, 216 { 217 .mask = BIT(2), 218 .num_adr = ARRAY_SIZE(rt1316_2_group1_adr), 219 .adr_d = rt1316_2_group1_adr, 220 }, 221 { 222 .mask = BIT(3), 223 .num_adr = ARRAY_SIZE(rt714_3_adr), 224 .adr_d = rt714_3_adr, 225 }, 226 {} 227 }; 228 229 static const struct snd_soc_acpi_link_adr adl_sdca_3_in_1[] = { 230 { 231 .mask = BIT(0), 232 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr), 233 .adr_d = rt711_sdca_0_adr, 234 }, 235 { 236 .mask = BIT(1), 237 .num_adr = ARRAY_SIZE(rt1316_1_group1_adr), 238 .adr_d = rt1316_1_group1_adr, 239 }, 240 { 241 .mask = BIT(2), 242 .num_adr = ARRAY_SIZE(rt714_2_adr), 243 .adr_d = rt714_2_adr, 244 }, 245 { 246 .mask = BIT(3), 247 .num_adr = ARRAY_SIZE(rt1316_3_group1_adr), 248 .adr_d = rt1316_3_group1_adr, 249 }, 250 {} 251 }; 252 253 static const struct snd_soc_acpi_link_adr adl_sdw_rt711_link2_rt1316_link01_rt714_link3[] = { 254 { 255 .mask = BIT(2), 256 .num_adr = ARRAY_SIZE(rt711_sdca_2_adr), 257 .adr_d = rt711_sdca_2_adr, 258 }, 259 { 260 .mask = BIT(0), 261 .num_adr = ARRAY_SIZE(rt1316_0_group2_adr), 262 .adr_d = rt1316_0_group2_adr, 263 }, 264 { 265 .mask = BIT(1), 266 .num_adr = ARRAY_SIZE(rt1316_1_group2_adr), 267 .adr_d = rt1316_1_group2_adr, 268 }, 269 { 270 .mask = BIT(3), 271 .num_adr = ARRAY_SIZE(rt714_3_adr), 272 .adr_d = rt714_3_adr, 273 }, 274 {} 275 }; 276 277 static const struct snd_soc_acpi_link_adr adl_sdw_rt711_link2_rt1316_link01[] = { 278 { 279 .mask = BIT(2), 280 .num_adr = ARRAY_SIZE(rt711_sdca_2_adr), 281 .adr_d = rt711_sdca_2_adr, 282 }, 283 { 284 .mask = BIT(0), 285 .num_adr = ARRAY_SIZE(rt1316_0_group2_adr), 286 .adr_d = rt1316_0_group2_adr, 287 }, 288 { 289 .mask = BIT(1), 290 .num_adr = ARRAY_SIZE(rt1316_1_group2_adr), 291 .adr_d = rt1316_1_group2_adr, 292 }, 293 {} 294 }; 295 296 static const struct snd_soc_acpi_link_adr adl_sdw_rt1316_link12_rt714_link0[] = { 297 { 298 .mask = BIT(1), 299 .num_adr = ARRAY_SIZE(rt1316_1_group1_adr), 300 .adr_d = rt1316_1_group1_adr, 301 }, 302 { 303 .mask = BIT(2), 304 .num_adr = ARRAY_SIZE(rt1316_2_group1_adr), 305 .adr_d = rt1316_2_group1_adr, 306 }, 307 { 308 .mask = BIT(0), 309 .num_adr = ARRAY_SIZE(rt714_0_adr), 310 .adr_d = rt714_0_adr, 311 }, 312 {} 313 }; 314 315 static const struct snd_soc_acpi_link_adr adl_sdw_rt1316_link2_rt714_link3[] = { 316 { 317 .mask = BIT(2), 318 .num_adr = ARRAY_SIZE(rt1316_2_single_adr), 319 .adr_d = rt1316_2_single_adr, 320 }, 321 { 322 .mask = BIT(3), 323 .num_adr = ARRAY_SIZE(rt714_3_adr), 324 .adr_d = rt714_3_adr, 325 }, 326 {} 327 }; 328 329 static const struct snd_soc_acpi_link_adr adl_sdw_rt1316_link2_rt714_link0[] = { 330 { 331 .mask = BIT(2), 332 .num_adr = ARRAY_SIZE(rt1316_2_single_adr), 333 .adr_d = rt1316_2_single_adr, 334 }, 335 { 336 .mask = BIT(0), 337 .num_adr = ARRAY_SIZE(rt714_0_adr), 338 .adr_d = rt714_0_adr, 339 }, 340 {} 341 }; 342 343 static const struct snd_soc_acpi_link_adr adl_sdw_rt711_link0_rt1316_link3[] = { 344 { 345 .mask = BIT(0), 346 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr), 347 .adr_d = rt711_sdca_0_adr, 348 }, 349 { 350 .mask = BIT(3), 351 .num_adr = ARRAY_SIZE(rt1316_3_single_adr), 352 .adr_d = rt1316_3_single_adr, 353 }, 354 {} 355 }; 356 357 static const struct snd_soc_acpi_adr_device mx8373_2_adr[] = { 358 { 359 .adr = 0x000223019F837300ull, 360 .num_endpoints = 1, 361 .endpoints = &spk_l_endpoint, 362 .name_prefix = "Left" 363 }, 364 { 365 .adr = 0x000227019F837300ull, 366 .num_endpoints = 1, 367 .endpoints = &spk_r_endpoint, 368 .name_prefix = "Right" 369 } 370 }; 371 372 static const struct snd_soc_acpi_adr_device rt5682_0_adr[] = { 373 { 374 .adr = 0x000021025D568200ull, 375 .num_endpoints = 1, 376 .endpoints = &single_endpoint, 377 .name_prefix = "rt5682" 378 } 379 }; 380 381 static const struct snd_soc_acpi_link_adr adl_rvp[] = { 382 { 383 .mask = BIT(0), 384 .num_adr = ARRAY_SIZE(rt711_0_adr), 385 .adr_d = rt711_0_adr, 386 }, 387 {} 388 }; 389 390 static const struct snd_soc_acpi_link_adr adlps_rvp[] = { 391 { 392 .mask = BIT(0), 393 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr), 394 .adr_d = rt711_sdca_0_adr, 395 }, 396 {} 397 }; 398 399 static const struct snd_soc_acpi_link_adr adl_chromebook_base[] = { 400 { 401 .mask = BIT(0), 402 .num_adr = ARRAY_SIZE(rt5682_0_adr), 403 .adr_d = rt5682_0_adr, 404 }, 405 { 406 .mask = BIT(2), 407 .num_adr = ARRAY_SIZE(mx8373_2_adr), 408 .adr_d = mx8373_2_adr, 409 }, 410 {} 411 }; 412 413 static const struct snd_soc_acpi_codecs adl_max98373_amp = { 414 .num_codecs = 1, 415 .codecs = {"MX98373"} 416 }; 417 418 static const struct snd_soc_acpi_codecs adl_max98357a_amp = { 419 .num_codecs = 1, 420 .codecs = {"MX98357A"} 421 }; 422 423 static const struct snd_soc_acpi_codecs adl_max98360a_amp = { 424 .num_codecs = 1, 425 .codecs = {"MX98360A"} 426 }; 427 428 static const struct snd_soc_acpi_codecs adl_rt5682_rt5682s_hp = { 429 .num_codecs = 2, 430 .codecs = {"10EC5682", "RTL5682"}, 431 }; 432 433 static const struct snd_soc_acpi_codecs adl_rt1015p_amp = { 434 .num_codecs = 1, 435 .codecs = {"RTL1015"} 436 }; 437 438 static const struct snd_soc_acpi_codecs adl_rt1019p_amp = { 439 .num_codecs = 1, 440 .codecs = {"RTL1019"} 441 }; 442 443 static const struct snd_soc_acpi_codecs adl_max98390_amp = { 444 .num_codecs = 1, 445 .codecs = {"MX98390"} 446 }; 447 448 static const struct snd_soc_acpi_codecs adl_lt6911_hdmi = { 449 .num_codecs = 1, 450 .codecs = {"INTC10B0"} 451 }; 452 453 static const struct snd_soc_acpi_codecs adl_nau8318_amp = { 454 .num_codecs = 1, 455 .codecs = {"NVTN2012"} 456 }; 457 458 struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = { 459 { 460 .comp_ids = &adl_rt5682_rt5682s_hp, 461 .drv_name = "adl_mx98373_rt5682", 462 .machine_quirk = snd_soc_acpi_codec_list, 463 .quirk_data = &adl_max98373_amp, 464 .sof_tplg_filename = "sof-adl-max98373-rt5682.tplg", 465 }, 466 { 467 .comp_ids = &adl_rt5682_rt5682s_hp, 468 .drv_name = "adl_mx98357_rt5682", 469 .machine_quirk = snd_soc_acpi_codec_list, 470 .quirk_data = &adl_max98357a_amp, 471 .sof_tplg_filename = "sof-adl-max98357a-rt5682.tplg", 472 }, 473 { 474 .comp_ids = &adl_rt5682_rt5682s_hp, 475 .drv_name = "adl_mx98360_rt5682", 476 .machine_quirk = snd_soc_acpi_codec_list, 477 .quirk_data = &adl_max98360a_amp, 478 .sof_tplg_filename = "sof-adl-max98360a-rt5682.tplg", 479 }, 480 { 481 .id = "10508825", 482 .drv_name = "adl_rt1019p_8825", 483 .machine_quirk = snd_soc_acpi_codec_list, 484 .quirk_data = &adl_rt1019p_amp, 485 .sof_tplg_filename = "sof-adl-rt1019-nau8825.tplg", 486 }, 487 { 488 .id = "10508825", 489 .drv_name = "adl_max98373_8825", 490 .machine_quirk = snd_soc_acpi_codec_list, 491 .quirk_data = &adl_max98373_amp, 492 .sof_tplg_filename = "sof-adl-max98373-nau8825.tplg", 493 }, 494 { 495 .id = "10508825", 496 .drv_name = "adl_mx98360a_8825", 497 .machine_quirk = snd_soc_acpi_codec_list, 498 .quirk_data = &adl_max98360a_amp, 499 .sof_tplg_filename = "sof-adl-max98360a-nau8825.tplg", 500 }, 501 { 502 .comp_ids = &adl_rt5682_rt5682s_hp, 503 .drv_name = "adl_rt1019_rt5682", 504 .machine_quirk = snd_soc_acpi_codec_list, 505 .quirk_data = &adl_rt1019p_amp, 506 .sof_tplg_filename = "sof-adl-rt1019-rt5682.tplg", 507 }, 508 { 509 .id = "10508825", 510 .drv_name = "adl_rt1015p_8825", 511 .machine_quirk = snd_soc_acpi_codec_list, 512 .quirk_data = &adl_rt1015p_amp, 513 .sof_tplg_filename = "sof-adl-rt1015-nau8825.tplg", 514 }, 515 { 516 .id = "10508825", 517 .drv_name = "adl_nau8318_8825", 518 .machine_quirk = snd_soc_acpi_codec_list, 519 .quirk_data = &adl_nau8318_amp, 520 .sof_tplg_filename = "sof-adl-nau8318-nau8825.tplg", 521 }, 522 { 523 .id = "10508825", 524 .drv_name = "sof_nau8825", 525 .sof_tplg_filename = "sof-adl-nau8825.tplg", 526 }, 527 { 528 .comp_ids = &adl_rt5682_rt5682s_hp, 529 .drv_name = "adl_max98390_rt5682", 530 .machine_quirk = snd_soc_acpi_codec_list, 531 .quirk_data = &adl_max98390_amp, 532 .sof_tplg_filename = "sof-adl-max98390-rt5682.tplg", 533 }, 534 { 535 .comp_ids = &adl_rt5682_rt5682s_hp, 536 .drv_name = "adl_rt5682", 537 .sof_tplg_filename = "sof-adl-rt5682.tplg", 538 }, 539 { 540 .id = "10134242", 541 .drv_name = "adl_mx98360a_cs4242", 542 .machine_quirk = snd_soc_acpi_codec_list, 543 .quirk_data = &adl_max98360a_amp, 544 .sof_tplg_filename = "sof-adl-max98360a-cs42l42.tplg", 545 }, 546 /* place amp-only boards in the end of table */ 547 { 548 .id = "CSC3541", 549 .drv_name = "adl_cs35l41", 550 .sof_tplg_filename = "sof-adl-cs35l41.tplg", 551 }, 552 { 553 .comp_ids = &essx_83x6, 554 .drv_name = "adl_es83x6_c1_h02", 555 .machine_quirk = snd_soc_acpi_codec_list, 556 .quirk_data = &adl_lt6911_hdmi, 557 .sof_tplg_filename = "sof-adl-es83x6-ssp1-hdmi-ssp02.tplg", 558 }, 559 { 560 .comp_ids = &essx_83x6, 561 .drv_name = "sof-essx8336", 562 .sof_tplg_filename = "sof-adl-es8336", /* the tplg suffix is added at run time */ 563 .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER | 564 SND_SOC_ACPI_TPLG_INTEL_SSP_MSB | 565 SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER, 566 }, 567 {}, 568 }; 569 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_adl_machines); 570 571 /* this table is used when there is no I2S codec present */ 572 struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_sdw_machines[] = { 573 { 574 .link_mask = 0xF, /* 4 active links required */ 575 .links = adl_default, 576 .drv_name = "sof_sdw", 577 .sof_tplg_filename = "sof-adl-rt711-l0-rt1308-l12-rt715-l3.tplg", 578 }, 579 { 580 .link_mask = 0xF, /* 4 active links required */ 581 .links = adl_sdca_default, 582 .drv_name = "sof_sdw", 583 .sof_tplg_filename = "sof-adl-rt711-l0-rt1316-l12-rt714-l3.tplg", 584 }, 585 { 586 .link_mask = 0xF, /* 4 active links required */ 587 .links = adl_sdca_3_in_1, 588 .drv_name = "sof_sdw", 589 .sof_tplg_filename = "sof-adl-rt711-l0-rt1316-l13-rt714-l2.tplg", 590 }, 591 { 592 .link_mask = 0xF, /* 4 active links required */ 593 .links = adl_sdw_rt711_link2_rt1316_link01_rt714_link3, 594 .drv_name = "sof_sdw", 595 .sof_tplg_filename = "sof-adl-rt711-l2-rt1316-l01-rt714-l3.tplg", 596 }, 597 { 598 .link_mask = 0x7, /* rt1316 on link0 and link1 & rt711 on link2*/ 599 .links = adl_sdw_rt711_link2_rt1316_link01, 600 .drv_name = "sof_sdw", 601 .sof_tplg_filename = "sof-adl-rt711-l2-rt1316-l01.tplg", 602 }, 603 { 604 .link_mask = 0xC, /* rt1316 on link2 & rt714 on link3 */ 605 .links = adl_sdw_rt1316_link2_rt714_link3, 606 .drv_name = "sof_sdw", 607 .sof_tplg_filename = "sof-adl-rt1316-l2-mono-rt714-l3.tplg", 608 }, 609 { 610 .link_mask = 0x7, /* rt714 on link0 & two rt1316s on link1 and link2 */ 611 .links = adl_sdw_rt1316_link12_rt714_link0, 612 .drv_name = "sof_sdw", 613 .sof_tplg_filename = "sof-adl-rt1316-l12-rt714-l0.tplg", 614 }, 615 { 616 .link_mask = 0x5, /* 2 active links required */ 617 .links = adl_sdw_rt1316_link2_rt714_link0, 618 .drv_name = "sof_sdw", 619 .sof_tplg_filename = "sof-adl-rt1316-l2-mono-rt714-l0.tplg", 620 }, 621 { 622 .link_mask = 0x9, /* 2 active links required */ 623 .links = adl_sdw_rt711_link0_rt1316_link3, 624 .drv_name = "sof_sdw", 625 .sof_tplg_filename = "sof-adl-rt711-l0-rt1316-l3.tplg", 626 }, 627 { 628 .link_mask = 0x1, /* link0 required */ 629 .links = adl_rvp, 630 .drv_name = "sof_sdw", 631 .sof_tplg_filename = "sof-adl-rt711.tplg", 632 }, 633 { 634 .link_mask = 0x1, /* link0 required */ 635 .links = adlps_rvp, 636 .drv_name = "sof_sdw", 637 .sof_tplg_filename = "sof-adl-rt711.tplg", 638 }, 639 { 640 .link_mask = 0x5, /* rt5682 on link0 & 2xmax98373 on link 2 */ 641 .links = adl_chromebook_base, 642 .drv_name = "sof_sdw", 643 .sof_tplg_filename = "sof-adl-sdw-max98373-rt5682.tplg", 644 }, 645 {}, 646 }; 647 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_adl_sdw_machines); 648