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 12 static const struct snd_soc_acpi_codecs tgl_codecs = { 13 .num_codecs = 1, 14 .codecs = {"MX98357A"} 15 }; 16 17 static const struct snd_soc_acpi_endpoint single_endpoint = { 18 .num = 0, 19 .aggregated = 0, 20 .group_position = 0, 21 .group_id = 0, 22 }; 23 24 static const struct snd_soc_acpi_endpoint spk_l_endpoint = { 25 .num = 0, 26 .aggregated = 1, 27 .group_position = 0, 28 .group_id = 1, 29 }; 30 31 static const struct snd_soc_acpi_endpoint spk_r_endpoint = { 32 .num = 0, 33 .aggregated = 1, 34 .group_position = 1, 35 .group_id = 1, 36 }; 37 38 static const struct snd_soc_acpi_adr_device rt711_0_adr[] = { 39 { 40 .adr = 0x000020025D071100, 41 .num_endpoints = 1, 42 .endpoints = &single_endpoint, 43 .name_prefix = "rt711" 44 } 45 }; 46 47 static const struct snd_soc_acpi_adr_device rt711_1_adr[] = { 48 { 49 .adr = 0x000120025D071100, 50 .num_endpoints = 1, 51 .endpoints = &single_endpoint, 52 .name_prefix = "rt711" 53 } 54 }; 55 56 static const struct snd_soc_acpi_adr_device rt1308_1_dual_adr[] = { 57 { 58 .adr = 0x000120025D130800, 59 .num_endpoints = 1, 60 .endpoints = &spk_l_endpoint, 61 .name_prefix = "rt1308-1" 62 }, 63 { 64 .adr = 0x000122025D130800, 65 .num_endpoints = 1, 66 .endpoints = &spk_r_endpoint, 67 .name_prefix = "rt1308-2" 68 } 69 }; 70 71 static const struct snd_soc_acpi_adr_device rt1308_1_single_adr[] = { 72 { 73 .adr = 0x000120025D130800, 74 .num_endpoints = 1, 75 .endpoints = &single_endpoint, 76 .name_prefix = "rt1308-1" 77 } 78 }; 79 80 static const struct snd_soc_acpi_adr_device rt1308_2_single_adr[] = { 81 { 82 .adr = 0x000220025D130800, 83 .num_endpoints = 1, 84 .endpoints = &single_endpoint, 85 .name_prefix = "rt1308-1" 86 } 87 }; 88 89 static const struct snd_soc_acpi_adr_device rt1308_1_group1_adr[] = { 90 { 91 .adr = 0x000120025D130800, 92 .num_endpoints = 1, 93 .endpoints = &spk_l_endpoint, 94 .name_prefix = "rt1308-1" 95 } 96 }; 97 98 static const struct snd_soc_acpi_adr_device rt1308_2_group1_adr[] = { 99 { 100 .adr = 0x000220025D130800, 101 .num_endpoints = 1, 102 .endpoints = &spk_r_endpoint, 103 .name_prefix = "rt1308-2" 104 } 105 }; 106 107 static const struct snd_soc_acpi_adr_device rt715_0_adr[] = { 108 { 109 .adr = 0x000021025D071500, 110 .num_endpoints = 1, 111 .endpoints = &single_endpoint, 112 .name_prefix = "rt715" 113 } 114 }; 115 116 static const struct snd_soc_acpi_adr_device rt715_3_adr[] = { 117 { 118 .adr = 0x000320025D071500, 119 .num_endpoints = 1, 120 .endpoints = &single_endpoint, 121 .name_prefix = "rt715" 122 } 123 }; 124 125 static const struct snd_soc_acpi_adr_device mx8373_1_adr[] = { 126 { 127 .adr = 0x000123019F837300, 128 .num_endpoints = 1, 129 .endpoints = &spk_l_endpoint, 130 .name_prefix = "Right" 131 }, 132 { 133 .adr = 0x000127019F837300, 134 .num_endpoints = 1, 135 .endpoints = &spk_r_endpoint, 136 .name_prefix = "Left" 137 } 138 }; 139 140 static const struct snd_soc_acpi_adr_device rt5682_0_adr[] = { 141 { 142 .adr = 0x000021025D568200, 143 .num_endpoints = 1, 144 .endpoints = &single_endpoint, 145 .name_prefix = "rt5682" 146 } 147 }; 148 149 static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = { 150 { 151 .adr = 0x000030025D071101, 152 .num_endpoints = 1, 153 .endpoints = &single_endpoint, 154 .name_prefix = "rt711" 155 } 156 }; 157 158 static const struct snd_soc_acpi_adr_device rt1316_1_group1_adr[] = { 159 { 160 .adr = 0x000131025D131601, /* unique ID is set for some reason */ 161 .num_endpoints = 1, 162 .endpoints = &spk_l_endpoint, 163 .name_prefix = "rt1316-1" 164 } 165 }; 166 167 static const struct snd_soc_acpi_adr_device rt1316_2_group1_adr[] = { 168 { 169 .adr = 0x000230025D131601, 170 .num_endpoints = 1, 171 .endpoints = &spk_r_endpoint, 172 .name_prefix = "rt1316-2" 173 } 174 }; 175 176 static const struct snd_soc_acpi_adr_device rt714_3_adr[] = { 177 { 178 .adr = 0x000330025D071401, 179 .num_endpoints = 1, 180 .endpoints = &single_endpoint, 181 .name_prefix = "rt714" 182 } 183 }; 184 185 static const struct snd_soc_acpi_link_adr tgl_rvp[] = { 186 { 187 .mask = BIT(0), 188 .num_adr = ARRAY_SIZE(rt711_0_adr), 189 .adr_d = rt711_0_adr, 190 }, 191 { 192 .mask = BIT(1), 193 .num_adr = ARRAY_SIZE(rt1308_1_dual_adr), 194 .adr_d = rt1308_1_dual_adr, 195 }, 196 {} 197 }; 198 199 static const struct snd_soc_acpi_link_adr tgl_hp[] = { 200 { 201 .mask = BIT(0), 202 .num_adr = ARRAY_SIZE(rt711_0_adr), 203 .adr_d = rt711_0_adr, 204 }, 205 { 206 .mask = BIT(1), 207 .num_adr = ARRAY_SIZE(rt1308_1_single_adr), 208 .adr_d = rt1308_1_single_adr, 209 }, 210 {} 211 }; 212 213 static const struct snd_soc_acpi_link_adr tgl_chromebook_base[] = { 214 { 215 .mask = BIT(0), 216 .num_adr = ARRAY_SIZE(rt5682_0_adr), 217 .adr_d = rt5682_0_adr, 218 }, 219 { 220 .mask = BIT(1), 221 .num_adr = ARRAY_SIZE(mx8373_1_adr), 222 .adr_d = mx8373_1_adr, 223 }, 224 {} 225 }; 226 227 static const struct snd_soc_acpi_link_adr tgl_3_in_1_default[] = { 228 { 229 .mask = BIT(0), 230 .num_adr = ARRAY_SIZE(rt711_0_adr), 231 .adr_d = rt711_0_adr, 232 }, 233 { 234 .mask = BIT(1), 235 .num_adr = ARRAY_SIZE(rt1308_1_group1_adr), 236 .adr_d = rt1308_1_group1_adr, 237 }, 238 { 239 .mask = BIT(2), 240 .num_adr = ARRAY_SIZE(rt1308_2_group1_adr), 241 .adr_d = rt1308_2_group1_adr, 242 }, 243 { 244 .mask = BIT(3), 245 .num_adr = ARRAY_SIZE(rt715_3_adr), 246 .adr_d = rt715_3_adr, 247 }, 248 {} 249 }; 250 251 static const struct snd_soc_acpi_link_adr tgl_3_in_1_mono_amp[] = { 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_single_adr), 260 .adr_d = rt1308_1_single_adr, 261 }, 262 { 263 .mask = BIT(3), 264 .num_adr = ARRAY_SIZE(rt715_3_adr), 265 .adr_d = rt715_3_adr, 266 }, 267 {} 268 }; 269 270 static const struct snd_soc_acpi_link_adr tgl_sdw_rt711_link1_rt1308_link2_rt715_link0[] = { 271 { 272 .mask = BIT(1), 273 .num_adr = ARRAY_SIZE(rt711_1_adr), 274 .adr_d = rt711_1_adr, 275 }, 276 { 277 .mask = BIT(2), 278 .num_adr = ARRAY_SIZE(rt1308_2_single_adr), 279 .adr_d = rt1308_2_single_adr, 280 }, 281 { 282 .mask = BIT(0), 283 .num_adr = ARRAY_SIZE(rt715_0_adr), 284 .adr_d = rt715_0_adr, 285 }, 286 {} 287 }; 288 289 static const struct snd_soc_acpi_link_adr tgl_3_in_1_sdca[] = { 290 { 291 .mask = BIT(0), 292 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr), 293 .adr_d = rt711_sdca_0_adr, 294 }, 295 { 296 .mask = BIT(1), 297 .num_adr = ARRAY_SIZE(rt1316_1_group1_adr), 298 .adr_d = rt1316_1_group1_adr, 299 }, 300 { 301 .mask = BIT(2), 302 .num_adr = ARRAY_SIZE(rt1316_2_group1_adr), 303 .adr_d = rt1316_2_group1_adr, 304 }, 305 { 306 .mask = BIT(3), 307 .num_adr = ARRAY_SIZE(rt714_3_adr), 308 .adr_d = rt714_3_adr, 309 }, 310 {} 311 }; 312 313 static const struct snd_soc_acpi_codecs tgl_max98373_amp = { 314 .num_codecs = 1, 315 .codecs = {"MX98373"} 316 }; 317 318 static const struct snd_soc_acpi_codecs tgl_rt1011_amp = { 319 .num_codecs = 1, 320 .codecs = {"10EC1011"} 321 }; 322 323 struct snd_soc_acpi_mach snd_soc_acpi_intel_tgl_machines[] = { 324 { 325 .id = "10EC5682", 326 .drv_name = "tgl_max98357a_rt5682", 327 .machine_quirk = snd_soc_acpi_codec_list, 328 .quirk_data = &tgl_codecs, 329 .sof_fw_filename = "sof-tgl.ri", 330 .sof_tplg_filename = "sof-tgl-max98357a-rt5682.tplg", 331 }, 332 { 333 .id = "10EC5682", 334 .drv_name = "tgl_max98373_rt5682", 335 .machine_quirk = snd_soc_acpi_codec_list, 336 .quirk_data = &tgl_max98373_amp, 337 .sof_fw_filename = "sof-tgl.ri", 338 .sof_tplg_filename = "sof-tgl-max98373-rt5682.tplg", 339 }, 340 { 341 .id = "10EC5682", 342 .drv_name = "tgl_rt1011_rt5682", 343 .machine_quirk = snd_soc_acpi_codec_list, 344 .quirk_data = &tgl_rt1011_amp, 345 .sof_fw_filename = "sof-tgl.ri", 346 .sof_tplg_filename = "sof-tgl-rt1011-rt5682.tplg", 347 }, 348 {}, 349 }; 350 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_tgl_machines); 351 352 /* this table is used when there is no I2S codec present */ 353 struct snd_soc_acpi_mach snd_soc_acpi_intel_tgl_sdw_machines[] = { 354 { 355 .link_mask = 0x7, 356 .links = tgl_sdw_rt711_link1_rt1308_link2_rt715_link0, 357 .drv_name = "sof_sdw", 358 .sof_tplg_filename = "sof-tgl-rt715-rt711-rt1308-mono.tplg", 359 }, 360 { 361 .link_mask = 0xF, /* 4 active links required */ 362 .links = tgl_3_in_1_default, 363 .drv_name = "sof_sdw", 364 .sof_tplg_filename = "sof-tgl-rt711-rt1308-rt715.tplg", 365 }, 366 { 367 /* 368 * link_mask should be 0xB, but all links are enabled by BIOS. 369 * This entry will be selected if there is no rt1308 exposed 370 * on link2 since it will fail to match the above entry. 371 */ 372 .link_mask = 0xF, 373 .links = tgl_3_in_1_mono_amp, 374 .drv_name = "sof_sdw", 375 .sof_tplg_filename = "sof-tgl-rt711-rt1308-mono-rt715.tplg", 376 }, 377 { 378 .link_mask = 0xF, /* 4 active links required */ 379 .links = tgl_3_in_1_sdca, 380 .drv_name = "sof_sdw", 381 .sof_tplg_filename = "sof-tgl-rt711-rt1316-rt714.tplg", 382 }, 383 { 384 .link_mask = 0x3, /* rt711 on link 0 and 1 rt1308 on link 1 */ 385 .links = tgl_hp, 386 .drv_name = "sof_sdw", 387 .sof_tplg_filename = "sof-tgl-rt711-rt1308.tplg", 388 }, 389 { 390 .link_mask = 0x3, /* rt711 on link 0 and 2 rt1308s on link 1 */ 391 .links = tgl_rvp, 392 .drv_name = "sof_sdw", 393 .sof_tplg_filename = "sof-tgl-rt711-rt1308.tplg", 394 }, 395 { 396 .link_mask = 0x3, /* rt5682 on link0 & 2xmax98373 on link 1 */ 397 .links = tgl_chromebook_base, 398 .drv_name = "sof_sdw", 399 .sof_tplg_filename = "sof-tgl-sdw-max98373-rt5682.tplg", 400 }, 401 {}, 402 }; 403 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_tgl_sdw_machines); 404