Skip to content

Commit 76d87a5

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 76d87a5

File tree

5 files changed

+114
-0
lines changed

5 files changed

+114
-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: 50 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,39 @@ 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_amp_g1_dmic_endpoints[] = {
49+
/* Jack Endpoint */
50+
{
51+
.num = 0,
52+
.aggregated = 0,
53+
.group_position = 0,
54+
.group_id = 0,
55+
},
56+
/* Amp Endpoint, work as spk_l_endpoint */
57+
{
58+
.num = 1,
59+
.aggregated = 1,
60+
.group_position = 0,
61+
.group_id = 1,
62+
},
63+
/* DMIC Endpoint */
64+
{
65+
.num = 2,
66+
.aggregated = 0,
67+
.group_position = 0,
68+
.group_id = 0,
69+
},
70+
};
71+
72+
static const struct snd_soc_acpi_adr_device rt712_vb_1_group1_adr[] = {
73+
{
74+
.adr = 0x000130025D071201ull,
75+
.num_endpoints = ARRAY_SIZE(jack_amp_g1_dmic_endpoints),
76+
.endpoints = jack_amp_g1_dmic_endpoints,
77+
.name_prefix = "rt712"
78+
}
79+
};
80+
4781
static const struct snd_soc_acpi_adr_device rt711_rt1316_group_adr[] = {
4882
{
4983
.adr = 0x000030025D071101ull,
@@ -254,6 +288,15 @@ static const struct snd_soc_acpi_link_adr acp70_cs35l56x4_l1[] = {
254288
{}
255289
};
256290

291+
static const struct snd_soc_acpi_link_adr acp70_alc712_vb_l1[] = {
292+
{
293+
.mask = BIT(1),
294+
.num_adr = ARRAY_SIZE(rt712_vb_1_group1_adr),
295+
.adr_d = rt712_vb_1_group1_adr,
296+
},
297+
{}
298+
};
299+
257300
static const struct snd_soc_acpi_link_adr acp70_rt722_only[] = {
258301
{
259302
.mask = BIT(0),
@@ -308,6 +351,12 @@ struct snd_soc_acpi_mach snd_soc_acpi_amd_acp70_sdw_machines[] = {
308351
.links = acp70_cs35l56x4_l1,
309352
.drv_name = "amd_sdw",
310353
},
354+
{
355+
.link_mask = BIT(1),
356+
.links = acp70_alc712_vb_l1,
357+
.machine_check = snd_soc_acpi_amd_sdca_is_device_rt712_vb,
358+
.drv_name = "amd_sdw",
359+
},
311360
{},
312361
};
313362
EXPORT_SYMBOL(snd_soc_acpi_amd_acp70_sdw_machines);
@@ -327,3 +376,4 @@ EXPORT_SYMBOL(snd_soc_acpi_amd_acp70_sof_sdw_machines);
327376
MODULE_DESCRIPTION("AMD ACP7.0 & ACP7.1 tables and support for ACPI enumeration");
328377
MODULE_LICENSE("GPL");
329378
MODULE_AUTHOR("Vijendar.Mukunda@amd.com");
379+
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)