Loading...
Note: File does not exist in v4.17.
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * soc-acpi-intel-cml-match.c - tables and support for CML ACPI enumeration.
4 *
5 * Copyright (c) 2019, Intel Corporation.
6 *
7 */
8
9#include <sound/soc-acpi.h>
10#include <sound/soc-acpi-intel-match.h>
11
12static struct snd_soc_acpi_codecs rt1011_spk_codecs = {
13 .num_codecs = 1,
14 .codecs = {"10EC1011"}
15};
16
17static struct snd_soc_acpi_codecs max98357a_spk_codecs = {
18 .num_codecs = 1,
19 .codecs = {"MX98357A"}
20};
21
22static struct snd_soc_acpi_codecs max98390_spk_codecs = {
23 .num_codecs = 1,
24 .codecs = {"MX98390"}
25};
26
27/*
28 * The order of the three entries with .id = "10EC5682" matters
29 * here, because DSDT tables expose an ACPI HID for the MAX98357A
30 * speaker amplifier which is not populated on the board.
31 */
32struct snd_soc_acpi_mach snd_soc_acpi_intel_cml_machines[] = {
33 {
34 .id = "10EC5682",
35 .drv_name = "cml_rt1011_rt5682",
36 .machine_quirk = snd_soc_acpi_codec_list,
37 .quirk_data = &rt1011_spk_codecs,
38 .sof_fw_filename = "sof-cml.ri",
39 .sof_tplg_filename = "sof-cml-rt1011-rt5682.tplg",
40 },
41 {
42 .id = "10EC5682",
43 .drv_name = "sof_rt5682",
44 .machine_quirk = snd_soc_acpi_codec_list,
45 .quirk_data = &max98357a_spk_codecs,
46 .sof_fw_filename = "sof-cml.ri",
47 .sof_tplg_filename = "sof-cml-rt5682-max98357a.tplg",
48 },
49 {
50 .id = "10EC5682",
51 .drv_name = "sof_rt5682",
52 .sof_fw_filename = "sof-cml.ri",
53 .sof_tplg_filename = "sof-cml-rt5682.tplg",
54 },
55 {
56 .id = "DLGS7219",
57 .drv_name = "cml_da7219_max98357a",
58 .machine_quirk = snd_soc_acpi_codec_list,
59 .quirk_data = &max98357a_spk_codecs,
60 .sof_fw_filename = "sof-cml.ri",
61 .sof_tplg_filename = "sof-cml-da7219-max98357a.tplg",
62 },
63 {
64 .id = "DLGS7219",
65 .drv_name = "cml_da7219_max98357a",
66 .machine_quirk = snd_soc_acpi_codec_list,
67 .quirk_data = &max98390_spk_codecs,
68 .sof_fw_filename = "sof-cml.ri",
69 .sof_tplg_filename = "sof-cml-da7219-max98357a.tplg",
70 },
71 {},
72};
73EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cml_machines);
74
75static const struct snd_soc_acpi_endpoint single_endpoint = {
76 .num = 0,
77 .aggregated = 0,
78 .group_position = 0,
79 .group_id = 0,
80};
81
82static const struct snd_soc_acpi_endpoint spk_l_endpoint = {
83 .num = 0,
84 .aggregated = 1,
85 .group_position = 0,
86 .group_id = 1,
87};
88
89static const struct snd_soc_acpi_endpoint spk_r_endpoint = {
90 .num = 0,
91 .aggregated = 1,
92 .group_position = 1,
93 .group_id = 1,
94};
95
96static const struct snd_soc_acpi_adr_device rt700_1_adr[] = {
97 {
98 .adr = 0x000110025D070000,
99 .num_endpoints = 1,
100 .endpoints = &single_endpoint,
101 }
102};
103
104static const struct snd_soc_acpi_link_adr cml_rvp[] = {
105 {
106 .mask = BIT(1),
107 .num_adr = ARRAY_SIZE(rt700_1_adr),
108 .adr_d = rt700_1_adr,
109 },
110 {}
111};
112
113static const struct snd_soc_acpi_adr_device rt711_0_adr[] = {
114 {
115 .adr = 0x000010025D071100,
116 .num_endpoints = 1,
117 .endpoints = &single_endpoint,
118 }
119};
120
121static const struct snd_soc_acpi_adr_device rt1308_1_adr[] = {
122 {
123 .adr = 0x000110025D130800,
124 .num_endpoints = 1,
125 .endpoints = &single_endpoint,
126 }
127};
128
129static const struct snd_soc_acpi_adr_device rt1308_1_group1_adr[] = {
130 {
131 .adr = 0x000110025D130800,
132 .num_endpoints = 1,
133 .endpoints = &spk_l_endpoint,
134 }
135};
136
137static const struct snd_soc_acpi_adr_device rt1308_2_group1_adr[] = {
138 {
139 .adr = 0x000210025D130800,
140 .num_endpoints = 1,
141 .endpoints = &spk_r_endpoint,
142 }
143};
144
145static const struct snd_soc_acpi_adr_device rt715_3_adr[] = {
146 {
147 .adr = 0x000310025D071500,
148 .num_endpoints = 1,
149 .endpoints = &single_endpoint,
150 }
151};
152
153static const struct snd_soc_acpi_link_adr cml_3_in_1_default[] = {
154 {
155 .mask = BIT(0),
156 .num_adr = ARRAY_SIZE(rt711_0_adr),
157 .adr_d = rt711_0_adr,
158 },
159 {
160 .mask = BIT(1),
161 .num_adr = ARRAY_SIZE(rt1308_1_group1_adr),
162 .adr_d = rt1308_1_group1_adr,
163 },
164 {
165 .mask = BIT(2),
166 .num_adr = ARRAY_SIZE(rt1308_2_group1_adr),
167 .adr_d = rt1308_2_group1_adr,
168 },
169 {
170 .mask = BIT(3),
171 .num_adr = ARRAY_SIZE(rt715_3_adr),
172 .adr_d = rt715_3_adr,
173 },
174 {}
175};
176
177static const struct snd_soc_acpi_link_adr cml_3_in_1_mono_amp[] = {
178 {
179 .mask = BIT(0),
180 .num_adr = ARRAY_SIZE(rt711_0_adr),
181 .adr_d = rt711_0_adr,
182 },
183 {
184 .mask = BIT(1),
185 .num_adr = ARRAY_SIZE(rt1308_1_adr),
186 .adr_d = rt1308_1_adr,
187 },
188 {
189 .mask = BIT(3),
190 .num_adr = ARRAY_SIZE(rt715_3_adr),
191 .adr_d = rt715_3_adr,
192 },
193 {}
194};
195
196struct snd_soc_acpi_mach snd_soc_acpi_intel_cml_sdw_machines[] = {
197 {
198 .link_mask = 0xF, /* 4 active links required */
199 .links = cml_3_in_1_default,
200 .drv_name = "sof_sdw",
201 .sof_fw_filename = "sof-cml.ri",
202 .sof_tplg_filename = "sof-cml-rt711-rt1308-rt715.tplg",
203 },
204 {
205 /*
206 * link_mask should be 0xB, but all links are enabled by BIOS.
207 * This entry will be selected if there is no rt1308 exposed
208 * on link2 since it will fail to match the above entry.
209 */
210 .link_mask = 0xF,
211 .links = cml_3_in_1_mono_amp,
212 .drv_name = "sof_sdw",
213 .sof_fw_filename = "sof-cml.ri",
214 .sof_tplg_filename = "sof-cml-rt711-rt1308-mono-rt715.tplg",
215 },
216 {
217 .link_mask = 0x2, /* RT700 connected on Link1 */
218 .links = cml_rvp,
219 .drv_name = "sof_sdw",
220 .sof_fw_filename = "sof-cml.ri",
221 .sof_tplg_filename = "sof-cml-rt700.tplg",
222 },
223 {}
224};
225EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cml_sdw_machines);
226
227MODULE_LICENSE("GPL v2");
228MODULE_DESCRIPTION("Intel Common ACPI Match module");