Skip to content

Commit 2694cda

Browse files
plbossartbroonie
authored andcommitted
ASoC: soc-acpi: cnl: add table for SoundWire mockup devices
Add support for two configurations with SoundWire mockup devices that emulate the two CometLake configurations with one and two amps. This patch helps test the SOF firmware on an UpExtreme board without any hardware connected, e.g. by doing a loopback of the playback stream on capture streams. The mapping of the partIDs is as follows: 0xAAAA: generic full-duplex codec (not currently used) 0xAA55: headset codec (mock-up of RT711/RT5682) - full-duplex 0x55AA: amplifier (mock-up of RT1308/RT1316/Maxim 98373) - playback with IV sense feedback 0x5555: mic codec (mock-up of RT715) - capture-only The tables are added in a separate file to allow for mockup codecs to be added on other platforms, but the mapping to specific topologies remains platform-specific. Signed-off-by: Pierre-Louis Bossart <[email protected]> Reviewed-by: Rander Wang <[email protected]> Signed-off-by: Bard Liao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 81d3d3d commit 2694cda

File tree

4 files changed

+200
-1
lines changed

4 files changed

+200
-1
lines changed

sound/soc/intel/common/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ snd-soc-acpi-intel-match-objs := soc-acpi-intel-byt-match.o soc-acpi-intel-cht-m
99
soc-acpi-intel-cml-match.o soc-acpi-intel-icl-match.o \
1010
soc-acpi-intel-tgl-match.o soc-acpi-intel-ehl-match.o \
1111
soc-acpi-intel-jsl-match.o soc-acpi-intel-adl-match.o \
12-
soc-acpi-intel-hda-match.o
12+
soc-acpi-intel-hda-match.o \
13+
soc-acpi-intel-sdw-mockup-match.o
1314

1415
obj-$(CONFIG_SND_SOC_INTEL_SST) += snd-soc-sst-dsp.o snd-soc-sst-ipc.o
1516
obj-$(CONFIG_SND_SOC_ACPI_INTEL_MATCH) += snd-soc-acpi-intel-match.o

sound/soc/intel/common/soc-acpi-intel-cnl-match.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <sound/soc-acpi.h>
1010
#include <sound/soc-acpi-intel-match.h>
1111
#include "../skylake/skl.h"
12+
#include "soc-acpi-intel-sdw-mockup-match.h"
1213

1314
static struct skl_machine_pdata cnl_pdata = {
1415
.use_tplg_pcm = true,
@@ -60,6 +61,20 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_sdw_machines[] = {
6061
.sof_fw_filename = "sof-cnl.ri",
6162
.sof_tplg_filename = "sof-cnl-rt5682-sdw2.tplg"
6263
},
64+
{
65+
.link_mask = GENMASK(3, 0),
66+
.links = sdw_mockup_headset_2amps_mic,
67+
.drv_name = "sof_sdw",
68+
.sof_fw_filename = "sof-cnl.ri",
69+
.sof_tplg_filename = "sof-cml-rt711-rt1308-rt715.tplg",
70+
},
71+
{
72+
.link_mask = BIT(0) | BIT(1) | BIT(3),
73+
.links = sdw_mockup_headset_1amp_mic,
74+
.drv_name = "sof_sdw",
75+
.sof_fw_filename = "sof-cnl.ri",
76+
.sof_tplg_filename = "sof-cml-rt711-rt1308-mono-rt715.tplg",
77+
},
6378
{}
6479
};
6580
EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cnl_sdw_machines);
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
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+
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
/*
3+
* soc-acpi-intel-sdw-mockup-match.h - tables and support for SoundWire
4+
* mockup device ACPI enumeration.
5+
*
6+
* Copyright (c) 2021, Intel Corporation.
7+
*
8+
*/
9+
10+
#ifndef _SND_SOC_ACPI_INTEL_SDW_MOCKUP_MATCH
11+
#define _SND_SOC_ACPI_INTEL_SDW_MOCKUP_MATCH
12+
13+
extern const struct snd_soc_acpi_link_adr sdw_mockup_headset_1amp_mic[];
14+
extern const struct snd_soc_acpi_link_adr sdw_mockup_headset_2amps_mic[];
15+
extern const struct snd_soc_acpi_link_adr sdw_mockup_mic_headset_1amp[];
16+
17+
#endif

0 commit comments

Comments
 (0)