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