xref: /openbmc/linux/sound/soc/sof/intel/pci-tgl.c (revision 5626af8f)
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 };
52 
53 static const struct sof_dev_desc tglh_desc = {
54 	.machines               = snd_soc_acpi_intel_tgl_machines,
55 	.alt_machines		= snd_soc_acpi_intel_tgl_sdw_machines,
56 	.use_acpi_target_states	= true,
57 	.resindex_lpe_base      = 0,
58 	.resindex_pcicfg_base   = -1,
59 	.resindex_imr_base      = -1,
60 	.irqindex_host_ipc      = -1,
61 	.chip_info = &tglh_chip_info,
62 	.ipc_supported_mask	= BIT(SOF_IPC) | BIT(SOF_INTEL_IPC4),
63 	.ipc_default		= SOF_IPC,
64 	.default_fw_path = {
65 		[SOF_IPC] = "intel/sof",
66 		[SOF_INTEL_IPC4] = "intel/avs/tgl-h",
67 	},
68 	.default_lib_path = {
69 		[SOF_INTEL_IPC4] = "intel/avs-lib/tgl-h",
70 	},
71 	.default_tplg_path = {
72 		[SOF_IPC] = "intel/sof-tplg",
73 		[SOF_INTEL_IPC4] = "intel/avs-tplg",
74 	},
75 	.default_fw_filename = {
76 		[SOF_IPC] = "sof-tgl-h.ri",
77 		[SOF_INTEL_IPC4] = "dsp_basefw.bin",
78 	},
79 	.nocodec_tplg_filename = "sof-tgl-nocodec.tplg",
80 	.ops = &sof_tgl_ops,
81 	.ops_init = sof_tgl_ops_init,
82 	.ops_free = hda_ops_free,
83 };
84 
85 static const struct sof_dev_desc ehl_desc = {
86 	.machines               = snd_soc_acpi_intel_ehl_machines,
87 	.use_acpi_target_states	= true,
88 	.resindex_lpe_base      = 0,
89 	.resindex_pcicfg_base   = -1,
90 	.resindex_imr_base      = -1,
91 	.irqindex_host_ipc      = -1,
92 	.chip_info = &ehl_chip_info,
93 	.ipc_supported_mask	= BIT(SOF_IPC) | BIT(SOF_INTEL_IPC4),
94 	.ipc_default		= SOF_IPC,
95 	.default_fw_path = {
96 		[SOF_IPC] = "intel/sof",
97 		[SOF_INTEL_IPC4] = "intel/avs/ehl",
98 	},
99 	.default_lib_path = {
100 		[SOF_INTEL_IPC4] = "intel/avs-lib/ehl",
101 	},
102 	.default_tplg_path = {
103 		[SOF_IPC] = "intel/sof-tplg",
104 		[SOF_INTEL_IPC4] = "intel/avs-tplg",
105 	},
106 	.default_fw_filename = {
107 		[SOF_IPC] = "sof-ehl.ri",
108 		[SOF_INTEL_IPC4] = "dsp_basefw.bin",
109 	},
110 	.nocodec_tplg_filename = "sof-ehl-nocodec.tplg",
111 	.ops = &sof_tgl_ops,
112 	.ops_init = sof_tgl_ops_init,
113 };
114 
115 static const struct sof_dev_desc adls_desc = {
116 	.machines               = snd_soc_acpi_intel_adl_machines,
117 	.alt_machines           = snd_soc_acpi_intel_adl_sdw_machines,
118 	.use_acpi_target_states	= true,
119 	.resindex_lpe_base      = 0,
120 	.resindex_pcicfg_base   = -1,
121 	.resindex_imr_base      = -1,
122 	.irqindex_host_ipc      = -1,
123 	.chip_info = &adls_chip_info,
124 	.ipc_supported_mask	= BIT(SOF_IPC) | BIT(SOF_INTEL_IPC4),
125 	.ipc_default		= SOF_IPC,
126 	.default_fw_path = {
127 		[SOF_IPC] = "intel/sof",
128 		[SOF_INTEL_IPC4] = "intel/avs/adl-s",
129 	},
130 	.default_lib_path = {
131 		[SOF_INTEL_IPC4] = "intel/avs-lib/adl-s",
132 	},
133 	.default_tplg_path = {
134 		[SOF_IPC] = "intel/sof-tplg",
135 		[SOF_INTEL_IPC4] = "intel/avs-tplg",
136 	},
137 	.default_fw_filename = {
138 		[SOF_IPC] = "sof-adl-s.ri",
139 		[SOF_INTEL_IPC4] = "dsp_basefw.bin",
140 	},
141 	.nocodec_tplg_filename = "sof-adl-nocodec.tplg",
142 	.ops = &sof_tgl_ops,
143 	.ops_init = sof_tgl_ops_init,
144 };
145 
146 static const struct sof_dev_desc adl_desc = {
147 	.machines               = snd_soc_acpi_intel_adl_machines,
148 	.alt_machines           = snd_soc_acpi_intel_adl_sdw_machines,
149 	.use_acpi_target_states = true,
150 	.resindex_lpe_base      = 0,
151 	.resindex_pcicfg_base   = -1,
152 	.resindex_imr_base      = -1,
153 	.irqindex_host_ipc      = -1,
154 	.chip_info = &tgl_chip_info,
155 	.ipc_supported_mask	= BIT(SOF_IPC) | BIT(SOF_INTEL_IPC4),
156 	.ipc_default		= SOF_IPC,
157 	.default_fw_path = {
158 		[SOF_IPC] = "intel/sof",
159 		[SOF_INTEL_IPC4] = "intel/avs/adl",
160 	},
161 	.default_lib_path = {
162 		[SOF_INTEL_IPC4] = "intel/avs-lib/adl",
163 	},
164 	.default_tplg_path = {
165 		[SOF_IPC] = "intel/sof-tplg",
166 		[SOF_INTEL_IPC4] = "intel/avs-tplg",
167 	},
168 	.default_fw_filename = {
169 		[SOF_IPC] = "sof-adl.ri",
170 		[SOF_INTEL_IPC4] = "dsp_basefw.bin",
171 	},
172 	.nocodec_tplg_filename = "sof-adl-nocodec.tplg",
173 	.ops = &sof_tgl_ops,
174 	.ops_init = sof_tgl_ops_init,
175 };
176 
177 static const struct sof_dev_desc adl_n_desc = {
178 	.machines               = snd_soc_acpi_intel_adl_machines,
179 	.alt_machines           = snd_soc_acpi_intel_adl_sdw_machines,
180 	.use_acpi_target_states = true,
181 	.resindex_lpe_base      = 0,
182 	.resindex_pcicfg_base   = -1,
183 	.resindex_imr_base      = -1,
184 	.irqindex_host_ipc      = -1,
185 	.chip_info = &tgl_chip_info,
186 	.ipc_supported_mask	= BIT(SOF_IPC) | BIT(SOF_INTEL_IPC4),
187 	.ipc_default		= SOF_IPC,
188 	.default_fw_path = {
189 		[SOF_IPC] = "intel/sof",
190 		[SOF_INTEL_IPC4] = "intel/avs/adl-n",
191 	},
192 	.default_lib_path = {
193 		[SOF_INTEL_IPC4] = "intel/avs-lib/adl-n",
194 	},
195 	.default_tplg_path = {
196 		[SOF_IPC] = "intel/sof-tplg",
197 		[SOF_INTEL_IPC4] = "intel/avs-tplg",
198 	},
199 	.default_fw_filename = {
200 		[SOF_IPC] = "sof-adl-n.ri",
201 		[SOF_INTEL_IPC4] = "dsp_basefw.bin",
202 	},
203 	.nocodec_tplg_filename = "sof-adl-nocodec.tplg",
204 	.ops = &sof_tgl_ops,
205 	.ops_init = sof_tgl_ops_init,
206 };
207 
208 static const struct sof_dev_desc rpls_desc = {
209 	.machines               = snd_soc_acpi_intel_rpl_machines,
210 	.alt_machines           = snd_soc_acpi_intel_rpl_sdw_machines,
211 	.use_acpi_target_states	= true,
212 	.resindex_lpe_base      = 0,
213 	.resindex_pcicfg_base   = -1,
214 	.resindex_imr_base      = -1,
215 	.irqindex_host_ipc      = -1,
216 	.chip_info = &adls_chip_info,
217 	.ipc_supported_mask	= BIT(SOF_IPC) | BIT(SOF_INTEL_IPC4),
218 	.ipc_default		= SOF_IPC,
219 	.default_fw_path = {
220 		[SOF_IPC] = "intel/sof",
221 		[SOF_INTEL_IPC4] = "intel/avs/rpl-s",
222 	},
223 	.default_lib_path = {
224 		[SOF_INTEL_IPC4] = "intel/avs-lib/rpl-s",
225 	},
226 	.default_tplg_path = {
227 		[SOF_IPC] = "intel/sof-tplg",
228 		[SOF_INTEL_IPC4] = "intel/avs-tplg",
229 	},
230 	.default_fw_filename = {
231 		[SOF_IPC] = "sof-rpl-s.ri",
232 		[SOF_INTEL_IPC4] = "dsp_basefw.bin",
233 	},
234 	.nocodec_tplg_filename = "sof-rpl-nocodec.tplg",
235 	.ops = &sof_tgl_ops,
236 	.ops_init = sof_tgl_ops_init,
237 };
238 
239 static const struct sof_dev_desc rpl_desc = {
240 	.machines               = snd_soc_acpi_intel_rpl_machines,
241 	.alt_machines           = snd_soc_acpi_intel_rpl_sdw_machines,
242 	.use_acpi_target_states = true,
243 	.resindex_lpe_base      = 0,
244 	.resindex_pcicfg_base   = -1,
245 	.resindex_imr_base      = -1,
246 	.irqindex_host_ipc      = -1,
247 	.chip_info = &tgl_chip_info,
248 	.ipc_supported_mask	= BIT(SOF_IPC) | BIT(SOF_INTEL_IPC4),
249 	.ipc_default		= SOF_IPC,
250 	.default_fw_path = {
251 		[SOF_IPC] = "intel/sof",
252 		[SOF_INTEL_IPC4] = "intel/avs/rpl",
253 	},
254 	.default_lib_path = {
255 		[SOF_INTEL_IPC4] = "intel/avs-lib/rpl",
256 	},
257 	.default_tplg_path = {
258 		[SOF_IPC] = "intel/sof-tplg",
259 		[SOF_INTEL_IPC4] = "intel/avs-tplg",
260 	},
261 	.default_fw_filename = {
262 		[SOF_IPC] = "sof-rpl.ri",
263 		[SOF_INTEL_IPC4] = "dsp_basefw.bin",
264 	},
265 	.nocodec_tplg_filename = "sof-rpl-nocodec.tplg",
266 	.ops = &sof_tgl_ops,
267 	.ops_init = sof_tgl_ops_init,
268 };
269 
270 /* PCI IDs */
271 static const struct pci_device_id sof_pci_ids[] = {
272 	{ PCI_DEVICE(0x8086, 0xa0c8), /* TGL-LP */
273 		.driver_data = (unsigned long)&tgl_desc},
274 	{ PCI_DEVICE(0x8086, 0x43c8), /* TGL-H */
275 		.driver_data = (unsigned long)&tglh_desc},
276 	{ PCI_DEVICE(0x8086, 0x4b55), /* EHL */
277 		.driver_data = (unsigned long)&ehl_desc},
278 	{ PCI_DEVICE(0x8086, 0x4b58), /* EHL */
279 		.driver_data = (unsigned long)&ehl_desc},
280 	{ PCI_DEVICE(0x8086, 0x7ad0), /* ADL-S */
281 		.driver_data = (unsigned long)&adls_desc},
282 	{ PCI_DEVICE(0x8086, 0x7a50), /* RPL-S */
283 		.driver_data = (unsigned long)&rpls_desc},
284 	{ PCI_DEVICE(0x8086, 0x51c8), /* ADL-P */
285 		.driver_data = (unsigned long)&adl_desc},
286 	{ PCI_DEVICE(0x8086, 0x51c9), /* ADL-PS */
287 		.driver_data = (unsigned long)&adl_desc},
288 	{ PCI_DEVICE(0x8086, 0x51ca), /* RPL-P */
289 		.driver_data = (unsigned long)&rpl_desc},
290 	{ PCI_DEVICE(0x8086, 0x51cb), /* RPL-P */
291 		.driver_data = (unsigned long)&rpl_desc},
292 	{ PCI_DEVICE(0x8086, 0x51cc), /* ADL-M */
293 		.driver_data = (unsigned long)&adl_desc},
294 	{ PCI_DEVICE(0x8086, 0x51cd), /* ADL-P */
295 		.driver_data = (unsigned long)&adl_desc},
296 	{ PCI_DEVICE(0x8086, 0x51ce), /* RPL-M */
297 		.driver_data = (unsigned long)&rpl_desc},
298 	{ PCI_DEVICE(0x8086, 0x51cf), /* RPL-PX */
299 		.driver_data = (unsigned long)&rpl_desc},
300 	{ PCI_DEVICE(0x8086, 0x54c8), /* ADL-N */
301 		.driver_data = (unsigned long)&adl_n_desc},
302 	{ 0, }
303 };
304 MODULE_DEVICE_TABLE(pci, sof_pci_ids);
305 
306 /* pci_driver definition */
307 static struct pci_driver snd_sof_pci_intel_tgl_driver = {
308 	.name = "sof-audio-pci-intel-tgl",
309 	.id_table = sof_pci_ids,
310 	.probe = hda_pci_intel_probe,
311 	.remove = sof_pci_remove,
312 	.shutdown = sof_pci_shutdown,
313 	.driver = {
314 		.pm = &sof_pci_pm,
315 	},
316 };
317 module_pci_driver(snd_sof_pci_intel_tgl_driver);
318 
319 MODULE_LICENSE("Dual BSD/GPL");
320 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_COMMON);
321 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV);
322