1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * soc-acpi-intel-mtl-match.c - tables and support for MTL ACPI enumeration.
4  *
5  * Copyright (c) 2022, Intel Corporation.
6  *
7  */
8 
9 #include <sound/soc-acpi.h>
10 #include <sound/soc-acpi-intel-match.h>
11 #include "soc-acpi-intel-sdw-mockup-match.h"
12 
13 static const struct snd_soc_acpi_codecs mtl_max98357a_amp = {
14 	.num_codecs = 1,
15 	.codecs = {"MX98357A"}
16 };
17 
18 static const struct snd_soc_acpi_codecs mtl_rt5682_rt5682s_hp = {
19 	.num_codecs = 2,
20 	.codecs = {"10EC5682", "RTL5682"},
21 };
22 
23 struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_machines[] = {
24 	{
25 		.comp_ids = &mtl_rt5682_rt5682s_hp,
26 		.drv_name = "mtl_mx98357_rt5682",
27 		.machine_quirk = snd_soc_acpi_codec_list,
28 		.quirk_data = &mtl_max98357a_amp,
29 		.sof_tplg_filename = "sof-mtl-max98357a-rt5682.tplg",
30 	},
31 	{},
32 };
33 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_mtl_machines);
34 
35 static const struct snd_soc_acpi_endpoint single_endpoint = {
36 	.num = 0,
37 	.aggregated = 0,
38 	.group_position = 0,
39 	.group_id = 0,
40 };
41 
42 static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = {
43 	{
44 		.adr = 0x000030025D071101ull,
45 		.num_endpoints = 1,
46 		.endpoints = &single_endpoint,
47 		.name_prefix = "rt711"
48 	}
49 };
50 
51 static const struct snd_soc_acpi_link_adr mtl_rvp[] = {
52 	{
53 		.mask = BIT(0),
54 		.num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
55 		.adr_d = rt711_sdca_0_adr,
56 	},
57 	{}
58 };
59 
60 /* this table is used when there is no I2S codec present */
61 struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = {
62 	/* mockup tests need to be first */
63 	{
64 		.link_mask = GENMASK(3, 0),
65 		.links = sdw_mockup_headset_2amps_mic,
66 		.drv_name = "sof_sdw",
67 		.sof_tplg_filename = "sof-mtl-rt711-rt1308-rt715.tplg",
68 	},
69 	{
70 		.link_mask = BIT(0) | BIT(1) | BIT(3),
71 		.links = sdw_mockup_headset_1amp_mic,
72 		.drv_name = "sof_sdw",
73 		.sof_tplg_filename = "sof-mtl-rt711-rt1308-mono-rt715.tplg",
74 	},
75 	{
76 		.link_mask = GENMASK(2, 0),
77 		.links = sdw_mockup_mic_headset_1amp,
78 		.drv_name = "sof_sdw",
79 		.sof_tplg_filename = "sof-mtl-rt715-rt711-rt1308-mono.tplg",
80 	},
81 	{
82 		.link_mask = BIT(0),
83 		.links = mtl_rvp,
84 		.drv_name = "sof_sdw",
85 		.sof_tplg_filename = "sof-mtl-rt711.tplg",
86 	},
87 	{},
88 };
89 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_mtl_sdw_machines);
90