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