1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * soc-acpi-intel-cht-match.c - tables and support for CHT ACPI enumeration. 4 * 5 * Copyright (c) 2017, Intel Corporation. 6 */ 7 8 #include <linux/dmi.h> 9 #include <sound/soc-acpi.h> 10 #include <sound/soc-acpi-intel-match.h> 11 12 static unsigned long cht_machine_id; 13 14 #define CHT_SURFACE_MACH 1 15 16 static int cht_surface_quirk_cb(const struct dmi_system_id *id) 17 { 18 cht_machine_id = CHT_SURFACE_MACH; 19 return 1; 20 } 21 22 static const struct dmi_system_id cht_table[] = { 23 { 24 .callback = cht_surface_quirk_cb, 25 .matches = { 26 DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), 27 DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"), 28 }, 29 }, 30 { } 31 }; 32 33 static struct snd_soc_acpi_mach cht_surface_mach = { 34 .id = "10EC5640", 35 .drv_name = "cht-bsw-rt5645", 36 .fw_filename = "intel/fw_sst_22a8.bin", 37 .board = "cht-bsw", 38 .sof_tplg_filename = "sof-cht-rt5645.tplg", 39 }; 40 41 static struct snd_soc_acpi_mach *cht_quirk(void *arg) 42 { 43 struct snd_soc_acpi_mach *mach = arg; 44 45 dmi_check_system(cht_table); 46 47 if (cht_machine_id == CHT_SURFACE_MACH) 48 return &cht_surface_mach; 49 else 50 return mach; 51 } 52 53 /* 54 * Some tablets with Android factory OS have buggy DSDTs with an ESSX8316 device 55 * in the ACPI tables. While they are not using an ESS8316 codec. These DSDTs 56 * also have an ACPI device for the correct codec, ignore the ESSX8316. 57 */ 58 static const struct dmi_system_id cht_ess8316_not_present_table[] = { 59 { 60 /* Nextbook Ares 8A */ 61 .matches = { 62 DMI_MATCH(DMI_SYS_VENDOR, "Insyde"), 63 DMI_MATCH(DMI_PRODUCT_NAME, "CherryTrail"), 64 DMI_MATCH(DMI_BIOS_VERSION, "M882"), 65 }, 66 }, 67 { } 68 }; 69 70 static struct snd_soc_acpi_mach *cht_ess8316_quirk(void *arg) 71 { 72 if (dmi_check_system(cht_ess8316_not_present_table)) 73 return NULL; 74 75 return arg; 76 } 77 78 static const struct snd_soc_acpi_codecs rt5640_comp_ids = { 79 .num_codecs = 2, 80 .codecs = { "10EC5640", "10EC3276" }, 81 }; 82 83 static const struct snd_soc_acpi_codecs rt5670_comp_ids = { 84 .num_codecs = 2, 85 .codecs = { "10EC5670", "10EC5672" }, 86 }; 87 88 static const struct snd_soc_acpi_codecs rt5645_comp_ids = { 89 .num_codecs = 3, 90 .codecs = { "10EC5645", "10EC5650", "10EC3270" }, 91 }; 92 93 static const struct snd_soc_acpi_codecs da7213_comp_ids = { 94 .num_codecs = 2, 95 .codecs = { "DGLS7212", "DGLS7213"}, 96 97 }; 98 99 /* Cherryview-based platforms: CherryTrail and Braswell */ 100 struct snd_soc_acpi_mach snd_soc_acpi_intel_cherrytrail_machines[] = { 101 { 102 .comp_ids = &rt5670_comp_ids, 103 .drv_name = "cht-bsw-rt5672", 104 .fw_filename = "intel/fw_sst_22a8.bin", 105 .board = "cht-bsw", 106 .sof_tplg_filename = "sof-cht-rt5670.tplg", 107 }, 108 { 109 .comp_ids = &rt5645_comp_ids, 110 .drv_name = "cht-bsw-rt5645", 111 .fw_filename = "intel/fw_sst_22a8.bin", 112 .board = "cht-bsw", 113 .sof_tplg_filename = "sof-cht-rt5645.tplg", 114 }, 115 { 116 .id = "193C9890", 117 .drv_name = "cht-bsw-max98090", 118 .fw_filename = "intel/fw_sst_22a8.bin", 119 .board = "cht-bsw", 120 .sof_tplg_filename = "sof-cht-max98090.tplg", 121 }, 122 { 123 .id = "10508824", 124 .drv_name = "cht-bsw-nau8824", 125 .fw_filename = "intel/fw_sst_22a8.bin", 126 .board = "cht-bsw", 127 .sof_tplg_filename = "sof-cht-nau8824.tplg", 128 }, 129 { 130 .comp_ids = &da7213_comp_ids, 131 .drv_name = "bytcht_da7213", 132 .fw_filename = "intel/fw_sst_22a8.bin", 133 .board = "bytcht_da7213", 134 .sof_tplg_filename = "sof-cht-da7213.tplg", 135 }, 136 { 137 .id = "ESSX8316", 138 .drv_name = "bytcht_es8316", 139 .fw_filename = "intel/fw_sst_22a8.bin", 140 .board = "bytcht_es8316", 141 .machine_quirk = cht_ess8316_quirk, 142 .sof_tplg_filename = "sof-cht-es8316.tplg", 143 }, 144 /* some CHT-T platforms rely on RT5640, use Baytrail machine driver */ 145 { 146 .comp_ids = &rt5640_comp_ids, 147 .drv_name = "bytcr_rt5640", 148 .fw_filename = "intel/fw_sst_22a8.bin", 149 .board = "bytcr_rt5640", 150 .machine_quirk = cht_quirk, 151 .sof_tplg_filename = "sof-cht-rt5640.tplg", 152 }, 153 { 154 .id = "10EC5682", 155 .drv_name = "sof_rt5682", 156 .sof_tplg_filename = "sof-cht-rt5682.tplg", 157 }, 158 /* some CHT-T platforms rely on RT5651, use Baytrail machine driver */ 159 { 160 .id = "10EC5651", 161 .drv_name = "bytcr_rt5651", 162 .fw_filename = "intel/fw_sst_22a8.bin", 163 .board = "bytcr_rt5651", 164 .sof_tplg_filename = "sof-cht-rt5651.tplg", 165 }, 166 { 167 .id = "14F10720", 168 .drv_name = "bytcht_cx2072x", 169 .fw_filename = "intel/fw_sst_22a8.bin", 170 .board = "bytcht_cx2072x", 171 .sof_tplg_filename = "sof-cht-cx2072x.tplg", 172 }, 173 { 174 .id = "104C5122", 175 .drv_name = "sof_pcm512x", 176 .sof_tplg_filename = "sof-cht-src-50khz-pcm512x.tplg", 177 }, 178 179 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH) 180 /* 181 * This is always last in the table so that it is selected only when 182 * enabled explicitly and there is no codec-related information in SSDT 183 */ 184 { 185 .id = "808622A8", 186 .drv_name = "bytcht_nocodec", 187 .fw_filename = "intel/fw_sst_22a8.bin", 188 .board = "bytcht_nocodec", 189 }, 190 #endif 191 {}, 192 }; 193 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cherrytrail_machines); 194