Skip to content

Commit 7bb6fca

Browse files
plbossartbardliao
authored andcommitted
ASoC: Intel: 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: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
1 parent 473b51f commit 7bb6fca

5 files changed

Lines changed: 115 additions & 0 deletions

File tree

sound/soc/intel/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,14 @@ if SND_SOC_INTEL_SST_TOPLEVEL || SND_SOC_SOF_INTEL_TOPLEVEL
7474
config SND_SOC_ACPI_INTEL_MATCH
7575
tristate
7676
select SND_SOC_ACPI if ACPI
77+
select SND_SOC_ACPI_INTEL_SDCA_QUIRKS
7778
# this option controls the compilation of ACPI matching tables and
7879
# helpers and is not meant to be selected by the user.
7980

81+
config SND_SOC_ACPI_INTEL_SDCA_QUIRKS
82+
tristate
83+
imply SND_SOC_SDCA
84+
8085
endif ## SND_SOC_INTEL_SST_TOPLEVEL || SND_SOC_SOF_INTEL_TOPLEVEL
8186

8287
config SND_SOC_INTEL_KEEMBAY

sound/soc/intel/common/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,8 @@ snd-soc-acpi-intel-match-y := soc-acpi-intel-byt-match.o soc-acpi-intel-cht-matc
1818

1919
snd-soc-acpi-intel-match-y += soc-acpi-intel-ssp-common.o
2020

21+
snd-soc-acpi-intel-sdca-quirks-y += soc-acpi-intel-sdca-quirks.o
22+
2123
obj-$(CONFIG_SND_SOC_INTEL_SST) += snd-soc-sst-dsp.o snd-soc-sst-ipc.o
2224
obj-$(CONFIG_SND_SOC_ACPI_INTEL_MATCH) += snd-soc-acpi-intel-match.o
25+
obj-$(CONFIG_SND_SOC_ACPI_INTEL_SDCA_QUIRKS) += snd-soc-acpi-intel-sdca-quirks.o

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

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
*
77
*/
88

9+
#include <linux/soundwire/sdw_intel.h>
10+
#include <sound/sdca.h>
911
#include <sound/soc-acpi.h>
1012
#include <sound/soc-acpi-intel-match.h>
1113
#include <sound/soc-acpi-intel-ssp-common.h>
14+
#include "soc-acpi-intel-sdca-quirks.h"
1215
#include "soc-acpi-intel-sdw-mockup-match.h"
1316

1417
static const struct snd_soc_acpi_codecs mtl_rt5682_rt5682s_hp = {
@@ -133,6 +136,27 @@ static const struct snd_soc_acpi_endpoint rt712_endpoints[] = {
133136
},
134137
};
135138

139+
static const struct snd_soc_acpi_endpoint rt712_vb_endpoints[] = {
140+
{
141+
.num = 0,
142+
.aggregated = 0,
143+
.group_position = 0,
144+
.group_id = 0,
145+
},
146+
{
147+
.num = 1,
148+
.aggregated = 0,
149+
.group_position = 0,
150+
.group_id = 0,
151+
},
152+
{
153+
.num = 2,
154+
.aggregated = 0,
155+
.group_position = 0,
156+
.group_id = 0,
157+
},
158+
};
159+
136160
/*
137161
* RT722 is a multi-function codec, three endpoints are created for
138162
* its headset, amp and dmic functions.
@@ -190,6 +214,15 @@ static const struct snd_soc_acpi_adr_device rt712_0_single_adr[] = {
190214
}
191215
};
192216

217+
static const struct snd_soc_acpi_adr_device rt712_vb_0_single_adr[] = {
218+
{
219+
.adr = 0x000030025D071201ull,
220+
.num_endpoints = ARRAY_SIZE(rt712_vb_endpoints),
221+
.endpoints = rt712_vb_endpoints,
222+
.name_prefix = "rt712"
223+
}
224+
};
225+
193226
static const struct snd_soc_acpi_adr_device rt1712_3_single_adr[] = {
194227
{
195228
.adr = 0x000330025D171201ull,
@@ -363,6 +396,15 @@ static const struct snd_soc_acpi_link_adr mtl_712_l0[] = {
363396
{}
364397
};
365398

399+
static const struct snd_soc_acpi_link_adr mtl_712_vb_l0[] = {
400+
{
401+
.mask = BIT(0),
402+
.num_adr = ARRAY_SIZE(rt712_vb_0_single_adr),
403+
.adr_d = rt712_vb_0_single_adr,
404+
},
405+
{}
406+
};
407+
366408
static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = {
367409
{ /* Jack Playback Endpoint */
368410
.num = 0,
@@ -774,6 +816,13 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = {
774816
.drv_name = "sof_sdw",
775817
.sof_tplg_filename = "sof-mtl-rt712-l0-rt1712-l3.tplg",
776818
},
819+
{
820+
.link_mask = BIT(0),
821+
.links = mtl_712_vb_l0,
822+
.drv_name = "sof_sdw",
823+
.machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb,
824+
.sof_tplg_filename = "sof-mtl-rt712-vb-l0.tplg",
825+
},
777826
{
778827
.link_mask = BIT(0),
779828
.links = mtl_712_l0,
@@ -843,3 +892,5 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = {
843892
{},
844893
};
845894
EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_mtl_sdw_machines);
895+
896+
MODULE_IMPORT_NS(SND_SOC_ACPI_INTEL_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-intel-sdca-quirks.c - tables and support for SDCA quirks
4+
*
5+
* Copyright (c) 2024, Intel Corporation.
6+
*
7+
*/
8+
9+
#include <linux/soundwire/sdw_intel.h>
10+
#include <sound/sdca.h>
11+
#include <sound/soc-acpi.h>
12+
#include "soc-acpi-intel-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_intel_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_intel_sdca_is_device_rt712_vb(void *arg)
23+
{
24+
struct sdw_intel_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_intel_sdca_is_device_rt712_vb, SND_SOC_ACPI_INTEL_SDCA_QUIRKS);
39+
40+
MODULE_DESCRIPTION("ASoC ACPI Intel 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-intel-sdca-quirks.h - tables and support for SDCA quirks
4+
*
5+
* Copyright (c) 2024, Intel Corporation.
6+
*
7+
*/
8+
9+
#ifndef _SND_SOC_ACPI_INTEL_SDCA_QUIRKS
10+
#define _SND_SOC_ACPI_INTEL_SDCA_QUIRKS
11+
12+
bool snd_soc_acpi_intel_sdca_is_device_rt712_vb(void *arg);
13+
14+
#endif

0 commit comments

Comments
 (0)