1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * soc-acpi-intel-ptl-match.c - tables and support for PTL ACPI enumeration. 4 * 5 * Copyright (c) 2024, Intel Corporation. 6 * 7 */ 8 9 #include <sound/soc-acpi.h> 10 #include <sound/soc-acpi-intel-match.h> 11 #include "soc-acpi-intel-sdca-quirks.h" 12 #include "soc-acpi-intel-sdw-mockup-match.h" 13 #include <sound/soc-acpi-intel-ssp-common.h> 14 15 static const struct snd_soc_acpi_codecs ptl_rt5682_rt5682s_hp = { 16 .num_codecs = 2, 17 .codecs = {RT5682_ACPI_HID, RT5682S_ACPI_HID}, 18 }; 19 20 struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_machines[] = { 21 { 22 .comp_ids = &ptl_rt5682_rt5682s_hp, 23 .drv_name = "ptl_rt5682_def", 24 .sof_tplg_filename = "sof-ptl", /* the tplg suffix is added at run time */ 25 .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME | 26 SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME, 27 }, 28 {}, 29 }; 30 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_ptl_machines); 31 32 static const struct snd_soc_acpi_endpoint single_endpoint = { 33 .num = 0, 34 .aggregated = 0, 35 .group_position = 0, 36 .group_id = 0, 37 }; 38 39 static const struct snd_soc_acpi_endpoint spk_l_endpoint = { 40 .num = 0, 41 .aggregated = 1, 42 .group_position = 0, 43 .group_id = 1, 44 }; 45 46 static const struct snd_soc_acpi_endpoint spk_r_endpoint = { 47 .num = 0, 48 .aggregated = 1, 49 .group_position = 1, 50 .group_id = 1, 51 }; 52 53 static const struct snd_soc_acpi_endpoint spk_1_endpoint = { 54 .num = 0, 55 .aggregated = 1, 56 .group_position = 1, 57 .group_id = 1, 58 }; 59 60 static const struct snd_soc_acpi_endpoint spk_2_endpoint = { 61 .num = 0, 62 .aggregated = 1, 63 .group_position = 2, 64 .group_id = 1, 65 }; 66 67 static const struct snd_soc_acpi_endpoint spk_3_endpoint = { 68 .num = 0, 69 .aggregated = 1, 70 .group_position = 3, 71 .group_id = 1, 72 }; 73 74 static const struct snd_soc_acpi_endpoint spk_4_endpoint = { 75 .num = 0, 76 .aggregated = 1, 77 .group_position = 4, 78 .group_id = 1, 79 }; 80 81 static const struct snd_soc_acpi_endpoint spk_5_endpoint = { 82 .num = 0, 83 .aggregated = 1, 84 .group_position = 5, 85 .group_id = 1, 86 }; 87 88 static const struct snd_soc_acpi_endpoint spk_6_endpoint = { 89 .num = 0, 90 .aggregated = 1, 91 .group_position = 6, 92 .group_id = 1, 93 }; 94 95 /* 96 * Multi-function codecs with three endpoints created for 97 * headset, amp and dmic functions. 98 */ 99 static const struct snd_soc_acpi_endpoint rt_mf_endpoints[] = { 100 { 101 .num = 0, 102 .aggregated = 0, 103 .group_position = 0, 104 .group_id = 0, 105 }, 106 { 107 .num = 1, 108 .aggregated = 0, 109 .group_position = 0, 110 .group_id = 0, 111 }, 112 { 113 .num = 2, 114 .aggregated = 0, 115 .group_position = 0, 116 .group_id = 0, 117 }, 118 }; 119 120 static const struct snd_soc_acpi_endpoint jack_dmic_endpoints[] = { 121 /* Jack Endpoint */ 122 { 123 .num = 0, 124 .aggregated = 0, 125 .group_position = 0, 126 .group_id = 0, 127 }, 128 /* DMIC Endpoint */ 129 { 130 .num = 1, 131 .aggregated = 0, 132 .group_position = 0, 133 .group_id = 0, 134 }, 135 }; 136 137 static const struct snd_soc_acpi_endpoint jack_amp_g1_dmic_endpoints_endpoints[] = { 138 /* Jack Endpoint */ 139 { 140 .num = 0, 141 .aggregated = 0, 142 .group_position = 0, 143 .group_id = 0, 144 }, 145 /* Amp Endpoint, work as spk_l_endpoint */ 146 { 147 .num = 1, 148 .aggregated = 1, 149 .group_position = 0, 150 .group_id = 1, 151 }, 152 /* DMIC Endpoint */ 153 { 154 .num = 2, 155 .aggregated = 0, 156 .group_position = 0, 157 .group_id = 0, 158 }, 159 }; 160 161 static const struct snd_soc_acpi_endpoint cs42l43_amp_spkagg_endpoints[] = { 162 { /* Jack Playback Endpoint */ 163 .num = 0, 164 .aggregated = 0, 165 .group_position = 0, 166 .group_id = 0, 167 }, 168 { /* DMIC Capture Endpoint */ 169 .num = 1, 170 .aggregated = 0, 171 .group_position = 0, 172 .group_id = 0, 173 }, 174 { /* Jack Capture Endpoint */ 175 .num = 2, 176 .aggregated = 0, 177 .group_position = 0, 178 .group_id = 0, 179 }, 180 { /* Speaker Playback Endpoint */ 181 .num = 3, 182 .aggregated = 1, 183 .group_position = 0, 184 .group_id = 1, 185 }, 186 }; 187 188 static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = { 189 { /* Jack Playback Endpoint */ 190 .num = 0, 191 .aggregated = 0, 192 .group_position = 0, 193 .group_id = 0, 194 }, 195 { /* DMIC Capture Endpoint */ 196 .num = 1, 197 .aggregated = 0, 198 .group_position = 0, 199 .group_id = 0, 200 }, 201 { /* Jack Capture Endpoint */ 202 .num = 2, 203 .aggregated = 0, 204 .group_position = 0, 205 .group_id = 0, 206 }, 207 { /* Speaker Playback Endpoint */ 208 .num = 3, 209 .aggregated = 0, 210 .group_position = 0, 211 .group_id = 0, 212 }, 213 }; 214 215 static const struct snd_soc_acpi_adr_device cs42l43_2_adr[] = { 216 { 217 .adr = 0x00023001fa424301ull, 218 .num_endpoints = ARRAY_SIZE(cs42l43_amp_spkagg_endpoints), 219 .endpoints = cs42l43_amp_spkagg_endpoints, 220 .name_prefix = "cs42l43" 221 } 222 }; 223 224 static const struct snd_soc_acpi_adr_device cs35l56_1_3amp_adr[] = { 225 { 226 .adr = 0x00013001fa355601ull, 227 .num_endpoints = 1, 228 .endpoints = &spk_1_endpoint, 229 .name_prefix = "AMP1" 230 }, 231 { 232 .adr = 0x00013101fa355601ull, 233 .num_endpoints = 1, 234 .endpoints = &spk_2_endpoint, 235 .name_prefix = "AMP2" 236 }, 237 { 238 .adr = 0x00013201fa355601ull, 239 .num_endpoints = 1, 240 .endpoints = &spk_3_endpoint, 241 .name_prefix = "AMP3" 242 } 243 }; 244 245 static const struct snd_soc_acpi_adr_device cs35l56_3_3amp_adr[] = { 246 { 247 .adr = 0x00033301fa355601ull, 248 .num_endpoints = 1, 249 .endpoints = &spk_4_endpoint, 250 .name_prefix = "AMP4" 251 }, 252 { 253 .adr = 0x00033401fa355601ull, 254 .num_endpoints = 1, 255 .endpoints = &spk_5_endpoint, 256 .name_prefix = "AMP5" 257 }, 258 { 259 .adr = 0x00033501fa355601ull, 260 .num_endpoints = 1, 261 .endpoints = &spk_6_endpoint, 262 .name_prefix = "AMP6" 263 } 264 }; 265 266 static const struct snd_soc_acpi_adr_device cs42l43_3_adr[] = { 267 { 268 .adr = 0x00033001FA424301ull, 269 .num_endpoints = ARRAY_SIZE(cs42l43_endpoints), 270 .endpoints = cs42l43_endpoints, 271 .name_prefix = "cs42l43" 272 } 273 }; 274 275 static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = { 276 { 277 .adr = 0x000030025D071101ull, 278 .num_endpoints = 1, 279 .endpoints = &single_endpoint, 280 .name_prefix = "rt711" 281 } 282 }; 283 284 static const struct snd_soc_acpi_adr_device rt712_vb_2_group1_adr[] = { 285 { 286 .adr = 0x000230025D071201ull, 287 .num_endpoints = ARRAY_SIZE(jack_amp_g1_dmic_endpoints_endpoints), 288 .endpoints = jack_amp_g1_dmic_endpoints_endpoints, 289 .name_prefix = "rt712" 290 } 291 }; 292 293 static const struct snd_soc_acpi_adr_device rt712_vb_3_group1_adr[] = { 294 { 295 .adr = 0x000330025D071201ull, 296 .num_endpoints = ARRAY_SIZE(jack_amp_g1_dmic_endpoints_endpoints), 297 .endpoints = jack_amp_g1_dmic_endpoints_endpoints, 298 .name_prefix = "rt712" 299 } 300 }; 301 302 static const struct snd_soc_acpi_adr_device rt713_vb_2_adr[] = { 303 { 304 .adr = 0x000230025d071301ull, 305 .num_endpoints = ARRAY_SIZE(jack_dmic_endpoints), 306 .endpoints = jack_dmic_endpoints, 307 .name_prefix = "rt713" 308 } 309 }; 310 311 static const struct snd_soc_acpi_adr_device rt713_vb_3_adr[] = { 312 { 313 .adr = 0x000330025D071301ull, 314 .num_endpoints = ARRAY_SIZE(jack_dmic_endpoints), 315 .endpoints = jack_dmic_endpoints, 316 .name_prefix = "rt713" 317 } 318 }; 319 320 static const struct snd_soc_acpi_adr_device rt721_3_single_adr[] = { 321 { 322 .adr = 0x000330025d072101ull, 323 .num_endpoints = ARRAY_SIZE(rt_mf_endpoints), 324 .endpoints = rt_mf_endpoints, 325 .name_prefix = "rt721" 326 } 327 }; 328 329 static const struct snd_soc_acpi_link_adr ptl_rt721_l3[] = { 330 { 331 .mask = BIT(3), 332 .num_adr = ARRAY_SIZE(rt721_3_single_adr), 333 .adr_d = rt721_3_single_adr, 334 }, 335 {}, 336 }; 337 338 static const struct snd_soc_acpi_adr_device rt722_0_single_adr[] = { 339 { 340 .adr = 0x000030025d072201ull, 341 .num_endpoints = ARRAY_SIZE(rt_mf_endpoints), 342 .endpoints = rt_mf_endpoints, 343 .name_prefix = "rt722" 344 } 345 }; 346 347 static const struct snd_soc_acpi_adr_device rt722_1_single_adr[] = { 348 { 349 .adr = 0x000130025d072201ull, 350 .num_endpoints = ARRAY_SIZE(rt_mf_endpoints), 351 .endpoints = rt_mf_endpoints, 352 .name_prefix = "rt722" 353 } 354 }; 355 356 static const struct snd_soc_acpi_adr_device rt722_3_single_adr[] = { 357 { 358 .adr = 0x000330025d072201ull, 359 .num_endpoints = ARRAY_SIZE(rt_mf_endpoints), 360 .endpoints = rt_mf_endpoints, 361 .name_prefix = "rt722" 362 } 363 }; 364 365 static const struct snd_soc_acpi_adr_device rt1320_1_group1_adr[] = { 366 { 367 .adr = 0x000130025D132001ull, 368 .num_endpoints = 1, 369 .endpoints = &spk_r_endpoint, 370 .name_prefix = "rt1320-1" 371 } 372 }; 373 374 static const struct snd_soc_acpi_adr_device rt1320_1_group2_adr[] = { 375 { 376 .adr = 0x000130025D132001ull, 377 .num_endpoints = 1, 378 .endpoints = &spk_l_endpoint, 379 .name_prefix = "rt1320-1" 380 } 381 }; 382 383 static const struct snd_soc_acpi_adr_device rt1320_2_group1_adr[] = { 384 { 385 .adr = 0x000230025D132001ull, 386 .num_endpoints = 1, 387 .endpoints = &spk_r_endpoint, 388 .name_prefix = "rt1320-1" 389 } 390 }; 391 392 static const struct snd_soc_acpi_adr_device rt1320_2_group2_adr[] = { 393 { 394 .adr = 0x000230025D132001ull, 395 .num_endpoints = 1, 396 .endpoints = &spk_r_endpoint, 397 .name_prefix = "rt1320-1" 398 } 399 }; 400 401 static const struct snd_soc_acpi_adr_device rt1320_3_group2_adr[] = { 402 { 403 .adr = 0x000330025D132001ull, 404 .num_endpoints = 1, 405 .endpoints = &spk_r_endpoint, 406 .name_prefix = "rt1320-2" 407 } 408 }; 409 410 static const struct snd_soc_acpi_link_adr ptl_cs42l43_l2_cs35l56x6_l13[] = { 411 { 412 .mask = BIT(2), 413 .num_adr = ARRAY_SIZE(cs42l43_2_adr), 414 .adr_d = cs42l43_2_adr, 415 }, 416 { 417 .mask = BIT(1), 418 .num_adr = ARRAY_SIZE(cs35l56_1_3amp_adr), 419 .adr_d = cs35l56_1_3amp_adr, 420 }, 421 { 422 .mask = BIT(3), 423 .num_adr = ARRAY_SIZE(cs35l56_3_3amp_adr), 424 .adr_d = cs35l56_3_3amp_adr, 425 }, 426 {} 427 }; 428 429 static const struct snd_soc_acpi_link_adr ptl_cs42l43_l3[] = { 430 { 431 .mask = BIT(3), 432 .num_adr = ARRAY_SIZE(cs42l43_3_adr), 433 .adr_d = cs42l43_3_adr, 434 } 435 }; 436 437 static const struct snd_soc_acpi_link_adr ptl_rt722_only[] = { 438 { 439 .mask = BIT(0), 440 .num_adr = ARRAY_SIZE(rt722_0_single_adr), 441 .adr_d = rt722_0_single_adr, 442 }, 443 {} 444 }; 445 446 static const struct snd_soc_acpi_link_adr ptl_rt722_l1[] = { 447 { 448 .mask = BIT(1), 449 .num_adr = ARRAY_SIZE(rt722_1_single_adr), 450 .adr_d = rt722_1_single_adr, 451 }, 452 {} 453 }; 454 455 static const struct snd_soc_acpi_link_adr ptl_rt722_l3[] = { 456 { 457 .mask = BIT(3), 458 .num_adr = ARRAY_SIZE(rt722_3_single_adr), 459 .adr_d = rt722_3_single_adr, 460 }, 461 {} 462 }; 463 464 static const struct snd_soc_acpi_link_adr ptl_rvp[] = { 465 { 466 .mask = BIT(0), 467 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr), 468 .adr_d = rt711_sdca_0_adr, 469 }, 470 {} 471 }; 472 473 static const struct snd_soc_acpi_link_adr ptl_sdw_rt713_vb_l2_rt1320_l13[] = { 474 { 475 .mask = BIT(2), 476 .num_adr = ARRAY_SIZE(rt713_vb_2_adr), 477 .adr_d = rt713_vb_2_adr, 478 }, 479 { 480 .mask = BIT(1), 481 .num_adr = ARRAY_SIZE(rt1320_1_group2_adr), 482 .adr_d = rt1320_1_group2_adr, 483 }, 484 { 485 .mask = BIT(3), 486 .num_adr = ARRAY_SIZE(rt1320_3_group2_adr), 487 .adr_d = rt1320_3_group2_adr, 488 }, 489 {} 490 }; 491 492 static const struct snd_soc_acpi_link_adr ptl_sdw_rt713_vb_l3_rt1320_l12[] = { 493 { 494 .mask = BIT(3), 495 .num_adr = ARRAY_SIZE(rt713_vb_3_adr), 496 .adr_d = rt713_vb_3_adr, 497 }, 498 { 499 .mask = BIT(1), 500 .num_adr = ARRAY_SIZE(rt1320_1_group2_adr), 501 .adr_d = rt1320_1_group2_adr, 502 }, 503 { 504 .mask = BIT(2), 505 .num_adr = ARRAY_SIZE(rt1320_2_group2_adr), 506 .adr_d = rt1320_2_group2_adr, 507 }, 508 {} 509 }; 510 511 static const struct snd_soc_acpi_link_adr ptl_sdw_rt712_vb_l2_rt1320_l1[] = { 512 { 513 .mask = BIT(2), 514 .num_adr = ARRAY_SIZE(rt712_vb_2_group1_adr), 515 .adr_d = rt712_vb_2_group1_adr, 516 }, 517 { 518 .mask = BIT(1), 519 .num_adr = ARRAY_SIZE(rt1320_1_group1_adr), 520 .adr_d = rt1320_1_group1_adr, 521 }, 522 {} 523 }; 524 525 static const struct snd_soc_acpi_link_adr ptl_sdw_rt712_vb_l3_rt1320_l2[] = { 526 { 527 .mask = BIT(3), 528 .num_adr = ARRAY_SIZE(rt712_vb_3_group1_adr), 529 .adr_d = rt712_vb_3_group1_adr, 530 }, 531 { 532 .mask = BIT(2), 533 .num_adr = ARRAY_SIZE(rt1320_2_group1_adr), 534 .adr_d = rt1320_2_group1_adr, 535 }, 536 {} 537 }; 538 539 /* this table is used when there is no I2S codec present */ 540 struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_sdw_machines[] = { 541 /* mockup tests need to be first */ 542 { 543 .link_mask = GENMASK(3, 0), 544 .links = sdw_mockup_headset_2amps_mic, 545 .drv_name = "sof_sdw", 546 .sof_tplg_filename = "sof-ptl-rt711-rt1308-rt715.tplg", 547 }, 548 { 549 .link_mask = BIT(0) | BIT(1) | BIT(3), 550 .links = sdw_mockup_headset_1amp_mic, 551 .drv_name = "sof_sdw", 552 .sof_tplg_filename = "sof-ptl-rt711-rt1308-mono-rt715.tplg", 553 }, 554 { 555 .link_mask = GENMASK(2, 0), 556 .links = sdw_mockup_mic_headset_1amp, 557 .drv_name = "sof_sdw", 558 .sof_tplg_filename = "sof-ptl-rt715-rt711-rt1308-mono.tplg", 559 }, 560 { 561 .link_mask = BIT(1) | BIT(2) | BIT(3), 562 .links = ptl_cs42l43_l2_cs35l56x6_l13, 563 .drv_name = "sof_sdw", 564 .sof_tplg_filename = "sof-ptl-cs42l43-l2-cs35l56x6-l13.tplg", 565 }, 566 { 567 .link_mask = BIT(0), 568 .links = sdw_mockup_multi_func, 569 .drv_name = "sof_sdw", 570 .sof_tplg_filename = "sof-ptl-rt722.tplg", /* Reuse the existing tplg file */ 571 }, 572 { 573 .link_mask = BIT(0), 574 .links = ptl_rvp, 575 .drv_name = "sof_sdw", 576 .sof_tplg_filename = "sof-ptl-rt711.tplg", 577 }, 578 { 579 .link_mask = BIT(3), 580 .links = ptl_cs42l43_l3, 581 .drv_name = "sof_sdw", 582 .sof_tplg_filename = "sof-ptl-cs42l43-l3.tplg", 583 }, 584 { 585 .link_mask = BIT(3), 586 .links = ptl_rt721_l3, 587 .drv_name = "sof_sdw", 588 .sof_tplg_filename = "sof-ptl-rt721.tplg", 589 }, 590 { 591 .link_mask = BIT(0), 592 .links = ptl_rt722_only, 593 .drv_name = "sof_sdw", 594 .sof_tplg_filename = "sof-ptl-rt722.tplg", 595 }, 596 { 597 .link_mask = BIT(1), 598 .links = ptl_rt722_l1, 599 .drv_name = "sof_sdw", 600 .sof_tplg_filename = "sof-ptl-rt722.tplg", 601 }, 602 { 603 .link_mask = BIT(3), 604 .links = ptl_rt722_l3, 605 .drv_name = "sof_sdw", 606 .sof_tplg_filename = "sof-ptl-rt722.tplg", 607 }, 608 { 609 .link_mask = BIT(1) | BIT(2), 610 .links = ptl_sdw_rt712_vb_l2_rt1320_l1, 611 .drv_name = "sof_sdw", 612 .machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb, 613 .sof_tplg_filename = "sof-ptl-rt712-l2-rt1320-l1.tplg" 614 }, 615 { 616 .link_mask = BIT(2) | BIT(3), 617 .links = ptl_sdw_rt712_vb_l3_rt1320_l2, 618 .drv_name = "sof_sdw", 619 .machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb, 620 .sof_tplg_filename = "sof-ptl-rt712-l3-rt1320-l2.tplg" 621 }, 622 { 623 .link_mask = BIT(1) | BIT(2) | BIT(3), 624 .links = ptl_sdw_rt713_vb_l2_rt1320_l13, 625 .drv_name = "sof_sdw", 626 .machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb, 627 .sof_tplg_filename = "sof-ptl-rt713-l2-rt1320-l13.tplg" 628 }, 629 { 630 .link_mask = BIT(1) | BIT(2) | BIT(3), 631 .links = ptl_sdw_rt713_vb_l3_rt1320_l12, 632 .drv_name = "sof_sdw", 633 .machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb, 634 .sof_tplg_filename = "sof-ptl-rt713-l3-rt1320-l12.tplg" 635 }, 636 {}, 637 }; 638 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_ptl_sdw_machines); 639