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_endpoint single_endpoint = { 12 .num = 0, 13 .aggregated = 0, 14 .group_position = 0, 15 .group_id = 0, 16 }; 17 18 static const struct snd_soc_acpi_endpoint spk_l_endpoint = { 19 .num = 0, 20 .aggregated = 1, 21 .group_position = 0, 22 .group_id = 1, 23 }; 24 25 static const struct snd_soc_acpi_endpoint spk_r_endpoint = { 26 .num = 0, 27 .aggregated = 1, 28 .group_position = 1, 29 .group_id = 1, 30 }; 31 32 static const struct snd_soc_acpi_adr_device rt711_0_adr[] = { 33 { 34 .adr = 0x000020025D071100ull, 35 .num_endpoints = 1, 36 .endpoints = &single_endpoint, 37 .name_prefix = "rt711" 38 } 39 }; 40 41 static const struct snd_soc_acpi_adr_device rt1308_1_group1_adr[] = { 42 { 43 .adr = 0x000120025D130800ull, 44 .num_endpoints = 1, 45 .endpoints = &spk_l_endpoint, 46 .name_prefix = "rt1308-1" 47 } 48 }; 49 50 static const struct snd_soc_acpi_adr_device rt1308_2_group1_adr[] = { 51 { 52 .adr = 0x000220025D130800ull, 53 .num_endpoints = 1, 54 .endpoints = &spk_r_endpoint, 55 .name_prefix = "rt1308-2" 56 } 57 }; 58 59 static const struct snd_soc_acpi_adr_device rt715_3_adr[] = { 60 { 61 .adr = 0x000320025D071500ull, 62 .num_endpoints = 1, 63 .endpoints = &single_endpoint, 64 .name_prefix = "rt715" 65 } 66 }; 67 68 static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = { 69 { 70 .adr = 0x000030025D071101ull, 71 .num_endpoints = 1, 72 .endpoints = &single_endpoint, 73 .name_prefix = "rt711" 74 } 75 }; 76 77 static const struct snd_soc_acpi_adr_device rt711_sdca_2_adr[] = { 78 { 79 .adr = 0x000230025D071101ull, 80 .num_endpoints = 1, 81 .endpoints = &single_endpoint, 82 .name_prefix = "rt711" 83 } 84 }; 85 86 static const struct snd_soc_acpi_adr_device rt1316_1_group1_adr[] = { 87 { 88 .adr = 0x000131025D131601ull, /* unique ID is set for some reason */ 89 .num_endpoints = 1, 90 .endpoints = &spk_l_endpoint, 91 .name_prefix = "rt1316-1" 92 } 93 }; 94 95 static const struct snd_soc_acpi_adr_device rt1316_2_group1_adr[] = { 96 { 97 .adr = 0x000230025D131601ull, 98 .num_endpoints = 1, 99 .endpoints = &spk_r_endpoint, 100 .name_prefix = "rt1316-2" 101 } 102 }; 103 104 static const struct snd_soc_acpi_adr_device rt1316_3_group1_adr[] = { 105 { 106 .adr = 0x000330025D131601ull, 107 .num_endpoints = 1, 108 .endpoints = &spk_r_endpoint, 109 .name_prefix = "rt1316-2" 110 } 111 }; 112 113 static const struct snd_soc_acpi_adr_device rt1316_0_group2_adr[] = { 114 { 115 .adr = 0x000031025D131601ull, 116 .num_endpoints = 1, 117 .endpoints = &spk_l_endpoint, 118 .name_prefix = "rt1316-1" 119 } 120 }; 121 122 static const struct snd_soc_acpi_adr_device rt1316_1_group2_adr[] = { 123 { 124 .adr = 0x000130025D131601ull, 125 .num_endpoints = 1, 126 .endpoints = &spk_r_endpoint, 127 .name_prefix = "rt1316-2" 128 } 129 }; 130 131 static const struct snd_soc_acpi_adr_device rt1316_2_single_adr[] = { 132 { 133 .adr = 0x000230025D131601ull, 134 .num_endpoints = 1, 135 .endpoints = &single_endpoint, 136 .name_prefix = "rt1316-1" 137 } 138 }; 139 140 static const struct snd_soc_acpi_adr_device rt714_0_adr[] = { 141 { 142 .adr = 0x000030025D071401ull, 143 .num_endpoints = 1, 144 .endpoints = &single_endpoint, 145 .name_prefix = "rt714" 146 } 147 }; 148 149 static const struct snd_soc_acpi_adr_device rt714_2_adr[] = { 150 { 151 .adr = 0x000230025D071401ull, 152 .num_endpoints = 1, 153 .endpoints = &single_endpoint, 154 .name_prefix = "rt714" 155 } 156 }; 157 158 static const struct snd_soc_acpi_adr_device rt714_3_adr[] = { 159 { 160 .adr = 0x000330025D071401ull, 161 .num_endpoints = 1, 162 .endpoints = &single_endpoint, 163 .name_prefix = "rt714" 164 } 165 }; 166 167 static const struct snd_soc_acpi_link_adr adl_default[] = { 168 { 169 .mask = BIT(0), 170 .num_adr = ARRAY_SIZE(rt711_0_adr), 171 .adr_d = rt711_0_adr, 172 }, 173 { 174 .mask = BIT(1), 175 .num_adr = ARRAY_SIZE(rt1308_1_group1_adr), 176 .adr_d = rt1308_1_group1_adr, 177 }, 178 { 179 .mask = BIT(2), 180 .num_adr = ARRAY_SIZE(rt1308_2_group1_adr), 181 .adr_d = rt1308_2_group1_adr, 182 }, 183 { 184 .mask = BIT(3), 185 .num_adr = ARRAY_SIZE(rt715_3_adr), 186 .adr_d = rt715_3_adr, 187 }, 188 {} 189 }; 190 191 static const struct snd_soc_acpi_link_adr adl_sdca_default[] = { 192 { 193 .mask = BIT(0), 194 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr), 195 .adr_d = rt711_sdca_0_adr, 196 }, 197 { 198 .mask = BIT(1), 199 .num_adr = ARRAY_SIZE(rt1316_1_group1_adr), 200 .adr_d = rt1316_1_group1_adr, 201 }, 202 { 203 .mask = BIT(2), 204 .num_adr = ARRAY_SIZE(rt1316_2_group1_adr), 205 .adr_d = rt1316_2_group1_adr, 206 }, 207 { 208 .mask = BIT(3), 209 .num_adr = ARRAY_SIZE(rt714_3_adr), 210 .adr_d = rt714_3_adr, 211 }, 212 {} 213 }; 214 215 static const struct snd_soc_acpi_link_adr adl_sdca_3_in_1[] = { 216 { 217 .mask = BIT(0), 218 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr), 219 .adr_d = rt711_sdca_0_adr, 220 }, 221 { 222 .mask = BIT(1), 223 .num_adr = ARRAY_SIZE(rt1316_1_group1_adr), 224 .adr_d = rt1316_1_group1_adr, 225 }, 226 { 227 .mask = BIT(2), 228 .num_adr = ARRAY_SIZE(rt714_2_adr), 229 .adr_d = rt714_2_adr, 230 }, 231 { 232 .mask = BIT(3), 233 .num_adr = ARRAY_SIZE(rt1316_3_group1_adr), 234 .adr_d = rt1316_3_group1_adr, 235 }, 236 {} 237 }; 238 239 static const struct snd_soc_acpi_link_adr adl_sdw_rt711_link2_rt1316_link01_rt714_link3[] = { 240 { 241 .mask = BIT(2), 242 .num_adr = ARRAY_SIZE(rt711_sdca_2_adr), 243 .adr_d = rt711_sdca_2_adr, 244 }, 245 { 246 .mask = BIT(0), 247 .num_adr = ARRAY_SIZE(rt1316_0_group2_adr), 248 .adr_d = rt1316_0_group2_adr, 249 }, 250 { 251 .mask = BIT(1), 252 .num_adr = ARRAY_SIZE(rt1316_1_group2_adr), 253 .adr_d = rt1316_1_group2_adr, 254 }, 255 { 256 .mask = BIT(3), 257 .num_adr = ARRAY_SIZE(rt714_3_adr), 258 .adr_d = rt714_3_adr, 259 }, 260 {} 261 }; 262 263 static const struct snd_soc_acpi_link_adr adl_sdw_rt1316_link12_rt714_link0[] = { 264 { 265 .mask = BIT(1), 266 .num_adr = ARRAY_SIZE(rt1316_1_group1_adr), 267 .adr_d = rt1316_1_group1_adr, 268 }, 269 { 270 .mask = BIT(2), 271 .num_adr = ARRAY_SIZE(rt1316_2_group1_adr), 272 .adr_d = rt1316_2_group1_adr, 273 }, 274 { 275 .mask = BIT(0), 276 .num_adr = ARRAY_SIZE(rt714_0_adr), 277 .adr_d = rt714_0_adr, 278 }, 279 {} 280 }; 281 282 static const struct snd_soc_acpi_link_adr adl_sdw_rt1316_link2_rt714_link3[] = { 283 { 284 .mask = BIT(2), 285 .num_adr = ARRAY_SIZE(rt1316_2_single_adr), 286 .adr_d = rt1316_2_single_adr, 287 }, 288 { 289 .mask = BIT(3), 290 .num_adr = ARRAY_SIZE(rt714_3_adr), 291 .adr_d = rt714_3_adr, 292 }, 293 {} 294 }; 295 296 static const struct snd_soc_acpi_link_adr adl_sdw_rt1316_link2_rt714_link0[] = { 297 { 298 .mask = BIT(2), 299 .num_adr = ARRAY_SIZE(rt1316_2_single_adr), 300 .adr_d = rt1316_2_single_adr, 301 }, 302 { 303 .mask = BIT(0), 304 .num_adr = ARRAY_SIZE(rt714_0_adr), 305 .adr_d = rt714_0_adr, 306 }, 307 {} 308 }; 309 310 static const struct snd_soc_acpi_adr_device mx8373_2_adr[] = { 311 { 312 .adr = 0x000223019F837300ull, 313 .num_endpoints = 1, 314 .endpoints = &spk_l_endpoint, 315 .name_prefix = "Left" 316 }, 317 { 318 .adr = 0x000227019F837300ull, 319 .num_endpoints = 1, 320 .endpoints = &spk_r_endpoint, 321 .name_prefix = "Right" 322 } 323 }; 324 325 static const struct snd_soc_acpi_adr_device rt5682_0_adr[] = { 326 { 327 .adr = 0x000021025D568200ull, 328 .num_endpoints = 1, 329 .endpoints = &single_endpoint, 330 .name_prefix = "rt5682" 331 } 332 }; 333 334 static const struct snd_soc_acpi_link_adr adl_rvp[] = { 335 { 336 .mask = BIT(0), 337 .num_adr = ARRAY_SIZE(rt711_0_adr), 338 .adr_d = rt711_0_adr, 339 }, 340 {} 341 }; 342 343 static const struct snd_soc_acpi_link_adr adl_chromebook_base[] = { 344 { 345 .mask = BIT(0), 346 .num_adr = ARRAY_SIZE(rt5682_0_adr), 347 .adr_d = rt5682_0_adr, 348 }, 349 { 350 .mask = BIT(2), 351 .num_adr = ARRAY_SIZE(mx8373_2_adr), 352 .adr_d = mx8373_2_adr, 353 }, 354 {} 355 }; 356 357 static const struct snd_soc_acpi_codecs adl_max98373_amp = { 358 .num_codecs = 1, 359 .codecs = {"MX98373"} 360 }; 361 362 static const struct snd_soc_acpi_codecs adl_max98357a_amp = { 363 .num_codecs = 1, 364 .codecs = {"MX98357A"} 365 }; 366 367 static const struct snd_soc_acpi_codecs adl_max98360a_amp = { 368 .num_codecs = 1, 369 .codecs = {"MX98360A"} 370 }; 371 372 static const struct snd_soc_acpi_codecs adl_rt5682_rt5682s_hp = { 373 .num_codecs = 2, 374 .codecs = {"10EC5682", "RTL5682"}, 375 }; 376 377 struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = { 378 { 379 .comp_ids = &adl_rt5682_rt5682s_hp, 380 .drv_name = "adl_mx98373_rt5682", 381 .machine_quirk = snd_soc_acpi_codec_list, 382 .quirk_data = &adl_max98373_amp, 383 .sof_fw_filename = "sof-adl.ri", 384 .sof_tplg_filename = "sof-adl-max98373-rt5682.tplg", 385 }, 386 { 387 .comp_ids = &adl_rt5682_rt5682s_hp, 388 .drv_name = "adl_mx98357_rt5682", 389 .machine_quirk = snd_soc_acpi_codec_list, 390 .quirk_data = &adl_max98357a_amp, 391 .sof_fw_filename = "sof-adl.ri", 392 .sof_tplg_filename = "sof-adl-max98357a-rt5682.tplg", 393 }, 394 { 395 .comp_ids = &adl_rt5682_rt5682s_hp, 396 .drv_name = "adl_mx98360_rt5682", 397 .machine_quirk = snd_soc_acpi_codec_list, 398 .quirk_data = &adl_max98360a_amp, 399 .sof_fw_filename = "sof-adl.ri", 400 .sof_tplg_filename = "sof-adl-max98360a-rt5682.tplg", 401 }, 402 {}, 403 }; 404 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_adl_machines); 405 406 /* this table is used when there is no I2S codec present */ 407 struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_sdw_machines[] = { 408 { 409 .link_mask = 0xF, /* 4 active links required */ 410 .links = adl_default, 411 .drv_name = "sof_sdw", 412 .sof_tplg_filename = "sof-adl-rt711-l0-rt1308-l12-rt715-l3.tplg", 413 }, 414 { 415 .link_mask = 0xF, /* 4 active links required */ 416 .links = adl_sdca_default, 417 .drv_name = "sof_sdw", 418 .sof_tplg_filename = "sof-adl-rt711-l0-rt1316-l12-rt714-l3.tplg", 419 }, 420 { 421 .link_mask = 0xF, /* 4 active links required */ 422 .links = adl_sdca_3_in_1, 423 .drv_name = "sof_sdw", 424 .sof_tplg_filename = "sof-adl-rt711-l0-rt1316-l13-rt714-l2.tplg", 425 }, 426 { 427 .link_mask = 0xF, /* 4 active links required */ 428 .links = adl_sdw_rt711_link2_rt1316_link01_rt714_link3, 429 .drv_name = "sof_sdw", 430 .sof_fw_filename = "sof-adl.ri", 431 .sof_tplg_filename = "sof-adl-rt711-l2-rt1316-l01-rt714-l3.tplg", 432 }, 433 { 434 .link_mask = 0xC, /* rt1316 on link2 & rt714 on link3 */ 435 .links = adl_sdw_rt1316_link2_rt714_link3, 436 .drv_name = "sof_sdw", 437 .sof_fw_filename = "sof-adl.ri", 438 .sof_tplg_filename = "sof-adl-rt1316-l2-mono-rt714-l3.tplg", 439 }, 440 { 441 .link_mask = 0x7, /* rt714 on link0 & two rt1316s on link1 and link2 */ 442 .links = adl_sdw_rt1316_link12_rt714_link0, 443 .drv_name = "sof_sdw", 444 .sof_fw_filename = "sof-adl.ri", 445 .sof_tplg_filename = "sof-adl-rt1316-l12-rt714-l0.tplg", 446 }, 447 { 448 .link_mask = 0x5, /* 2 active links required */ 449 .links = adl_sdw_rt1316_link2_rt714_link0, 450 .drv_name = "sof_sdw", 451 .sof_tplg_filename = "sof-adl-rt1316-l2-mono-rt714-l0.tplg", 452 }, 453 { 454 .link_mask = 0x1, /* link0 required */ 455 .links = adl_rvp, 456 .drv_name = "sof_sdw", 457 .sof_tplg_filename = "sof-adl-rt711.tplg", 458 }, 459 { 460 .link_mask = 0x5, /* rt5682 on link0 & 2xmax98373 on link 2 */ 461 .links = adl_chromebook_base, 462 .drv_name = "sof_sdw", 463 .sof_fw_filename = "sof-adl.ri", 464 .sof_tplg_filename = "sof-adl-sdw-max98373-rt5682.tplg", 465 }, 466 {}, 467 }; 468 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_adl_sdw_machines); 469