1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * soc-apci-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_THINKPAD_10  1
15 #define BYT_POV_P1006W   2
16 
17 static int byt_thinkpad10_quirk_cb(const struct dmi_system_id *id)
18 {
19 	byt_machine_id = BYT_THINKPAD_10;
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_thinkpad10_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_thinkpad10_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_thinkpad10_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_thinkpad10_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 };
71 
72 static struct snd_soc_acpi_mach byt_thinkpad_10 = {
73 	.id = "10EC5640",
74 	.drv_name = "cht-bsw-rt5672",
75 	.fw_filename = "intel/fw_sst_0f28.bin",
76 	.board = "cht-bsw",
77 	.sof_fw_filename = "sof-byt.ri",
78 	.sof_tplg_filename = "sof-byt-rt5670.tplg",
79 };
80 
81 static struct snd_soc_acpi_mach byt_pov_p1006w = {
82 	.id = "10EC5640",
83 	.drv_name = "bytcr_rt5651",
84 	.fw_filename = "intel/fw_sst_0f28.bin",
85 	.board = "bytcr_rt5651",
86 	.sof_fw_filename = "sof-byt.ri",
87 	.sof_tplg_filename = "sof-byt-rt5651.tplg",
88 };
89 
90 static struct snd_soc_acpi_mach *byt_quirk(void *arg)
91 {
92 	struct snd_soc_acpi_mach *mach = arg;
93 
94 	dmi_check_system(byt_table);
95 
96 	switch (byt_machine_id) {
97 	case BYT_THINKPAD_10:
98 		return &byt_thinkpad_10;
99 	case BYT_POV_P1006W:
100 		return &byt_pov_p1006w;
101 	default:
102 		return mach;
103 	}
104 }
105 
106 struct snd_soc_acpi_mach snd_soc_acpi_intel_baytrail_legacy_machines[] = {
107 	{
108 		.id = "10EC5640",
109 		.drv_name = "byt-rt5640",
110 		.fw_filename = "intel/fw_sst_0f28.bin-48kHz_i2s_master",
111 	},
112 	{
113 		.id = "193C9890",
114 		.drv_name = "byt-max98090",
115 		.fw_filename = "intel/fw_sst_0f28.bin-48kHz_i2s_master",
116 	},
117 	{}
118 };
119 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_baytrail_legacy_machines);
120 
121 struct snd_soc_acpi_mach  snd_soc_acpi_intel_baytrail_machines[] = {
122 	{
123 		.id = "10EC5640",
124 		.drv_name = "bytcr_rt5640",
125 		.fw_filename = "intel/fw_sst_0f28.bin",
126 		.board = "bytcr_rt5640",
127 		.machine_quirk = byt_quirk,
128 		.sof_fw_filename = "sof-byt.ri",
129 		.sof_tplg_filename = "sof-byt-rt5640.tplg",
130 	},
131 	{
132 		.id = "10EC5642",
133 		.drv_name = "bytcr_rt5640",
134 		.fw_filename = "intel/fw_sst_0f28.bin",
135 		.board = "bytcr_rt5640",
136 		.sof_fw_filename = "sof-byt.ri",
137 		.sof_tplg_filename = "sof-byt-rt5640.tplg",
138 	},
139 	{
140 		.id = "INTCCFFD",
141 		.drv_name = "bytcr_rt5640",
142 		.fw_filename = "intel/fw_sst_0f28.bin",
143 		.board = "bytcr_rt5640",
144 		.sof_fw_filename = "sof-byt.ri",
145 		.sof_tplg_filename = "sof-byt-rt5640.tplg",
146 	},
147 	{
148 		.id = "10EC5651",
149 		.drv_name = "bytcr_rt5651",
150 		.fw_filename = "intel/fw_sst_0f28.bin",
151 		.board = "bytcr_rt5651",
152 		.sof_fw_filename = "sof-byt.ri",
153 		.sof_tplg_filename = "sof-byt-rt5651.tplg",
154 	},
155 	{
156 		.id = "DLGS7212",
157 		.drv_name = "bytcht_da7213",
158 		.fw_filename = "intel/fw_sst_0f28.bin",
159 		.board = "bytcht_da7213",
160 		.sof_fw_filename = "sof-byt.ri",
161 		.sof_tplg_filename = "sof-byt-da7213.tplg",
162 	},
163 	{
164 		.id = "DLGS7213",
165 		.drv_name = "bytcht_da7213",
166 		.fw_filename = "intel/fw_sst_0f28.bin",
167 		.board = "bytcht_da7213",
168 		.sof_fw_filename = "sof-byt.ri",
169 		.sof_tplg_filename = "sof-byt-da7213.tplg",
170 	},
171 	{
172 		.id = "ESSX8316",
173 		.drv_name = "bytcht_es8316",
174 		.fw_filename = "intel/fw_sst_0f28.bin",
175 		.board = "bytcht_es8316",
176 		.sof_fw_filename = "sof-byt.ri",
177 		.sof_tplg_filename = "sof-byt-es8316.tplg",
178 	},
179 	{
180 		.id = "10EC5682",
181 		.drv_name = "sof_rt5682",
182 		.sof_fw_filename = "sof-byt.ri",
183 		.sof_tplg_filename = "sof-byt-rt5682.tplg",
184 	},
185 	/* some Baytrail platforms rely on RT5645, use CHT machine driver */
186 	{
187 		.id = "10EC5645",
188 		.drv_name = "cht-bsw-rt5645",
189 		.fw_filename = "intel/fw_sst_0f28.bin",
190 		.board = "cht-bsw",
191 		.sof_fw_filename = "sof-byt.ri",
192 		.sof_tplg_filename = "sof-byt-rt5645.tplg",
193 	},
194 	{
195 		.id = "10EC5648",
196 		.drv_name = "cht-bsw-rt5645",
197 		.fw_filename = "intel/fw_sst_0f28.bin",
198 		.board = "cht-bsw",
199 		.sof_fw_filename = "sof-byt.ri",
200 		.sof_tplg_filename = "sof-byt-rt5645.tplg",
201 	},
202 	/* use CHT driver to Baytrail Chromebooks */
203 	{
204 		.id = "193C9890",
205 		.drv_name = "cht-bsw-max98090",
206 		.fw_filename = "intel/fw_sst_0f28.bin",
207 		.board = "cht-bsw",
208 		.sof_fw_filename = "sof-byt.ri",
209 		.sof_tplg_filename = "sof-byt-max98090.tplg",
210 	},
211 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH)
212 	/*
213 	 * This is always last in the table so that it is selected only when
214 	 * enabled explicitly and there is no codec-related information in SSDT
215 	 */
216 	{
217 		.id = "80860F28",
218 		.drv_name = "bytcht_nocodec",
219 		.fw_filename = "intel/fw_sst_0f28.bin",
220 		.board = "bytcht_nocodec",
221 	},
222 #endif
223 	{},
224 };
225 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_baytrail_machines);
226 
227 MODULE_LICENSE("GPL v2");
228 MODULE_DESCRIPTION("Intel Common ACPI Match module");
229