1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * soc-acpi-intel-mtl-match.c - tables and support for MTL ACPI enumeration. 4 * 5 * Copyright (c) 2022, Intel Corporation. 6 * 7 */ 8 9 #include <sound/soc-acpi.h> 10 #include <sound/soc-acpi-intel-match.h> 11 #include "soc-acpi-intel-sdw-mockup-match.h" 12 13 static const struct snd_soc_acpi_codecs mtl_max98357a_amp = { 14 .num_codecs = 1, 15 .codecs = {"MX98357A"} 16 }; 17 18 static const struct snd_soc_acpi_codecs mtl_max98360a_amp = { 19 .num_codecs = 1, 20 .codecs = {"MX98360A"} 21 }; 22 23 static const struct snd_soc_acpi_codecs mtl_rt1019p_amp = { 24 .num_codecs = 1, 25 .codecs = {"RTL1019"} 26 }; 27 28 static const struct snd_soc_acpi_codecs mtl_rt5682_rt5682s_hp = { 29 .num_codecs = 2, 30 .codecs = {"10EC5682", "RTL5682"}, 31 }; 32 33 static const struct snd_soc_acpi_codecs mtl_essx_83x6 = { 34 .num_codecs = 3, 35 .codecs = { "ESSX8316", "ESSX8326", "ESSX8336"}, 36 }; 37 38 static const struct snd_soc_acpi_codecs mtl_lt6911_hdmi = { 39 .num_codecs = 1, 40 .codecs = {"INTC10B0"} 41 }; 42 43 struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_machines[] = { 44 { 45 .comp_ids = &mtl_rt5682_rt5682s_hp, 46 .drv_name = "mtl_mx98357_rt5682", 47 .machine_quirk = snd_soc_acpi_codec_list, 48 .quirk_data = &mtl_max98357a_amp, 49 .sof_tplg_filename = "sof-mtl-max98357a-rt5682.tplg", 50 }, 51 { 52 .comp_ids = &mtl_rt5682_rt5682s_hp, 53 .drv_name = "mtl_mx98360_rt5682", 54 .machine_quirk = snd_soc_acpi_codec_list, 55 .quirk_data = &mtl_max98360a_amp, 56 .sof_tplg_filename = "sof-mtl-max98360a-rt5682.tplg", 57 }, 58 { 59 .comp_ids = &mtl_rt5682_rt5682s_hp, 60 .drv_name = "mtl_rt1019_rt5682", 61 .machine_quirk = snd_soc_acpi_codec_list, 62 .quirk_data = &mtl_rt1019p_amp, 63 .sof_tplg_filename = "sof-mtl-rt1019-rt5682.tplg", 64 }, 65 { 66 .comp_ids = &mtl_essx_83x6, 67 .drv_name = "mtl_es83x6_c1_h02", 68 .machine_quirk = snd_soc_acpi_codec_list, 69 .quirk_data = &mtl_lt6911_hdmi, 70 .sof_tplg_filename = "sof-mtl-es83x6-ssp1-hdmi-ssp02.tplg", 71 }, 72 { 73 .comp_ids = &mtl_essx_83x6, 74 .drv_name = "sof-essx8336", 75 .sof_tplg_filename = "sof-mtl-es8336", /* the tplg suffix is added at run time */ 76 .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER | 77 SND_SOC_ACPI_TPLG_INTEL_SSP_MSB | 78 SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER, 79 }, 80 /* place amp-only boards in the end of table */ 81 { 82 .id = "INTC10B0", 83 .drv_name = "mtl_lt6911_hdmi_ssp", 84 .sof_tplg_filename = "sof-mtl-hdmi-ssp02.tplg", 85 }, 86 {}, 87 }; 88 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_mtl_machines); 89 90 static const struct snd_soc_acpi_endpoint single_endpoint = { 91 .num = 0, 92 .aggregated = 0, 93 .group_position = 0, 94 .group_id = 0, 95 }; 96 97 static const struct snd_soc_acpi_endpoint spk_l_endpoint = { 98 .num = 0, 99 .aggregated = 1, 100 .group_position = 0, 101 .group_id = 1, 102 }; 103 104 static const struct snd_soc_acpi_endpoint spk_r_endpoint = { 105 .num = 0, 106 .aggregated = 1, 107 .group_position = 1, 108 .group_id = 1, 109 }; 110 111 static const struct snd_soc_acpi_endpoint rt712_endpoints[] = { 112 { 113 .num = 0, 114 .aggregated = 0, 115 .group_position = 0, 116 .group_id = 0, 117 }, 118 { 119 .num = 1, 120 .aggregated = 0, 121 .group_position = 0, 122 .group_id = 0, 123 }, 124 }; 125 126 static const struct snd_soc_acpi_endpoint spk_2_endpoint = { 127 .num = 0, 128 .aggregated = 1, 129 .group_position = 2, 130 .group_id = 1, 131 }; 132 133 static const struct snd_soc_acpi_endpoint spk_3_endpoint = { 134 .num = 0, 135 .aggregated = 1, 136 .group_position = 3, 137 .group_id = 1, 138 }; 139 140 static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = { 141 { 142 .adr = 0x000030025D071101ull, 143 .num_endpoints = 1, 144 .endpoints = &single_endpoint, 145 .name_prefix = "rt711" 146 } 147 }; 148 149 static const struct snd_soc_acpi_adr_device rt712_0_single_adr[] = { 150 { 151 .adr = 0x000030025D071201ull, 152 .num_endpoints = ARRAY_SIZE(rt712_endpoints), 153 .endpoints = rt712_endpoints, 154 .name_prefix = "rt712" 155 } 156 }; 157 158 static const struct snd_soc_acpi_adr_device rt1712_3_single_adr[] = { 159 { 160 .adr = 0x000330025D171201ull, 161 .num_endpoints = 1, 162 .endpoints = &single_endpoint, 163 .name_prefix = "rt712-dmic" 164 } 165 }; 166 167 static const struct snd_soc_acpi_adr_device rt713_0_single_adr[] = { 168 { 169 .adr = 0x000031025D071301ull, 170 .num_endpoints = 1, 171 .endpoints = &single_endpoint, 172 .name_prefix = "rt713" 173 } 174 }; 175 176 static const struct snd_soc_acpi_adr_device rt1713_3_single_adr[] = { 177 { 178 .adr = 0x000331025D171301ull, 179 .num_endpoints = 1, 180 .endpoints = &single_endpoint, 181 .name_prefix = "rt713-dmic" 182 } 183 }; 184 185 static const struct snd_soc_acpi_adr_device mx8373_0_adr[] = { 186 { 187 .adr = 0x000023019F837300ull, 188 .num_endpoints = 1, 189 .endpoints = &spk_l_endpoint, 190 .name_prefix = "Left" 191 }, 192 { 193 .adr = 0x000027019F837300ull, 194 .num_endpoints = 1, 195 .endpoints = &spk_r_endpoint, 196 .name_prefix = "Right" 197 } 198 }; 199 200 static const struct snd_soc_acpi_adr_device rt5682_2_adr[] = { 201 { 202 .adr = 0x000221025D568200ull, 203 .num_endpoints = 1, 204 .endpoints = &single_endpoint, 205 .name_prefix = "rt5682" 206 } 207 }; 208 209 static const struct snd_soc_acpi_adr_device rt1316_2_group1_adr[] = { 210 { 211 .adr = 0x000230025D131601ull, 212 .num_endpoints = 1, 213 .endpoints = &spk_l_endpoint, 214 .name_prefix = "rt1316-1" 215 } 216 }; 217 218 static const struct snd_soc_acpi_adr_device rt1316_3_group1_adr[] = { 219 { 220 .adr = 0x000331025D131601ull, 221 .num_endpoints = 1, 222 .endpoints = &spk_r_endpoint, 223 .name_prefix = "rt1316-2" 224 } 225 }; 226 227 static const struct snd_soc_acpi_adr_device rt1316_1_group2_adr[] = { 228 { 229 .adr = 0x000131025D131601ull, 230 .num_endpoints = 1, 231 .endpoints = &spk_l_endpoint, 232 .name_prefix = "rt1316-1" 233 } 234 }; 235 236 static const struct snd_soc_acpi_adr_device rt1316_2_group2_adr[] = { 237 { 238 .adr = 0x000230025D131601ull, 239 .num_endpoints = 1, 240 .endpoints = &spk_r_endpoint, 241 .name_prefix = "rt1316-2" 242 } 243 }; 244 245 static const struct snd_soc_acpi_adr_device rt1318_1_group1_adr[] = { 246 { 247 .adr = 0x000130025D131801ull, 248 .num_endpoints = 1, 249 .endpoints = &spk_l_endpoint, 250 .name_prefix = "rt1318-1" 251 } 252 }; 253 254 static const struct snd_soc_acpi_adr_device rt1318_2_group1_adr[] = { 255 { 256 .adr = 0x000232025D131801ull, 257 .num_endpoints = 1, 258 .endpoints = &spk_r_endpoint, 259 .name_prefix = "rt1318-2" 260 } 261 }; 262 263 static const struct snd_soc_acpi_adr_device rt714_0_adr[] = { 264 { 265 .adr = 0x000030025D071401ull, 266 .num_endpoints = 1, 267 .endpoints = &single_endpoint, 268 .name_prefix = "rt714" 269 } 270 }; 271 272 static const struct snd_soc_acpi_adr_device rt714_1_adr[] = { 273 { 274 .adr = 0x000130025D071401ull, 275 .num_endpoints = 1, 276 .endpoints = &single_endpoint, 277 .name_prefix = "rt714" 278 } 279 }; 280 281 static const struct snd_soc_acpi_link_adr mtl_712_only[] = { 282 { 283 .mask = BIT(0), 284 .num_adr = ARRAY_SIZE(rt712_0_single_adr), 285 .adr_d = rt712_0_single_adr, 286 }, 287 { 288 .mask = BIT(3), 289 .num_adr = ARRAY_SIZE(rt1712_3_single_adr), 290 .adr_d = rt1712_3_single_adr, 291 }, 292 {} 293 }; 294 295 static const struct snd_soc_acpi_adr_device cs42l43_0_adr[] = { 296 { 297 .adr = 0x00003001FA424301ull, 298 .num_endpoints = 1, 299 .endpoints = &single_endpoint, 300 .name_prefix = "cs42l43" 301 } 302 }; 303 304 static const struct snd_soc_acpi_adr_device cs35l56_1_adr[] = { 305 { 306 .adr = 0x00013701FA355601ull, 307 .num_endpoints = 1, 308 .endpoints = &spk_r_endpoint, 309 .name_prefix = "cs35l56-8" 310 }, 311 { 312 .adr = 0x00013601FA355601ull, 313 .num_endpoints = 1, 314 .endpoints = &spk_3_endpoint, 315 .name_prefix = "cs35l56-7" 316 } 317 }; 318 319 static const struct snd_soc_acpi_adr_device cs35l56_2_adr[] = { 320 { 321 .adr = 0x00023301FA355601ull, 322 .num_endpoints = 1, 323 .endpoints = &spk_l_endpoint, 324 .name_prefix = "cs35l56-1" 325 }, 326 { 327 .adr = 0x00023201FA355601ull, 328 .num_endpoints = 1, 329 .endpoints = &spk_2_endpoint, 330 .name_prefix = "cs35l56-2" 331 } 332 }; 333 334 static const struct snd_soc_acpi_link_adr rt5682_link2_max98373_link0[] = { 335 /* Expected order: jack -> amp */ 336 { 337 .mask = BIT(2), 338 .num_adr = ARRAY_SIZE(rt5682_2_adr), 339 .adr_d = rt5682_2_adr, 340 }, 341 { 342 .mask = BIT(0), 343 .num_adr = ARRAY_SIZE(mx8373_0_adr), 344 .adr_d = mx8373_0_adr, 345 }, 346 {} 347 }; 348 349 static const struct snd_soc_acpi_link_adr mtl_rvp[] = { 350 { 351 .mask = BIT(0), 352 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr), 353 .adr_d = rt711_sdca_0_adr, 354 }, 355 {} 356 }; 357 358 static const struct snd_soc_acpi_link_adr mtl_3_in_1_sdca[] = { 359 { 360 .mask = BIT(0), 361 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr), 362 .adr_d = rt711_sdca_0_adr, 363 }, 364 { 365 .mask = BIT(2), 366 .num_adr = ARRAY_SIZE(rt1316_2_group1_adr), 367 .adr_d = rt1316_2_group1_adr, 368 }, 369 { 370 .mask = BIT(3), 371 .num_adr = ARRAY_SIZE(rt1316_3_group1_adr), 372 .adr_d = rt1316_3_group1_adr, 373 }, 374 { 375 .mask = BIT(1), 376 .num_adr = ARRAY_SIZE(rt714_1_adr), 377 .adr_d = rt714_1_adr, 378 }, 379 {} 380 }; 381 382 static const struct snd_soc_acpi_link_adr mtl_sdw_rt1318_l12_rt714_l0[] = { 383 { 384 .mask = BIT(1), 385 .num_adr = ARRAY_SIZE(rt1318_1_group1_adr), 386 .adr_d = rt1318_1_group1_adr, 387 }, 388 { 389 .mask = BIT(2), 390 .num_adr = ARRAY_SIZE(rt1318_2_group1_adr), 391 .adr_d = rt1318_2_group1_adr, 392 }, 393 { 394 .mask = BIT(0), 395 .num_adr = ARRAY_SIZE(rt714_0_adr), 396 .adr_d = rt714_0_adr, 397 }, 398 {} 399 }; 400 401 static const struct snd_soc_acpi_link_adr mtl_rt713_l0_rt1316_l12_rt1713_l3[] = { 402 { 403 .mask = BIT(0), 404 .num_adr = ARRAY_SIZE(rt713_0_single_adr), 405 .adr_d = rt713_0_single_adr, 406 }, 407 { 408 .mask = BIT(1), 409 .num_adr = ARRAY_SIZE(rt1316_1_group2_adr), 410 .adr_d = rt1316_1_group2_adr, 411 }, 412 { 413 .mask = BIT(2), 414 .num_adr = ARRAY_SIZE(rt1316_2_group2_adr), 415 .adr_d = rt1316_2_group2_adr, 416 }, 417 { 418 .mask = BIT(3), 419 .num_adr = ARRAY_SIZE(rt1713_3_single_adr), 420 .adr_d = rt1713_3_single_adr, 421 }, 422 {} 423 }; 424 425 static const struct snd_soc_acpi_adr_device mx8363_2_adr[] = { 426 { 427 .adr = 0x000230019F836300ull, 428 .num_endpoints = 1, 429 .endpoints = &spk_l_endpoint, 430 .name_prefix = "Left" 431 }, 432 { 433 .adr = 0x000231019F836300ull, 434 .num_endpoints = 1, 435 .endpoints = &spk_r_endpoint, 436 .name_prefix = "Right" 437 } 438 }; 439 440 static const struct snd_soc_acpi_adr_device cs42l42_0_adr[] = { 441 { 442 .adr = 0x00001001FA424200ull, 443 .num_endpoints = 1, 444 .endpoints = &single_endpoint, 445 .name_prefix = "cs42l42" 446 } 447 }; 448 449 static const struct snd_soc_acpi_link_adr cs42l42_link0_max98363_link2[] = { 450 /* Expected order: jack -> amp */ 451 { 452 .mask = BIT(0), 453 .num_adr = ARRAY_SIZE(cs42l42_0_adr), 454 .adr_d = cs42l42_0_adr, 455 }, 456 { 457 .mask = BIT(2), 458 .num_adr = ARRAY_SIZE(mx8363_2_adr), 459 .adr_d = mx8363_2_adr, 460 }, 461 {} 462 }; 463 464 static const struct snd_soc_acpi_link_adr mtl_cs42l43_cs35l56[] = { 465 { 466 .mask = BIT(0), 467 .num_adr = ARRAY_SIZE(cs42l43_0_adr), 468 .adr_d = cs42l43_0_adr, 469 }, 470 { 471 .mask = BIT(1), 472 .num_adr = ARRAY_SIZE(cs35l56_1_adr), 473 .adr_d = cs35l56_1_adr, 474 }, 475 { 476 .mask = BIT(2), 477 .num_adr = ARRAY_SIZE(cs35l56_2_adr), 478 .adr_d = cs35l56_2_adr, 479 }, 480 {} 481 }; 482 483 /* this table is used when there is no I2S codec present */ 484 struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = { 485 /* mockup tests need to be first */ 486 { 487 .link_mask = GENMASK(3, 0), 488 .links = sdw_mockup_headset_2amps_mic, 489 .drv_name = "sof_sdw", 490 .sof_tplg_filename = "sof-mtl-rt711-rt1308-rt715.tplg", 491 }, 492 { 493 .link_mask = BIT(0) | BIT(1) | BIT(3), 494 .links = sdw_mockup_headset_1amp_mic, 495 .drv_name = "sof_sdw", 496 .sof_tplg_filename = "sof-mtl-rt711-rt1308-mono-rt715.tplg", 497 }, 498 { 499 .link_mask = GENMASK(2, 0), 500 .links = sdw_mockup_mic_headset_1amp, 501 .drv_name = "sof_sdw", 502 .sof_tplg_filename = "sof-mtl-rt715-rt711-rt1308-mono.tplg", 503 }, 504 { 505 .link_mask = GENMASK(3, 0), 506 .links = mtl_rt713_l0_rt1316_l12_rt1713_l3, 507 .drv_name = "sof_sdw", 508 .sof_tplg_filename = "sof-mtl-rt713-l0-rt1316-l12-rt1713-l3.tplg", 509 }, 510 { 511 .link_mask = BIT(3) | BIT(0), 512 .links = mtl_712_only, 513 .drv_name = "sof_sdw", 514 .sof_tplg_filename = "sof-mtl-rt712-l0-rt1712-l3.tplg", 515 }, 516 { 517 .link_mask = GENMASK(2, 0), 518 .links = mtl_sdw_rt1318_l12_rt714_l0, 519 .drv_name = "sof_sdw", 520 .sof_tplg_filename = "sof-mtl-rt1318-l12-rt714-l0.tplg" 521 }, 522 { 523 .link_mask = GENMASK(2, 0), 524 .links = mtl_cs42l43_cs35l56, 525 .drv_name = "sof_sdw", 526 .sof_tplg_filename = "sof-mtl-cs42l43-l0-cs35l56-l12.tplg", 527 }, 528 { 529 .link_mask = GENMASK(3, 0), 530 .links = mtl_3_in_1_sdca, 531 .drv_name = "sof_sdw", 532 .sof_tplg_filename = "sof-mtl-rt711-l0-rt1316-l23-rt714-l1.tplg", 533 }, 534 { 535 .link_mask = BIT(0), 536 .links = mtl_rvp, 537 .drv_name = "sof_sdw", 538 .sof_tplg_filename = "sof-mtl-rt711.tplg", 539 }, 540 { 541 .link_mask = BIT(0) | BIT(2), 542 .links = rt5682_link2_max98373_link0, 543 .drv_name = "sof_sdw", 544 .sof_tplg_filename = "sof-mtl-sdw-rt5682-l2-max98373-l0.tplg", 545 }, 546 { 547 .link_mask = BIT(0) | BIT(2), 548 .links = cs42l42_link0_max98363_link2, 549 .drv_name = "sof_sdw", 550 .sof_tplg_filename = "sof-mtl-sdw-cs42l42-l0-max98363-l2.tplg", 551 }, 552 {}, 553 }; 554 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_mtl_sdw_machines); 555