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