1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * soc-apci-intel-arl-match.c - tables and support for ARL ACPI enumeration. 4 * 5 * Copyright (c) 2023 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_endpoint spk_2_endpoint = { 34 .num = 0, 35 .aggregated = 1, 36 .group_position = 2, 37 .group_id = 1, 38 }; 39 40 static const struct snd_soc_acpi_endpoint spk_3_endpoint = { 41 .num = 0, 42 .aggregated = 1, 43 .group_position = 3, 44 .group_id = 1, 45 }; 46 47 /* 48 * RT722 is a multi-function codec, three endpoints are created for 49 * its headset, amp and dmic functions. 50 */ 51 static const struct snd_soc_acpi_endpoint rt722_endpoints[] = { 52 { 53 .num = 0, 54 .aggregated = 0, 55 .group_position = 0, 56 .group_id = 0, 57 }, 58 { 59 .num = 1, 60 .aggregated = 0, 61 .group_position = 0, 62 .group_id = 0, 63 }, 64 { 65 .num = 2, 66 .aggregated = 0, 67 .group_position = 0, 68 .group_id = 0, 69 }, 70 }; 71 72 static const struct snd_soc_acpi_adr_device cs35l56_2_lr_adr[] = { 73 { 74 .adr = 0x00023001FA355601ull, 75 .num_endpoints = 1, 76 .endpoints = &spk_l_endpoint, 77 .name_prefix = "AMP1" 78 }, 79 { 80 .adr = 0x00023101FA355601ull, 81 .num_endpoints = 1, 82 .endpoints = &spk_r_endpoint, 83 .name_prefix = "AMP2" 84 } 85 }; 86 87 static const struct snd_soc_acpi_adr_device cs35l56_3_lr_adr[] = { 88 { 89 .adr = 0x00033001FA355601ull, 90 .num_endpoints = 1, 91 .endpoints = &spk_l_endpoint, 92 .name_prefix = "AMP1" 93 }, 94 { 95 .adr = 0x00033401FA355601ull, 96 .num_endpoints = 1, 97 .endpoints = &spk_r_endpoint, 98 .name_prefix = "AMP2" 99 } 100 }; 101 102 static const struct snd_soc_acpi_adr_device cs35l56_2_r_adr[] = { 103 { 104 .adr = 0x00023201FA355601ull, 105 .num_endpoints = 1, 106 .endpoints = &spk_r_endpoint, 107 .name_prefix = "AMP3" 108 }, 109 { 110 .adr = 0x00023301FA355601ull, 111 .num_endpoints = 1, 112 .endpoints = &spk_3_endpoint, 113 .name_prefix = "AMP4" 114 } 115 }; 116 117 static const struct snd_soc_acpi_adr_device cs35l56_3_l_adr[] = { 118 { 119 .adr = 0x00033001fa355601ull, 120 .num_endpoints = 1, 121 .endpoints = &spk_l_endpoint, 122 .name_prefix = "AMP1" 123 }, 124 { 125 .adr = 0x00033101fa355601ull, 126 .num_endpoints = 1, 127 .endpoints = &spk_2_endpoint, 128 .name_prefix = "AMP2" 129 } 130 }; 131 132 static const struct snd_soc_acpi_adr_device cs35l56_2_r1_adr[] = { 133 { 134 .adr = 0x00023101FA355601ull, 135 .num_endpoints = 1, 136 .endpoints = &spk_r_endpoint, 137 .name_prefix = "AMP2" 138 }, 139 }; 140 141 static const struct snd_soc_acpi_adr_device cs35l56_3_l1_adr[] = { 142 { 143 .adr = 0x00033301fa355601ull, 144 .num_endpoints = 1, 145 .endpoints = &spk_l_endpoint, 146 .name_prefix = "AMP1" 147 }, 148 }; 149 150 static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = { 151 { /* Jack Playback Endpoint */ 152 .num = 0, 153 .aggregated = 0, 154 .group_position = 0, 155 .group_id = 0, 156 }, 157 { /* DMIC Capture Endpoint */ 158 .num = 1, 159 .aggregated = 0, 160 .group_position = 0, 161 .group_id = 0, 162 }, 163 { /* Jack Capture Endpoint */ 164 .num = 2, 165 .aggregated = 0, 166 .group_position = 0, 167 .group_id = 0, 168 }, 169 { /* Speaker Playback Endpoint */ 170 .num = 3, 171 .aggregated = 0, 172 .group_position = 0, 173 .group_id = 0, 174 }, 175 }; 176 177 static const struct snd_soc_acpi_adr_device cs42l43_0_adr[] = { 178 { 179 .adr = 0x00003001FA424301ull, 180 .num_endpoints = ARRAY_SIZE(cs42l43_endpoints), 181 .endpoints = cs42l43_endpoints, 182 .name_prefix = "cs42l43" 183 } 184 }; 185 186 static const struct snd_soc_acpi_adr_device cs42l43_2_adr[] = { 187 { 188 .adr = 0x00023001FA424301ull, 189 .num_endpoints = ARRAY_SIZE(cs42l43_endpoints), 190 .endpoints = cs42l43_endpoints, 191 .name_prefix = "cs42l43" 192 } 193 }; 194 195 static const struct snd_soc_acpi_adr_device rt711_0_adr[] = { 196 { 197 .adr = 0x000020025D071100ull, 198 .num_endpoints = 1, 199 .endpoints = &single_endpoint, 200 .name_prefix = "rt711" 201 } 202 }; 203 204 static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = { 205 { 206 .adr = 0x000030025D071101ull, 207 .num_endpoints = 1, 208 .endpoints = &single_endpoint, 209 .name_prefix = "rt711" 210 } 211 }; 212 213 static const struct snd_soc_acpi_adr_device rt722_0_single_adr[] = { 214 { 215 .adr = 0x000030025D072201ull, 216 .num_endpoints = ARRAY_SIZE(rt722_endpoints), 217 .endpoints = rt722_endpoints, 218 .name_prefix = "rt722" 219 } 220 }; 221 222 static const struct snd_soc_acpi_adr_device rt1320_2_single_adr[] = { 223 { 224 .adr = 0x000230025D132001ull, 225 .num_endpoints = 1, 226 .endpoints = &single_endpoint, 227 .name_prefix = "rt1320-1" 228 } 229 }; 230 231 static const struct snd_soc_acpi_link_adr arl_cs42l43_l0[] = { 232 { 233 .mask = BIT(0), 234 .num_adr = ARRAY_SIZE(cs42l43_0_adr), 235 .adr_d = cs42l43_0_adr, 236 }, 237 {} 238 }; 239 240 static const struct snd_soc_acpi_link_adr arl_cs42l43_l2[] = { 241 { 242 .mask = BIT(2), 243 .num_adr = ARRAY_SIZE(cs42l43_2_adr), 244 .adr_d = cs42l43_2_adr, 245 }, 246 {} 247 }; 248 249 static const struct snd_soc_acpi_link_adr arl_cs42l43_l2_cs35l56_l3[] = { 250 { 251 .mask = BIT(2), 252 .num_adr = ARRAY_SIZE(cs42l43_2_adr), 253 .adr_d = cs42l43_2_adr, 254 }, 255 { 256 .mask = BIT(3), 257 .num_adr = ARRAY_SIZE(cs35l56_3_lr_adr), 258 .adr_d = cs35l56_3_lr_adr, 259 }, 260 {} 261 }; 262 263 static const struct snd_soc_acpi_link_adr arl_cs42l43_l0_cs35l56_l2[] = { 264 { 265 .mask = BIT(0), 266 .num_adr = ARRAY_SIZE(cs42l43_0_adr), 267 .adr_d = cs42l43_0_adr, 268 }, 269 { 270 .mask = BIT(2), 271 .num_adr = ARRAY_SIZE(cs35l56_2_lr_adr), 272 .adr_d = cs35l56_2_lr_adr, 273 }, 274 {} 275 }; 276 277 static const struct snd_soc_acpi_link_adr arl_cs42l43_l0_cs35l56_l23[] = { 278 { 279 .mask = BIT(0), 280 .num_adr = ARRAY_SIZE(cs42l43_0_adr), 281 .adr_d = cs42l43_0_adr, 282 }, 283 { 284 .mask = BIT(2), 285 .num_adr = ARRAY_SIZE(cs35l56_2_r_adr), 286 .adr_d = cs35l56_2_r_adr, 287 }, 288 { 289 .mask = BIT(3), 290 .num_adr = ARRAY_SIZE(cs35l56_3_l_adr), 291 .adr_d = cs35l56_3_l_adr, 292 }, 293 {} 294 }; 295 296 static const struct snd_soc_acpi_link_adr arl_cs42l43_l0_cs35l56_2_l23[] = { 297 { 298 .mask = BIT(0), 299 .num_adr = ARRAY_SIZE(cs42l43_0_adr), 300 .adr_d = cs42l43_0_adr, 301 }, 302 { 303 .mask = BIT(2), 304 .num_adr = ARRAY_SIZE(cs35l56_2_r1_adr), 305 .adr_d = cs35l56_2_r1_adr, 306 }, 307 { 308 .mask = BIT(3), 309 .num_adr = ARRAY_SIZE(cs35l56_3_l1_adr), 310 .adr_d = cs35l56_3_l1_adr, 311 }, 312 {} 313 }; 314 315 static const struct snd_soc_acpi_link_adr arl_rvp[] = { 316 { 317 .mask = BIT(0), 318 .num_adr = ARRAY_SIZE(rt711_0_adr), 319 .adr_d = rt711_0_adr, 320 }, 321 {} 322 }; 323 324 static const struct snd_soc_acpi_link_adr arl_sdca_rvp[] = { 325 { 326 .mask = BIT(0), 327 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr), 328 .adr_d = rt711_sdca_0_adr, 329 }, 330 {} 331 }; 332 333 static const struct snd_soc_acpi_link_adr arl_rt722_l0_rt1320_l2[] = { 334 { 335 .mask = BIT(0), 336 .num_adr = ARRAY_SIZE(rt722_0_single_adr), 337 .adr_d = rt722_0_single_adr, 338 }, 339 { 340 .mask = BIT(2), 341 .num_adr = ARRAY_SIZE(rt1320_2_single_adr), 342 .adr_d = rt1320_2_single_adr, 343 }, 344 {} 345 }; 346 347 static const struct snd_soc_acpi_codecs arl_essx_83x6 = { 348 .num_codecs = 3, 349 .codecs = { "ESSX8316", "ESSX8326", "ESSX8336"}, 350 }; 351 352 static const struct snd_soc_acpi_codecs arl_rt5682_hp = { 353 .num_codecs = 2, 354 .codecs = {RT5682_ACPI_HID, RT5682S_ACPI_HID}, 355 }; 356 357 static const struct snd_soc_acpi_codecs arl_lt6911_hdmi = { 358 .num_codecs = 1, 359 .codecs = {"INTC10B0"} 360 }; 361 362 struct snd_soc_acpi_mach snd_soc_acpi_intel_arl_machines[] = { 363 { 364 .comp_ids = &arl_essx_83x6, 365 .drv_name = "arl_es83x6_c1_h02", 366 .machine_quirk = snd_soc_acpi_codec_list, 367 .quirk_data = &arl_lt6911_hdmi, 368 .sof_tplg_filename = "sof-arl-es83x6-ssp1-hdmi-ssp02.tplg", 369 }, 370 { 371 .comp_ids = &arl_essx_83x6, 372 .drv_name = "sof-essx8336", 373 .sof_tplg_filename = "sof-arl-es8336", /* the tplg suffix is added at run time */ 374 .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER | 375 SND_SOC_ACPI_TPLG_INTEL_SSP_MSB | 376 SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER, 377 }, 378 { 379 .comp_ids = &arl_rt5682_hp, 380 .drv_name = "arl_rt5682_c1_h02", 381 .machine_quirk = snd_soc_acpi_codec_list, 382 .quirk_data = &arl_lt6911_hdmi, 383 .sof_tplg_filename = "sof-arl-rt5682-ssp1-hdmi-ssp02.tplg", 384 }, 385 /* place amp-only boards in the end of table */ 386 { 387 .id = "INTC10B0", 388 .drv_name = "arl_lt6911_hdmi_ssp", 389 .sof_tplg_filename = "sof-arl-hdmi-ssp02.tplg", 390 }, 391 {}, 392 }; 393 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_arl_machines); 394 395 /* this table is used when there is no I2S codec present */ 396 struct snd_soc_acpi_mach snd_soc_acpi_intel_arl_sdw_machines[] = { 397 { 398 .link_mask = BIT(0) | BIT(2) | BIT(3), 399 .links = arl_cs42l43_l0_cs35l56_l23, 400 .drv_name = "sof_sdw", 401 .sof_tplg_filename = "sof-arl-cs42l43-l0-cs35l56-l23.tplg", 402 }, 403 { 404 .link_mask = BIT(0) | BIT(2) | BIT(3), 405 .links = arl_cs42l43_l0_cs35l56_2_l23, 406 .drv_name = "sof_sdw", 407 .sof_tplg_filename = "sof-arl-cs42l43-l0-cs35l56-l23.tplg", 408 }, 409 { 410 .link_mask = BIT(0) | BIT(2), 411 .links = arl_cs42l43_l0_cs35l56_l2, 412 .drv_name = "sof_sdw", 413 .sof_tplg_filename = "sof-arl-cs42l43-l0-cs35l56-l2.tplg", 414 }, 415 { 416 .link_mask = BIT(0), 417 .links = arl_cs42l43_l0, 418 .drv_name = "sof_sdw", 419 .sof_tplg_filename = "sof-arl-cs42l43-l0.tplg", 420 }, 421 { 422 .link_mask = BIT(2), 423 .links = arl_cs42l43_l2, 424 .drv_name = "sof_sdw", 425 .sof_tplg_filename = "sof-arl-cs42l43-l2.tplg", 426 }, 427 { 428 .link_mask = BIT(2) | BIT(3), 429 .links = arl_cs42l43_l2_cs35l56_l3, 430 .drv_name = "sof_sdw", 431 .sof_tplg_filename = "sof-arl-cs42l43-l2-cs35l56-l3.tplg", 432 }, 433 { 434 .link_mask = 0x1, /* link0 required */ 435 .links = arl_rvp, 436 .drv_name = "sof_sdw", 437 .sof_tplg_filename = "sof-arl-rt711.tplg", 438 }, 439 { 440 .link_mask = 0x1, /* link0 required */ 441 .links = arl_sdca_rvp, 442 .drv_name = "sof_sdw", 443 .sof_tplg_filename = "sof-arl-rt711-l0.tplg", 444 }, 445 { 446 .link_mask = BIT(0) | BIT(2), 447 .links = arl_rt722_l0_rt1320_l2, 448 .drv_name = "sof_sdw", 449 .sof_tplg_filename = "sof-arl-rt722-l0_rt1320-l2.tplg", 450 }, 451 {}, 452 }; 453 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_arl_sdw_machines); 454