1 // SPDX-License-Identifier: GPL-2.0-only
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 = 0x000020025D071100,
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 = 0x000120025D130800,
85 		.num_endpoints = 1,
86 		.endpoints = &single_endpoint,
87 	}
88 };
89 
90 static const struct snd_soc_acpi_adr_device rt1308_1_group1_adr[] = {
91 	{
92 		.adr = 0x000120025D130800,
93 		.num_endpoints = 1,
94 		.endpoints = &spk_l_endpoint,
95 	}
96 };
97 
98 static const struct snd_soc_acpi_adr_device rt1308_2_group1_adr[] = {
99 	{
100 		.adr = 0x000220025D130800,
101 		.num_endpoints = 1,
102 		.endpoints = &spk_r_endpoint,
103 	}
104 };
105 
106 static const struct snd_soc_acpi_adr_device rt715_3_adr[] = {
107 	{
108 		.adr = 0x000320025D071500,
109 		.num_endpoints = 1,
110 		.endpoints = &single_endpoint,
111 	}
112 };
113 
114 static const struct snd_soc_acpi_link_adr icl_3_in_1_default[] = {
115 	{
116 		.mask = BIT(0),
117 		.num_adr = ARRAY_SIZE(rt711_0_adr),
118 		.adr_d = rt711_0_adr,
119 	},
120 	{
121 		.mask = BIT(1),
122 		.num_adr = ARRAY_SIZE(rt1308_1_group1_adr),
123 		.adr_d = rt1308_1_group1_adr,
124 	},
125 	{
126 		.mask = BIT(2),
127 		.num_adr = ARRAY_SIZE(rt1308_2_group1_adr),
128 		.adr_d = rt1308_2_group1_adr,
129 	},
130 	{
131 		.mask = BIT(3),
132 		.num_adr = ARRAY_SIZE(rt715_3_adr),
133 		.adr_d = rt715_3_adr,
134 	},
135 	{}
136 };
137 
138 static const struct snd_soc_acpi_link_adr icl_3_in_1_mono_amp[] = {
139 	{
140 		.mask = BIT(0),
141 		.num_adr = ARRAY_SIZE(rt711_0_adr),
142 		.adr_d = rt711_0_adr,
143 	},
144 	{
145 		.mask = BIT(1),
146 		.num_adr = ARRAY_SIZE(rt1308_1_adr),
147 		.adr_d = rt1308_1_adr,
148 	},
149 	{
150 		.mask = BIT(3),
151 		.num_adr = ARRAY_SIZE(rt715_3_adr),
152 		.adr_d = rt715_3_adr,
153 	},
154 	{}
155 };
156 
157 struct snd_soc_acpi_mach snd_soc_acpi_intel_icl_sdw_machines[] = {
158 	{
159 		.link_mask = 0xF, /* 4 active links required */
160 		.links = icl_3_in_1_default,
161 		.drv_name = "sof_sdw",
162 		.sof_fw_filename = "sof-icl.ri",
163 		.sof_tplg_filename = "sof-icl-rt711-rt1308-rt715.tplg",
164 	},
165 	{
166 		.link_mask = 0xB, /* 3 active links required */
167 		.links = icl_3_in_1_mono_amp,
168 		.drv_name = "sof_sdw",
169 		.sof_fw_filename = "sof-icl.ri",
170 		.sof_tplg_filename = "sof-icl-rt711-rt1308-rt715-mono.tplg",
171 	},
172 	{
173 		.link_mask = 0x1, /* rt700 connected on link0 */
174 		.links = icl_rvp,
175 		.drv_name = "sof_sdw",
176 		.sof_fw_filename = "sof-icl.ri",
177 		.sof_tplg_filename = "sof-icl-rt700.tplg",
178 	},
179 	{},
180 };
181 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_icl_sdw_machines);
182 
183 MODULE_LICENSE("GPL v2");
184 MODULE_DESCRIPTION("Intel Common ACPI Match module");
185