xref: /openbmc/linux/sound/soc/sof/intel/pci-tgl.c (revision e847c767)
1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
2 //
3 // This file is provided under a dual BSD/GPLv2 license.  When using or
4 // redistributing this file, you may do so under either license.
5 //
6 // Copyright(c) 2018-2021 Intel Corporation. All rights reserved.
7 //
8 // Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
9 //
10 
11 #include <linux/module.h>
12 #include <linux/pci.h>
13 #include <sound/soc-acpi.h>
14 #include <sound/soc-acpi-intel-match.h>
15 #include <sound/sof.h>
16 #include "../ops.h"
17 #include "../sof-pci-dev.h"
18 
19 /* platform specific devices */
20 #include "hda.h"
21 
22 static const struct sof_dev_desc tgl_desc = {
23 	.machines               = snd_soc_acpi_intel_tgl_machines,
24 	.alt_machines		= snd_soc_acpi_intel_tgl_sdw_machines,
25 	.use_acpi_target_states	= true,
26 	.resindex_lpe_base      = 0,
27 	.resindex_pcicfg_base   = -1,
28 	.resindex_imr_base      = -1,
29 	.irqindex_host_ipc      = -1,
30 	.chip_info = &tgl_chip_info,
31 	.ipc_supported_mask	= BIT(SOF_IPC) | BIT(SOF_INTEL_IPC4),
32 	.ipc_default		= SOF_IPC,
33 	.default_fw_path = {
34 		[SOF_IPC] = "intel/sof",
35 		[SOF_INTEL_IPC4] = "intel/avs/tgl",
36 	},
37 	.default_lib_path = {
38 		[SOF_INTEL_IPC4] = "intel/avs-lib/tgl",
39 	},
40 	.default_tplg_path = {
41 		[SOF_IPC] = "intel/sof-tplg",
42 		[SOF_INTEL_IPC4] = "intel/avs-tplg",
43 	},
44 	.default_fw_filename = {
45 		[SOF_IPC] = "sof-tgl.ri",
46 		[SOF_INTEL_IPC4] = "dsp_basefw.bin",
47 	},
48 	.nocodec_tplg_filename = "sof-tgl-nocodec.tplg",
49 	.ops = &sof_tgl_ops,
50 	.ops_init = sof_tgl_ops_init,
51 	.ops_free = hda_ops_free,
52 };
53 
54 static const struct sof_dev_desc tglh_desc = {
55 	.machines               = snd_soc_acpi_intel_tgl_machines,
56 	.alt_machines		= snd_soc_acpi_intel_tgl_sdw_machines,
57 	.use_acpi_target_states	= true,
58 	.resindex_lpe_base      = 0,
59 	.resindex_pcicfg_base   = -1,
60 	.resindex_imr_base      = -1,
61 	.irqindex_host_ipc      = -1,
62 	.chip_info = &tglh_chip_info,
63 	.ipc_supported_mask	= BIT(SOF_IPC) | BIT(SOF_INTEL_IPC4),
64 	.ipc_default		= SOF_IPC,
65 	.default_fw_path = {
66 		[SOF_IPC] = "intel/sof",
67 		[SOF_INTEL_IPC4] = "intel/avs/tgl-h",
68 	},
69 	.default_lib_path = {
70 		[SOF_INTEL_IPC4] = "intel/avs-lib/tgl-h",
71 	},
72 	.default_tplg_path = {
73 		[SOF_IPC] = "intel/sof-tplg",
74 		[SOF_INTEL_IPC4] = "intel/avs-tplg",
75 	},
76 	.default_fw_filename = {
77 		[SOF_IPC] = "sof-tgl-h.ri",
78 		[SOF_INTEL_IPC4] = "dsp_basefw.bin",
79 	},
80 	.nocodec_tplg_filename = "sof-tgl-nocodec.tplg",
81 	.ops = &sof_tgl_ops,
82 	.ops_init = sof_tgl_ops_init,
83 	.ops_free = hda_ops_free,
84 };
85 
86 static const struct sof_dev_desc ehl_desc = {
87 	.machines               = snd_soc_acpi_intel_ehl_machines,
88 	.use_acpi_target_states	= true,
89 	.resindex_lpe_base      = 0,
90 	.resindex_pcicfg_base   = -1,
91 	.resindex_imr_base      = -1,
92 	.irqindex_host_ipc      = -1,
93 	.chip_info = &ehl_chip_info,
94 	.ipc_supported_mask	= BIT(SOF_IPC) | BIT(SOF_INTEL_IPC4),
95 	.ipc_default		= SOF_IPC,
96 	.default_fw_path = {
97 		[SOF_IPC] = "intel/sof",
98 		[SOF_INTEL_IPC4] = "intel/avs/ehl",
99 	},
100 	.default_lib_path = {
101 		[SOF_INTEL_IPC4] = "intel/avs-lib/ehl",
102 	},
103 	.default_tplg_path = {
104 		[SOF_IPC] = "intel/sof-tplg",
105 		[SOF_INTEL_IPC4] = "intel/avs-tplg",
106 	},
107 	.default_fw_filename = {
108 		[SOF_IPC] = "sof-ehl.ri",
109 		[SOF_INTEL_IPC4] = "dsp_basefw.bin",
110 	},
111 	.nocodec_tplg_filename = "sof-ehl-nocodec.tplg",
112 	.ops = &sof_tgl_ops,
113 	.ops_init = sof_tgl_ops_init,
114 	.ops_free = hda_ops_free,
115 };
116 
117 static const struct sof_dev_desc adls_desc = {
118 	.machines               = snd_soc_acpi_intel_adl_machines,
119 	.alt_machines           = snd_soc_acpi_intel_adl_sdw_machines,
120 	.use_acpi_target_states	= true,
121 	.resindex_lpe_base      = 0,
122 	.resindex_pcicfg_base   = -1,
123 	.resindex_imr_base      = -1,
124 	.irqindex_host_ipc      = -1,
125 	.chip_info = &adls_chip_info,
126 	.ipc_supported_mask	= BIT(SOF_IPC) | BIT(SOF_INTEL_IPC4),
127 	.ipc_default		= SOF_IPC,
128 	.default_fw_path = {
129 		[SOF_IPC] = "intel/sof",
130 		[SOF_INTEL_IPC4] = "intel/avs/adl-s",
131 	},
132 	.default_lib_path = {
133 		[SOF_INTEL_IPC4] = "intel/avs-lib/adl-s",
134 	},
135 	.default_tplg_path = {
136 		[SOF_IPC] = "intel/sof-tplg",
137 		[SOF_INTEL_IPC4] = "intel/avs-tplg",
138 	},
139 	.default_fw_filename = {
140 		[SOF_IPC] = "sof-adl-s.ri",
141 		[SOF_INTEL_IPC4] = "dsp_basefw.bin",
142 	},
143 	.nocodec_tplg_filename = "sof-adl-nocodec.tplg",
144 	.ops = &sof_tgl_ops,
145 	.ops_init = sof_tgl_ops_init,
146 	.ops_free = hda_ops_free,
147 };
148 
149 static const struct sof_dev_desc adl_desc = {
150 	.machines               = snd_soc_acpi_intel_adl_machines,
151 	.alt_machines           = snd_soc_acpi_intel_adl_sdw_machines,
152 	.use_acpi_target_states = true,
153 	.resindex_lpe_base      = 0,
154 	.resindex_pcicfg_base   = -1,
155 	.resindex_imr_base      = -1,
156 	.irqindex_host_ipc      = -1,
157 	.chip_info = &tgl_chip_info,
158 	.ipc_supported_mask	= BIT(SOF_IPC) | BIT(SOF_INTEL_IPC4),
159 	.ipc_default		= SOF_IPC,
160 	.default_fw_path = {
161 		[SOF_IPC] = "intel/sof",
162 		[SOF_INTEL_IPC4] = "intel/avs/adl",
163 	},
164 	.default_lib_path = {
165 		[SOF_INTEL_IPC4] = "intel/avs-lib/adl",
166 	},
167 	.default_tplg_path = {
168 		[SOF_IPC] = "intel/sof-tplg",
169 		[SOF_INTEL_IPC4] = "intel/avs-tplg",
170 	},
171 	.default_fw_filename = {
172 		[SOF_IPC] = "sof-adl.ri",
173 		[SOF_INTEL_IPC4] = "dsp_basefw.bin",
174 	},
175 	.nocodec_tplg_filename = "sof-adl-nocodec.tplg",
176 	.ops = &sof_tgl_ops,
177 	.ops_init = sof_tgl_ops_init,
178 	.ops_free = hda_ops_free,
179 };
180 
181 static const struct sof_dev_desc adl_n_desc = {
182 	.machines               = snd_soc_acpi_intel_adl_machines,
183 	.alt_machines           = snd_soc_acpi_intel_adl_sdw_machines,
184 	.use_acpi_target_states = true,
185 	.resindex_lpe_base      = 0,
186 	.resindex_pcicfg_base   = -1,
187 	.resindex_imr_base      = -1,
188 	.irqindex_host_ipc      = -1,
189 	.chip_info = &tgl_chip_info,
190 	.ipc_supported_mask	= BIT(SOF_IPC) | BIT(SOF_INTEL_IPC4),
191 	.ipc_default		= SOF_IPC,
192 	.default_fw_path = {
193 		[SOF_IPC] = "intel/sof",
194 		[SOF_INTEL_IPC4] = "intel/avs/adl-n",
195 	},
196 	.default_lib_path = {
197 		[SOF_INTEL_IPC4] = "intel/avs-lib/adl-n",
198 	},
199 	.default_tplg_path = {
200 		[SOF_IPC] = "intel/sof-tplg",
201 		[SOF_INTEL_IPC4] = "intel/avs-tplg",
202 	},
203 	.default_fw_filename = {
204 		[SOF_IPC] = "sof-adl-n.ri",
205 		[SOF_INTEL_IPC4] = "dsp_basefw.bin",
206 	},
207 	.nocodec_tplg_filename = "sof-adl-nocodec.tplg",
208 	.ops = &sof_tgl_ops,
209 	.ops_init = sof_tgl_ops_init,
210 	.ops_free = hda_ops_free,
211 };
212 
213 static const struct sof_dev_desc rpls_desc = {
214 	.machines               = snd_soc_acpi_intel_rpl_machines,
215 	.alt_machines           = snd_soc_acpi_intel_rpl_sdw_machines,
216 	.use_acpi_target_states	= true,
217 	.resindex_lpe_base      = 0,
218 	.resindex_pcicfg_base   = -1,
219 	.resindex_imr_base      = -1,
220 	.irqindex_host_ipc      = -1,
221 	.chip_info = &adls_chip_info,
222 	.ipc_supported_mask	= BIT(SOF_IPC) | BIT(SOF_INTEL_IPC4),
223 	.ipc_default		= SOF_IPC,
224 	.default_fw_path = {
225 		[SOF_IPC] = "intel/sof",
226 		[SOF_INTEL_IPC4] = "intel/avs/rpl-s",
227 	},
228 	.default_lib_path = {
229 		[SOF_INTEL_IPC4] = "intel/avs-lib/rpl-s",
230 	},
231 	.default_tplg_path = {
232 		[SOF_IPC] = "intel/sof-tplg",
233 		[SOF_INTEL_IPC4] = "intel/avs-tplg",
234 	},
235 	.default_fw_filename = {
236 		[SOF_IPC] = "sof-rpl-s.ri",
237 		[SOF_INTEL_IPC4] = "dsp_basefw.bin",
238 	},
239 	.nocodec_tplg_filename = "sof-rpl-nocodec.tplg",
240 	.ops = &sof_tgl_ops,
241 	.ops_init = sof_tgl_ops_init,
242 	.ops_free = hda_ops_free,
243 };
244 
245 static const struct sof_dev_desc rpl_desc = {
246 	.machines               = snd_soc_acpi_intel_rpl_machines,
247 	.alt_machines           = snd_soc_acpi_intel_rpl_sdw_machines,
248 	.use_acpi_target_states = true,
249 	.resindex_lpe_base      = 0,
250 	.resindex_pcicfg_base   = -1,
251 	.resindex_imr_base      = -1,
252 	.irqindex_host_ipc      = -1,
253 	.chip_info = &tgl_chip_info,
254 	.ipc_supported_mask	= BIT(SOF_IPC) | BIT(SOF_INTEL_IPC4),
255 	.ipc_default		= SOF_IPC,
256 	.default_fw_path = {
257 		[SOF_IPC] = "intel/sof",
258 		[SOF_INTEL_IPC4] = "intel/avs/rpl",
259 	},
260 	.default_lib_path = {
261 		[SOF_INTEL_IPC4] = "intel/avs-lib/rpl",
262 	},
263 	.default_tplg_path = {
264 		[SOF_IPC] = "intel/sof-tplg",
265 		[SOF_INTEL_IPC4] = "intel/avs-tplg",
266 	},
267 	.default_fw_filename = {
268 		[SOF_IPC] = "sof-rpl.ri",
269 		[SOF_INTEL_IPC4] = "dsp_basefw.bin",
270 	},
271 	.nocodec_tplg_filename = "sof-rpl-nocodec.tplg",
272 	.ops = &sof_tgl_ops,
273 	.ops_init = sof_tgl_ops_init,
274 	.ops_free = hda_ops_free,
275 };
276 
277 /* PCI IDs */
278 static const struct pci_device_id sof_pci_ids[] = {
279 	{ PCI_DEVICE(0x8086, 0xa0c8), /* TGL-LP */
280 		.driver_data = (unsigned long)&tgl_desc},
281 	{ PCI_DEVICE(0x8086, 0x43c8), /* TGL-H */
282 		.driver_data = (unsigned long)&tglh_desc},
283 	{ PCI_DEVICE(0x8086, 0x4b55), /* EHL */
284 		.driver_data = (unsigned long)&ehl_desc},
285 	{ PCI_DEVICE(0x8086, 0x4b58), /* EHL */
286 		.driver_data = (unsigned long)&ehl_desc},
287 	{ PCI_DEVICE(0x8086, 0x7ad0), /* ADL-S */
288 		.driver_data = (unsigned long)&adls_desc},
289 	{ PCI_DEVICE(0x8086, 0x7a50), /* RPL-S */
290 		.driver_data = (unsigned long)&rpls_desc},
291 	{ PCI_DEVICE(0x8086, 0x51c8), /* ADL-P */
292 		.driver_data = (unsigned long)&adl_desc},
293 	{ PCI_DEVICE(0x8086, 0x51c9), /* ADL-PS */
294 		.driver_data = (unsigned long)&adl_desc},
295 	{ PCI_DEVICE(0x8086, 0x51ca), /* RPL-P */
296 		.driver_data = (unsigned long)&rpl_desc},
297 	{ PCI_DEVICE(0x8086, 0x51cb), /* RPL-P */
298 		.driver_data = (unsigned long)&rpl_desc},
299 	{ PCI_DEVICE(0x8086, 0x51cc), /* ADL-M */
300 		.driver_data = (unsigned long)&adl_desc},
301 	{ PCI_DEVICE(0x8086, 0x51cd), /* ADL-P */
302 		.driver_data = (unsigned long)&adl_desc},
303 	{ PCI_DEVICE(0x8086, 0x51ce), /* RPL-M */
304 		.driver_data = (unsigned long)&rpl_desc},
305 	{ PCI_DEVICE(0x8086, 0x51cf), /* RPL-PX */
306 		.driver_data = (unsigned long)&rpl_desc},
307 	{ PCI_DEVICE(0x8086, 0x54c8), /* ADL-N */
308 		.driver_data = (unsigned long)&adl_n_desc},
309 	{ 0, }
310 };
311 MODULE_DEVICE_TABLE(pci, sof_pci_ids);
312 
313 /* pci_driver definition */
314 static struct pci_driver snd_sof_pci_intel_tgl_driver = {
315 	.name = "sof-audio-pci-intel-tgl",
316 	.id_table = sof_pci_ids,
317 	.probe = hda_pci_intel_probe,
318 	.remove = sof_pci_remove,
319 	.shutdown = sof_pci_shutdown,
320 	.driver = {
321 		.pm = &sof_pci_pm,
322 	},
323 };
324 module_pci_driver(snd_sof_pci_intel_tgl_driver);
325 
326 MODULE_LICENSE("Dual BSD/GPL");
327 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_COMMON);
328 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV);
329