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-2022 Intel Corporation
7 //
8 // Author: Ranjani Sridharan <ranjani.sridharan@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 #include "mtl.h"
22 
23 static const struct sof_dev_desc mtl_desc = {
24 	.use_acpi_target_states	= true,
25 	.machines               = snd_soc_acpi_intel_mtl_machines,
26 	.alt_machines		= snd_soc_acpi_intel_mtl_sdw_machines,
27 	.resindex_lpe_base      = 0,
28 	.resindex_pcicfg_base   = -1,
29 	.resindex_imr_base      = -1,
30 	.irqindex_host_ipc      = -1,
31 	.chip_info = &mtl_chip_info,
32 	.ipc_supported_mask	= BIT(SOF_IPC_TYPE_4),
33 	.ipc_default		= SOF_IPC_TYPE_4,
34 	.dspless_mode_supported	= true,		/* Only supported for HDaudio */
35 	.default_fw_path = {
36 		[SOF_IPC_TYPE_4] = "intel/sof-ipc4/mtl",
37 	},
38 	.default_lib_path = {
39 		[SOF_IPC_TYPE_4] = "intel/sof-ipc4-lib/mtl",
40 	},
41 	.default_tplg_path = {
42 		[SOF_IPC_TYPE_4] = "intel/sof-ace-tplg",
43 	},
44 	.default_fw_filename = {
45 		[SOF_IPC_TYPE_4] = "sof-mtl.ri",
46 	},
47 	.nocodec_tplg_filename = "sof-mtl-nocodec.tplg",
48 	.ops = &sof_mtl_ops,
49 	.ops_init = sof_mtl_ops_init,
50 	.ops_free = hda_ops_free,
51 };
52 
53 static const struct sof_dev_desc arl_desc = {
54 	.use_acpi_target_states = true,
55 	.machines               = snd_soc_acpi_intel_arl_machines,
56 	.alt_machines           = snd_soc_acpi_intel_arl_sdw_machines,
57 	.resindex_lpe_base      = 0,
58 	.resindex_pcicfg_base   = -1,
59 	.resindex_imr_base      = -1,
60 	.irqindex_host_ipc      = -1,
61 	.chip_info = &mtl_chip_info,
62 	.ipc_supported_mask     = BIT(SOF_IPC_TYPE_4),
63 	.ipc_default            = SOF_IPC_TYPE_4,
64 	.dspless_mode_supported = true,         /* Only supported for HDaudio */
65 	.default_fw_path = {
66 		[SOF_IPC_TYPE_4] = "intel/sof-ipc4/arl",
67 	},
68 	.default_lib_path = {
69 		[SOF_IPC_TYPE_4] = "intel/sof-ipc4-lib/arl",
70 	},
71 	.default_tplg_path = {
72 		[SOF_IPC_TYPE_4] = "intel/sof-ace-tplg",
73 	},
74 	.default_fw_filename = {
75 		[SOF_IPC_TYPE_4] = "sof-arl.ri",
76 	},
77 	.nocodec_tplg_filename = "sof-arl-nocodec.tplg",
78 	.ops = &sof_mtl_ops,
79 	.ops_init = sof_mtl_ops_init,
80 	.ops_free = hda_ops_free,
81 };
82 
83 static const struct sof_dev_desc arl_s_desc = {
84 	.use_acpi_target_states = true,
85 	.machines               = snd_soc_acpi_intel_arl_machines,
86 	.alt_machines           = snd_soc_acpi_intel_arl_sdw_machines,
87 	.resindex_lpe_base      = 0,
88 	.resindex_pcicfg_base   = -1,
89 	.resindex_imr_base      = -1,
90 	.irqindex_host_ipc      = -1,
91 	.chip_info = &arl_s_chip_info,
92 	.ipc_supported_mask     = BIT(SOF_IPC_TYPE_4),
93 	.ipc_default            = SOF_IPC_TYPE_4,
94 	.dspless_mode_supported = true,         /* Only supported for HDaudio */
95 	.default_fw_path = {
96 		[SOF_IPC_TYPE_4] = "intel/sof-ipc4/arl-s",
97 	},
98 	.default_lib_path = {
99 		[SOF_IPC_TYPE_4] = "intel/sof-ipc4-lib/arl-s",
100 	},
101 	.default_tplg_path = {
102 		[SOF_IPC_TYPE_4] = "intel/sof-ace-tplg",
103 	},
104 	.default_fw_filename = {
105 		[SOF_IPC_TYPE_4] = "sof-arl-s.ri",
106 	},
107 	.nocodec_tplg_filename = "sof-arl-nocodec.tplg",
108 	.ops = &sof_mtl_ops,
109 	.ops_init = sof_mtl_ops_init,
110 	.ops_free = hda_ops_free,
111 };
112 
113 /* PCI IDs */
114 static const struct pci_device_id sof_pci_ids[] = {
115 	{ PCI_DEVICE_DATA(INTEL, HDA_MTL, &mtl_desc) },
116 	{ PCI_DEVICE_DATA(INTEL, HDA_ARL_S, &arl_s_desc) },
117 	{ PCI_DEVICE_DATA(INTEL, HDA_ARL, &arl_desc) },
118 	{ 0, }
119 };
120 MODULE_DEVICE_TABLE(pci, sof_pci_ids);
121 
122 /* pci_driver definition */
123 static struct pci_driver snd_sof_pci_intel_mtl_driver = {
124 	.name = "sof-audio-pci-intel-mtl",
125 	.id_table = sof_pci_ids,
126 	.probe = hda_pci_intel_probe,
127 	.remove = sof_pci_remove,
128 	.shutdown = sof_pci_shutdown,
129 	.driver = {
130 		.pm = &sof_pci_pm,
131 	},
132 };
133 module_pci_driver(snd_sof_pci_intel_mtl_driver);
134 
135 MODULE_LICENSE("Dual BSD/GPL");
136 MODULE_DESCRIPTION("SOF support for MeteorLake platforms");
137 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_GENERIC);
138 MODULE_IMPORT_NS(SND_SOC_SOF_INTEL_HDA_COMMON);
139 MODULE_IMPORT_NS(SND_SOC_SOF_PCI_DEV);
140