xref: /linux/sound/soc/intel/common/soc-acpi-intel-ptl-match.c (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * soc-acpi-intel-ptl-match.c - tables and support for PTL ACPI enumeration.
4  *
5  * Copyright (c) 2024, 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 struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_machines[] = {
14 	{},
15 };
16 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_ptl_machines);
17 
18 static const struct snd_soc_acpi_endpoint single_endpoint = {
19 	.num = 0,
20 	.aggregated = 0,
21 	.group_position = 0,
22 	.group_id = 0,
23 };
24 
25 /*
26  * RT722 is a multi-function codec, three endpoints are created for
27  * its headset, amp and dmic functions.
28  */
29 static const struct snd_soc_acpi_endpoint rt722_endpoints[] = {
30 	{
31 		.num = 0,
32 		.aggregated = 0,
33 		.group_position = 0,
34 		.group_id = 0,
35 	},
36 	{
37 		.num = 1,
38 		.aggregated = 0,
39 		.group_position = 0,
40 		.group_id = 0,
41 	},
42 	{
43 		.num = 2,
44 		.aggregated = 0,
45 		.group_position = 0,
46 		.group_id = 0,
47 	},
48 };
49 
50 static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = {
51 	{
52 		.adr = 0x000030025D071101ull,
53 		.num_endpoints = 1,
54 		.endpoints = &single_endpoint,
55 		.name_prefix = "rt711"
56 	}
57 };
58 
59 static const struct snd_soc_acpi_adr_device rt722_0_single_adr[] = {
60 	{
61 		.adr = 0x000030025d072201ull,
62 		.num_endpoints = ARRAY_SIZE(rt722_endpoints),
63 		.endpoints = rt722_endpoints,
64 		.name_prefix = "rt722"
65 	}
66 };
67 
68 static const struct snd_soc_acpi_adr_device rt722_3_single_adr[] = {
69 	{
70 		.adr = 0x000330025d072201ull,
71 		.num_endpoints = ARRAY_SIZE(rt722_endpoints),
72 		.endpoints = rt722_endpoints,
73 		.name_prefix = "rt722"
74 	}
75 };
76 
77 static const struct snd_soc_acpi_link_adr ptl_rt722_only[] = {
78 	{
79 		.mask = BIT(0),
80 		.num_adr = ARRAY_SIZE(rt722_0_single_adr),
81 		.adr_d = rt722_0_single_adr,
82 	},
83 	{}
84 };
85 
86 static const struct snd_soc_acpi_link_adr ptl_rt722_l3[] = {
87 	{
88 		.mask = BIT(3),
89 		.num_adr = ARRAY_SIZE(rt722_3_single_adr),
90 		.adr_d = rt722_3_single_adr,
91 	},
92 	{}
93 };
94 
95 static const struct snd_soc_acpi_link_adr ptl_rvp[] = {
96 	{
97 		.mask = BIT(0),
98 		.num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
99 		.adr_d = rt711_sdca_0_adr,
100 	},
101 	{}
102 };
103 
104 /* this table is used when there is no I2S codec present */
105 struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_sdw_machines[] = {
106 	/* mockup tests need to be first */
107 	{
108 		.link_mask = GENMASK(3, 0),
109 		.links = sdw_mockup_headset_2amps_mic,
110 		.drv_name = "sof_sdw",
111 		.sof_tplg_filename = "sof-ptl-rt711-rt1308-rt715.tplg",
112 	},
113 	{
114 		.link_mask = BIT(0) | BIT(1) | BIT(3),
115 		.links = sdw_mockup_headset_1amp_mic,
116 		.drv_name = "sof_sdw",
117 		.sof_tplg_filename = "sof-ptl-rt711-rt1308-mono-rt715.tplg",
118 	},
119 	{
120 		.link_mask = GENMASK(2, 0),
121 		.links = sdw_mockup_mic_headset_1amp,
122 		.drv_name = "sof_sdw",
123 		.sof_tplg_filename = "sof-ptl-rt715-rt711-rt1308-mono.tplg",
124 	},
125 	{
126 		.link_mask = BIT(0),
127 		.links = ptl_rvp,
128 		.drv_name = "sof_sdw",
129 		.sof_tplg_filename = "sof-ptl-rt711.tplg",
130 	},
131 	{
132 		.link_mask = BIT(0),
133 		.links = ptl_rt722_only,
134 		.drv_name = "sof_sdw",
135 		.sof_tplg_filename = "sof-ptl-rt722.tplg",
136 	},
137 	{
138 		.link_mask = BIT(3),
139 		.links = ptl_rt722_l3,
140 		.drv_name = "sof_sdw",
141 		.sof_tplg_filename = "sof-ptl-rt722.tplg",
142 	},
143 	{},
144 };
145 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_ptl_sdw_machines);
146