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_rt5682_rt5682s_hp = { 24 .num_codecs = 2, 25 .codecs = {"10EC5682", "RTL5682"}, 26 }; 27 28 struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_machines[] = { 29 { 30 .comp_ids = &mtl_rt5682_rt5682s_hp, 31 .drv_name = "mtl_mx98357_rt5682", 32 .machine_quirk = snd_soc_acpi_codec_list, 33 .quirk_data = &mtl_max98357a_amp, 34 .sof_tplg_filename = "sof-mtl-max98357a-rt5682.tplg", 35 }, 36 { 37 .comp_ids = &mtl_rt5682_rt5682s_hp, 38 .drv_name = "mtl_mx98360_rt5682", 39 .machine_quirk = snd_soc_acpi_codec_list, 40 .quirk_data = &mtl_max98360a_amp, 41 .sof_tplg_filename = "sof-mtl-max98360a-rt5682.tplg", 42 }, 43 {}, 44 }; 45 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_mtl_machines); 46 47 static const struct snd_soc_acpi_endpoint single_endpoint = { 48 .num = 0, 49 .aggregated = 0, 50 .group_position = 0, 51 .group_id = 0, 52 }; 53 54 static const struct snd_soc_acpi_endpoint spk_l_endpoint = { 55 .num = 0, 56 .aggregated = 1, 57 .group_position = 0, 58 .group_id = 1, 59 }; 60 61 static const struct snd_soc_acpi_endpoint spk_r_endpoint = { 62 .num = 0, 63 .aggregated = 1, 64 .group_position = 1, 65 .group_id = 1, 66 }; 67 68 static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = { 69 { 70 .adr = 0x000030025D071101ull, 71 .num_endpoints = 1, 72 .endpoints = &single_endpoint, 73 .name_prefix = "rt711" 74 } 75 }; 76 77 static const struct snd_soc_acpi_adr_device mx8373_0_adr[] = { 78 { 79 .adr = 0x000023019F837300ull, 80 .num_endpoints = 1, 81 .endpoints = &spk_l_endpoint, 82 .name_prefix = "Left" 83 }, 84 { 85 .adr = 0x000027019F837300ull, 86 .num_endpoints = 1, 87 .endpoints = &spk_r_endpoint, 88 .name_prefix = "Right" 89 } 90 }; 91 92 static const struct snd_soc_acpi_adr_device rt5682_2_adr[] = { 93 { 94 .adr = 0x000221025D568200ull, 95 .num_endpoints = 1, 96 .endpoints = &single_endpoint, 97 .name_prefix = "rt5682" 98 } 99 }; 100 101 static const struct snd_soc_acpi_link_adr rt5682_link2_max98373_link0[] = { 102 /* Expected order: jack -> amp */ 103 { 104 .mask = BIT(2), 105 .num_adr = ARRAY_SIZE(rt5682_2_adr), 106 .adr_d = rt5682_2_adr, 107 }, 108 { 109 .mask = BIT(0), 110 .num_adr = ARRAY_SIZE(mx8373_0_adr), 111 .adr_d = mx8373_0_adr, 112 }, 113 {} 114 }; 115 116 static const struct snd_soc_acpi_link_adr mtl_rvp[] = { 117 { 118 .mask = BIT(0), 119 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr), 120 .adr_d = rt711_sdca_0_adr, 121 }, 122 {} 123 }; 124 125 /* this table is used when there is no I2S codec present */ 126 struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = { 127 /* mockup tests need to be first */ 128 { 129 .link_mask = GENMASK(3, 0), 130 .links = sdw_mockup_headset_2amps_mic, 131 .drv_name = "sof_sdw", 132 .sof_tplg_filename = "sof-mtl-rt711-rt1308-rt715.tplg", 133 }, 134 { 135 .link_mask = BIT(0) | BIT(1) | BIT(3), 136 .links = sdw_mockup_headset_1amp_mic, 137 .drv_name = "sof_sdw", 138 .sof_tplg_filename = "sof-mtl-rt711-rt1308-mono-rt715.tplg", 139 }, 140 { 141 .link_mask = GENMASK(2, 0), 142 .links = sdw_mockup_mic_headset_1amp, 143 .drv_name = "sof_sdw", 144 .sof_tplg_filename = "sof-mtl-rt715-rt711-rt1308-mono.tplg", 145 }, 146 { 147 .link_mask = BIT(0), 148 .links = mtl_rvp, 149 .drv_name = "sof_sdw", 150 .sof_tplg_filename = "sof-mtl-rt711.tplg", 151 }, 152 { 153 .link_mask = BIT(0) | BIT(2), 154 .links = rt5682_link2_max98373_link0, 155 .drv_name = "sof_sdw", 156 .sof_tplg_filename = "sof-mtl-sdw-rt5682-l2-max98373-l0.tplg", 157 }, 158 {}, 159 }; 160 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_mtl_sdw_machines); 161