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 
12 static unsigned long cht_machine_id;
13 
14 #define CHT_SURFACE_MACH 1
15 
16 static int cht_surface_quirk_cb(const struct dmi_system_id *id)
17 {
18 	cht_machine_id = CHT_SURFACE_MACH;
19 	return 1;
20 }
21 
22 static 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 
33 static 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_tplg_filename = "sof-cht-rt5645.tplg",
39 };
40 
41 static struct snd_soc_acpi_mach *cht_quirk(void *arg)
42 {
43 	struct snd_soc_acpi_mach *mach = arg;
44 
45 	dmi_check_system(cht_table);
46 
47 	if (cht_machine_id == CHT_SURFACE_MACH)
48 		return &cht_surface_mach;
49 	else
50 		return mach;
51 }
52 
53 static const struct snd_soc_acpi_codecs rt5640_comp_ids = {
54 	.num_codecs = 2,
55 	.codecs = { "10EC5640", "10EC3276" },
56 };
57 
58 static const struct snd_soc_acpi_codecs rt5670_comp_ids = {
59 	.num_codecs = 2,
60 	.codecs = { "10EC5670", "10EC5672" },
61 };
62 
63 static const struct snd_soc_acpi_codecs rt5645_comp_ids = {
64 	.num_codecs = 3,
65 	.codecs = { "10EC5645", "10EC5650", "10EC3270" },
66 };
67 
68 static const struct snd_soc_acpi_codecs da7213_comp_ids = {
69 	.num_codecs = 2,
70 	.codecs = { "DGLS7212", "DGLS7213"},
71 
72 };
73 
74 /* Cherryview-based platforms: CherryTrail and Braswell */
75 struct snd_soc_acpi_mach  snd_soc_acpi_intel_cherrytrail_machines[] = {
76 	{
77 		.comp_ids = &rt5670_comp_ids,
78 		.drv_name = "cht-bsw-rt5672",
79 		.fw_filename = "intel/fw_sst_22a8.bin",
80 		.board = "cht-bsw",
81 		.sof_tplg_filename = "sof-cht-rt5670.tplg",
82 	},
83 	{
84 		.comp_ids = &rt5645_comp_ids,
85 		.drv_name = "cht-bsw-rt5645",
86 		.fw_filename = "intel/fw_sst_22a8.bin",
87 		.board = "cht-bsw",
88 		.sof_tplg_filename = "sof-cht-rt5645.tplg",
89 	},
90 	{
91 		.id = "193C9890",
92 		.drv_name = "cht-bsw-max98090",
93 		.fw_filename = "intel/fw_sst_22a8.bin",
94 		.board = "cht-bsw",
95 		.sof_tplg_filename = "sof-cht-max98090.tplg",
96 	},
97 	{
98 		.id = "10508824",
99 		.drv_name = "cht-bsw-nau8824",
100 		.fw_filename = "intel/fw_sst_22a8.bin",
101 		.board = "cht-bsw",
102 		.sof_tplg_filename = "sof-cht-nau8824.tplg",
103 	},
104 	{
105 		.comp_ids = &da7213_comp_ids,
106 		.drv_name = "bytcht_da7213",
107 		.fw_filename = "intel/fw_sst_22a8.bin",
108 		.board = "bytcht_da7213",
109 		.sof_tplg_filename = "sof-cht-da7213.tplg",
110 	},
111 	{
112 		.id = "ESSX8316",
113 		.drv_name = "bytcht_es8316",
114 		.fw_filename = "intel/fw_sst_22a8.bin",
115 		.board = "bytcht_es8316",
116 		.sof_tplg_filename = "sof-cht-es8316.tplg",
117 	},
118 	/* some CHT-T platforms rely on RT5640, use Baytrail machine driver */
119 	{
120 		.comp_ids = &rt5640_comp_ids,
121 		.drv_name = "bytcr_rt5640",
122 		.fw_filename = "intel/fw_sst_22a8.bin",
123 		.board = "bytcr_rt5640",
124 		.machine_quirk = cht_quirk,
125 		.sof_tplg_filename = "sof-cht-rt5640.tplg",
126 	},
127 	{
128 		.id = "10EC5682",
129 		.drv_name = "sof_rt5682",
130 		.sof_tplg_filename = "sof-cht-rt5682.tplg",
131 	},
132 	/* some CHT-T platforms rely on RT5651, use Baytrail machine driver */
133 	{
134 		.id = "10EC5651",
135 		.drv_name = "bytcr_rt5651",
136 		.fw_filename = "intel/fw_sst_22a8.bin",
137 		.board = "bytcr_rt5651",
138 		.sof_tplg_filename = "sof-cht-rt5651.tplg",
139 	},
140 	{
141 		.id = "14F10720",
142 		.drv_name = "bytcht_cx2072x",
143 		.fw_filename = "intel/fw_sst_22a8.bin",
144 		.board = "bytcht_cx2072x",
145 		.sof_tplg_filename = "sof-cht-cx2072x.tplg",
146 	},
147 	{
148 		.id = "104C5122",
149 		.drv_name = "sof_pcm512x",
150 		.sof_tplg_filename = "sof-cht-src-50khz-pcm512x.tplg",
151 	},
152 
153 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH)
154 	/*
155 	 * This is always last in the table so that it is selected only when
156 	 * enabled explicitly and there is no codec-related information in SSDT
157 	 */
158 	{
159 		.id = "808622A8",
160 		.drv_name = "bytcht_nocodec",
161 		.fw_filename = "intel/fw_sst_22a8.bin",
162 		.board = "bytcht_nocodec",
163 	},
164 #endif
165 	{},
166 };
167 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cherrytrail_machines);
168