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