1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * soc-acpi-intel-lnl-match.c - tables and support for LNL ACPI enumeration. 4 * 5 * Copyright (c) 2023, 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 struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_machines[] = { 14 {}, 15 }; 16 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_lnl_machines); 17 18 static const struct snd_soc_acpi_endpoint single_endpoint = { 19 .num = 0, 20 .aggregated = 0, 21 .group_position = 0, 22 .group_id = 0, 23 }; 24 25 static const struct snd_soc_acpi_endpoint spk_l_endpoint = { 26 .num = 0, 27 .aggregated = 1, 28 .group_position = 0, 29 .group_id = 1, 30 }; 31 32 static const struct snd_soc_acpi_endpoint spk_r_endpoint = { 33 .num = 0, 34 .aggregated = 1, 35 .group_position = 1, 36 .group_id = 1, 37 }; 38 39 static const struct snd_soc_acpi_endpoint rt712_endpoints[] = { 40 { 41 .num = 0, 42 .aggregated = 0, 43 .group_position = 0, 44 .group_id = 0, 45 }, 46 { 47 .num = 1, 48 .aggregated = 0, 49 .group_position = 0, 50 .group_id = 0, 51 }, 52 }; 53 54 /* 55 * RT722 is a multi-function codec, three endpoints are created for 56 * its headset, amp and dmic functions. 57 */ 58 static const struct snd_soc_acpi_endpoint rt722_endpoints[] = { 59 { 60 .num = 0, 61 .aggregated = 0, 62 .group_position = 0, 63 .group_id = 0, 64 }, 65 { 66 .num = 1, 67 .aggregated = 0, 68 .group_position = 0, 69 .group_id = 0, 70 }, 71 { 72 .num = 2, 73 .aggregated = 0, 74 .group_position = 0, 75 .group_id = 0, 76 }, 77 }; 78 79 static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = { 80 { /* Jack Playback Endpoint */ 81 .num = 0, 82 .aggregated = 0, 83 .group_position = 0, 84 .group_id = 0, 85 }, 86 { /* DMIC Capture Endpoint */ 87 .num = 1, 88 .aggregated = 0, 89 .group_position = 0, 90 .group_id = 0, 91 }, 92 { /* Jack Capture Endpoint */ 93 .num = 2, 94 .aggregated = 0, 95 .group_position = 0, 96 .group_id = 0, 97 }, 98 { /* Speaker Playback Endpoint */ 99 .num = 3, 100 .aggregated = 0, 101 .group_position = 0, 102 .group_id = 0, 103 }, 104 }; 105 106 static const struct snd_soc_acpi_adr_device cs42l43_0_adr[] = { 107 { 108 .adr = 0x00003001FA424301ull, 109 .num_endpoints = ARRAY_SIZE(cs42l43_endpoints), 110 .endpoints = cs42l43_endpoints, 111 .name_prefix = "cs42l43" 112 } 113 }; 114 115 static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = { 116 { 117 .adr = 0x000030025D071101ull, 118 .num_endpoints = 1, 119 .endpoints = &single_endpoint, 120 .name_prefix = "rt711" 121 } 122 }; 123 124 static const struct snd_soc_acpi_adr_device rt712_2_single_adr[] = { 125 { 126 .adr = 0x000230025D071201ull, 127 .num_endpoints = ARRAY_SIZE(rt712_endpoints), 128 .endpoints = rt712_endpoints, 129 .name_prefix = "rt712" 130 } 131 }; 132 133 static const struct snd_soc_acpi_adr_device rt1712_3_single_adr[] = { 134 { 135 .adr = 0x000330025D171201ull, 136 .num_endpoints = 1, 137 .endpoints = &single_endpoint, 138 .name_prefix = "rt712-dmic" 139 } 140 }; 141 142 static const struct snd_soc_acpi_adr_device rt722_0_single_adr[] = { 143 { 144 .adr = 0x000030025d072201ull, 145 .num_endpoints = ARRAY_SIZE(rt722_endpoints), 146 .endpoints = rt722_endpoints, 147 .name_prefix = "rt722" 148 } 149 }; 150 151 static const struct snd_soc_acpi_adr_device rt1316_2_group1_adr[] = { 152 { 153 .adr = 0x000230025D131601ull, 154 .num_endpoints = 1, 155 .endpoints = &spk_l_endpoint, 156 .name_prefix = "rt1316-1" 157 } 158 }; 159 160 static const struct snd_soc_acpi_adr_device rt1316_3_group1_adr[] = { 161 { 162 .adr = 0x000331025D131601ull, 163 .num_endpoints = 1, 164 .endpoints = &spk_r_endpoint, 165 .name_prefix = "rt1316-2" 166 } 167 }; 168 169 static const struct snd_soc_acpi_adr_device rt1318_1_group1_adr[] = { 170 { 171 .adr = 0x000130025D131801ull, 172 .num_endpoints = 1, 173 .endpoints = &spk_l_endpoint, 174 .name_prefix = "rt1318-1" 175 } 176 }; 177 178 static const struct snd_soc_acpi_adr_device rt1318_2_group1_adr[] = { 179 { 180 .adr = 0x000232025D131801ull, 181 .num_endpoints = 1, 182 .endpoints = &spk_r_endpoint, 183 .name_prefix = "rt1318-2" 184 } 185 }; 186 187 static const struct snd_soc_acpi_adr_device rt714_0_adr[] = { 188 { 189 .adr = 0x000030025D071401ull, 190 .num_endpoints = 1, 191 .endpoints = &single_endpoint, 192 .name_prefix = "rt714" 193 } 194 }; 195 196 static const struct snd_soc_acpi_adr_device rt714_1_adr[] = { 197 { 198 .adr = 0x000130025D071401ull, 199 .num_endpoints = 1, 200 .endpoints = &single_endpoint, 201 .name_prefix = "rt714" 202 } 203 }; 204 205 static const struct snd_soc_acpi_link_adr lnl_cs42l43_l0[] = { 206 { 207 .mask = BIT(0), 208 .num_adr = ARRAY_SIZE(cs42l43_0_adr), 209 .adr_d = cs42l43_0_adr, 210 }, 211 }; 212 213 static const struct snd_soc_acpi_link_adr lnl_rvp[] = { 214 { 215 .mask = BIT(0), 216 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr), 217 .adr_d = rt711_sdca_0_adr, 218 }, 219 {} 220 }; 221 222 static const struct snd_soc_acpi_link_adr lnl_712_only[] = { 223 { 224 .mask = BIT(2), 225 .num_adr = ARRAY_SIZE(rt712_2_single_adr), 226 .adr_d = rt712_2_single_adr, 227 }, 228 { 229 .mask = BIT(3), 230 .num_adr = ARRAY_SIZE(rt1712_3_single_adr), 231 .adr_d = rt1712_3_single_adr, 232 }, 233 {} 234 }; 235 236 static const struct snd_soc_acpi_link_adr lnl_rt722_only[] = { 237 { 238 .mask = BIT(0), 239 .num_adr = ARRAY_SIZE(rt722_0_single_adr), 240 .adr_d = rt722_0_single_adr, 241 }, 242 {} 243 }; 244 245 static const struct snd_soc_acpi_link_adr lnl_3_in_1_sdca[] = { 246 { 247 .mask = BIT(0), 248 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr), 249 .adr_d = rt711_sdca_0_adr, 250 }, 251 { 252 .mask = BIT(2), 253 .num_adr = ARRAY_SIZE(rt1316_2_group1_adr), 254 .adr_d = rt1316_2_group1_adr, 255 }, 256 { 257 .mask = BIT(3), 258 .num_adr = ARRAY_SIZE(rt1316_3_group1_adr), 259 .adr_d = rt1316_3_group1_adr, 260 }, 261 { 262 .mask = BIT(1), 263 .num_adr = ARRAY_SIZE(rt714_1_adr), 264 .adr_d = rt714_1_adr, 265 }, 266 {} 267 }; 268 269 static const struct snd_soc_acpi_link_adr lnl_sdw_rt1318_l12_rt714_l0[] = { 270 { 271 .mask = BIT(1), 272 .num_adr = ARRAY_SIZE(rt1318_1_group1_adr), 273 .adr_d = rt1318_1_group1_adr, 274 }, 275 { 276 .mask = BIT(2), 277 .num_adr = ARRAY_SIZE(rt1318_2_group1_adr), 278 .adr_d = rt1318_2_group1_adr, 279 }, 280 { 281 .mask = BIT(0), 282 .num_adr = ARRAY_SIZE(rt714_0_adr), 283 .adr_d = rt714_0_adr, 284 }, 285 {} 286 }; 287 288 /* this table is used when there is no I2S codec present */ 289 struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_sdw_machines[] = { 290 /* mockup tests need to be first */ 291 { 292 .link_mask = GENMASK(3, 0), 293 .links = sdw_mockup_headset_2amps_mic, 294 .drv_name = "sof_sdw", 295 .sof_tplg_filename = "sof-lnl-rt711-rt1308-rt715.tplg", 296 }, 297 { 298 .link_mask = BIT(0) | BIT(1) | BIT(3), 299 .links = sdw_mockup_headset_1amp_mic, 300 .drv_name = "sof_sdw", 301 .sof_tplg_filename = "sof-lnl-rt711-rt1308-mono-rt715.tplg", 302 }, 303 { 304 .link_mask = GENMASK(2, 0), 305 .links = sdw_mockup_mic_headset_1amp, 306 .drv_name = "sof_sdw", 307 .sof_tplg_filename = "sof-lnl-rt715-rt711-rt1308-mono.tplg", 308 }, 309 { 310 .link_mask = GENMASK(3, 0), 311 .links = lnl_3_in_1_sdca, 312 .drv_name = "sof_sdw", 313 .sof_tplg_filename = "sof-lnl-rt711-l0-rt1316-l23-rt714-l1.tplg", 314 }, 315 { 316 .link_mask = BIT(0), 317 .links = lnl_cs42l43_l0, 318 .drv_name = "sof_sdw", 319 .sof_tplg_filename = "sof-lnl-cs42l43-l0.tplg", 320 }, 321 { 322 .link_mask = BIT(0), 323 .links = lnl_rvp, 324 .drv_name = "sof_sdw", 325 .sof_tplg_filename = "sof-lnl-rt711.tplg", 326 }, 327 { 328 .link_mask = BIT(2) | BIT(3), 329 .links = lnl_712_only, 330 .drv_name = "sof_sdw", 331 .sof_tplg_filename = "sof-lnl-rt712-l2-rt1712-l3.tplg", 332 }, 333 { 334 .link_mask = BIT(0), 335 .links = lnl_rt722_only, 336 .drv_name = "sof_sdw", 337 .sof_tplg_filename = "sof-lnl-rt722-l0.tplg", 338 }, 339 { 340 .link_mask = GENMASK(2, 0), 341 .links = lnl_sdw_rt1318_l12_rt714_l0, 342 .drv_name = "sof_sdw", 343 .sof_tplg_filename = "sof-lnl-rt1318-l12-rt714-l0.tplg" 344 }, 345 {}, 346 }; 347 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_lnl_sdw_machines); 348