1 // SPDX-License-Identifier: GPL-2.0-only 1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 2 /* 3 * soc-acpi-intel-cht-match.c - tables and sup 3 * soc-acpi-intel-cht-match.c - tables and support for CHT ACPI enumeration. 4 * 4 * 5 * Copyright (c) 2017, Intel Corporation. 5 * Copyright (c) 2017, Intel Corporation. 6 */ 6 */ 7 7 8 #include <linux/dmi.h> 8 #include <linux/dmi.h> 9 #include <sound/soc-acpi.h> 9 #include <sound/soc-acpi.h> 10 #include <sound/soc-acpi-intel-match.h> 10 #include <sound/soc-acpi-intel-match.h> 11 11 12 static unsigned long cht_machine_id; 12 static unsigned long cht_machine_id; 13 13 14 #define CHT_SURFACE_MACH 1 14 #define CHT_SURFACE_MACH 1 15 15 16 static int cht_surface_quirk_cb(const struct d 16 static int cht_surface_quirk_cb(const struct dmi_system_id *id) 17 { 17 { 18 cht_machine_id = CHT_SURFACE_MACH; 18 cht_machine_id = CHT_SURFACE_MACH; 19 return 1; 19 return 1; 20 } 20 } 21 21 22 static const struct dmi_system_id cht_table[] 22 static const struct dmi_system_id cht_table[] = { 23 { 23 { 24 .callback = cht_surface_quirk_ 24 .callback = cht_surface_quirk_cb, 25 .matches = { 25 .matches = { 26 DMI_MATCH(DMI_SYS_VEND 26 DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), 27 DMI_MATCH(DMI_PRODUCT_ 27 DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"), 28 }, 28 }, 29 }, 29 }, 30 { } 30 { } 31 }; 31 }; 32 32 33 static struct snd_soc_acpi_mach cht_surface_ma 33 static struct snd_soc_acpi_mach cht_surface_mach = { 34 .id = "10EC5640", 34 .id = "10EC5640", 35 .drv_name = "cht-bsw-rt5645", 35 .drv_name = "cht-bsw-rt5645", 36 .fw_filename = "intel/fw_sst_22a8.bin" 36 .fw_filename = "intel/fw_sst_22a8.bin", 37 .board = "cht-bsw", 37 .board = "cht-bsw", 38 .sof_tplg_filename = "sof-cht-rt5645.t 38 .sof_tplg_filename = "sof-cht-rt5645.tplg", 39 }; 39 }; 40 40 41 static struct snd_soc_acpi_mach *cht_quirk(voi 41 static struct snd_soc_acpi_mach *cht_quirk(void *arg) 42 { 42 { 43 struct snd_soc_acpi_mach *mach = arg; 43 struct snd_soc_acpi_mach *mach = arg; 44 44 45 dmi_check_system(cht_table); 45 dmi_check_system(cht_table); 46 46 47 if (cht_machine_id == CHT_SURFACE_MACH 47 if (cht_machine_id == CHT_SURFACE_MACH) 48 return &cht_surface_mach; 48 return &cht_surface_mach; 49 else 49 else 50 return mach; 50 return mach; 51 } 51 } 52 52 53 /* 53 /* 54 * Some tablets with Android factory OS have b 54 * Some tablets with Android factory OS have buggy DSDTs with an ESSX8316 device 55 * in the ACPI tables. While they are not usin 55 * in the ACPI tables. While they are not using an ESS8316 codec. These DSDTs 56 * also have an ACPI device for the correct co 56 * also have an ACPI device for the correct codec, ignore the ESSX8316. 57 */ 57 */ 58 static const struct dmi_system_id cht_ess8316_ 58 static const struct dmi_system_id cht_ess8316_not_present_table[] = { 59 { 59 { 60 /* Nextbook Ares 8A */ 60 /* Nextbook Ares 8A */ 61 .matches = { 61 .matches = { 62 DMI_MATCH(DMI_SYS_VEND 62 DMI_MATCH(DMI_SYS_VENDOR, "Insyde"), 63 DMI_MATCH(DMI_PRODUCT_ 63 DMI_MATCH(DMI_PRODUCT_NAME, "CherryTrail"), 64 DMI_MATCH(DMI_BIOS_VER 64 DMI_MATCH(DMI_BIOS_VERSION, "M882"), 65 }, 65 }, 66 }, 66 }, 67 { } 67 { } 68 }; 68 }; 69 69 70 static struct snd_soc_acpi_mach *cht_ess8316_q 70 static struct snd_soc_acpi_mach *cht_ess8316_quirk(void *arg) 71 { 71 { 72 if (dmi_check_system(cht_ess8316_not_p 72 if (dmi_check_system(cht_ess8316_not_present_table)) 73 return NULL; 73 return NULL; 74 74 75 return arg; 75 return arg; 76 } 76 } 77 77 78 /* 78 /* 79 * The Lenovo Yoga Tab 3 Pro YT3-X90, with And 79 * The Lenovo Yoga Tab 3 Pro YT3-X90, with Android factory OS has a buggy DSDT 80 * with the coded not being listed at all. 80 * with the coded not being listed at all. 81 */ 81 */ 82 static const struct dmi_system_id lenovo_yoga_ 82 static const struct dmi_system_id lenovo_yoga_tab3_x90[] = { 83 { 83 { 84 /* Lenovo Yoga Tab 3 Pro YT3-X 84 /* Lenovo Yoga Tab 3 Pro YT3-X90, codec missing from DSDT */ 85 .matches = { 85 .matches = { 86 DMI_MATCH(DMI_SYS_VEND 86 DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"), 87 DMI_MATCH(DMI_PRODUCT_ 87 DMI_MATCH(DMI_PRODUCT_VERSION, "Blade3-10A-001"), 88 }, 88 }, 89 }, 89 }, 90 { } 90 { } 91 }; 91 }; 92 92 93 static struct snd_soc_acpi_mach cht_lenovo_yog 93 static struct snd_soc_acpi_mach cht_lenovo_yoga_tab3_x90_mach = { 94 .id = "10WM5102", 94 .id = "10WM5102", 95 .drv_name = "bytcr_wm5102", 95 .drv_name = "bytcr_wm5102", 96 .fw_filename = "intel/fw_sst_22a8.bin" 96 .fw_filename = "intel/fw_sst_22a8.bin", 97 .board = "bytcr_wm5102", 97 .board = "bytcr_wm5102", 98 .sof_tplg_filename = "sof-cht-wm5102.t 98 .sof_tplg_filename = "sof-cht-wm5102.tplg", 99 }; 99 }; 100 100 101 static struct snd_soc_acpi_mach *lenovo_yt3_x9 101 static struct snd_soc_acpi_mach *lenovo_yt3_x90_quirk(void *arg) 102 { 102 { 103 if (dmi_check_system(lenovo_yoga_tab3_ 103 if (dmi_check_system(lenovo_yoga_tab3_x90)) 104 return &cht_lenovo_yoga_tab3_x 104 return &cht_lenovo_yoga_tab3_x90_mach; 105 105 106 /* Skip wildcard match snd_soc_acpi_in 106 /* Skip wildcard match snd_soc_acpi_intel_cherrytrail_machines[] entry */ 107 return NULL; 107 return NULL; 108 } 108 } 109 109 110 static const struct snd_soc_acpi_codecs rt5640 110 static const struct snd_soc_acpi_codecs rt5640_comp_ids = { 111 .num_codecs = 2, 111 .num_codecs = 2, 112 .codecs = { "10EC5640", "10EC3276" }, 112 .codecs = { "10EC5640", "10EC3276" }, 113 }; 113 }; 114 114 115 static const struct snd_soc_acpi_codecs rt5670 115 static const struct snd_soc_acpi_codecs rt5670_comp_ids = { 116 .num_codecs = 2, 116 .num_codecs = 2, 117 .codecs = { "10EC5670", "10EC5672" }, 117 .codecs = { "10EC5670", "10EC5672" }, 118 }; 118 }; 119 119 120 static const struct snd_soc_acpi_codecs rt5645 120 static const struct snd_soc_acpi_codecs rt5645_comp_ids = { 121 .num_codecs = 3, 121 .num_codecs = 3, 122 .codecs = { "10EC5645", "10EC5650", "1 122 .codecs = { "10EC5645", "10EC5650", "10EC3270" }, 123 }; 123 }; 124 124 125 static const struct snd_soc_acpi_codecs da7213 125 static const struct snd_soc_acpi_codecs da7213_comp_ids = { 126 .num_codecs = 2, 126 .num_codecs = 2, 127 .codecs = { "DGLS7212", "DGLS7213"}, 127 .codecs = { "DGLS7212", "DGLS7213"}, 128 128 129 }; 129 }; 130 130 131 /* Cherryview-based platforms: CherryTrail and 131 /* Cherryview-based platforms: CherryTrail and Braswell */ 132 struct snd_soc_acpi_mach snd_soc_acpi_intel_c 132 struct snd_soc_acpi_mach snd_soc_acpi_intel_cherrytrail_machines[] = { 133 { 133 { 134 .comp_ids = &rt5670_comp_ids, 134 .comp_ids = &rt5670_comp_ids, 135 .drv_name = "cht-bsw-rt5672", 135 .drv_name = "cht-bsw-rt5672", 136 .fw_filename = "intel/fw_sst_2 136 .fw_filename = "intel/fw_sst_22a8.bin", 137 .board = "cht-bsw", 137 .board = "cht-bsw", 138 .sof_tplg_filename = "sof-cht- 138 .sof_tplg_filename = "sof-cht-rt5670.tplg", 139 }, 139 }, 140 { 140 { 141 .comp_ids = &rt5645_comp_ids, 141 .comp_ids = &rt5645_comp_ids, 142 .drv_name = "cht-bsw-rt5645", 142 .drv_name = "cht-bsw-rt5645", 143 .fw_filename = "intel/fw_sst_2 143 .fw_filename = "intel/fw_sst_22a8.bin", 144 .board = "cht-bsw", 144 .board = "cht-bsw", 145 .sof_tplg_filename = "sof-cht- 145 .sof_tplg_filename = "sof-cht-rt5645.tplg", 146 }, 146 }, 147 { 147 { 148 .id = "193C9890", 148 .id = "193C9890", 149 .drv_name = "cht-bsw-max98090" 149 .drv_name = "cht-bsw-max98090", 150 .fw_filename = "intel/fw_sst_2 150 .fw_filename = "intel/fw_sst_22a8.bin", 151 .board = "cht-bsw", 151 .board = "cht-bsw", 152 .sof_tplg_filename = "sof-cht- 152 .sof_tplg_filename = "sof-cht-max98090.tplg", 153 }, 153 }, 154 { 154 { 155 .id = "10508824", 155 .id = "10508824", 156 .drv_name = "cht-bsw-nau8824", 156 .drv_name = "cht-bsw-nau8824", 157 .fw_filename = "intel/fw_sst_2 157 .fw_filename = "intel/fw_sst_22a8.bin", 158 .board = "cht-bsw", 158 .board = "cht-bsw", 159 .sof_tplg_filename = "sof-cht- 159 .sof_tplg_filename = "sof-cht-nau8824.tplg", 160 }, 160 }, 161 { 161 { 162 .comp_ids = &da7213_comp_ids, 162 .comp_ids = &da7213_comp_ids, 163 .drv_name = "bytcht_da7213", 163 .drv_name = "bytcht_da7213", 164 .fw_filename = "intel/fw_sst_2 164 .fw_filename = "intel/fw_sst_22a8.bin", 165 .board = "bytcht_da7213", 165 .board = "bytcht_da7213", 166 .sof_tplg_filename = "sof-cht- 166 .sof_tplg_filename = "sof-cht-da7213.tplg", 167 }, 167 }, 168 { 168 { 169 .id = "ESSX8316", 169 .id = "ESSX8316", 170 .drv_name = "bytcht_es8316", 170 .drv_name = "bytcht_es8316", 171 .fw_filename = "intel/fw_sst_2 171 .fw_filename = "intel/fw_sst_22a8.bin", 172 .board = "bytcht_es8316", 172 .board = "bytcht_es8316", 173 .machine_quirk = cht_ess8316_q 173 .machine_quirk = cht_ess8316_quirk, 174 .sof_tplg_filename = "sof-cht- 174 .sof_tplg_filename = "sof-cht-es8316.tplg", 175 }, 175 }, 176 /* some CHT-T platforms rely on RT5640 176 /* some CHT-T platforms rely on RT5640, use Baytrail machine driver */ 177 { 177 { 178 .comp_ids = &rt5640_comp_ids, 178 .comp_ids = &rt5640_comp_ids, 179 .drv_name = "bytcr_rt5640", 179 .drv_name = "bytcr_rt5640", 180 .fw_filename = "intel/fw_sst_2 180 .fw_filename = "intel/fw_sst_22a8.bin", 181 .board = "bytcr_rt5640", 181 .board = "bytcr_rt5640", 182 .machine_quirk = cht_quirk, 182 .machine_quirk = cht_quirk, 183 .sof_tplg_filename = "sof-cht- 183 .sof_tplg_filename = "sof-cht-rt5640.tplg", 184 }, 184 }, 185 { 185 { 186 .id = "10EC5682", 186 .id = "10EC5682", 187 .drv_name = "sof_rt5682", 187 .drv_name = "sof_rt5682", 188 .sof_tplg_filename = "sof-cht- 188 .sof_tplg_filename = "sof-cht-rt5682.tplg", 189 }, 189 }, 190 /* some CHT-T platforms rely on RT5651 190 /* some CHT-T platforms rely on RT5651, use Baytrail machine driver */ 191 { 191 { 192 .id = "10EC5651", 192 .id = "10EC5651", 193 .drv_name = "bytcr_rt5651", 193 .drv_name = "bytcr_rt5651", 194 .fw_filename = "intel/fw_sst_2 194 .fw_filename = "intel/fw_sst_22a8.bin", 195 .board = "bytcr_rt5651", 195 .board = "bytcr_rt5651", 196 .sof_tplg_filename = "sof-cht- 196 .sof_tplg_filename = "sof-cht-rt5651.tplg", 197 }, 197 }, 198 { 198 { 199 .id = "14F10720", 199 .id = "14F10720", 200 .drv_name = "bytcht_cx2072x", 200 .drv_name = "bytcht_cx2072x", 201 .fw_filename = "intel/fw_sst_2 201 .fw_filename = "intel/fw_sst_22a8.bin", 202 .board = "bytcht_cx2072x", 202 .board = "bytcht_cx2072x", 203 .sof_tplg_filename = "sof-cht- 203 .sof_tplg_filename = "sof-cht-cx2072x.tplg", 204 }, 204 }, 205 { 205 { 206 .id = "104C5122", 206 .id = "104C5122", 207 .drv_name = "sof_pcm512x", 207 .drv_name = "sof_pcm512x", 208 .sof_tplg_filename = "sof-cht- 208 .sof_tplg_filename = "sof-cht-src-50khz-pcm512x.tplg", 209 }, 209 }, 210 /* 210 /* 211 * Special case for the Lenovo Yoga Ta 211 * Special case for the Lenovo Yoga Tab 3 Pro YT3-X90 where the DSDT 212 * misses the codec. Match on the SST 212 * misses the codec. Match on the SST id instead, lenovo_yt3_x90_quirk() 213 * will return a YT3 specific mach or 213 * will return a YT3 specific mach or NULL when called on other hw, 214 * skipping this entry. 214 * skipping this entry. 215 */ 215 */ 216 { 216 { 217 .id = "808622A8", 217 .id = "808622A8", 218 .machine_quirk = lenovo_yt3_x9 218 .machine_quirk = lenovo_yt3_x90_quirk, 219 }, 219 }, 220 220 221 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_BYT_CHT_NO 221 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH) 222 /* 222 /* 223 * This is always last in the table so 223 * This is always last in the table so that it is selected only when 224 * enabled explicitly and there is no 224 * enabled explicitly and there is no codec-related information in SSDT 225 */ 225 */ 226 { 226 { 227 .id = "808622A8", 227 .id = "808622A8", 228 .drv_name = "bytcht_nocodec", 228 .drv_name = "bytcht_nocodec", 229 .fw_filename = "intel/fw_sst_2 229 .fw_filename = "intel/fw_sst_22a8.bin", 230 .board = "bytcht_nocodec", 230 .board = "bytcht_nocodec", 231 }, 231 }, 232 #endif 232 #endif 233 {}, 233 {}, 234 }; 234 }; 235 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cherrytra 235 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cherrytrail_machines); 236 236
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.