summaryrefslogtreecommitdiff
path: root/sound/soc/amd/acp-config.c
blob: a58d646d28f6bf305723c31f69510075a888941f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
//
// This file is provided under a dual BSD/GPLv2 license. When using or
// redistributing this file, you may do so under either license.
//
// Copyright(c) 2021 Advanced Micro Devices, Inc.
//
// Authors: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
//

/* ACP machine configuration module */

#include <linux/acpi.h>
#include <linux/bits.h>
#include <linux/dmi.h>
#include <linux/module.h>
#include <linux/pci.h>

#include "../sof/amd/acp.h"
#include "mach-config.h"

static int acp_quirk_data;

static const struct config_entry config_table[] = {
	{
		.flags = FLAG_AMD_SOF,
		.device = ACP_PCI_DEV_ID,
		.dmi_table = (const struct dmi_system_id []) {
			{
				.matches = {
					DMI_MATCH(DMI_SYS_VENDOR, "AMD"),
					DMI_MATCH(DMI_PRODUCT_NAME, "Majolica-CZN"),
				},
			},
			{}
		},
	},
	{
		.flags = FLAG_AMD_SOF,
		.device = ACP_PCI_DEV_ID,
		.dmi_table = (const struct dmi_system_id []) {
			{
				.matches = {
					DMI_MATCH(DMI_SYS_VENDOR, "Google"),
				},
			},
			{}
		},
	},
	{
		.flags = FLAG_AMD_SOF,
		.device = ACP_PCI_DEV_ID,
		.dmi_table = (const struct dmi_system_id []) {
			{
				.matches = {
					DMI_MATCH(DMI_SYS_VENDOR, "Valve"),
					DMI_MATCH(DMI_PRODUCT_NAME, "Galileo"),
					DMI_MATCH(DMI_PRODUCT_FAMILY, "Sephiroth"),
				},
			},
			{}
		},
	},
	{
		.flags = FLAG_AMD_LEGACY,
		.device = ACP_PCI_DEV_ID,
		.dmi_table = (const struct dmi_system_id []) {
			{
				.matches = {
					DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "HUAWEI"),
					DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "KLVL-WXXW"),
					DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "M1010"),
				},
			},
			{}
		},
	},
	{
		.flags = FLAG_AMD_LEGACY,
		.device = ACP_PCI_DEV_ID,
		.dmi_table = (const struct dmi_system_id []) {
			{
				.matches = {
					DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "HUAWEI"),
					DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "KLVL-WXX9"),
					DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "M1010"),
				},
			},
			{}
		},
	},
	{
		.flags = FLAG_AMD_LEGACY,
		.device = ACP_PCI_DEV_ID,
		.dmi_table = (const struct dmi_system_id []) {
			{
				.matches = {
					DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "HUAWEI"),
					DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "BOM-WXX9"),
					DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "M1010"),
				},
			},
			{}
		},
	},
	{
		.flags = FLAG_AMD_LEGACY,
		.device = ACP_PCI_DEV_ID,
		.dmi_table = (const struct dmi_system_id []) {
			{
				.matches = {
					DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "HUAWEI"),
					DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "HVY-WXX9"),
					DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "M1020"),
				},
			},
			{}
		},
	},
	{
		.flags = FLAG_AMD_LEGACY,
		.device = ACP_PCI_DEV_ID,
		.dmi_table = (const struct dmi_system_id []) {
			{
				.matches = {
					DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "HUAWEI"),
					DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "HVY-WXX9"),
					DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "M1040"),
				},
			},
			{}
		},
	},
};

int snd_amd_acp_find_config(struct pci_dev *pci)
{
	const struct config_entry *table = config_table;
	u16 device = pci->device;
	int i;

	/* Do not enable FLAGS on older platforms with Rev id zero */
	if (!pci->revision)
		return 0;

	for (i = 0; i < ARRAY_SIZE(config_table); i++, table++) {
		if (table->device != device)
			continue;
		if (table->dmi_table && !dmi_check_system(table->dmi_table))
			continue;
		acp_quirk_data = table->flags;
		return table->flags;
	}

	return 0;
}
EXPORT_SYMBOL(snd_amd_acp_find_config);

static struct snd_soc_acpi_codecs amp_rt1019 = {
	.num_codecs = 1,
	.codecs = {"10EC1019"}
};

static struct snd_soc_acpi_codecs amp_max = {
	.num_codecs = 1,
	.codecs = {"MX98360A"}
};

static struct snd_soc_acpi_codecs amp_max98388 = {
	.num_codecs = 1,
	.codecs = {"ADS8388"}
};

struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[] = {
	{
		.id = "10EC5682",
		.drv_name = "rt5682-rt1019",
		.pdata = (void *)&acp_quirk_data,
		.machine_quirk = snd_soc_acpi_codec_list,
		.quirk_data = &amp_rt1019,
		.fw_filename = "sof-rn.ri",
		.sof_tplg_filename = "sof-rn-rt5682-rt1019.tplg",
	},
	{
		.id = "10EC5682",
		.drv_name = "rt5682-max",
		.pdata = (void *)&acp_quirk_data,
		.machine_quirk = snd_soc_acpi_codec_list,
		.quirk_data = &amp_max,
		.fw_filename = "sof-rn.ri",
		.sof_tplg_filename = "sof-rn-rt5682-max98360.tplg",
	},
	{
		.id = "RTL5682",
		.drv_name = "rt5682s-max",
		.pdata = (void *)&acp_quirk_data,
		.machine_quirk = snd_soc_acpi_codec_list,
		.quirk_data = &amp_max,
		.fw_filename = "sof-rn.ri",
		.sof_tplg_filename = "sof-rn-rt5682-max98360.tplg",
	},
	{
		.id = "RTL5682",
		.drv_name = "rt5682s-rt1019",
		.pdata = (void *)&acp_quirk_data,
		.machine_quirk = snd_soc_acpi_codec_list,
		.quirk_data = &amp_rt1019,
		.fw_filename = "sof-rn.ri",
		.sof_tplg_filename = "sof-rn-rt5682-rt1019.tplg",
	},
	{
		.id = "AMDI1019",
		.drv_name = "renoir-dsp",
		.pdata = (void *)&acp_quirk_data,
		.fw_filename = "sof-rn.ri",
		.sof_tplg_filename = "sof-acp.tplg",
	},
	{},
};
EXPORT_SYMBOL(snd_soc_acpi_amd_sof_machines);

struct snd_soc_acpi_mach snd_soc_acpi_amd_vangogh_sof_machines[] = {
	{
		.id = "NVTN2020",
		.drv_name = "nau8821-max",
		.pdata = &acp_quirk_data,
		.machine_quirk = snd_soc_acpi_codec_list,
		.quirk_data = &amp_max98388,
		.fw_filename = "sof-vangogh.ri",
		.sof_tplg_filename = "sof-vangogh-nau8821-max.tplg",
	},
	{},
};
EXPORT_SYMBOL(snd_soc_acpi_amd_vangogh_sof_machines);

struct snd_soc_acpi_mach snd_soc_acpi_amd_rmb_sof_machines[] = {
	{
		.id = "AMDI1019",
		.drv_name = "rmb-dsp",
		.pdata = &acp_quirk_data,
		.fw_filename = "sof-rmb.ri",
		.sof_tplg_filename = "sof-acp-rmb.tplg",
	},
	{
		.id = "10508825",
		.drv_name = "nau8825-max",
		.pdata = &acp_quirk_data,
		.machine_quirk = snd_soc_acpi_codec_list,
		.quirk_data = &amp_max,
		.fw_filename = "sof-rmb.ri",
		.sof_tplg_filename = "sof-rmb-nau8825-max98360.tplg",
	},
	{
		.id = "RTL5682",
		.drv_name = "rt5682s-hs-rt1019",
		.pdata = &acp_quirk_data,
		.machine_quirk = snd_soc_acpi_codec_list,
		.quirk_data = &amp_rt1019,
		.fw_filename = "sof-rmb.ri",
		.sof_tplg_filename = "sof-rmb-rt5682s-rt1019.tplg",
	},
	{},
};
EXPORT_SYMBOL(snd_soc_acpi_amd_rmb_sof_machines);

MODULE_LICENSE("Dual BSD/GPL");