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