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 rt714_1_adr[] = { 165 { 166 .adr = 0x000130025D071401ull, 167 .num_endpoints = 1, 168 .endpoints = &single_endpoint, 169 .name_prefix = "rt714" 170 } 171 }; 172 173 static const struct snd_soc_acpi_link_adr mtl_712_only[] = { 174 { 175 .mask = BIT(0), 176 .num_adr = ARRAY_SIZE(rt712_0_single_adr), 177 .adr_d = rt712_0_single_adr, 178 }, 179 { 180 .mask = BIT(3), 181 .num_adr = ARRAY_SIZE(rt1712_3_single_adr), 182 .adr_d = rt1712_3_single_adr, 183 }, 184 {} 185 }; 186 187 static const struct snd_soc_acpi_link_adr rt5682_link2_max98373_link0[] = { 188 /* Expected order: jack -> amp */ 189 { 190 .mask = BIT(2), 191 .num_adr = ARRAY_SIZE(rt5682_2_adr), 192 .adr_d = rt5682_2_adr, 193 }, 194 { 195 .mask = BIT(0), 196 .num_adr = ARRAY_SIZE(mx8373_0_adr), 197 .adr_d = mx8373_0_adr, 198 }, 199 {} 200 }; 201 202 static const struct snd_soc_acpi_link_adr mtl_rvp[] = { 203 { 204 .mask = BIT(0), 205 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr), 206 .adr_d = rt711_sdca_0_adr, 207 }, 208 {} 209 }; 210 211 static const struct snd_soc_acpi_link_adr mtl_3_in_1_sdca[] = { 212 { 213 .mask = BIT(0), 214 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr), 215 .adr_d = rt711_sdca_0_adr, 216 }, 217 { 218 .mask = BIT(2), 219 .num_adr = ARRAY_SIZE(rt1316_2_group1_adr), 220 .adr_d = rt1316_2_group1_adr, 221 }, 222 { 223 .mask = BIT(3), 224 .num_adr = ARRAY_SIZE(rt1316_3_group1_adr), 225 .adr_d = rt1316_3_group1_adr, 226 }, 227 { 228 .mask = BIT(1), 229 .num_adr = ARRAY_SIZE(rt714_1_adr), 230 .adr_d = rt714_1_adr, 231 }, 232 {} 233 }; 234 235 static const struct snd_soc_acpi_adr_device mx8363_2_adr[] = { 236 { 237 .adr = 0x000230019F836300ull, 238 .num_endpoints = 1, 239 .endpoints = &spk_l_endpoint, 240 .name_prefix = "Left" 241 }, 242 { 243 .adr = 0x000231019F836300ull, 244 .num_endpoints = 1, 245 .endpoints = &spk_r_endpoint, 246 .name_prefix = "Right" 247 } 248 }; 249 250 static const struct snd_soc_acpi_adr_device cs42l42_0_adr[] = { 251 { 252 .adr = 0x00001001FA424200ull, 253 .num_endpoints = 1, 254 .endpoints = &single_endpoint, 255 .name_prefix = "cs42l42" 256 } 257 }; 258 259 static const struct snd_soc_acpi_link_adr cs42l42_link0_max98363_link2[] = { 260 /* Expected order: jack -> amp */ 261 { 262 .mask = BIT(0), 263 .num_adr = ARRAY_SIZE(cs42l42_0_adr), 264 .adr_d = cs42l42_0_adr, 265 }, 266 { 267 .mask = BIT(2), 268 .num_adr = ARRAY_SIZE(mx8363_2_adr), 269 .adr_d = mx8363_2_adr, 270 }, 271 {} 272 }; 273 274 /* this table is used when there is no I2S codec present */ 275 struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = { 276 /* mockup tests need to be first */ 277 { 278 .link_mask = GENMASK(3, 0), 279 .links = sdw_mockup_headset_2amps_mic, 280 .drv_name = "sof_sdw", 281 .sof_tplg_filename = "sof-mtl-rt711-rt1308-rt715.tplg", 282 }, 283 { 284 .link_mask = BIT(0) | BIT(1) | BIT(3), 285 .links = sdw_mockup_headset_1amp_mic, 286 .drv_name = "sof_sdw", 287 .sof_tplg_filename = "sof-mtl-rt711-rt1308-mono-rt715.tplg", 288 }, 289 { 290 .link_mask = GENMASK(2, 0), 291 .links = sdw_mockup_mic_headset_1amp, 292 .drv_name = "sof_sdw", 293 .sof_tplg_filename = "sof-mtl-rt715-rt711-rt1308-mono.tplg", 294 }, 295 { 296 .link_mask = BIT(3) | BIT(0), 297 .links = mtl_712_only, 298 .drv_name = "sof_sdw", 299 .sof_tplg_filename = "sof-mtl-rt712-l0-rt1712-l3.tplg", 300 }, 301 { 302 .link_mask = GENMASK(3, 0), 303 .links = mtl_3_in_1_sdca, 304 .drv_name = "sof_sdw", 305 .sof_tplg_filename = "sof-mtl-rt711-l0-rt1316-l23-rt714-l1.tplg", 306 }, 307 { 308 .link_mask = BIT(0), 309 .links = mtl_rvp, 310 .drv_name = "sof_sdw", 311 .sof_tplg_filename = "sof-mtl-rt711.tplg", 312 }, 313 { 314 .link_mask = BIT(0) | BIT(2), 315 .links = rt5682_link2_max98373_link0, 316 .drv_name = "sof_sdw", 317 .sof_tplg_filename = "sof-mtl-sdw-rt5682-l2-max98373-l0.tplg", 318 }, 319 { 320 .link_mask = BIT(0) | BIT(2), 321 .links = cs42l42_link0_max98363_link2, 322 .drv_name = "sof_sdw", 323 .sof_tplg_filename = "sof-mtl-sdw-cs42l42-l0-max98363-l2.tplg", 324 }, 325 {}, 326 }; 327 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_mtl_sdw_machines); 328