1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * soc-acpi-intel-tgl-match.c - tables and support for TGL ACPI enumeration. 4 * 5 * Copyright (c) 2019, 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 essx_83x6 = { 14 .num_codecs = 3, 15 .codecs = { "ESSX8316", "ESSX8326", "ESSX8336"}, 16 }; 17 18 static const struct snd_soc_acpi_codecs tgl_codecs = { 19 .num_codecs = 1, 20 .codecs = {"MX98357A"} 21 }; 22 23 static const struct snd_soc_acpi_endpoint single_endpoint = { 24 .num = 0, 25 .aggregated = 0, 26 .group_position = 0, 27 .group_id = 0, 28 }; 29 30 static const struct snd_soc_acpi_endpoint spk_l_endpoint = { 31 .num = 0, 32 .aggregated = 1, 33 .group_position = 0, 34 .group_id = 1, 35 }; 36 37 static const struct snd_soc_acpi_endpoint spk_r_endpoint = { 38 .num = 0, 39 .aggregated = 1, 40 .group_position = 1, 41 .group_id = 1, 42 }; 43 44 static const struct snd_soc_acpi_adr_device rt711_0_adr[] = { 45 { 46 .adr = 0x000020025D071100ull, 47 .num_endpoints = 1, 48 .endpoints = &single_endpoint, 49 .name_prefix = "rt711" 50 } 51 }; 52 53 static const struct snd_soc_acpi_adr_device rt711_1_adr[] = { 54 { 55 .adr = 0x000120025D071100ull, 56 .num_endpoints = 1, 57 .endpoints = &single_endpoint, 58 .name_prefix = "rt711" 59 } 60 }; 61 62 static const struct snd_soc_acpi_adr_device rt1308_1_dual_adr[] = { 63 { 64 .adr = 0x000120025D130800ull, 65 .num_endpoints = 1, 66 .endpoints = &spk_l_endpoint, 67 .name_prefix = "rt1308-1" 68 }, 69 { 70 .adr = 0x000122025D130800ull, 71 .num_endpoints = 1, 72 .endpoints = &spk_r_endpoint, 73 .name_prefix = "rt1308-2" 74 } 75 }; 76 77 static const struct snd_soc_acpi_adr_device rt1308_1_single_adr[] = { 78 { 79 .adr = 0x000120025D130800ull, 80 .num_endpoints = 1, 81 .endpoints = &single_endpoint, 82 .name_prefix = "rt1308-1" 83 } 84 }; 85 86 static const struct snd_soc_acpi_adr_device rt1308_2_single_adr[] = { 87 { 88 .adr = 0x000220025D130800ull, 89 .num_endpoints = 1, 90 .endpoints = &single_endpoint, 91 .name_prefix = "rt1308-1" 92 } 93 }; 94 95 static const struct snd_soc_acpi_adr_device rt1308_1_group1_adr[] = { 96 { 97 .adr = 0x000120025D130800ull, 98 .num_endpoints = 1, 99 .endpoints = &spk_l_endpoint, 100 .name_prefix = "rt1308-1" 101 } 102 }; 103 104 static const struct snd_soc_acpi_adr_device rt1308_2_group1_adr[] = { 105 { 106 .adr = 0x000220025D130800ull, 107 .num_endpoints = 1, 108 .endpoints = &spk_r_endpoint, 109 .name_prefix = "rt1308-2" 110 } 111 }; 112 113 static const struct snd_soc_acpi_adr_device rt715_0_adr[] = { 114 { 115 .adr = 0x000021025D071500ull, 116 .num_endpoints = 1, 117 .endpoints = &single_endpoint, 118 .name_prefix = "rt715" 119 } 120 }; 121 122 static const struct snd_soc_acpi_adr_device rt715_3_adr[] = { 123 { 124 .adr = 0x000320025D071500ull, 125 .num_endpoints = 1, 126 .endpoints = &single_endpoint, 127 .name_prefix = "rt715" 128 } 129 }; 130 131 static const struct snd_soc_acpi_adr_device mx8373_1_adr[] = { 132 { 133 .adr = 0x000123019F837300ull, 134 .num_endpoints = 1, 135 .endpoints = &spk_l_endpoint, 136 .name_prefix = "Right" 137 }, 138 { 139 .adr = 0x000127019F837300ull, 140 .num_endpoints = 1, 141 .endpoints = &spk_r_endpoint, 142 .name_prefix = "Left" 143 } 144 }; 145 146 static const struct snd_soc_acpi_adr_device rt5682_0_adr[] = { 147 { 148 .adr = 0x000021025D568200ull, 149 .num_endpoints = 1, 150 .endpoints = &single_endpoint, 151 .name_prefix = "rt5682" 152 } 153 }; 154 155 static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = { 156 { 157 .adr = 0x000030025D071101ull, 158 .num_endpoints = 1, 159 .endpoints = &single_endpoint, 160 .name_prefix = "rt711" 161 } 162 }; 163 164 static const struct snd_soc_acpi_adr_device rt1316_1_single_adr[] = { 165 { 166 .adr = 0x000131025D131601ull, 167 .num_endpoints = 1, 168 .endpoints = &single_endpoint, 169 .name_prefix = "rt1316-1" 170 } 171 }; 172 173 static const struct snd_soc_acpi_adr_device rt1316_1_group1_adr[] = { 174 { 175 .adr = 0x000131025D131601ull, /* unique ID is set for some reason */ 176 .num_endpoints = 1, 177 .endpoints = &spk_l_endpoint, 178 .name_prefix = "rt1316-1" 179 } 180 }; 181 182 static const struct snd_soc_acpi_adr_device rt1316_2_group1_adr[] = { 183 { 184 .adr = 0x000230025D131601ull, 185 .num_endpoints = 1, 186 .endpoints = &spk_r_endpoint, 187 .name_prefix = "rt1316-2" 188 } 189 }; 190 191 static const struct snd_soc_acpi_adr_device rt714_3_adr[] = { 192 { 193 .adr = 0x000330025D071401ull, 194 .num_endpoints = 1, 195 .endpoints = &single_endpoint, 196 .name_prefix = "rt714" 197 } 198 }; 199 200 static const struct snd_soc_acpi_link_adr tgl_rvp[] = { 201 { 202 .mask = BIT(0), 203 .num_adr = ARRAY_SIZE(rt711_0_adr), 204 .adr_d = rt711_0_adr, 205 }, 206 { 207 .mask = BIT(1), 208 .num_adr = ARRAY_SIZE(rt1308_1_dual_adr), 209 .adr_d = rt1308_1_dual_adr, 210 }, 211 {} 212 }; 213 214 static const struct snd_soc_acpi_link_adr tgl_rvp_headset_only[] = { 215 { 216 .mask = BIT(0), 217 .num_adr = ARRAY_SIZE(rt711_0_adr), 218 .adr_d = rt711_0_adr, 219 }, 220 {} 221 }; 222 223 static const struct snd_soc_acpi_link_adr tgl_hp[] = { 224 { 225 .mask = BIT(0), 226 .num_adr = ARRAY_SIZE(rt711_0_adr), 227 .adr_d = rt711_0_adr, 228 }, 229 { 230 .mask = BIT(1), 231 .num_adr = ARRAY_SIZE(rt1308_1_single_adr), 232 .adr_d = rt1308_1_single_adr, 233 }, 234 {} 235 }; 236 237 static const struct snd_soc_acpi_link_adr tgl_chromebook_base[] = { 238 { 239 .mask = BIT(0), 240 .num_adr = ARRAY_SIZE(rt5682_0_adr), 241 .adr_d = rt5682_0_adr, 242 }, 243 { 244 .mask = BIT(1), 245 .num_adr = ARRAY_SIZE(mx8373_1_adr), 246 .adr_d = mx8373_1_adr, 247 }, 248 {} 249 }; 250 251 static const struct snd_soc_acpi_link_adr tgl_3_in_1_default[] = { 252 { 253 .mask = BIT(0), 254 .num_adr = ARRAY_SIZE(rt711_0_adr), 255 .adr_d = rt711_0_adr, 256 }, 257 { 258 .mask = BIT(1), 259 .num_adr = ARRAY_SIZE(rt1308_1_group1_adr), 260 .adr_d = rt1308_1_group1_adr, 261 }, 262 { 263 .mask = BIT(2), 264 .num_adr = ARRAY_SIZE(rt1308_2_group1_adr), 265 .adr_d = rt1308_2_group1_adr, 266 }, 267 { 268 .mask = BIT(3), 269 .num_adr = ARRAY_SIZE(rt715_3_adr), 270 .adr_d = rt715_3_adr, 271 }, 272 {} 273 }; 274 275 static const struct snd_soc_acpi_link_adr tgl_3_in_1_mono_amp[] = { 276 { 277 .mask = BIT(0), 278 .num_adr = ARRAY_SIZE(rt711_0_adr), 279 .adr_d = rt711_0_adr, 280 }, 281 { 282 .mask = BIT(1), 283 .num_adr = ARRAY_SIZE(rt1308_1_single_adr), 284 .adr_d = rt1308_1_single_adr, 285 }, 286 { 287 .mask = BIT(3), 288 .num_adr = ARRAY_SIZE(rt715_3_adr), 289 .adr_d = rt715_3_adr, 290 }, 291 {} 292 }; 293 294 static const struct snd_soc_acpi_link_adr tgl_sdw_rt711_link1_rt1308_link2_rt715_link0[] = { 295 { 296 .mask = BIT(1), 297 .num_adr = ARRAY_SIZE(rt711_1_adr), 298 .adr_d = rt711_1_adr, 299 }, 300 { 301 .mask = BIT(2), 302 .num_adr = ARRAY_SIZE(rt1308_2_single_adr), 303 .adr_d = rt1308_2_single_adr, 304 }, 305 { 306 .mask = BIT(0), 307 .num_adr = ARRAY_SIZE(rt715_0_adr), 308 .adr_d = rt715_0_adr, 309 }, 310 {} 311 }; 312 313 static const struct snd_soc_acpi_link_adr tgl_3_in_1_sdca[] = { 314 { 315 .mask = BIT(0), 316 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr), 317 .adr_d = rt711_sdca_0_adr, 318 }, 319 { 320 .mask = BIT(1), 321 .num_adr = ARRAY_SIZE(rt1316_1_group1_adr), 322 .adr_d = rt1316_1_group1_adr, 323 }, 324 { 325 .mask = BIT(2), 326 .num_adr = ARRAY_SIZE(rt1316_2_group1_adr), 327 .adr_d = rt1316_2_group1_adr, 328 }, 329 { 330 .mask = BIT(3), 331 .num_adr = ARRAY_SIZE(rt714_3_adr), 332 .adr_d = rt714_3_adr, 333 }, 334 {} 335 }; 336 337 static const struct snd_soc_acpi_link_adr tgl_3_in_1_sdca_mono[] = { 338 { 339 .mask = BIT(0), 340 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr), 341 .adr_d = rt711_sdca_0_adr, 342 }, 343 { 344 .mask = BIT(1), 345 .num_adr = ARRAY_SIZE(rt1316_1_single_adr), 346 .adr_d = rt1316_1_single_adr, 347 }, 348 { 349 .mask = BIT(3), 350 .num_adr = ARRAY_SIZE(rt714_3_adr), 351 .adr_d = rt714_3_adr, 352 }, 353 {} 354 }; 355 356 static const struct snd_soc_acpi_codecs tgl_max98373_amp = { 357 .num_codecs = 1, 358 .codecs = {"MX98373"} 359 }; 360 361 static const struct snd_soc_acpi_codecs tgl_rt1011_amp = { 362 .num_codecs = 1, 363 .codecs = {"10EC1011"} 364 }; 365 366 static const struct snd_soc_acpi_codecs tgl_rt5682_rt5682s_hp = { 367 .num_codecs = 2, 368 .codecs = {"10EC5682", "RTL5682"}, 369 }; 370 371 static const struct snd_soc_acpi_codecs tgl_lt6911_hdmi = { 372 .num_codecs = 1, 373 .codecs = {"INTC10B0"} 374 }; 375 376 struct snd_soc_acpi_mach snd_soc_acpi_intel_tgl_machines[] = { 377 { 378 .comp_ids = &tgl_rt5682_rt5682s_hp, 379 .drv_name = "tgl_mx98357_rt5682", 380 .machine_quirk = snd_soc_acpi_codec_list, 381 .quirk_data = &tgl_codecs, 382 .sof_tplg_filename = "sof-tgl-max98357a-rt5682.tplg", 383 }, 384 { 385 .comp_ids = &tgl_rt5682_rt5682s_hp, 386 .drv_name = "tgl_mx98373_rt5682", 387 .machine_quirk = snd_soc_acpi_codec_list, 388 .quirk_data = &tgl_max98373_amp, 389 .sof_tplg_filename = "sof-tgl-max98373-rt5682.tplg", 390 }, 391 { 392 .comp_ids = &tgl_rt5682_rt5682s_hp, 393 .drv_name = "tgl_rt1011_rt5682", 394 .machine_quirk = snd_soc_acpi_codec_list, 395 .quirk_data = &tgl_rt1011_amp, 396 .sof_tplg_filename = "sof-tgl-rt1011-rt5682.tplg", 397 }, 398 { 399 .comp_ids = &essx_83x6, 400 .drv_name = "sof-essx8336", 401 .sof_tplg_filename = "sof-tgl-es8336", /* the tplg suffix is added at run time */ 402 .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER | 403 SND_SOC_ACPI_TPLG_INTEL_SSP_MSB | 404 SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER, 405 }, 406 { 407 .id = "10EC1308", 408 .drv_name = "tgl_rt1308_hdmi_ssp", 409 .machine_quirk = snd_soc_acpi_codec_list, 410 .quirk_data = &tgl_lt6911_hdmi, 411 .sof_tplg_filename = "sof-tgl-rt1308-ssp2-hdmi-ssp15.tplg" 412 }, 413 {}, 414 }; 415 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_tgl_machines); 416 417 /* this table is used when there is no I2S codec present */ 418 struct snd_soc_acpi_mach snd_soc_acpi_intel_tgl_sdw_machines[] = { 419 /* mockup tests need to be first */ 420 { 421 .link_mask = GENMASK(3, 0), 422 .links = sdw_mockup_headset_2amps_mic, 423 .drv_name = "sof_sdw", 424 .sof_tplg_filename = "sof-tgl-rt711-rt1308-rt715.tplg", 425 }, 426 { 427 .link_mask = BIT(0) | BIT(1) | BIT(3), 428 .links = sdw_mockup_headset_1amp_mic, 429 .drv_name = "sof_sdw", 430 .sof_tplg_filename = "sof-tgl-rt711-rt1308-mono-rt715.tplg", 431 }, 432 { 433 .link_mask = BIT(0) | BIT(1) | BIT(2), 434 .links = sdw_mockup_mic_headset_1amp, 435 .drv_name = "sof_sdw", 436 .sof_tplg_filename = "sof-tgl-rt715-rt711-rt1308-mono.tplg", 437 }, 438 { 439 .link_mask = 0x7, 440 .links = tgl_sdw_rt711_link1_rt1308_link2_rt715_link0, 441 .drv_name = "sof_sdw", 442 .sof_tplg_filename = "sof-tgl-rt715-rt711-rt1308-mono.tplg", 443 }, 444 { 445 .link_mask = 0xF, /* 4 active links required */ 446 .links = tgl_3_in_1_default, 447 .drv_name = "sof_sdw", 448 .sof_tplg_filename = "sof-tgl-rt711-rt1308-rt715.tplg", 449 }, 450 { 451 /* 452 * link_mask should be 0xB, but all links are enabled by BIOS. 453 * This entry will be selected if there is no rt1308 exposed 454 * on link2 since it will fail to match the above entry. 455 */ 456 .link_mask = 0xF, 457 .links = tgl_3_in_1_mono_amp, 458 .drv_name = "sof_sdw", 459 .sof_tplg_filename = "sof-tgl-rt711-rt1308-mono-rt715.tplg", 460 }, 461 { 462 .link_mask = 0xF, /* 4 active links required */ 463 .links = tgl_3_in_1_sdca, 464 .drv_name = "sof_sdw", 465 .sof_tplg_filename = "sof-tgl-rt711-rt1316-rt714.tplg", 466 }, 467 { 468 /* 469 * link_mask should be 0xB, but all links are enabled by BIOS. 470 * This entry will be selected if there is no rt1316 amplifier exposed 471 * on link2 since it will fail to match the above entry. 472 */ 473 474 .link_mask = 0xF, /* 4 active links required */ 475 .links = tgl_3_in_1_sdca_mono, 476 .drv_name = "sof_sdw", 477 .sof_tplg_filename = "sof-tgl-rt711-l0-rt1316-l1-mono-rt714-l3.tplg", 478 }, 479 480 { 481 .link_mask = 0x3, /* rt711 on link 0 and 1 rt1308 on link 1 */ 482 .links = tgl_hp, 483 .drv_name = "sof_sdw", 484 .sof_tplg_filename = "sof-tgl-rt711-rt1308.tplg", 485 }, 486 { 487 .link_mask = 0x3, /* rt711 on link 0 and 2 rt1308s on link 1 */ 488 .links = tgl_rvp, 489 .drv_name = "sof_sdw", 490 .sof_tplg_filename = "sof-tgl-rt711-rt1308.tplg", 491 }, 492 { 493 .link_mask = 0x3, /* rt5682 on link0 & 2xmax98373 on link 1 */ 494 .links = tgl_chromebook_base, 495 .drv_name = "sof_sdw", 496 .sof_tplg_filename = "sof-tgl-sdw-max98373-rt5682.tplg", 497 }, 498 { 499 .link_mask = 0x1, /* rt711 on link 0 */ 500 .links = tgl_rvp_headset_only, 501 .drv_name = "sof_sdw", 502 .sof_tplg_filename = "sof-tgl-rt711.tplg", 503 }, 504 {}, 505 }; 506 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_tgl_sdw_machines); 507