1 /*
2  * soc-apci-intel-cht-match.c - tables and support for CHT 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 cht_machine_id;
22 
23 #define CHT_SURFACE_MACH 1
24 
25 static int cht_surface_quirk_cb(const struct dmi_system_id *id)
26 {
27 	cht_machine_id = CHT_SURFACE_MACH;
28 	return 1;
29 }
30 
31 static const struct dmi_system_id cht_table[] = {
32 	{
33 		.callback = cht_surface_quirk_cb,
34 		.matches = {
35 			DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
36 			DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
37 		},
38 	},
39 	{ }
40 };
41 
42 static struct snd_soc_acpi_mach cht_surface_mach = {
43 	.id = "10EC5640",
44 	.drv_name = "cht-bsw-rt5645",
45 	.fw_filename = "intel/fw_sst_22a8.bin",
46 	.board = "cht-bsw",
47 	.sof_fw_filename = "intel/reef-cht.ri",
48 	.sof_tplg_filename = "intel/reef-cht-rt5645.tplg",
49 	.asoc_plat_name = "sst-mfld-platform",
50 };
51 
52 static struct snd_soc_acpi_mach *cht_quirk(void *arg)
53 {
54 	struct snd_soc_acpi_mach *mach = arg;
55 
56 	dmi_check_system(cht_table);
57 
58 	if (cht_machine_id == CHT_SURFACE_MACH)
59 		return &cht_surface_mach;
60 	else
61 		return mach;
62 }
63 
64 /* Cherryview-based platforms: CherryTrail and Braswell */
65 struct snd_soc_acpi_mach  snd_soc_acpi_intel_cherrytrail_machines[] = {
66 	{
67 		.id = "10EC5670",
68 		.drv_name = "cht-bsw-rt5672",
69 		.fw_filename = "intel/fw_sst_22a8.bin",
70 		.board = "cht-bsw",
71 		.sof_fw_filename = "intel/reef-cht.ri",
72 		.sof_tplg_filename = "intel/reef-cht-rt5670.tplg",
73 		.asoc_plat_name = "sst-mfld-platform",
74 	},
75 	{
76 		.id = "10EC5672",
77 		.drv_name = "cht-bsw-rt5672",
78 		.fw_filename = "intel/fw_sst_22a8.bin",
79 		.board = "cht-bsw",
80 		.sof_fw_filename = "intel/reef-cht.ri",
81 		.sof_tplg_filename = "intel/reef-cht-rt5670.tplg",
82 		.asoc_plat_name = "sst-mfld-platform",
83 	},
84 	{
85 		.id = "10EC5645",
86 		.drv_name = "cht-bsw-rt5645",
87 		.fw_filename = "intel/fw_sst_22a8.bin",
88 		.board = "cht-bsw",
89 		.sof_fw_filename = "intel/reef-cht.ri",
90 		.sof_tplg_filename = "intel/reef-cht-rt5645.tplg",
91 		.asoc_plat_name = "sst-mfld-platform",
92 	},
93 	{
94 		.id = "10EC5650",
95 		.drv_name = "cht-bsw-rt5645",
96 		.fw_filename = "intel/fw_sst_22a8.bin",
97 		.board = "cht-bsw",
98 		.sof_fw_filename = "intel/reef-cht.ri",
99 		.sof_tplg_filename = "intel/reef-cht-rt5645.tplg",
100 		.asoc_plat_name = "sst-mfld-platform",
101 	},
102 	{
103 		.id = "10EC3270",
104 		.drv_name = "cht-bsw-rt5645",
105 		.fw_filename = "intel/fw_sst_22a8.bin",
106 		.board = "cht-bsw",
107 		.sof_fw_filename = "intel/reef-cht.ri",
108 		.sof_tplg_filename = "intel/reef-cht-rt5645.tplg",
109 		.asoc_plat_name = "sst-mfld-platform",
110 	},
111 	{
112 		.id = "193C9890",
113 		.drv_name = "cht-bsw-max98090",
114 		.fw_filename = "intel/fw_sst_22a8.bin",
115 		.board = "cht-bsw",
116 		.sof_fw_filename = "intel/reef-cht.ri",
117 		.sof_tplg_filename = "intel/reef-cht-max98090.tplg",
118 		.asoc_plat_name = "sst-mfld-platform",
119 	},
120 	{
121 		.id = "10508824",
122 		.drv_name = "cht-bsw-nau8824",
123 		.fw_filename = "intel/fw_sst_22a8.bin",
124 		.board = "cht-bsw",
125 		.sof_fw_filename = "intel/reef-cht.ri",
126 		.sof_tplg_filename = "intel/reef-cht-nau8824.tplg",
127 		.asoc_plat_name = "sst-mfld-platform",
128 	},
129 	{
130 		.id = "DLGS7212",
131 		.drv_name = "bytcht_da7213",
132 		.fw_filename = "intel/fw_sst_22a8.bin",
133 		.board = "bytcht_da7213",
134 		.sof_fw_filename = "intel/reef-cht.ri",
135 		.sof_tplg_filename = "intel/reef-cht-da7213.tplg",
136 		.asoc_plat_name = "sst-mfld-platform",
137 	},
138 	{
139 		.id = "DLGS7213",
140 		.drv_name = "bytcht_da7213",
141 		.fw_filename = "intel/fw_sst_22a8.bin",
142 		.board = "bytcht_da7213",
143 		.sof_fw_filename = "intel/reef-cht.ri",
144 		.sof_tplg_filename = "intel/reef-cht-da7213.tplg",
145 		.asoc_plat_name = "sst-mfld-platform",
146 	},
147 	{
148 		.id = "ESSX8316",
149 		.drv_name = "bytcht_es8316",
150 		.fw_filename = "intel/fw_sst_22a8.bin",
151 		.board = "bytcht_es8316",
152 		.sof_fw_filename = "intel/reef-cht.ri",
153 		.sof_tplg_filename = "intel/reef-cht-es8316.tplg",
154 		.asoc_plat_name = "sst-mfld-platform",
155 	},
156 	/* some CHT-T platforms rely on RT5640, use Baytrail machine driver */
157 	{
158 		.id = "10EC5640",
159 		.drv_name = "bytcr_rt5640",
160 		.fw_filename = "intel/fw_sst_22a8.bin",
161 		.board = "bytcr_rt5640",
162 		.machine_quirk = cht_quirk,
163 		.sof_fw_filename = "intel/reef-cht.ri",
164 		.sof_tplg_filename = "intel/reef-cht-rt5640.tplg",
165 		.asoc_plat_name = "sst-mfld-platform",
166 	},
167 	{
168 		.id = "10EC3276",
169 		.drv_name = "bytcr_rt5640",
170 		.fw_filename = "intel/fw_sst_22a8.bin",
171 		.board = "bytcr_rt5640",
172 		.sof_fw_filename = "intel/reef-cht.ri",
173 		.sof_tplg_filename = "intel/reef-cht-rt5640.tplg",
174 		.asoc_plat_name = "sst-mfld-platform",
175 	},
176 	/* some CHT-T platforms rely on RT5651, use Baytrail machine driver */
177 	{
178 		.id = "10EC5651",
179 		.drv_name = "bytcr_rt5651",
180 		.fw_filename = "intel/fw_sst_22a8.bin",
181 		.board = "bytcr_rt5651",
182 		.sof_fw_filename = "intel/reef-cht.ri",
183 		.sof_tplg_filename = "intel/reef-cht-rt5651.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 = "808622A8",
193 		.drv_name = "bytcht_nocodec",
194 		.fw_filename = "intel/fw_sst_22a8.bin",
195 		.board = "bytcht_nocodec",
196 	},
197 #endif
198 	{},
199 };
200 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cherrytrail_machines);
201 
202 MODULE_LICENSE("GPL v2");
203 MODULE_DESCRIPTION("Intel Common ACPI Match module");
204