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 const struct snd_soc_acpi_codecs essx_83x6 = {
14 	.num_codecs = 3,
15 	.codecs = { "ESSX8316", "ESSX8326", "ESSX8336"},
16 };
17 
18 static struct skl_machine_pdata icl_pdata = {
19 	.use_tplg_pcm = true,
20 };
21 
22 struct snd_soc_acpi_mach snd_soc_acpi_intel_icl_machines[] = {
23 	{
24 		.id = "INT34C2",
25 		.drv_name = "icl_rt274",
26 		.fw_filename = "intel/dsp_fw_icl.bin",
27 		.pdata = &icl_pdata,
28 		.sof_tplg_filename = "sof-icl-rt274.tplg",
29 	},
30 	{
31 		.id = "10EC5682",
32 		.drv_name = "sof_rt5682",
33 		.sof_tplg_filename = "sof-icl-rt5682.tplg",
34 	},
35 	{
36 		.comp_ids = &essx_83x6,
37 		.drv_name = "sof-essx8336",
38 		.sof_tplg_filename = "sof-icl-es8336", /* the tplg suffix is added at run time */
39 		.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER |
40 					SND_SOC_ACPI_TPLG_INTEL_SSP_MSB |
41 					SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER,
42 	},
43 	{},
44 };
45 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_icl_machines);
46 
47 static const struct snd_soc_acpi_endpoint single_endpoint = {
48 	.num = 0,
49 	.aggregated = 0,
50 	.group_position = 0,
51 	.group_id = 0,
52 };
53 
54 static const struct snd_soc_acpi_endpoint spk_l_endpoint = {
55 	.num = 0,
56 	.aggregated = 1,
57 	.group_position = 0,
58 	.group_id = 1,
59 };
60 
61 static const struct snd_soc_acpi_endpoint spk_r_endpoint = {
62 	.num = 0,
63 	.aggregated = 1,
64 	.group_position = 1,
65 	.group_id = 1,
66 };
67 
68 static const struct snd_soc_acpi_adr_device rt700_0_adr[] = {
69 	{
70 		.adr = 0x000010025D070000ull,
71 		.num_endpoints = 1,
72 		.endpoints = &single_endpoint,
73 		.name_prefix = "rt700"
74 	}
75 };
76 
77 static const struct snd_soc_acpi_link_adr icl_rvp[] = {
78 	{
79 		.mask = BIT(0),
80 		.num_adr = ARRAY_SIZE(rt700_0_adr),
81 		.adr_d = rt700_0_adr,
82 	},
83 	{}
84 };
85 
86 static const struct snd_soc_acpi_adr_device rt711_0_adr[] = {
87 	{
88 		.adr = 0x000020025D071100ull,
89 		.num_endpoints = 1,
90 		.endpoints = &single_endpoint,
91 		.name_prefix = "rt711"
92 	}
93 };
94 
95 static const struct snd_soc_acpi_adr_device rt1308_1_adr[] = {
96 	{
97 		.adr = 0x000120025D130800ull,
98 		.num_endpoints = 1,
99 		.endpoints = &single_endpoint,
100 		.name_prefix = "rt1308-1"
101 	}
102 };
103 
104 static const struct snd_soc_acpi_adr_device rt1308_1_group1_adr[] = {
105 	{
106 		.adr = 0x000120025D130800ull,
107 		.num_endpoints = 1,
108 		.endpoints = &spk_l_endpoint,
109 		.name_prefix = "rt1308-1"
110 	}
111 };
112 
113 static const struct snd_soc_acpi_adr_device rt1308_2_group1_adr[] = {
114 	{
115 		.adr = 0x000220025D130800ull,
116 		.num_endpoints = 1,
117 		.endpoints = &spk_r_endpoint,
118 		.name_prefix = "rt1308-2"
119 	}
120 };
121 
122 static const struct snd_soc_acpi_adr_device rt715_3_adr[] = {
123 	{
124 		.adr = 0x000320025D071500ull,
125 		.num_endpoints = 1,
126 		.endpoints = &single_endpoint,
127 		.name_prefix = "rt715"
128 	}
129 };
130 
131 static const struct snd_soc_acpi_link_adr icl_3_in_1_default[] = {
132 	{
133 		.mask = BIT(0),
134 		.num_adr = ARRAY_SIZE(rt711_0_adr),
135 		.adr_d = rt711_0_adr,
136 	},
137 	{
138 		.mask = BIT(1),
139 		.num_adr = ARRAY_SIZE(rt1308_1_group1_adr),
140 		.adr_d = rt1308_1_group1_adr,
141 	},
142 	{
143 		.mask = BIT(2),
144 		.num_adr = ARRAY_SIZE(rt1308_2_group1_adr),
145 		.adr_d = rt1308_2_group1_adr,
146 	},
147 	{
148 		.mask = BIT(3),
149 		.num_adr = ARRAY_SIZE(rt715_3_adr),
150 		.adr_d = rt715_3_adr,
151 	},
152 	{}
153 };
154 
155 static const struct snd_soc_acpi_link_adr icl_3_in_1_mono_amp[] = {
156 	{
157 		.mask = BIT(0),
158 		.num_adr = ARRAY_SIZE(rt711_0_adr),
159 		.adr_d = rt711_0_adr,
160 	},
161 	{
162 		.mask = BIT(1),
163 		.num_adr = ARRAY_SIZE(rt1308_1_adr),
164 		.adr_d = rt1308_1_adr,
165 	},
166 	{
167 		.mask = BIT(3),
168 		.num_adr = ARRAY_SIZE(rt715_3_adr),
169 		.adr_d = rt715_3_adr,
170 	},
171 	{}
172 };
173 
174 struct snd_soc_acpi_mach snd_soc_acpi_intel_icl_sdw_machines[] = {
175 	{
176 		.link_mask = 0xF, /* 4 active links required */
177 		.links = icl_3_in_1_default,
178 		.drv_name = "sof_sdw",
179 		.sof_tplg_filename = "sof-icl-rt711-rt1308-rt715.tplg",
180 	},
181 	{
182 		.link_mask = 0xB, /* 3 active links required */
183 		.links = icl_3_in_1_mono_amp,
184 		.drv_name = "sof_sdw",
185 		.sof_tplg_filename = "sof-icl-rt711-rt1308-rt715-mono.tplg",
186 	},
187 	{
188 		.link_mask = 0x1, /* rt700 connected on link0 */
189 		.links = icl_rvp,
190 		.drv_name = "sof_sdw",
191 		.sof_tplg_filename = "sof-icl-rt700.tplg",
192 	},
193 	{},
194 };
195 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_icl_sdw_machines);
196