Skip to content

Commit 7f053f5

Browse files
ASoC: amd: acp: soc-acpi: add is_device_rt712_vb() helper
Add a filter to skip the RT172 VB configuration if a SmartMic Function is not found in the SDCA descriptors. If the ACPI information is incorrect this can only be quirked further with DMI information. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
1 parent e00fe14 commit 7f053f5

File tree

5 files changed

+131
-0
lines changed

5 files changed

+131
-0
lines changed

sound/soc/amd/acp/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@ config SND_SOC_AMD_ACP_COMMON
1515

1616
config SND_SOC_ACPI_AMD_MATCH
1717
tristate
18+
select SND_SOC_ACPI_AMD_SDCA_QUIRKS
1819
select SND_SOC_ACPI if ACPI
1920

21+
config SND_SOC_ACPI_AMD_SDCA_QUIRKS
22+
tristate
23+
depends on ACPI
24+
depends on SND_SOC_SDCA
25+
2026
if SND_SOC_AMD_ACP_COMMON
2127

2228
config SND_SOC_AMD_ACP_PDM

sound/soc/amd/acp/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ snd-soc-acpi-amd-match-y := amd-acp63-acpi-match.o amd-acp70-acpi-match.o
2727
snd-acp-sdw-mach-y := acp-sdw-mach-common.o
2828
snd-acp-sdw-sof-mach-y += acp-sdw-sof-mach.o
2929
snd-acp-sdw-legacy-mach-y += acp-sdw-legacy-mach.o
30+
snd-soc-acpi-amd-sdca-quirks-y += soc-acpi-amd-sdca-quirks.o
3031

3132
obj-$(CONFIG_SND_SOC_AMD_ACP_PCM) += snd-acp-pcm.o
3233
obj-$(CONFIG_SND_SOC_AMD_ACP_I2S) += snd-acp-i2s.o
@@ -40,6 +41,7 @@ obj-$(CONFIG_SND_AMD_ASOC_REMBRANDT) += snd-acp-rembrandt.o
4041
obj-$(CONFIG_SND_AMD_ASOC_ACP63) += snd-acp63.o
4142
obj-$(CONFIG_SND_AMD_ASOC_ACP70) += snd-acp70.o
4243

44+
obj-$(CONFIG_SND_SOC_ACPI_AMD_SDCA_QUIRKS) += snd-soc-acpi-amd-sdca-quirks.o
4345
obj-$(CONFIG_SND_AMD_SOUNDWIRE_ACPI) += snd-amd-sdw-acpi.o
4446
obj-$(CONFIG_SND_SOC_AMD_MACH_COMMON) += snd-acp-mach.o
4547
obj-$(CONFIG_SND_SOC_AMD_LEGACY_MACH) += snd-acp-legacy-mach.o

sound/soc/amd/acp/amd-acp70-acpi-match.c

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88

99
#include <sound/soc-acpi.h>
10+
#include "soc-acpi-amd-sdca-quirks.h"
1011
#include "../mach-config.h"
1112

1213
static const struct snd_soc_acpi_endpoint single_endpoint = {
@@ -44,6 +45,56 @@ static const struct snd_soc_acpi_endpoint spk_3_endpoint = {
4445
.group_id = 1
4546
};
4647

48+
static const struct snd_soc_acpi_endpoint jack_dmic_endpoints[] = {
49+
/* Jack Endpoint */
50+
{
51+
.num = 0,
52+
.aggregated = 0,
53+
.group_position = 0,
54+
.group_id = 0,
55+
},
56+
/* DMIC Endpoint */
57+
{
58+
.num = 1,
59+
.aggregated = 0,
60+
.group_position = 0,
61+
.group_id = 0,
62+
},
63+
};
64+
65+
static const struct snd_soc_acpi_endpoint jack_amp_g1_dmic_endpoints[] = {
66+
/* Jack Endpoint */
67+
{
68+
.num = 0,
69+
.aggregated = 0,
70+
.group_position = 0,
71+
.group_id = 0,
72+
},
73+
/* Amp Endpoint, work as spk_l_endpoint */
74+
{
75+
.num = 1,
76+
.aggregated = 1,
77+
.group_position = 0,
78+
.group_id = 1,
79+
},
80+
/* DMIC Endpoint */
81+
{
82+
.num = 2,
83+
.aggregated = 0,
84+
.group_position = 0,
85+
.group_id = 0,
86+
},
87+
};
88+
89+
static const struct snd_soc_acpi_adr_device rt712_vb_1_group1_adr[] = {
90+
{
91+
.adr = 0x000130025D071201ull,
92+
.num_endpoints = ARRAY_SIZE(jack_amp_g1_dmic_endpoints),
93+
.endpoints = jack_amp_g1_dmic_endpoints,
94+
.name_prefix = "rt712"
95+
}
96+
};
97+
4798
static const struct snd_soc_acpi_adr_device rt711_rt1316_group_adr[] = {
4899
{
49100
.adr = 0x000030025D071101ull,
@@ -254,6 +305,15 @@ static const struct snd_soc_acpi_link_adr acp70_cs35l56x4_l1[] = {
254305
{}
255306
};
256307

308+
static const struct snd_soc_acpi_link_adr acp70_alc712_vb_l1[] = {
309+
{
310+
.mask = BIT(1),
311+
.num_adr = ARRAY_SIZE(rt712_vb_1_group1_adr),
312+
.adr_d = rt712_vb_1_group1_adr,
313+
},
314+
{}
315+
};
316+
257317
static const struct snd_soc_acpi_link_adr acp70_rt722_only[] = {
258318
{
259319
.mask = BIT(0),
@@ -308,6 +368,12 @@ struct snd_soc_acpi_mach snd_soc_acpi_amd_acp70_sdw_machines[] = {
308368
.links = acp70_cs35l56x4_l1,
309369
.drv_name = "amd_sdw",
310370
},
371+
{
372+
.link_mask = BIT(1),
373+
.links = acp70_alc712_vb_l1,
374+
.machine_check = snd_soc_acpi_amd_sdca_is_device_rt712_vb,
375+
.drv_name = "amd_sdw",
376+
},
311377
{},
312378
};
313379
EXPORT_SYMBOL(snd_soc_acpi_amd_acp70_sdw_machines);
@@ -327,3 +393,4 @@ EXPORT_SYMBOL(snd_soc_acpi_amd_acp70_sof_sdw_machines);
327393
MODULE_DESCRIPTION("AMD ACP7.0 & ACP7.1 tables and support for ACPI enumeration");
328394
MODULE_LICENSE("GPL");
329395
MODULE_AUTHOR("Vijendar.Mukunda@amd.com");
396+
MODULE_IMPORT_NS("SND_SOC_ACPI_AMD_SDCA_QUIRKS");
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
/*
3+
* soc-acpi-amd-sdca-quirks.c - tables and support for SDCA quirks
4+
*
5+
* Copyright(c) 2025 Advanced Micro Devices, Inc. All rights reserved.
6+
*
7+
*/
8+
9+
#include <linux/soundwire/sdw_amd.h>
10+
#include <sound/sdca.h>
11+
#include <sound/soc-acpi.h>
12+
#include "soc-acpi-amd-sdca-quirks.h"
13+
14+
/*
15+
* Pretend machine quirk. The argument type is not the traditional
16+
* 'struct snd_soc_acpi_mach' pointer but instead the sdw_amd_ctx
17+
* which contains the peripheral information required for the
18+
* SoundWire/SDCA filter on the SMART_MIC setup and interface
19+
* revision. When the return value is false, the entry in the
20+
* 'snd_soc_acpi_mach' table needs to be skipped.
21+
*/
22+
bool snd_soc_acpi_amd_sdca_is_device_rt712_vb(void *arg)
23+
{
24+
struct sdw_amd_ctx *ctx = arg;
25+
int i;
26+
27+
if (!ctx)
28+
return false;
29+
30+
for (i = 0; i < ctx->peripherals->num_peripherals; i++) {
31+
if (sdca_device_quirk_match(ctx->peripherals->array[i],
32+
SDCA_QUIRKS_RT712_VB))
33+
return true;
34+
}
35+
36+
return false;
37+
}
38+
EXPORT_SYMBOL_NS(snd_soc_acpi_amd_sdca_is_device_rt712_vb, "SND_SOC_ACPI_AMD_SDCA_QUIRKS");
39+
40+
MODULE_DESCRIPTION("ASoC ACPI AMD SDCA quirks");
41+
MODULE_LICENSE("GPL");
42+
MODULE_IMPORT_NS("SND_SOC_SDCA");
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
/*
3+
* soc-acpi-amd-sdca-quirks.h - tables and support for SDCA quirks
4+
*
5+
* Copyright(c) 2025 Advanced Micro Devices, Inc. All rights reserved.
6+
*
7+
*/
8+
9+
#ifndef _SND_SOC_ACPI_AMD_SDCA_QUIRKS
10+
#define _SND_SOC_ACPI_AMD_SDCA_QUIRKS
11+
12+
bool snd_soc_acpi_amd_sdca_is_device_rt712_vb(void *arg);
13+
14+
#endif

0 commit comments

Comments
 (0)