1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * soc-acpi-intel-byt-match.c - tables and support for BYT 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 byt_machine_id;
13 
14 #define BYT_RT5672       1
15 #define BYT_POV_P1006W   2
16 
17 static int byt_rt5672_quirk_cb(const struct dmi_system_id *id)
18 {
19 	byt_machine_id = BYT_RT5672;
20 	return 1;
21 }
22 
23 static int byt_pov_p1006w_quirk_cb(const struct dmi_system_id *id)
24 {
25 	byt_machine_id = BYT_POV_P1006W;
26 	return 1;
27 }
28 
29 static const struct dmi_system_id byt_table[] = {
30 	{
31 		.callback = byt_rt5672_quirk_cb,
32 		.matches = {
33 			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
34 			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad 8"),
35 		},
36 	},
37 	{
38 		.callback = byt_rt5672_quirk_cb,
39 		.matches = {
40 			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
41 			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad 10"),
42 		},
43 	},
44 	{
45 		.callback = byt_rt5672_quirk_cb,
46 		.matches = {
47 			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
48 			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Tablet B"),
49 		},
50 	},
51 	{
52 		.callback = byt_rt5672_quirk_cb,
53 		.matches = {
54 			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
55 			DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Miix 2 10"),
56 		},
57 	},
58 	{
59 		/* Point of View mobii wintab p1006w (v1.0) */
60 		.callback = byt_pov_p1006w_quirk_cb,
61 		.matches = {
62 			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Insyde"),
63 			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "BayTrail"),
64 			/* Note 105b is Foxcon's USB/PCI vendor id */
65 			DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "105B"),
66 			DMI_EXACT_MATCH(DMI_BOARD_NAME, "0E57"),
67 		},
68 	},
69 	{
70 		/* Aegex 10 tablet (RU2) */
71 		.callback = byt_rt5672_quirk_cb,
72 		.matches = {
73 			DMI_MATCH(DMI_SYS_VENDOR, "AEGEX"),
74 			DMI_MATCH(DMI_PRODUCT_VERSION, "RU2"),
75 		},
76 	},
77 	{
78 		/* Dell Venue 10 Pro 5055 */
79 		.callback = byt_rt5672_quirk_cb,
80 		.matches = {
81 			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
82 			DMI_MATCH(DMI_PRODUCT_NAME, "Venue 10 Pro 5055"),
83 		},
84 	},
85 	{ }
86 };
87 
88 /* Various devices use an ACPI id of 10EC5640 while using a rt5672 codec */
89 static struct snd_soc_acpi_mach byt_rt5672 = {
90 	.id = "10EC5640",
91 	.drv_name = "cht-bsw-rt5672",
92 	.fw_filename = "intel/fw_sst_0f28.bin",
93 	.board = "cht-bsw",
94 	.sof_fw_filename = "sof-byt.ri",
95 	.sof_tplg_filename = "sof-byt-rt5670.tplg",
96 };
97 
98 static struct snd_soc_acpi_mach byt_pov_p1006w = {
99 	.id = "10EC5640",
100 	.drv_name = "bytcr_rt5651",
101 	.fw_filename = "intel/fw_sst_0f28.bin",
102 	.board = "bytcr_rt5651",
103 	.sof_fw_filename = "sof-byt.ri",
104 	.sof_tplg_filename = "sof-byt-rt5651.tplg",
105 };
106 
107 static struct snd_soc_acpi_mach *byt_quirk(void *arg)
108 {
109 	struct snd_soc_acpi_mach *mach = arg;
110 
111 	dmi_check_system(byt_table);
112 
113 	switch (byt_machine_id) {
114 	case BYT_RT5672:
115 		return &byt_rt5672;
116 	case BYT_POV_P1006W:
117 		return &byt_pov_p1006w;
118 	default:
119 		return mach;
120 	}
121 }
122 
123 struct snd_soc_acpi_mach  snd_soc_acpi_intel_baytrail_machines[] = {
124 	{
125 		.id = "10EC5640",
126 		.drv_name = "bytcr_rt5640",
127 		.fw_filename = "intel/fw_sst_0f28.bin",
128 		.board = "bytcr_rt5640",
129 		.machine_quirk = byt_quirk,
130 		.sof_fw_filename = "sof-byt.ri",
131 		.sof_tplg_filename = "sof-byt-rt5640.tplg",
132 	},
133 	{
134 		.id = "10EC5642",
135 		.drv_name = "bytcr_rt5640",
136 		.fw_filename = "intel/fw_sst_0f28.bin",
137 		.board = "bytcr_rt5640",
138 		.sof_fw_filename = "sof-byt.ri",
139 		.sof_tplg_filename = "sof-byt-rt5640.tplg",
140 	},
141 	{
142 		.id = "INTCCFFD",
143 		.drv_name = "bytcr_rt5640",
144 		.fw_filename = "intel/fw_sst_0f28.bin",
145 		.board = "bytcr_rt5640",
146 		.sof_fw_filename = "sof-byt.ri",
147 		.sof_tplg_filename = "sof-byt-rt5640.tplg",
148 	},
149 	{
150 		.id = "10EC5651",
151 		.drv_name = "bytcr_rt5651",
152 		.fw_filename = "intel/fw_sst_0f28.bin",
153 		.board = "bytcr_rt5651",
154 		.sof_fw_filename = "sof-byt.ri",
155 		.sof_tplg_filename = "sof-byt-rt5651.tplg",
156 	},
157 	{
158 		.id = "WM510204",
159 		.drv_name = "bytcr_wm5102",
160 		.fw_filename = "intel/fw_sst_0f28.bin",
161 		.board = "bytcr_wm5102",
162 		.sof_fw_filename = "sof-byt.ri",
163 		.sof_tplg_filename = "sof-byt-wm5102.tplg",
164 	},
165 	{
166 		.id = "WM510205",
167 		.drv_name = "bytcr_wm5102",
168 		.fw_filename = "intel/fw_sst_0f28.bin",
169 		.board = "bytcr_wm5102",
170 		.sof_fw_filename = "sof-byt.ri",
171 		.sof_tplg_filename = "sof-byt-wm5102.tplg",
172 	},
173 	{
174 		.id = "DLGS7212",
175 		.drv_name = "bytcht_da7213",
176 		.fw_filename = "intel/fw_sst_0f28.bin",
177 		.board = "bytcht_da7213",
178 		.sof_fw_filename = "sof-byt.ri",
179 		.sof_tplg_filename = "sof-byt-da7213.tplg",
180 	},
181 	{
182 		.id = "DLGS7213",
183 		.drv_name = "bytcht_da7213",
184 		.fw_filename = "intel/fw_sst_0f28.bin",
185 		.board = "bytcht_da7213",
186 		.sof_fw_filename = "sof-byt.ri",
187 		.sof_tplg_filename = "sof-byt-da7213.tplg",
188 	},
189 	{
190 		.id = "ESSX8316",
191 		.drv_name = "bytcht_es8316",
192 		.fw_filename = "intel/fw_sst_0f28.bin",
193 		.board = "bytcht_es8316",
194 		.sof_fw_filename = "sof-byt.ri",
195 		.sof_tplg_filename = "sof-byt-es8316.tplg",
196 	},
197 	{
198 		.id = "10EC5682",
199 		.drv_name = "sof_rt5682",
200 		.sof_fw_filename = "sof-byt.ri",
201 		.sof_tplg_filename = "sof-byt-rt5682.tplg",
202 	},
203 	/* some Baytrail platforms rely on RT5645, use CHT machine driver */
204 	{
205 		.id = "10EC5645",
206 		.drv_name = "cht-bsw-rt5645",
207 		.fw_filename = "intel/fw_sst_0f28.bin",
208 		.board = "cht-bsw",
209 		.sof_fw_filename = "sof-byt.ri",
210 		.sof_tplg_filename = "sof-byt-rt5645.tplg",
211 	},
212 	{
213 		.id = "10EC5648",
214 		.drv_name = "cht-bsw-rt5645",
215 		.fw_filename = "intel/fw_sst_0f28.bin",
216 		.board = "cht-bsw",
217 		.sof_fw_filename = "sof-byt.ri",
218 		.sof_tplg_filename = "sof-byt-rt5645.tplg",
219 	},
220 	/* use CHT driver to Baytrail Chromebooks */
221 	{
222 		.id = "193C9890",
223 		.drv_name = "cht-bsw-max98090",
224 		.fw_filename = "intel/fw_sst_0f28.bin",
225 		.board = "cht-bsw",
226 		.sof_fw_filename = "sof-byt.ri",
227 		.sof_tplg_filename = "sof-byt-max98090.tplg",
228 	},
229 	{
230 		.id = "14F10720",
231 		.drv_name = "bytcht_cx2072x",
232 		.fw_filename = "intel/fw_sst_0f28.bin",
233 		.board = "bytcht_cx2072x",
234 		.sof_fw_filename = "sof-byt.ri",
235 		.sof_tplg_filename = "sof-byt-cx2072x.tplg",
236 	},
237 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH)
238 	/*
239 	 * This is always last in the table so that it is selected only when
240 	 * enabled explicitly and there is no codec-related information in SSDT
241 	 */
242 	{
243 		.id = "80860F28",
244 		.drv_name = "bytcht_nocodec",
245 		.fw_filename = "intel/fw_sst_0f28.bin",
246 		.board = "bytcht_nocodec",
247 	},
248 #endif
249 	{},
250 };
251 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_baytrail_machines);
252