xref: /openbmc/linux/sound/soc/sof/intel/pci-tgl.c (revision a97abb3c)
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 };
48 
49 static const struct sof_dev_desc tglh_desc = {
50 	.machines               = snd_soc_acpi_intel_tgl_machines,
51 	.alt_machines		= snd_soc_acpi_intel_tgl_sdw_machines,
52 	.use_acpi_target_states	= true,
53 	.resindex_lpe_base      = 0,
54 	.resindex_pcicfg_base   = -1,
55 	.resindex_imr_base      = -1,
56 	.irqindex_host_ipc      = -1,
57 	.chip_info = &tglh_chip_info,
58 	.ipc_supported_mask	= BIT(SOF_IPC) | BIT(SOF_INTEL_IPC4),
59 	.ipc_default		= SOF_IPC,
60 	.default_fw_path = {
61 		[SOF_IPC] = "intel/sof",
62 		[SOF_INTEL_IPC4] = "intel/avs/tgl-h",
63 	},
64 	.default_tplg_path = {
65 		[SOF_IPC] = "intel/sof-tplg",
66 		[SOF_INTEL_IPC4] = "intel/avs-tplg",
67 	},
68 	.default_fw_filename = {
69 		[SOF_IPC] = "sof-tgl-h.ri",
70 		[SOF_INTEL_IPC4] = "dsp_basefw.bin",
71 	},
72 	.nocodec_tplg_filename = "sof-tgl-nocodec.tplg",
73 	.ops = &sof_tgl_ops,
74 };
75 
76 static const struct sof_dev_desc ehl_desc = {
77 	.machines               = snd_soc_acpi_intel_ehl_machines,
78 	.use_acpi_target_states	= true,
79 	.resindex_lpe_base      = 0,
80 	.resindex_pcicfg_base   = -1,
81 	.resindex_imr_base      = -1,
82 	.irqindex_host_ipc      = -1,
83 	.chip_info = &ehl_chip_info,
84 	.ipc_supported_mask	= BIT(SOF_IPC) | BIT(SOF_INTEL_IPC4),
85 	.ipc_default		= SOF_IPC,
86 	.default_fw_path = {
87 		[SOF_IPC] = "intel/sof",
88 		[SOF_INTEL_IPC4] = "intel/avs/ehl",
89 	},
90 	.default_tplg_path = {
91 		[SOF_IPC] = "intel/sof-tplg",
92 		[SOF_INTEL_IPC4] = "intel/avs-tplg",
93 	},
94 	.default_fw_filename = {
95 		[SOF_IPC] = "sof-ehl.ri",
96 		[SOF_INTEL_IPC4] = "dsp_basefw.bin",
97 	},
98 	.nocodec_tplg_filename = "sof-ehl-nocodec.tplg",
99 	.ops = &sof_tgl_ops,
100 };
101 
102 static const struct sof_dev_desc adls_desc = {
103 	.machines               = snd_soc_acpi_intel_adl_machines,
104 	.alt_machines           = snd_soc_acpi_intel_adl_sdw_machines,
105 	.use_acpi_target_states	= true,
106 	.resindex_lpe_base      = 0,
107 	.resindex_pcicfg_base   = -1,
108 	.resindex_imr_base      = -1,
109 	.irqindex_host_ipc      = -1,
110 	.chip_info = &adls_chip_info,
111 	.ipc_supported_mask	= BIT(SOF_IPC) | BIT(SOF_INTEL_IPC4),
112 	.ipc_default		= SOF_IPC,
113 	.default_fw_path = {
114 		[SOF_IPC] = "intel/sof",
115 		[SOF_INTEL_IPC4] = "intel/avs/adl-s",
116 	},
117 	.default_tplg_path = {
118 		[SOF_IPC] = "intel/sof-tplg",
119 		[SOF_INTEL_IPC4] = "intel/avs-tplg",
120 	},
121 	.default_fw_filename = {
122 		[SOF_IPC] = "sof-adl-s.ri",
123 		[SOF_INTEL_IPC4] = "dsp_basefw.bin",
124 	},
125 	.nocodec_tplg_filename = "sof-adl-nocodec.tplg",
126 	.ops = &sof_tgl_ops,
127 };
128 
129 static const struct sof_dev_desc adl_desc = {
130 	.machines               = snd_soc_acpi_intel_adl_machines,
131 	.alt_machines           = snd_soc_acpi_intel_adl_sdw_machines,
132 	.use_acpi_target_states = true,
133 	.resindex_lpe_base      = 0,
134 	.resindex_pcicfg_base   = -1,
135 	.resindex_imr_base      = -1,
136 	.irqindex_host_ipc      = -1,
137 	.chip_info = &tgl_chip_info,
138 	.ipc_supported_mask	= BIT(SOF_IPC) | BIT(SOF_INTEL_IPC4),
139 	.ipc_default		= SOF_IPC,
140 	.default_fw_path = {
141 		[SOF_IPC] = "intel/sof",
142 		[SOF_INTEL_IPC4] = "intel/avs/adl",
143 	},
144 	.default_tplg_path = {
145 		[SOF_IPC] = "intel/sof-tplg",
146 		[SOF_INTEL_IPC4] = "intel/avs-tplg",
147 	},
148 	.default_fw_filename = {
149 		[SOF_IPC] = "sof-adl.ri",
150 		[SOF_INTEL_IPC4] = "dsp_basefw.bin",
151 	},
152 	.nocodec_tplg_filename = "sof-adl-nocodec.tplg",
153 	.ops = &sof_tgl_ops,
154 };
155 
156 /* PCI IDs */
157 static const struct pci_device_id sof_pci_ids[] = {
158 	{ PCI_DEVICE(0x8086, 0xa0c8), /* TGL-LP */
159 		.driver_data = (unsigned long)&tgl_desc},
160 	{ PCI_DEVICE(0x8086, 0x43c8), /* TGL-H */
161 		.driver_data = (unsigned long)&tglh_desc},
162 	{ PCI_DEVICE(0x8086, 0x4b55), /* EHL */
163 		.driver_data = (unsigned long)&ehl_desc},
164 	{ PCI_DEVICE(0x8086, 0x4b58), /* EHL */
165 		.driver_data = (unsigned long)&ehl_desc},
166 	{ PCI_DEVICE(0x8086, 0x7ad0), /* ADL-S */
167 		.driver_data = (unsigned long)&adls_desc},
168 	{ PCI_DEVICE(0x8086, 0x7a50), /* RPL-S */
169 		.driver_data = (unsigned long)&adls_desc},
170 	{ PCI_DEVICE(0x8086, 0x51c8), /* ADL-P */
171 		.driver_data = (unsigned long)&adl_desc},
172 	{ PCI_DEVICE(0x8086, 0x51cd), /* ADL-P */
173 		.driver_data = (unsigned long)&adl_desc},
174 	{ PCI_DEVICE(0x8086, 0x51cc), /* ADL-M */
175 		.driver_data = (unsigned long)&adl_desc},
176 	{ PCI_DEVICE(0x8086, 0x54c8), /* ADL-N */
177 		.driver_data = (unsigned long)&adl_desc},
178 	{ 0, }
179 };
180 MODULE_DEVICE_TABLE(pci, sof_pci_ids);
181 
182 /* pci_driver definition */
183 static struct pci_driver snd_sof_pci_intel_tgl_driver = {
184 	.name = "sof-audio-pci-intel-tgl",
185 	.id_table = sof_pci_ids,
186 	.probe = hda_pci_intel_probe,
187 	.remove = sof_pci_remove,
188 	.shutdown = sof_pci_shutdown,
189 	.driver = {
190 		.pm = &sof_pci_pm,
191 	},
192 };
193 module_pci_driver(snd_sof_pci_intel_tgl_driver);
194 
195 MODULE_LICENSE("Dual BSD/GPL");
196 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_COMMON);
197 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV);
198 
199