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 = 0x000010025D070000ull,
60 		.num_endpoints = 1,
61 		.endpoints = &single_endpoint,
62 		.name_prefix = "rt700"
63 	}
64 };
65 
66 static const struct snd_soc_acpi_link_adr icl_rvp[] = {
67 	{
68 		.mask = BIT(0),
69 		.num_adr = ARRAY_SIZE(rt700_0_adr),
70 		.adr_d = rt700_0_adr,
71 	},
72 	{}
73 };
74 
75 static const struct snd_soc_acpi_adr_device rt711_0_adr[] = {
76 	{
77 		.adr = 0x000020025D071100ull,
78 		.num_endpoints = 1,
79 		.endpoints = &single_endpoint,
80 		.name_prefix = "rt711"
81 	}
82 };
83 
84 static const struct snd_soc_acpi_adr_device rt1308_1_adr[] = {
85 	{
86 		.adr = 0x000120025D130800ull,
87 		.num_endpoints = 1,
88 		.endpoints = &single_endpoint,
89 		.name_prefix = "rt1308-1"
90 	}
91 };
92 
93 static const struct snd_soc_acpi_adr_device rt1308_1_group1_adr[] = {
94 	{
95 		.adr = 0x000120025D130800ull,
96 		.num_endpoints = 1,
97 		.endpoints = &spk_l_endpoint,
98 		.name_prefix = "rt1308-1"
99 	}
100 };
101 
102 static const struct snd_soc_acpi_adr_device rt1308_2_group1_adr[] = {
103 	{
104 		.adr = 0x000220025D130800ull,
105 		.num_endpoints = 1,
106 		.endpoints = &spk_r_endpoint,
107 		.name_prefix = "rt1308-2"
108 	}
109 };
110 
111 static const struct snd_soc_acpi_adr_device rt715_3_adr[] = {
112 	{
113 		.adr = 0x000320025D071500ull,
114 		.num_endpoints = 1,
115 		.endpoints = &single_endpoint,
116 		.name_prefix = "rt715"
117 	}
118 };
119 
120 static const struct snd_soc_acpi_link_adr icl_3_in_1_default[] = {
121 	{
122 		.mask = BIT(0),
123 		.num_adr = ARRAY_SIZE(rt711_0_adr),
124 		.adr_d = rt711_0_adr,
125 	},
126 	{
127 		.mask = BIT(1),
128 		.num_adr = ARRAY_SIZE(rt1308_1_group1_adr),
129 		.adr_d = rt1308_1_group1_adr,
130 	},
131 	{
132 		.mask = BIT(2),
133 		.num_adr = ARRAY_SIZE(rt1308_2_group1_adr),
134 		.adr_d = rt1308_2_group1_adr,
135 	},
136 	{
137 		.mask = BIT(3),
138 		.num_adr = ARRAY_SIZE(rt715_3_adr),
139 		.adr_d = rt715_3_adr,
140 	},
141 	{}
142 };
143 
144 static const struct snd_soc_acpi_link_adr icl_3_in_1_mono_amp[] = {
145 	{
146 		.mask = BIT(0),
147 		.num_adr = ARRAY_SIZE(rt711_0_adr),
148 		.adr_d = rt711_0_adr,
149 	},
150 	{
151 		.mask = BIT(1),
152 		.num_adr = ARRAY_SIZE(rt1308_1_adr),
153 		.adr_d = rt1308_1_adr,
154 	},
155 	{
156 		.mask = BIT(3),
157 		.num_adr = ARRAY_SIZE(rt715_3_adr),
158 		.adr_d = rt715_3_adr,
159 	},
160 	{}
161 };
162 
163 struct snd_soc_acpi_mach snd_soc_acpi_intel_icl_sdw_machines[] = {
164 	{
165 		.link_mask = 0xF, /* 4 active links required */
166 		.links = icl_3_in_1_default,
167 		.drv_name = "sof_sdw",
168 		.sof_fw_filename = "sof-icl.ri",
169 		.sof_tplg_filename = "sof-icl-rt711-rt1308-rt715.tplg",
170 	},
171 	{
172 		.link_mask = 0xB, /* 3 active links required */
173 		.links = icl_3_in_1_mono_amp,
174 		.drv_name = "sof_sdw",
175 		.sof_fw_filename = "sof-icl.ri",
176 		.sof_tplg_filename = "sof-icl-rt711-rt1308-rt715-mono.tplg",
177 	},
178 	{
179 		.link_mask = 0x1, /* rt700 connected on link0 */
180 		.links = icl_rvp,
181 		.drv_name = "sof_sdw",
182 		.sof_fw_filename = "sof-icl.ri",
183 		.sof_tplg_filename = "sof-icl-rt700.tplg",
184 	},
185 	{},
186 };
187 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_icl_sdw_machines);
188