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-sdw-mockup-match.h" 12 #include <sound/soc-acpi-intel-ssp-common.h> 13 14 static const struct snd_soc_acpi_codecs ptl_rt5682_rt5682s_hp = { 15 .num_codecs = 2, 16 .codecs = {RT5682_ACPI_HID, RT5682S_ACPI_HID}, 17 }; 18 19 struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_machines[] = { 20 { 21 .comp_ids = &ptl_rt5682_rt5682s_hp, 22 .drv_name = "ptl_rt5682_def", 23 .sof_tplg_filename = "sof-ptl", /* the tplg suffix is added at run time */ 24 .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME | 25 SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME, 26 }, 27 {}, 28 }; 29 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_ptl_machines); 30 31 static const struct snd_soc_acpi_endpoint single_endpoint = { 32 .num = 0, 33 .aggregated = 0, 34 .group_position = 0, 35 .group_id = 0, 36 }; 37 38 /* 39 * Multi-function codecs with three endpoints created for 40 * headset, amp and dmic functions. 41 */ 42 static const struct snd_soc_acpi_endpoint rt_mf_endpoints[] = { 43 { 44 .num = 0, 45 .aggregated = 0, 46 .group_position = 0, 47 .group_id = 0, 48 }, 49 { 50 .num = 1, 51 .aggregated = 0, 52 .group_position = 0, 53 .group_id = 0, 54 }, 55 { 56 .num = 2, 57 .aggregated = 0, 58 .group_position = 0, 59 .group_id = 0, 60 }, 61 }; 62 63 static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = { 64 { 65 .adr = 0x000030025D071101ull, 66 .num_endpoints = 1, 67 .endpoints = &single_endpoint, 68 .name_prefix = "rt711" 69 } 70 }; 71 72 static const struct snd_soc_acpi_adr_device rt721_3_single_adr[] = { 73 { 74 .adr = 0x000330025d072101ull, 75 .num_endpoints = ARRAY_SIZE(rt_mf_endpoints), 76 .endpoints = rt_mf_endpoints, 77 .name_prefix = "rt721" 78 } 79 }; 80 81 static const struct snd_soc_acpi_link_adr ptl_rt721_l3[] = { 82 { 83 .mask = BIT(3), 84 .num_adr = ARRAY_SIZE(rt721_3_single_adr), 85 .adr_d = rt721_3_single_adr, 86 }, 87 {}, 88 }; 89 90 static const struct snd_soc_acpi_adr_device rt722_0_single_adr[] = { 91 { 92 .adr = 0x000030025d072201ull, 93 .num_endpoints = ARRAY_SIZE(rt_mf_endpoints), 94 .endpoints = rt_mf_endpoints, 95 .name_prefix = "rt722" 96 } 97 }; 98 99 static const struct snd_soc_acpi_adr_device rt722_1_single_adr[] = { 100 { 101 .adr = 0x000130025d072201ull, 102 .num_endpoints = ARRAY_SIZE(rt_mf_endpoints), 103 .endpoints = rt_mf_endpoints, 104 .name_prefix = "rt722" 105 } 106 }; 107 108 static const struct snd_soc_acpi_adr_device rt722_3_single_adr[] = { 109 { 110 .adr = 0x000330025d072201ull, 111 .num_endpoints = ARRAY_SIZE(rt_mf_endpoints), 112 .endpoints = rt_mf_endpoints, 113 .name_prefix = "rt722" 114 } 115 }; 116 117 static const struct snd_soc_acpi_link_adr ptl_rt722_only[] = { 118 { 119 .mask = BIT(0), 120 .num_adr = ARRAY_SIZE(rt722_0_single_adr), 121 .adr_d = rt722_0_single_adr, 122 }, 123 {} 124 }; 125 126 static const struct snd_soc_acpi_link_adr ptl_rt722_l1[] = { 127 { 128 .mask = BIT(1), 129 .num_adr = ARRAY_SIZE(rt722_1_single_adr), 130 .adr_d = rt722_1_single_adr, 131 }, 132 {} 133 }; 134 135 static const struct snd_soc_acpi_link_adr ptl_rt722_l3[] = { 136 { 137 .mask = BIT(3), 138 .num_adr = ARRAY_SIZE(rt722_3_single_adr), 139 .adr_d = rt722_3_single_adr, 140 }, 141 {} 142 }; 143 144 static const struct snd_soc_acpi_link_adr ptl_rvp[] = { 145 { 146 .mask = BIT(0), 147 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr), 148 .adr_d = rt711_sdca_0_adr, 149 }, 150 {} 151 }; 152 153 /* this table is used when there is no I2S codec present */ 154 struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_sdw_machines[] = { 155 /* mockup tests need to be first */ 156 { 157 .link_mask = GENMASK(3, 0), 158 .links = sdw_mockup_headset_2amps_mic, 159 .drv_name = "sof_sdw", 160 .sof_tplg_filename = "sof-ptl-rt711-rt1308-rt715.tplg", 161 }, 162 { 163 .link_mask = BIT(0) | BIT(1) | BIT(3), 164 .links = sdw_mockup_headset_1amp_mic, 165 .drv_name = "sof_sdw", 166 .sof_tplg_filename = "sof-ptl-rt711-rt1308-mono-rt715.tplg", 167 }, 168 { 169 .link_mask = GENMASK(2, 0), 170 .links = sdw_mockup_mic_headset_1amp, 171 .drv_name = "sof_sdw", 172 .sof_tplg_filename = "sof-ptl-rt715-rt711-rt1308-mono.tplg", 173 }, 174 { 175 .link_mask = BIT(0), 176 .links = ptl_rvp, 177 .drv_name = "sof_sdw", 178 .sof_tplg_filename = "sof-ptl-rt711.tplg", 179 }, 180 { 181 .link_mask = BIT(3), 182 .links = ptl_rt721_l3, 183 .drv_name = "sof_sdw", 184 .sof_tplg_filename = "sof-ptl-rt721.tplg", 185 }, 186 { 187 .link_mask = BIT(0), 188 .links = ptl_rt722_only, 189 .drv_name = "sof_sdw", 190 .sof_tplg_filename = "sof-ptl-rt722.tplg", 191 }, 192 { 193 .link_mask = BIT(1), 194 .links = ptl_rt722_l1, 195 .drv_name = "sof_sdw", 196 .sof_tplg_filename = "sof-ptl-rt722.tplg", 197 }, 198 { 199 .link_mask = BIT(3), 200 .links = ptl_rt722_l3, 201 .drv_name = "sof_sdw", 202 .sof_tplg_filename = "sof-ptl-rt722.tplg", 203 }, 204 {}, 205 }; 206 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_ptl_sdw_machines); 207