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