xref: /openbmc/linux/sound/soc/sof/intel/pci-tgl.c (revision 53f9cd5c)
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 /* PCI IDs */
163 static const struct pci_device_id sof_pci_ids[] = {
164 	{ PCI_DEVICE(0x8086, 0xa0c8), /* TGL-LP */
165 		.driver_data = (unsigned long)&tgl_desc},
166 	{ PCI_DEVICE(0x8086, 0x43c8), /* TGL-H */
167 		.driver_data = (unsigned long)&tglh_desc},
168 	{ PCI_DEVICE(0x8086, 0x4b55), /* EHL */
169 		.driver_data = (unsigned long)&ehl_desc},
170 	{ PCI_DEVICE(0x8086, 0x4b58), /* EHL */
171 		.driver_data = (unsigned long)&ehl_desc},
172 	{ PCI_DEVICE(0x8086, 0x7ad0), /* ADL-S */
173 		.driver_data = (unsigned long)&adls_desc},
174 	{ PCI_DEVICE(0x8086, 0x7a50), /* RPL-S */
175 		.driver_data = (unsigned long)&adls_desc},
176 	{ PCI_DEVICE(0x8086, 0x51c8), /* ADL-P */
177 		.driver_data = (unsigned long)&adl_desc},
178 	{ PCI_DEVICE(0x8086, 0x51cd), /* ADL-P */
179 		.driver_data = (unsigned long)&adl_desc},
180 	{ PCI_DEVICE(0x8086, 0x51c9), /* ADL-PS */
181 		.driver_data = (unsigned long)&adl_desc},
182 	{ PCI_DEVICE(0x8086, 0x51ca), /* RPL-P */
183 		.driver_data = (unsigned long)&adl_desc},
184 	{ PCI_DEVICE(0x8086, 0x51cb), /* RPL-P */
185 		.driver_data = (unsigned long)&adl_desc},
186 	{ PCI_DEVICE(0x8086, 0x51cc), /* ADL-M */
187 		.driver_data = (unsigned long)&adl_desc},
188 	{ PCI_DEVICE(0x8086, 0x54c8), /* ADL-N */
189 		.driver_data = (unsigned long)&adl_desc},
190 	{ 0, }
191 };
192 MODULE_DEVICE_TABLE(pci, sof_pci_ids);
193 
194 /* pci_driver definition */
195 static struct pci_driver snd_sof_pci_intel_tgl_driver = {
196 	.name = "sof-audio-pci-intel-tgl",
197 	.id_table = sof_pci_ids,
198 	.probe = hda_pci_intel_probe,
199 	.remove = sof_pci_remove,
200 	.shutdown = sof_pci_shutdown,
201 	.driver = {
202 		.pm = &sof_pci_pm,
203 	},
204 };
205 module_pci_driver(snd_sof_pci_intel_tgl_driver);
206 
207 MODULE_LICENSE("Dual BSD/GPL");
208 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_COMMON);
209 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV);
210