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 static const struct snd_soc_acpi_codecs rt5640_comp_ids = {
124 	.num_codecs = 3,
125 	.codecs = { "10EC5640", "10EC5642", "INTCCFFD"},
126 };
127 
128 static const struct snd_soc_acpi_codecs wm5102_comp_ids = {
129 	.num_codecs = 2,
130 	.codecs = { "WM510204", "WM510205"},
131 };
132 
133 static const struct snd_soc_acpi_codecs da7213_comp_ids = {
134 	.num_codecs = 2,
135 	.codecs = { "DGLS7212", "DGLS7213"},
136 };
137 
138 static const struct snd_soc_acpi_codecs rt5645_comp_ids = {
139 	.num_codecs = 2,
140 	.codecs = { "10EC5645", "10EC5648"},
141 };
142 
143 struct snd_soc_acpi_mach  snd_soc_acpi_intel_baytrail_machines[] = {
144 	{
145 		.comp_ids = &rt5640_comp_ids,
146 		.drv_name = "bytcr_rt5640",
147 		.fw_filename = "intel/fw_sst_0f28.bin",
148 		.board = "bytcr_rt5640",
149 		.machine_quirk = byt_quirk,
150 		.sof_fw_filename = "sof-byt.ri",
151 		.sof_tplg_filename = "sof-byt-rt5640.tplg",
152 	},
153 	{
154 		.id = "10EC5651",
155 		.drv_name = "bytcr_rt5651",
156 		.fw_filename = "intel/fw_sst_0f28.bin",
157 		.board = "bytcr_rt5651",
158 		.sof_fw_filename = "sof-byt.ri",
159 		.sof_tplg_filename = "sof-byt-rt5651.tplg",
160 	},
161 	{
162 		.comp_ids = &wm5102_comp_ids,
163 		.drv_name = "bytcr_wm5102",
164 		.fw_filename = "intel/fw_sst_0f28.bin",
165 		.board = "bytcr_wm5102",
166 		.sof_fw_filename = "sof-byt.ri",
167 		.sof_tplg_filename = "sof-byt-wm5102.tplg",
168 	},
169 	{
170 		.comp_ids = &da7213_comp_ids,
171 		.drv_name = "bytcht_da7213",
172 		.fw_filename = "intel/fw_sst_0f28.bin",
173 		.board = "bytcht_da7213",
174 		.sof_fw_filename = "sof-byt.ri",
175 		.sof_tplg_filename = "sof-byt-da7213.tplg",
176 	},
177 	{
178 		.id = "ESSX8316",
179 		.drv_name = "bytcht_es8316",
180 		.fw_filename = "intel/fw_sst_0f28.bin",
181 		.board = "bytcht_es8316",
182 		.sof_fw_filename = "sof-byt.ri",
183 		.sof_tplg_filename = "sof-byt-es8316.tplg",
184 	},
185 	{
186 		.id = "10EC5682",
187 		.drv_name = "sof_rt5682",
188 		.sof_fw_filename = "sof-byt.ri",
189 		.sof_tplg_filename = "sof-byt-rt5682.tplg",
190 	},
191 	/* some Baytrail platforms rely on RT5645, use CHT machine driver */
192 	{
193 		.comp_ids = &rt5645_comp_ids,
194 		.drv_name = "cht-bsw-rt5645",
195 		.fw_filename = "intel/fw_sst_0f28.bin",
196 		.board = "cht-bsw",
197 		.sof_fw_filename = "sof-byt.ri",
198 		.sof_tplg_filename = "sof-byt-rt5645.tplg",
199 	},
200 	/* use CHT driver to Baytrail Chromebooks */
201 	{
202 		.id = "193C9890",
203 		.drv_name = "cht-bsw-max98090",
204 		.fw_filename = "intel/fw_sst_0f28.bin",
205 		.board = "cht-bsw",
206 		.sof_fw_filename = "sof-byt.ri",
207 		.sof_tplg_filename = "sof-byt-max98090.tplg",
208 	},
209 	{
210 		.id = "14F10720",
211 		.drv_name = "bytcht_cx2072x",
212 		.fw_filename = "intel/fw_sst_0f28.bin",
213 		.board = "bytcht_cx2072x",
214 		.sof_fw_filename = "sof-byt.ri",
215 		.sof_tplg_filename = "sof-byt-cx2072x.tplg",
216 	},
217 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH)
218 	/*
219 	 * This is always last in the table so that it is selected only when
220 	 * enabled explicitly and there is no codec-related information in SSDT
221 	 */
222 	{
223 		.id = "80860F28",
224 		.drv_name = "bytcht_nocodec",
225 		.fw_filename = "intel/fw_sst_0f28.bin",
226 		.board = "bytcht_nocodec",
227 	},
228 #endif
229 	{},
230 };
231 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_baytrail_machines);
232