1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * soc-acpi-intel-icl-match.c - tables and support for ICL ACPI enumeration.
4  *
5  * Copyright (c) 2018, Intel Corporation.
6  *
7  */
8 
9 #include <sound/soc-acpi.h>
10 #include <sound/soc-acpi-intel-match.h>
11 #include "../skylake/skl.h"
12 
13 static struct skl_machine_pdata icl_pdata = {
14 	.use_tplg_pcm = true,
15 };
16 
17 struct snd_soc_acpi_mach snd_soc_acpi_intel_icl_machines[] = {
18 	{
19 		.id = "INT34C2",
20 		.drv_name = "icl_rt274",
21 		.fw_filename = "intel/dsp_fw_icl.bin",
22 		.pdata = &icl_pdata,
23 		.sof_fw_filename = "sof-icl.ri",
24 		.sof_tplg_filename = "sof-icl-rt274.tplg",
25 	},
26 	{
27 		.id = "10EC5682",
28 		.drv_name = "sof_rt5682",
29 		.sof_fw_filename = "sof-icl.ri",
30 		.sof_tplg_filename = "sof-icl-rt5682.tplg",
31 	},
32 	{},
33 };
34 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_icl_machines);
35 
36 static const struct snd_soc_acpi_endpoint single_endpoint = {
37 	.num = 0,
38 	.aggregated = 0,
39 	.group_position = 0,
40 	.group_id = 0,
41 };
42 
43 static const struct snd_soc_acpi_endpoint spk_l_endpoint = {
44 	.num = 0,
45 	.aggregated = 1,
46 	.group_position = 0,
47 	.group_id = 1,
48 };
49 
50 static const struct snd_soc_acpi_endpoint spk_r_endpoint = {
51 	.num = 0,
52 	.aggregated = 1,
53 	.group_position = 1,
54 	.group_id = 1,
55 };
56 
57 static const struct snd_soc_acpi_adr_device rt700_0_adr[] = {
58 	{
59 		.adr = 0x000010025D070000,
60 		.num_endpoints = 1,
61 		.endpoints = &single_endpoint,
62 	}
63 };
64 
65 static const struct snd_soc_acpi_link_adr icl_rvp[] = {
66 	{
67 		.mask = BIT(0),
68 		.num_adr = ARRAY_SIZE(rt700_0_adr),
69 		.adr_d = rt700_0_adr,
70 	},
71 	{}
72 };
73 
74 static const struct snd_soc_acpi_adr_device rt711_0_adr[] = {
75 	{
76 		.adr = 0x000010025D071100,
77 		.num_endpoints = 1,
78 		.endpoints = &single_endpoint,
79 	}
80 };
81 
82 static const struct snd_soc_acpi_adr_device rt1308_1_adr[] = {
83 	{
84 		.adr = 0x000110025D130800,
85 		.num_endpoints = 1,
86 		.endpoints = &single_endpoint,
87 	}
88 };
89 
90 static const struct snd_soc_acpi_adr_device rt1308_2_adr[] = {
91 	{
92 		.adr = 0x000210025D130800,
93 		.num_endpoints = 1,
94 		.endpoints = &single_endpoint,
95 	}
96 };
97 
98 static const struct snd_soc_acpi_adr_device rt1308_1_group1_adr[] = {
99 	{
100 		.adr = 0x000110025D130800,
101 		.num_endpoints = 1,
102 		.endpoints = &spk_l_endpoint,
103 	}
104 };
105 
106 static const struct snd_soc_acpi_adr_device rt1308_2_group1_adr[] = {
107 	{
108 		.adr = 0x000210025D130800,
109 		.num_endpoints = 1,
110 		.endpoints = &spk_r_endpoint,
111 	}
112 };
113 
114 static const struct snd_soc_acpi_adr_device rt715_3_adr[] = {
115 	{
116 		.adr = 0x000310025D071500,
117 		.num_endpoints = 1,
118 		.endpoints = &single_endpoint,
119 	}
120 };
121 
122 static const struct snd_soc_acpi_link_adr icl_3_in_1_default[] = {
123 	{
124 		.mask = BIT(0),
125 		.num_adr = ARRAY_SIZE(rt711_0_adr),
126 		.adr_d = rt711_0_adr,
127 	},
128 	{
129 		.mask = BIT(1),
130 		.num_adr = ARRAY_SIZE(rt1308_1_group1_adr),
131 		.adr_d = rt1308_1_group1_adr,
132 	},
133 	{
134 		.mask = BIT(2),
135 		.num_adr = ARRAY_SIZE(rt1308_2_group1_adr),
136 		.adr_d = rt1308_2_group1_adr,
137 	},
138 	{
139 		.mask = BIT(3),
140 		.num_adr = ARRAY_SIZE(rt715_3_adr),
141 		.adr_d = rt715_3_adr,
142 	},
143 	{}
144 };
145 
146 static const struct snd_soc_acpi_link_adr icl_3_in_1_mono_amp[] = {
147 	{
148 		.mask = BIT(0),
149 		.num_adr = ARRAY_SIZE(rt711_0_adr),
150 		.adr_d = rt711_0_adr,
151 	},
152 	{
153 		.mask = BIT(1),
154 		.num_adr = ARRAY_SIZE(rt1308_1_adr),
155 		.adr_d = rt1308_1_adr,
156 	},
157 	{
158 		.mask = BIT(3),
159 		.num_adr = ARRAY_SIZE(rt715_3_adr),
160 		.adr_d = rt715_3_adr,
161 	},
162 	{}
163 };
164 
165 struct snd_soc_acpi_mach snd_soc_acpi_intel_icl_sdw_machines[] = {
166 	{
167 		.link_mask = 0xF, /* 4 active links required */
168 		.links = icl_3_in_1_default,
169 		.drv_name = "sof_sdw",
170 		.sof_fw_filename = "sof-icl.ri",
171 		.sof_tplg_filename = "sof-icl-rt711-rt1308-rt715.tplg",
172 	},
173 	{
174 		.link_mask = 0xB, /* 3 active links required */
175 		.links = icl_3_in_1_mono_amp,
176 		.drv_name = "sof_sdw",
177 		.sof_fw_filename = "sof-icl.ri",
178 		.sof_tplg_filename = "sof-icl-rt711-rt1308-rt715-mono.tplg",
179 	},
180 	{
181 		.link_mask = 0x1, /* rt700 connected on link0 */
182 		.links = icl_rvp,
183 		.drv_name = "sof_sdw",
184 		.sof_fw_filename = "sof-icl.ri",
185 		.sof_tplg_filename = "sof-icl-rt700.tplg",
186 	},
187 	{},
188 };
189 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_icl_sdw_machines);
190 
191 MODULE_LICENSE("GPL v2");
192 MODULE_DESCRIPTION("Intel Common ACPI Match module");
193