1 // SPDX-License-Identifier: GPL-2.0-only
2 //
3 // soc-acpi-intel-sdw-mockup-match.c - tables and support for SoundWire
4 // mockup device ACPI enumeration.
5 //
6 // Copyright (c) 2021, Intel Corporation.
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_endpoint sdw_mockup_single_endpoint = {
14 	.num = 0,
15 	.aggregated = 0,
16 	.group_position = 0,
17 	.group_id = 0,
18 };
19 
20 static const struct snd_soc_acpi_endpoint sdw_mockup_l_endpoint = {
21 	.num = 0,
22 	.aggregated = 1,
23 	.group_position = 0,
24 	.group_id = 1,
25 };
26 
27 static const struct snd_soc_acpi_endpoint sdw_mockup_r_endpoint = {
28 	.num = 0,
29 	.aggregated = 1,
30 	.group_position = 1,
31 	.group_id = 1,
32 };
33 
34 static const struct snd_soc_acpi_adr_device sdw_mockup_headset_0_adr[] = {
35 	{
36 		.adr = 0x0000000105AA5500ull,
37 		.num_endpoints = 1,
38 		.endpoints = &sdw_mockup_single_endpoint,
39 		.name_prefix = "sdw_mockup_headset0"
40 	}
41 };
42 
43 static const struct snd_soc_acpi_adr_device sdw_mockup_headset_1_adr[] = {
44 	{
45 		.adr = 0x0001000105AA5500ull,
46 		.num_endpoints = 1,
47 		.endpoints = &sdw_mockup_single_endpoint,
48 		.name_prefix = "sdw_mockup_headset1"
49 	}
50 };
51 
52 static const struct snd_soc_acpi_adr_device sdw_mockup_amp_1_adr[] = {
53 	{
54 		.adr = 0x000100010555AA00ull,
55 		.num_endpoints = 1,
56 		.endpoints = &sdw_mockup_single_endpoint,
57 		.name_prefix = "sdw_mockup_amp1"
58 	}
59 };
60 
61 static const struct snd_soc_acpi_adr_device sdw_mockup_amp_2_adr[] = {
62 	{
63 		.adr = 0x000200010555AA00ull,
64 		.num_endpoints = 1,
65 		.endpoints = &sdw_mockup_single_endpoint,
66 		.name_prefix = "sdw_mockup_amp2"
67 	}
68 };
69 
70 static const struct snd_soc_acpi_adr_device sdw_mockup_mic_0_adr[] = {
71 	{
72 		.adr = 0x0000000105555500ull,
73 		.num_endpoints = 1,
74 		.endpoints = &sdw_mockup_single_endpoint,
75 		.name_prefix = "sdw_mockup_mic0"
76 	}
77 };
78 
79 static const struct snd_soc_acpi_adr_device sdw_mockup_mic_3_adr[] = {
80 	{
81 		.adr = 0x0003000105555500ull,
82 		.num_endpoints = 1,
83 		.endpoints = &sdw_mockup_single_endpoint,
84 		.name_prefix = "sdw_mockup_mic3"
85 	}
86 };
87 
88 static const struct snd_soc_acpi_adr_device sdw_mockup_amp_1_group1_adr[] = {
89 	{
90 		.adr = 0x000100010555AA00ull,
91 		.num_endpoints = 1,
92 		.endpoints = &sdw_mockup_l_endpoint,
93 		.name_prefix = "sdw_mockup_amp1_l"
94 	}
95 };
96 
97 static const struct snd_soc_acpi_adr_device sdw_mockup_amp_2_group1_adr[] = {
98 	{
99 		.adr = 0x000200010555AA00ull,
100 		.num_endpoints = 1,
101 		.endpoints = &sdw_mockup_r_endpoint,
102 		.name_prefix = "sdw_mockup_amp2_r"
103 	}
104 };
105 
106 const struct snd_soc_acpi_link_adr sdw_mockup_headset_1amp_mic[] = {
107 	{
108 		.mask = BIT(0),
109 		.num_adr = ARRAY_SIZE(sdw_mockup_headset_0_adr),
110 		.adr_d = sdw_mockup_headset_0_adr,
111 	},
112 	{
113 		.mask = BIT(1),
114 		.num_adr = ARRAY_SIZE(sdw_mockup_amp_1_adr),
115 		.adr_d = sdw_mockup_amp_1_adr,
116 	},
117 	{
118 		.mask = BIT(3),
119 		.num_adr = ARRAY_SIZE(sdw_mockup_mic_3_adr),
120 		.adr_d = sdw_mockup_mic_3_adr,
121 	},
122 	{}
123 };
124 
125 const struct snd_soc_acpi_link_adr sdw_mockup_headset_2amps_mic[] = {
126 	{
127 		.mask = BIT(0),
128 		.num_adr = ARRAY_SIZE(sdw_mockup_headset_0_adr),
129 		.adr_d = sdw_mockup_headset_0_adr,
130 	},
131 	{
132 		.mask = BIT(1),
133 		.num_adr = ARRAY_SIZE(sdw_mockup_amp_1_group1_adr),
134 		.adr_d = sdw_mockup_amp_1_group1_adr,
135 	},
136 	{
137 		.mask = BIT(2),
138 		.num_adr = ARRAY_SIZE(sdw_mockup_amp_2_group1_adr),
139 		.adr_d = sdw_mockup_amp_2_group1_adr,
140 	},
141 	{
142 		.mask = BIT(3),
143 		.num_adr = ARRAY_SIZE(sdw_mockup_mic_3_adr),
144 		.adr_d = sdw_mockup_mic_3_adr,
145 	},
146 	{}
147 };
148 
149 const struct snd_soc_acpi_link_adr sdw_mockup_mic_headset_1amp[] = {
150 	{
151 		.mask = BIT(1),
152 		.num_adr = ARRAY_SIZE(sdw_mockup_headset_1_adr),
153 		.adr_d = sdw_mockup_headset_1_adr,
154 	},
155 	{
156 		.mask = BIT(2),
157 		.num_adr = ARRAY_SIZE(sdw_mockup_amp_2_adr),
158 		.adr_d = sdw_mockup_amp_2_adr,
159 	},
160 	{
161 		.mask = BIT(0),
162 		.num_adr = ARRAY_SIZE(sdw_mockup_mic_0_adr),
163 		.adr_d = sdw_mockup_mic_0_adr,
164 	},
165 	{}
166 };
167