1 /*
2  * soc-apci-intel-byt-match.c - tables and support for BYT ACPI enumeration.
3  *
4  * Copyright (c) 2017, Intel Corporation.
5  *
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms and conditions of the GNU General Public License,
9  * version 2, as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14  * more details.
15  */
16 
17 #include <linux/dmi.h>
18 #include <sound/soc-acpi.h>
19 #include <sound/soc-acpi-intel-match.h>
20 
21 static unsigned long byt_machine_id;
22 
23 #define BYT_THINKPAD_10  1
24 
25 static int byt_thinkpad10_quirk_cb(const struct dmi_system_id *id)
26 {
27 	byt_machine_id = BYT_THINKPAD_10;
28 	return 1;
29 }
30 
31 
32 static const struct dmi_system_id byt_table[] = {
33 	{
34 		.callback = byt_thinkpad10_quirk_cb,
35 		.matches = {
36 			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
37 			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad 8"),
38 		},
39 	},
40 	{
41 		.callback = byt_thinkpad10_quirk_cb,
42 		.matches = {
43 			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
44 			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad 10"),
45 		},
46 	},
47 	{
48 		.callback = byt_thinkpad10_quirk_cb,
49 		.matches = {
50 			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
51 			DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Tablet B"),
52 		},
53 	},
54 	{
55 		.callback = byt_thinkpad10_quirk_cb,
56 		.matches = {
57 			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
58 			DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Miix 2 10"),
59 		},
60 	},
61 	{ }
62 };
63 
64 static struct snd_soc_acpi_mach byt_thinkpad_10 = {
65 	.id = "10EC5640",
66 	.drv_name = "cht-bsw-rt5672",
67 	.fw_filename = "intel/fw_sst_0f28.bin",
68 	.board = "cht-bsw",
69 	.sof_fw_filename = "intel/sof-byt.ri",
70 	.sof_tplg_filename = "intel/sof-byt-rt5670.tplg",
71 	.asoc_plat_name = "sst-mfld-platform",
72 };
73 
74 static struct snd_soc_acpi_mach *byt_quirk(void *arg)
75 {
76 	struct snd_soc_acpi_mach *mach = arg;
77 
78 	dmi_check_system(byt_table);
79 
80 	if (byt_machine_id == BYT_THINKPAD_10)
81 		return &byt_thinkpad_10;
82 	else
83 		return mach;
84 }
85 
86 struct snd_soc_acpi_mach snd_soc_acpi_intel_baytrail_legacy_machines[] = {
87 	{
88 		.id = "10EC5640",
89 		.drv_name = "byt-rt5640",
90 		.fw_filename = "intel/fw_sst_0f28.bin-48kHz_i2s_master",
91 	},
92 	{
93 		.id = "193C9890",
94 		.drv_name = "byt-max98090",
95 		.fw_filename = "intel/fw_sst_0f28.bin-48kHz_i2s_master",
96 	},
97 	{}
98 };
99 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_baytrail_legacy_machines);
100 
101 struct snd_soc_acpi_mach  snd_soc_acpi_intel_baytrail_machines[] = {
102 	{
103 		.id = "10EC5640",
104 		.drv_name = "bytcr_rt5640",
105 		.fw_filename = "intel/fw_sst_0f28.bin",
106 		.board = "bytcr_rt5640",
107 		.machine_quirk = byt_quirk,
108 		.sof_fw_filename = "intel/sof-byt.ri",
109 		.sof_tplg_filename = "intel/sof-byt-rt5640.tplg",
110 		.asoc_plat_name = "sst-mfld-platform",
111 	},
112 	{
113 		.id = "10EC5642",
114 		.drv_name = "bytcr_rt5640",
115 		.fw_filename = "intel/fw_sst_0f28.bin",
116 		.board = "bytcr_rt5640",
117 		.sof_fw_filename = "intel/sof-byt.ri",
118 		.sof_tplg_filename = "intel/sof-byt-rt5640.tplg",
119 		.asoc_plat_name = "sst-mfld-platform",
120 	},
121 	{
122 		.id = "INTCCFFD",
123 		.drv_name = "bytcr_rt5640",
124 		.fw_filename = "intel/fw_sst_0f28.bin",
125 		.board = "bytcr_rt5640",
126 		.sof_fw_filename = "intel/sof-byt.ri",
127 		.sof_tplg_filename = "intel/sof-byt-rt5640.tplg",
128 		.asoc_plat_name = "sst-mfld-platform",
129 	},
130 	{
131 		.id = "10EC5651",
132 		.drv_name = "bytcr_rt5651",
133 		.fw_filename = "intel/fw_sst_0f28.bin",
134 		.board = "bytcr_rt5651",
135 		.sof_fw_filename = "intel/sof-byt.ri",
136 		.sof_tplg_filename = "intel/sof-byt-rt5651.tplg",
137 		.asoc_plat_name = "sst-mfld-platform",
138 	},
139 	{
140 		.id = "DLGS7212",
141 		.drv_name = "bytcht_da7213",
142 		.fw_filename = "intel/fw_sst_0f28.bin",
143 		.board = "bytcht_da7213",
144 		.sof_fw_filename = "intel/sof-byt.ri",
145 		.sof_tplg_filename = "intel/sof-byt-da7213.tplg",
146 		.asoc_plat_name = "sst-mfld-platform",
147 	},
148 	{
149 		.id = "DLGS7213",
150 		.drv_name = "bytcht_da7213",
151 		.fw_filename = "intel/fw_sst_0f28.bin",
152 		.board = "bytcht_da7213",
153 		.sof_fw_filename = "intel/sof-byt.ri",
154 		.sof_tplg_filename = "intel/sof-byt-da7213.tplg",
155 		.asoc_plat_name = "sst-mfld-platform",
156 	},
157 	/* some Baytrail platforms rely on RT5645, use CHT machine driver */
158 	{
159 		.id = "10EC5645",
160 		.drv_name = "cht-bsw-rt5645",
161 		.fw_filename = "intel/fw_sst_0f28.bin",
162 		.board = "cht-bsw",
163 		.sof_fw_filename = "intel/sof-byt.ri",
164 		.sof_tplg_filename = "intel/sof-byt-rt5645.tplg",
165 		.asoc_plat_name = "sst-mfld-platform",
166 	},
167 	{
168 		.id = "10EC5648",
169 		.drv_name = "cht-bsw-rt5645",
170 		.fw_filename = "intel/fw_sst_0f28.bin",
171 		.board = "cht-bsw",
172 		.sof_fw_filename = "intel/sof-byt.ri",
173 		.sof_tplg_filename = "intel/sof-byt-rt5645.tplg",
174 		.asoc_plat_name = "sst-mfld-platform",
175 	},
176 	/* use CHT driver to Baytrail Chromebooks */
177 	{
178 		.id = "193C9890",
179 		.drv_name = "cht-bsw-max98090",
180 		.fw_filename = "intel/fw_sst_0f28.bin",
181 		.board = "cht-bsw",
182 		.sof_fw_filename = "intel/sof-byt.ri",
183 		.sof_tplg_filename = "intel/sof-byt-max98090.tplg",
184 		.asoc_plat_name = "sst-mfld-platform",
185 	},
186 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH)
187 	/*
188 	 * This is always last in the table so that it is selected only when
189 	 * enabled explicitly and there is no codec-related information in SSDT
190 	 */
191 	{
192 		.id = "80860F28",
193 		.drv_name = "bytcht_nocodec",
194 		.fw_filename = "intel/fw_sst_0f28.bin",
195 		.board = "bytcht_nocodec",
196 	},
197 #endif
198 	{},
199 };
200 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_baytrail_machines);
201 
202 MODULE_LICENSE("GPL v2");
203 MODULE_DESCRIPTION("Intel Common ACPI Match module");
204