1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * soc-acpi-intel-ptl-match.c - tables and support for PTL ACPI enumeration. 4 * 5 * Copyright (c) 2024, Intel Corporation. 6 * 7 */ 8 9 #include <sound/soc-acpi.h> 10 #include <sound/soc-acpi-intel-match.h> 11 #include "soc-acpi-intel-sdca-quirks.h" 12 #include "soc-acpi-intel-sdw-mockup-match.h" 13 #include <sound/soc-acpi-intel-ssp-common.h> 14 15 static const struct snd_soc_acpi_codecs ptl_rt5682_rt5682s_hp = { 16 .num_codecs = 2, 17 .codecs = {RT5682_ACPI_HID, RT5682S_ACPI_HID}, 18 }; 19 20 struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_machines[] = { 21 { 22 .comp_ids = &ptl_rt5682_rt5682s_hp, 23 .drv_name = "ptl_rt5682_def", 24 .sof_tplg_filename = "sof-ptl", /* the tplg suffix is added at run time */ 25 .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME | 26 SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME, 27 }, 28 {}, 29 }; 30 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_ptl_machines); 31 32 static const struct snd_soc_acpi_endpoint single_endpoint = { 33 .num = 0, 34 .aggregated = 0, 35 .group_position = 0, 36 .group_id = 0, 37 }; 38 39 static const struct snd_soc_acpi_endpoint spk_l_endpoint = { 40 .num = 0, 41 .aggregated = 1, 42 .group_position = 0, 43 .group_id = 1, 44 }; 45 46 static const struct snd_soc_acpi_endpoint spk_r_endpoint = { 47 .num = 0, 48 .aggregated = 1, 49 .group_position = 1, 50 .group_id = 1, 51 }; 52 53 /* 54 * Multi-function codecs with three endpoints created for 55 * headset, amp and dmic functions. 56 */ 57 static const struct snd_soc_acpi_endpoint rt_mf_endpoints[] = { 58 { 59 .num = 0, 60 .aggregated = 0, 61 .group_position = 0, 62 .group_id = 0, 63 }, 64 { 65 .num = 1, 66 .aggregated = 0, 67 .group_position = 0, 68 .group_id = 0, 69 }, 70 { 71 .num = 2, 72 .aggregated = 0, 73 .group_position = 0, 74 .group_id = 0, 75 }, 76 }; 77 78 static const struct snd_soc_acpi_endpoint jack_dmic_endpoints[] = { 79 /* Jack Endpoint */ 80 { 81 .num = 0, 82 .aggregated = 0, 83 .group_position = 0, 84 .group_id = 0, 85 }, 86 /* DMIC Endpoint */ 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_endpoint jack_amp_g1_dmic_endpoints_endpoints[] = { 96 /* Jack Endpoint */ 97 { 98 .num = 0, 99 .aggregated = 0, 100 .group_position = 0, 101 .group_id = 0, 102 }, 103 /* Amp Endpoint, work as spk_l_endpoint */ 104 { 105 .num = 1, 106 .aggregated = 1, 107 .group_position = 0, 108 .group_id = 1, 109 }, 110 /* DMIC Endpoint */ 111 { 112 .num = 2, 113 .aggregated = 0, 114 .group_position = 0, 115 .group_id = 0, 116 }, 117 }; 118 119 static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = { 120 { 121 .adr = 0x000030025D071101ull, 122 .num_endpoints = 1, 123 .endpoints = &single_endpoint, 124 .name_prefix = "rt711" 125 } 126 }; 127 128 static const struct snd_soc_acpi_adr_device rt712_vb_2_group1_adr[] = { 129 { 130 .adr = 0x000230025D071201ull, 131 .num_endpoints = ARRAY_SIZE(jack_amp_g1_dmic_endpoints_endpoints), 132 .endpoints = jack_amp_g1_dmic_endpoints_endpoints, 133 .name_prefix = "rt712" 134 } 135 }; 136 137 static const struct snd_soc_acpi_adr_device rt713_vb_2_adr[] = { 138 { 139 .adr = 0x000230025d071301ull, 140 .num_endpoints = ARRAY_SIZE(jack_dmic_endpoints), 141 .endpoints = jack_dmic_endpoints, 142 .name_prefix = "rt713" 143 } 144 }; 145 146 static const struct snd_soc_acpi_adr_device rt721_3_single_adr[] = { 147 { 148 .adr = 0x000330025d072101ull, 149 .num_endpoints = ARRAY_SIZE(rt_mf_endpoints), 150 .endpoints = rt_mf_endpoints, 151 .name_prefix = "rt721" 152 } 153 }; 154 155 static const struct snd_soc_acpi_link_adr ptl_rt721_l3[] = { 156 { 157 .mask = BIT(3), 158 .num_adr = ARRAY_SIZE(rt721_3_single_adr), 159 .adr_d = rt721_3_single_adr, 160 }, 161 {}, 162 }; 163 164 static const struct snd_soc_acpi_adr_device rt722_0_single_adr[] = { 165 { 166 .adr = 0x000030025d072201ull, 167 .num_endpoints = ARRAY_SIZE(rt_mf_endpoints), 168 .endpoints = rt_mf_endpoints, 169 .name_prefix = "rt722" 170 } 171 }; 172 173 static const struct snd_soc_acpi_adr_device rt722_1_single_adr[] = { 174 { 175 .adr = 0x000130025d072201ull, 176 .num_endpoints = ARRAY_SIZE(rt_mf_endpoints), 177 .endpoints = rt_mf_endpoints, 178 .name_prefix = "rt722" 179 } 180 }; 181 182 static const struct snd_soc_acpi_adr_device rt722_3_single_adr[] = { 183 { 184 .adr = 0x000330025d072201ull, 185 .num_endpoints = ARRAY_SIZE(rt_mf_endpoints), 186 .endpoints = rt_mf_endpoints, 187 .name_prefix = "rt722" 188 } 189 }; 190 191 static const struct snd_soc_acpi_adr_device rt1320_1_group1_adr[] = { 192 { 193 .adr = 0x000130025D132001ull, 194 .num_endpoints = 1, 195 .endpoints = &spk_r_endpoint, 196 .name_prefix = "rt1320-1" 197 } 198 }; 199 200 static const struct snd_soc_acpi_adr_device rt1320_1_group2_adr[] = { 201 { 202 .adr = 0x000130025D132001ull, 203 .num_endpoints = 1, 204 .endpoints = &spk_l_endpoint, 205 .name_prefix = "rt1320-1" 206 } 207 }; 208 209 static const struct snd_soc_acpi_adr_device rt1320_3_group2_adr[] = { 210 { 211 .adr = 0x000330025D132001ull, 212 .num_endpoints = 1, 213 .endpoints = &spk_r_endpoint, 214 .name_prefix = "rt1320-2" 215 } 216 }; 217 218 static const struct snd_soc_acpi_link_adr ptl_rt722_only[] = { 219 { 220 .mask = BIT(0), 221 .num_adr = ARRAY_SIZE(rt722_0_single_adr), 222 .adr_d = rt722_0_single_adr, 223 }, 224 {} 225 }; 226 227 static const struct snd_soc_acpi_link_adr ptl_rt722_l1[] = { 228 { 229 .mask = BIT(1), 230 .num_adr = ARRAY_SIZE(rt722_1_single_adr), 231 .adr_d = rt722_1_single_adr, 232 }, 233 {} 234 }; 235 236 static const struct snd_soc_acpi_link_adr ptl_rt722_l3[] = { 237 { 238 .mask = BIT(3), 239 .num_adr = ARRAY_SIZE(rt722_3_single_adr), 240 .adr_d = rt722_3_single_adr, 241 }, 242 {} 243 }; 244 245 static const struct snd_soc_acpi_link_adr ptl_rvp[] = { 246 { 247 .mask = BIT(0), 248 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr), 249 .adr_d = rt711_sdca_0_adr, 250 }, 251 {} 252 }; 253 254 static const struct snd_soc_acpi_link_adr ptl_sdw_rt713_vb_l2_rt1320_l13[] = { 255 { 256 .mask = BIT(2), 257 .num_adr = ARRAY_SIZE(rt713_vb_2_adr), 258 .adr_d = rt713_vb_2_adr, 259 }, 260 { 261 .mask = BIT(1), 262 .num_adr = ARRAY_SIZE(rt1320_1_group2_adr), 263 .adr_d = rt1320_1_group2_adr, 264 }, 265 { 266 .mask = BIT(3), 267 .num_adr = ARRAY_SIZE(rt1320_3_group2_adr), 268 .adr_d = rt1320_3_group2_adr, 269 }, 270 {} 271 }; 272 273 static const struct snd_soc_acpi_link_adr ptl_sdw_rt712_vb_l2_rt1320_l1[] = { 274 { 275 .mask = BIT(2), 276 .num_adr = ARRAY_SIZE(rt712_vb_2_group1_adr), 277 .adr_d = rt712_vb_2_group1_adr, 278 }, 279 { 280 .mask = BIT(1), 281 .num_adr = ARRAY_SIZE(rt1320_1_group1_adr), 282 .adr_d = rt1320_1_group1_adr, 283 }, 284 {} 285 }; 286 287 /* this table is used when there is no I2S codec present */ 288 struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_sdw_machines[] = { 289 /* mockup tests need to be first */ 290 { 291 .link_mask = GENMASK(3, 0), 292 .links = sdw_mockup_headset_2amps_mic, 293 .drv_name = "sof_sdw", 294 .sof_tplg_filename = "sof-ptl-rt711-rt1308-rt715.tplg", 295 }, 296 { 297 .link_mask = BIT(0) | BIT(1) | BIT(3), 298 .links = sdw_mockup_headset_1amp_mic, 299 .drv_name = "sof_sdw", 300 .sof_tplg_filename = "sof-ptl-rt711-rt1308-mono-rt715.tplg", 301 }, 302 { 303 .link_mask = GENMASK(2, 0), 304 .links = sdw_mockup_mic_headset_1amp, 305 .drv_name = "sof_sdw", 306 .sof_tplg_filename = "sof-ptl-rt715-rt711-rt1308-mono.tplg", 307 }, 308 { 309 .link_mask = BIT(0), 310 .links = ptl_rvp, 311 .drv_name = "sof_sdw", 312 .sof_tplg_filename = "sof-ptl-rt711.tplg", 313 }, 314 { 315 .link_mask = BIT(3), 316 .links = ptl_rt721_l3, 317 .drv_name = "sof_sdw", 318 .sof_tplg_filename = "sof-ptl-rt721.tplg", 319 }, 320 { 321 .link_mask = BIT(0), 322 .links = ptl_rt722_only, 323 .drv_name = "sof_sdw", 324 .sof_tplg_filename = "sof-ptl-rt722.tplg", 325 }, 326 { 327 .link_mask = BIT(1), 328 .links = ptl_rt722_l1, 329 .drv_name = "sof_sdw", 330 .sof_tplg_filename = "sof-ptl-rt722.tplg", 331 }, 332 { 333 .link_mask = BIT(3), 334 .links = ptl_rt722_l3, 335 .drv_name = "sof_sdw", 336 .sof_tplg_filename = "sof-ptl-rt722.tplg", 337 }, 338 { 339 .link_mask = BIT(1) | BIT(2), 340 .links = ptl_sdw_rt712_vb_l2_rt1320_l1, 341 .drv_name = "sof_sdw", 342 .machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb, 343 .sof_tplg_filename = "sof-ptl-rt712-l2-rt1320-l1.tplg" 344 }, 345 { 346 .link_mask = BIT(1) | BIT(2) | BIT(3), 347 .links = ptl_sdw_rt713_vb_l2_rt1320_l13, 348 .drv_name = "sof_sdw", 349 .machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb, 350 .sof_tplg_filename = "sof-ptl-rt713-l2-rt1320-l13.tplg" 351 }, 352 {}, 353 }; 354 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_ptl_sdw_machines); 355