1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * soc-acpi-intel-mtl-match.c - tables and support for MTL ACPI enumeration. 4 * 5 * Copyright (c) 2022, 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 mtl_max98357a_amp = { 14 .num_codecs = 1, 15 .codecs = {"MX98357A"} 16 }; 17 18 static const struct snd_soc_acpi_codecs mtl_max98360a_amp = { 19 .num_codecs = 1, 20 .codecs = {"MX98360A"} 21 }; 22 23 static const struct snd_soc_acpi_codecs mtl_rt1019p_amp = { 24 .num_codecs = 1, 25 .codecs = {"RTL1019"} 26 }; 27 28 static const struct snd_soc_acpi_codecs mtl_rt5682_rt5682s_hp = { 29 .num_codecs = 2, 30 .codecs = {"10EC5682", "RTL5682"}, 31 }; 32 33 struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_machines[] = { 34 { 35 .comp_ids = &mtl_rt5682_rt5682s_hp, 36 .drv_name = "mtl_mx98357_rt5682", 37 .machine_quirk = snd_soc_acpi_codec_list, 38 .quirk_data = &mtl_max98357a_amp, 39 .sof_tplg_filename = "sof-mtl-max98357a-rt5682.tplg", 40 }, 41 { 42 .comp_ids = &mtl_rt5682_rt5682s_hp, 43 .drv_name = "mtl_mx98360_rt5682", 44 .machine_quirk = snd_soc_acpi_codec_list, 45 .quirk_data = &mtl_max98360a_amp, 46 .sof_tplg_filename = "sof-mtl-max98360a-rt5682.tplg", 47 }, 48 { 49 .comp_ids = &mtl_rt5682_rt5682s_hp, 50 .drv_name = "mtl_rt1019_rt5682", 51 .machine_quirk = snd_soc_acpi_codec_list, 52 .quirk_data = &mtl_rt1019p_amp, 53 .sof_tplg_filename = "sof-mtl-rt1019-rt5682.tplg", 54 }, 55 {}, 56 }; 57 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_mtl_machines); 58 59 static const struct snd_soc_acpi_endpoint single_endpoint = { 60 .num = 0, 61 .aggregated = 0, 62 .group_position = 0, 63 .group_id = 0, 64 }; 65 66 static const struct snd_soc_acpi_endpoint spk_l_endpoint = { 67 .num = 0, 68 .aggregated = 1, 69 .group_position = 0, 70 .group_id = 1, 71 }; 72 73 static const struct snd_soc_acpi_endpoint spk_r_endpoint = { 74 .num = 0, 75 .aggregated = 1, 76 .group_position = 1, 77 .group_id = 1, 78 }; 79 80 static const struct snd_soc_acpi_endpoint rt712_endpoints[] = { 81 { 82 .num = 0, 83 .aggregated = 0, 84 .group_position = 0, 85 .group_id = 0, 86 }, 87 { 88 .num = 1, 89 .aggregated = 0, 90 .group_position = 0, 91 .group_id = 0, 92 }, 93 }; 94 95 static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = { 96 { 97 .adr = 0x000030025D071101ull, 98 .num_endpoints = 1, 99 .endpoints = &single_endpoint, 100 .name_prefix = "rt711" 101 } 102 }; 103 104 static const struct snd_soc_acpi_adr_device rt712_0_single_adr[] = { 105 { 106 .adr = 0x000030025D071201ull, 107 .num_endpoints = ARRAY_SIZE(rt712_endpoints), 108 .endpoints = rt712_endpoints, 109 .name_prefix = "rt712" 110 } 111 }; 112 113 static const struct snd_soc_acpi_adr_device rt1712_3_single_adr[] = { 114 { 115 .adr = 0x000330025D171201ull, 116 .num_endpoints = 1, 117 .endpoints = &single_endpoint, 118 .name_prefix = "rt712-dmic" 119 } 120 }; 121 122 static const struct snd_soc_acpi_adr_device mx8373_0_adr[] = { 123 { 124 .adr = 0x000023019F837300ull, 125 .num_endpoints = 1, 126 .endpoints = &spk_l_endpoint, 127 .name_prefix = "Left" 128 }, 129 { 130 .adr = 0x000027019F837300ull, 131 .num_endpoints = 1, 132 .endpoints = &spk_r_endpoint, 133 .name_prefix = "Right" 134 } 135 }; 136 137 static const struct snd_soc_acpi_adr_device rt5682_2_adr[] = { 138 { 139 .adr = 0x000221025D568200ull, 140 .num_endpoints = 1, 141 .endpoints = &single_endpoint, 142 .name_prefix = "rt5682" 143 } 144 }; 145 146 static const struct snd_soc_acpi_adr_device rt1316_2_group1_adr[] = { 147 { 148 .adr = 0x000230025D131601ull, 149 .num_endpoints = 1, 150 .endpoints = &spk_l_endpoint, 151 .name_prefix = "rt1316-1" 152 } 153 }; 154 155 static const struct snd_soc_acpi_adr_device rt1316_3_group1_adr[] = { 156 { 157 .adr = 0x000331025D131601ull, 158 .num_endpoints = 1, 159 .endpoints = &spk_r_endpoint, 160 .name_prefix = "rt1316-2" 161 } 162 }; 163 164 static const struct snd_soc_acpi_adr_device rt1318_1_group1_adr[] = { 165 { 166 .adr = 0x000130025D131801ull, 167 .num_endpoints = 1, 168 .endpoints = &spk_l_endpoint, 169 .name_prefix = "rt1318-1" 170 } 171 }; 172 173 static const struct snd_soc_acpi_adr_device rt1318_2_group1_adr[] = { 174 { 175 .adr = 0x000232025D131801ull, 176 .num_endpoints = 1, 177 .endpoints = &spk_r_endpoint, 178 .name_prefix = "rt1318-2" 179 } 180 }; 181 182 static const struct snd_soc_acpi_adr_device rt714_0_adr[] = { 183 { 184 .adr = 0x000030025D071401ull, 185 .num_endpoints = 1, 186 .endpoints = &single_endpoint, 187 .name_prefix = "rt714" 188 } 189 }; 190 191 static const struct snd_soc_acpi_adr_device rt714_1_adr[] = { 192 { 193 .adr = 0x000130025D071401ull, 194 .num_endpoints = 1, 195 .endpoints = &single_endpoint, 196 .name_prefix = "rt714" 197 } 198 }; 199 200 static const struct snd_soc_acpi_link_adr mtl_712_only[] = { 201 { 202 .mask = BIT(0), 203 .num_adr = ARRAY_SIZE(rt712_0_single_adr), 204 .adr_d = rt712_0_single_adr, 205 }, 206 { 207 .mask = BIT(3), 208 .num_adr = ARRAY_SIZE(rt1712_3_single_adr), 209 .adr_d = rt1712_3_single_adr, 210 }, 211 {} 212 }; 213 214 static const struct snd_soc_acpi_link_adr rt5682_link2_max98373_link0[] = { 215 /* Expected order: jack -> amp */ 216 { 217 .mask = BIT(2), 218 .num_adr = ARRAY_SIZE(rt5682_2_adr), 219 .adr_d = rt5682_2_adr, 220 }, 221 { 222 .mask = BIT(0), 223 .num_adr = ARRAY_SIZE(mx8373_0_adr), 224 .adr_d = mx8373_0_adr, 225 }, 226 {} 227 }; 228 229 static const struct snd_soc_acpi_link_adr mtl_rvp[] = { 230 { 231 .mask = BIT(0), 232 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr), 233 .adr_d = rt711_sdca_0_adr, 234 }, 235 {} 236 }; 237 238 static const struct snd_soc_acpi_link_adr mtl_3_in_1_sdca[] = { 239 { 240 .mask = BIT(0), 241 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr), 242 .adr_d = rt711_sdca_0_adr, 243 }, 244 { 245 .mask = BIT(2), 246 .num_adr = ARRAY_SIZE(rt1316_2_group1_adr), 247 .adr_d = rt1316_2_group1_adr, 248 }, 249 { 250 .mask = BIT(3), 251 .num_adr = ARRAY_SIZE(rt1316_3_group1_adr), 252 .adr_d = rt1316_3_group1_adr, 253 }, 254 { 255 .mask = BIT(1), 256 .num_adr = ARRAY_SIZE(rt714_1_adr), 257 .adr_d = rt714_1_adr, 258 }, 259 {} 260 }; 261 262 static const struct snd_soc_acpi_link_adr mtl_sdw_rt1318_l12_rt714_l0[] = { 263 { 264 .mask = BIT(1), 265 .num_adr = ARRAY_SIZE(rt1318_1_group1_adr), 266 .adr_d = rt1318_1_group1_adr, 267 }, 268 { 269 .mask = BIT(2), 270 .num_adr = ARRAY_SIZE(rt1318_2_group1_adr), 271 .adr_d = rt1318_2_group1_adr, 272 }, 273 { 274 .mask = BIT(0), 275 .num_adr = ARRAY_SIZE(rt714_0_adr), 276 .adr_d = rt714_0_adr, 277 }, 278 {} 279 }; 280 281 static const struct snd_soc_acpi_adr_device mx8363_2_adr[] = { 282 { 283 .adr = 0x000230019F836300ull, 284 .num_endpoints = 1, 285 .endpoints = &spk_l_endpoint, 286 .name_prefix = "Left" 287 }, 288 { 289 .adr = 0x000231019F836300ull, 290 .num_endpoints = 1, 291 .endpoints = &spk_r_endpoint, 292 .name_prefix = "Right" 293 } 294 }; 295 296 static const struct snd_soc_acpi_adr_device cs42l42_0_adr[] = { 297 { 298 .adr = 0x00001001FA424200ull, 299 .num_endpoints = 1, 300 .endpoints = &single_endpoint, 301 .name_prefix = "cs42l42" 302 } 303 }; 304 305 static const struct snd_soc_acpi_link_adr cs42l42_link0_max98363_link2[] = { 306 /* Expected order: jack -> amp */ 307 { 308 .mask = BIT(0), 309 .num_adr = ARRAY_SIZE(cs42l42_0_adr), 310 .adr_d = cs42l42_0_adr, 311 }, 312 { 313 .mask = BIT(2), 314 .num_adr = ARRAY_SIZE(mx8363_2_adr), 315 .adr_d = mx8363_2_adr, 316 }, 317 {} 318 }; 319 320 /* this table is used when there is no I2S codec present */ 321 struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = { 322 /* mockup tests need to be first */ 323 { 324 .link_mask = GENMASK(3, 0), 325 .links = sdw_mockup_headset_2amps_mic, 326 .drv_name = "sof_sdw", 327 .sof_tplg_filename = "sof-mtl-rt711-rt1308-rt715.tplg", 328 }, 329 { 330 .link_mask = BIT(0) | BIT(1) | BIT(3), 331 .links = sdw_mockup_headset_1amp_mic, 332 .drv_name = "sof_sdw", 333 .sof_tplg_filename = "sof-mtl-rt711-rt1308-mono-rt715.tplg", 334 }, 335 { 336 .link_mask = GENMASK(2, 0), 337 .links = sdw_mockup_mic_headset_1amp, 338 .drv_name = "sof_sdw", 339 .sof_tplg_filename = "sof-mtl-rt715-rt711-rt1308-mono.tplg", 340 }, 341 { 342 .link_mask = BIT(3) | BIT(0), 343 .links = mtl_712_only, 344 .drv_name = "sof_sdw", 345 .sof_tplg_filename = "sof-mtl-rt712-l0-rt1712-l3.tplg", 346 }, 347 { 348 .link_mask = GENMASK(2, 0), 349 .links = mtl_sdw_rt1318_l12_rt714_l0, 350 .drv_name = "sof_sdw", 351 .sof_tplg_filename = "sof-mtl-rt1318-l12-rt714-l0.tplg" 352 }, 353 { 354 .link_mask = GENMASK(3, 0), 355 .links = mtl_3_in_1_sdca, 356 .drv_name = "sof_sdw", 357 .sof_tplg_filename = "sof-mtl-rt711-l0-rt1316-l23-rt714-l1.tplg", 358 }, 359 { 360 .link_mask = BIT(0), 361 .links = mtl_rvp, 362 .drv_name = "sof_sdw", 363 .sof_tplg_filename = "sof-mtl-rt711.tplg", 364 }, 365 { 366 .link_mask = BIT(0) | BIT(2), 367 .links = rt5682_link2_max98373_link0, 368 .drv_name = "sof_sdw", 369 .sof_tplg_filename = "sof-mtl-sdw-rt5682-l2-max98373-l0.tplg", 370 }, 371 { 372 .link_mask = BIT(0) | BIT(2), 373 .links = cs42l42_link0_max98363_link2, 374 .drv_name = "sof_sdw", 375 .sof_tplg_filename = "sof-mtl-sdw-cs42l42-l0-max98363-l2.tplg", 376 }, 377 {}, 378 }; 379 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_mtl_sdw_machines); 380