xref: /linux/sound/soc/sof/intel/pci-cnl.c (revision 3ff78451)
18d4ba1beSPierre-Louis Bossart // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
28d4ba1beSPierre-Louis Bossart //
38d4ba1beSPierre-Louis Bossart // This file is provided under a dual BSD/GPLv2 license.  When using or
48d4ba1beSPierre-Louis Bossart // redistributing this file, you may do so under either license.
58d4ba1beSPierre-Louis Bossart //
6293ad281SPierre-Louis Bossart // Copyright(c) 2018 Intel Corporation
78d4ba1beSPierre-Louis Bossart //
88d4ba1beSPierre-Louis Bossart // Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
98d4ba1beSPierre-Louis Bossart //
108d4ba1beSPierre-Louis Bossart 
118d4ba1beSPierre-Louis Bossart #include <linux/module.h>
128d4ba1beSPierre-Louis Bossart #include <linux/pci.h>
138d4ba1beSPierre-Louis Bossart #include <sound/soc-acpi.h>
148d4ba1beSPierre-Louis Bossart #include <sound/soc-acpi-intel-match.h>
158d4ba1beSPierre-Louis Bossart #include <sound/sof.h>
168d4ba1beSPierre-Louis Bossart #include "../ops.h"
178d4ba1beSPierre-Louis Bossart #include "../sof-pci-dev.h"
188d4ba1beSPierre-Louis Bossart 
198d4ba1beSPierre-Louis Bossart /* platform specific devices */
208d4ba1beSPierre-Louis Bossart #include "hda.h"
218d4ba1beSPierre-Louis Bossart 
228d4ba1beSPierre-Louis Bossart static const struct sof_dev_desc cnl_desc = {
238d4ba1beSPierre-Louis Bossart 	.machines		= snd_soc_acpi_intel_cnl_machines,
248d4ba1beSPierre-Louis Bossart 	.alt_machines		= snd_soc_acpi_intel_cnl_sdw_machines,
258d4ba1beSPierre-Louis Bossart 	.use_acpi_target_states	= true,
268d4ba1beSPierre-Louis Bossart 	.resindex_lpe_base	= 0,
278d4ba1beSPierre-Louis Bossart 	.resindex_pcicfg_base	= -1,
288d4ba1beSPierre-Louis Bossart 	.resindex_imr_base	= -1,
298d4ba1beSPierre-Louis Bossart 	.irqindex_host_ipc	= -1,
308d4ba1beSPierre-Louis Bossart 	.chip_info = &cnl_chip_info,
31a8fffb94SPeter Ujfalusi 	.ipc_supported_mask	= BIT(SOF_IPC_TYPE_3) | BIT(SOF_IPC_TYPE_4),
32a8fffb94SPeter Ujfalusi 	.ipc_default		= SOF_IPC_TYPE_3,
33a417d71fSPeter Ujfalusi 	.dspless_mode_supported	= true,		/* Only supported for HDaudio */
34a3757915SPierre-Louis Bossart 	.default_fw_path = {
35a8fffb94SPeter Ujfalusi 		[SOF_IPC_TYPE_3] = "intel/sof",
36a8fffb94SPeter Ujfalusi 		[SOF_IPC_TYPE_4] = "intel/avs/cnl",
37a3757915SPierre-Louis Bossart 	},
38cd6f2a2eSPeter Ujfalusi 	.default_lib_path = {
39a8fffb94SPeter Ujfalusi 		[SOF_IPC_TYPE_4] = "intel/avs-lib/cnl",
40cd6f2a2eSPeter Ujfalusi 	},
41a3757915SPierre-Louis Bossart 	.default_tplg_path = {
42a8fffb94SPeter Ujfalusi 		[SOF_IPC_TYPE_3] = "intel/sof-tplg",
43a8fffb94SPeter Ujfalusi 		[SOF_IPC_TYPE_4] = "intel/avs-tplg",
44a3757915SPierre-Louis Bossart 	},
45a97abb3cSPierre-Louis Bossart 	.default_fw_filename = {
46a8fffb94SPeter Ujfalusi 		[SOF_IPC_TYPE_3] = "sof-cnl.ri",
47a8fffb94SPeter Ujfalusi 		[SOF_IPC_TYPE_4] = "dsp_basefw.bin",
48a97abb3cSPierre-Louis Bossart 	},
498d4ba1beSPierre-Louis Bossart 	.nocodec_tplg_filename = "sof-cnl-nocodec.tplg",
508d4ba1beSPierre-Louis Bossart 	.ops = &sof_cnl_ops,
5137e809d5SPierre-Louis Bossart 	.ops_init = sof_cnl_ops_init,
529eb2b4caSRanjani Sridharan 	.ops_free = hda_ops_free,
538d4ba1beSPierre-Louis Bossart };
548d4ba1beSPierre-Louis Bossart 
558d4ba1beSPierre-Louis Bossart static const struct sof_dev_desc cfl_desc = {
568d4ba1beSPierre-Louis Bossart 	.machines		= snd_soc_acpi_intel_cfl_machines,
578d4ba1beSPierre-Louis Bossart 	.alt_machines		= snd_soc_acpi_intel_cfl_sdw_machines,
588d4ba1beSPierre-Louis Bossart 	.use_acpi_target_states	= true,
598d4ba1beSPierre-Louis Bossart 	.resindex_lpe_base	= 0,
608d4ba1beSPierre-Louis Bossart 	.resindex_pcicfg_base	= -1,
618d4ba1beSPierre-Louis Bossart 	.resindex_imr_base	= -1,
628d4ba1beSPierre-Louis Bossart 	.irqindex_host_ipc	= -1,
638d4ba1beSPierre-Louis Bossart 	.chip_info = &cnl_chip_info,
64a8fffb94SPeter Ujfalusi 	.ipc_supported_mask	= BIT(SOF_IPC_TYPE_3) | BIT(SOF_IPC_TYPE_4),
65a8fffb94SPeter Ujfalusi 	.ipc_default		= SOF_IPC_TYPE_3,
66a417d71fSPeter Ujfalusi 	.dspless_mode_supported	= true,		/* Only supported for HDaudio */
67a3757915SPierre-Louis Bossart 	.default_fw_path = {
68a8fffb94SPeter Ujfalusi 		[SOF_IPC_TYPE_3] = "intel/sof",
69a8fffb94SPeter Ujfalusi 		[SOF_IPC_TYPE_4] = "intel/avs/cnl",
70a3757915SPierre-Louis Bossart 	},
71cd6f2a2eSPeter Ujfalusi 	.default_lib_path = {
72a8fffb94SPeter Ujfalusi 		[SOF_IPC_TYPE_4] = "intel/avs-lib/cnl",
73cd6f2a2eSPeter Ujfalusi 	},
74a3757915SPierre-Louis Bossart 	.default_tplg_path = {
75a8fffb94SPeter Ujfalusi 		[SOF_IPC_TYPE_3] = "intel/sof-tplg",
76a8fffb94SPeter Ujfalusi 		[SOF_IPC_TYPE_4] = "intel/avs-tplg",
77a3757915SPierre-Louis Bossart 	},
78a97abb3cSPierre-Louis Bossart 	.default_fw_filename = {
79a8fffb94SPeter Ujfalusi 		[SOF_IPC_TYPE_3] = "sof-cfl.ri",
80a8fffb94SPeter Ujfalusi 		[SOF_IPC_TYPE_4] = "dsp_basefw.bin",
81a97abb3cSPierre-Louis Bossart 	},
828d4ba1beSPierre-Louis Bossart 	.nocodec_tplg_filename = "sof-cnl-nocodec.tplg",
838d4ba1beSPierre-Louis Bossart 	.ops = &sof_cnl_ops,
8437e809d5SPierre-Louis Bossart 	.ops_init = sof_cnl_ops_init,
851da51943SRanjani Sridharan 	.ops_free = hda_ops_free,
868d4ba1beSPierre-Louis Bossart };
878d4ba1beSPierre-Louis Bossart 
888d4ba1beSPierre-Louis Bossart static const struct sof_dev_desc cml_desc = {
898d4ba1beSPierre-Louis Bossart 	.machines		= snd_soc_acpi_intel_cml_machines,
908d4ba1beSPierre-Louis Bossart 	.alt_machines		= snd_soc_acpi_intel_cml_sdw_machines,
918d4ba1beSPierre-Louis Bossart 	.use_acpi_target_states	= true,
928d4ba1beSPierre-Louis Bossart 	.resindex_lpe_base	= 0,
938d4ba1beSPierre-Louis Bossart 	.resindex_pcicfg_base	= -1,
948d4ba1beSPierre-Louis Bossart 	.resindex_imr_base	= -1,
958d4ba1beSPierre-Louis Bossart 	.irqindex_host_ipc	= -1,
968d4ba1beSPierre-Louis Bossart 	.chip_info = &cnl_chip_info,
97a8fffb94SPeter Ujfalusi 	.ipc_supported_mask	= BIT(SOF_IPC_TYPE_3) | BIT(SOF_IPC_TYPE_4),
98a8fffb94SPeter Ujfalusi 	.ipc_default		= SOF_IPC_TYPE_3,
99a417d71fSPeter Ujfalusi 	.dspless_mode_supported	= true,		/* Only supported for HDaudio */
100a3757915SPierre-Louis Bossart 	.default_fw_path = {
101a8fffb94SPeter Ujfalusi 		[SOF_IPC_TYPE_3] = "intel/sof",
102a8fffb94SPeter Ujfalusi 		[SOF_IPC_TYPE_4] = "intel/avs/cnl",
103a3757915SPierre-Louis Bossart 	},
104cd6f2a2eSPeter Ujfalusi 	.default_lib_path = {
105a8fffb94SPeter Ujfalusi 		[SOF_IPC_TYPE_4] = "intel/avs-lib/cnl",
106cd6f2a2eSPeter Ujfalusi 	},
107a3757915SPierre-Louis Bossart 	.default_tplg_path = {
108a8fffb94SPeter Ujfalusi 		[SOF_IPC_TYPE_3] = "intel/sof-tplg",
109a8fffb94SPeter Ujfalusi 		[SOF_IPC_TYPE_4] = "intel/avs-tplg",
110a3757915SPierre-Louis Bossart 	},
111a97abb3cSPierre-Louis Bossart 	.default_fw_filename = {
112a8fffb94SPeter Ujfalusi 		[SOF_IPC_TYPE_3] = "sof-cml.ri",
113a8fffb94SPeter Ujfalusi 		[SOF_IPC_TYPE_4] = "dsp_basefw.bin",
114a97abb3cSPierre-Louis Bossart 	},
1158d4ba1beSPierre-Louis Bossart 	.nocodec_tplg_filename = "sof-cnl-nocodec.tplg",
1168d4ba1beSPierre-Louis Bossart 	.ops = &sof_cnl_ops,
11737e809d5SPierre-Louis Bossart 	.ops_init = sof_cnl_ops_init,
1189eb2b4caSRanjani Sridharan 	.ops_free = hda_ops_free,
1198d4ba1beSPierre-Louis Bossart };
1208d4ba1beSPierre-Louis Bossart 
1218d4ba1beSPierre-Louis Bossart /* PCI IDs */
1228d4ba1beSPierre-Louis Bossart static const struct pci_device_id sof_pci_ids[] = {
123a9022f4bSAmadeusz Sławiński 	{ PCI_DEVICE_DATA(INTEL, HDA_CNL_LP, &cnl_desc) },
124a9022f4bSAmadeusz Sławiński 	{ PCI_DEVICE_DATA(INTEL, HDA_CNL_H, &cfl_desc) },
125a9022f4bSAmadeusz Sławiński 	{ PCI_DEVICE_DATA(INTEL, HDA_CML_LP, &cml_desc) },
126a9022f4bSAmadeusz Sławiński 	{ PCI_DEVICE_DATA(INTEL, HDA_CML_H, &cml_desc) },
127a9022f4bSAmadeusz Sławiński 	{ PCI_DEVICE_DATA(INTEL, HDA_CML_S, &cml_desc) },
1288d4ba1beSPierre-Louis Bossart 	{ 0, }
1298d4ba1beSPierre-Louis Bossart };
1308d4ba1beSPierre-Louis Bossart MODULE_DEVICE_TABLE(pci, sof_pci_ids);
1318d4ba1beSPierre-Louis Bossart 
1328d4ba1beSPierre-Louis Bossart /* pci_driver definition */
1338d4ba1beSPierre-Louis Bossart static struct pci_driver snd_sof_pci_intel_cnl_driver = {
1348d4ba1beSPierre-Louis Bossart 	.name = "sof-audio-pci-intel-cnl",
1358d4ba1beSPierre-Louis Bossart 	.id_table = sof_pci_ids,
136194fe0fcSPierre-Louis Bossart 	.probe = hda_pci_intel_probe,
1378d4ba1beSPierre-Louis Bossart 	.remove = sof_pci_remove,
1388d4ba1beSPierre-Louis Bossart 	.shutdown = sof_pci_shutdown,
1398d4ba1beSPierre-Louis Bossart 	.driver = {
1408d4ba1beSPierre-Louis Bossart 		.pm = &sof_pci_pm,
1418d4ba1beSPierre-Louis Bossart 	},
1428d4ba1beSPierre-Louis Bossart };
1438d4ba1beSPierre-Louis Bossart module_pci_driver(snd_sof_pci_intel_cnl_driver);
1448d4ba1beSPierre-Louis Bossart 
1458d4ba1beSPierre-Louis Bossart MODULE_LICENSE("Dual BSD/GPL");
146*3ff78451SPierre-Louis Bossart MODULE_DESCRIPTION("SOF support for CannonLake platforms");
1476fe61f31SPierre-Louis Bossart MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_GENERIC);
1488d4ba1beSPierre-Louis Bossart MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_COMMON);
1498d4ba1beSPierre-Louis Bossart MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV);
150