Skip to content

Commit

Permalink
ASoC: Intel: soc-acpi: add is_device_rt712_vb() helper
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
plbossart authored and bardliao committed Oct 15, 2024
1 parent 473b51f commit 7bb6fca
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sound/soc/intel/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,14 @@ if SND_SOC_INTEL_SST_TOPLEVEL || SND_SOC_SOF_INTEL_TOPLEVEL
config SND_SOC_ACPI_INTEL_MATCH
tristate
select SND_SOC_ACPI if ACPI
select SND_SOC_ACPI_INTEL_SDCA_QUIRKS
# this option controls the compilation of ACPI matching tables and
# helpers and is not meant to be selected by the user.

config SND_SOC_ACPI_INTEL_SDCA_QUIRKS
tristate
imply SND_SOC_SDCA

endif ## SND_SOC_INTEL_SST_TOPLEVEL || SND_SOC_SOF_INTEL_TOPLEVEL

config SND_SOC_INTEL_KEEMBAY
Expand Down
3 changes: 3 additions & 0 deletions sound/soc/intel/common/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@ snd-soc-acpi-intel-match-y := soc-acpi-intel-byt-match.o soc-acpi-intel-cht-matc

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

snd-soc-acpi-intel-sdca-quirks-y += soc-acpi-intel-sdca-quirks.o

obj-$(CONFIG_SND_SOC_INTEL_SST) += snd-soc-sst-dsp.o snd-soc-sst-ipc.o
obj-$(CONFIG_SND_SOC_ACPI_INTEL_MATCH) += snd-soc-acpi-intel-match.o
obj-$(CONFIG_SND_SOC_ACPI_INTEL_SDCA_QUIRKS) += snd-soc-acpi-intel-sdca-quirks.o
51 changes: 51 additions & 0 deletions sound/soc/intel/common/soc-acpi-intel-mtl-match.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
*
*/

#include <linux/soundwire/sdw_intel.h>
#include <sound/sdca.h>
#include <sound/soc-acpi.h>
#include <sound/soc-acpi-intel-match.h>
#include <sound/soc-acpi-intel-ssp-common.h>
#include "soc-acpi-intel-sdca-quirks.h"
#include "soc-acpi-intel-sdw-mockup-match.h"

static const struct snd_soc_acpi_codecs mtl_rt5682_rt5682s_hp = {
Expand Down Expand Up @@ -133,6 +136,27 @@ static const struct snd_soc_acpi_endpoint rt712_endpoints[] = {
},
};

static const struct snd_soc_acpi_endpoint rt712_vb_endpoints[] = {
{
.num = 0,
.aggregated = 0,
.group_position = 0,
.group_id = 0,
},
{
.num = 1,
.aggregated = 0,
.group_position = 0,
.group_id = 0,
},
{
.num = 2,
.aggregated = 0,
.group_position = 0,
.group_id = 0,
},
};

/*
* RT722 is a multi-function codec, three endpoints are created for
* its headset, amp and dmic functions.
Expand Down Expand Up @@ -190,6 +214,15 @@ static const struct snd_soc_acpi_adr_device rt712_0_single_adr[] = {
}
};

static const struct snd_soc_acpi_adr_device rt712_vb_0_single_adr[] = {
{
.adr = 0x000030025D071201ull,
.num_endpoints = ARRAY_SIZE(rt712_vb_endpoints),
.endpoints = rt712_vb_endpoints,
.name_prefix = "rt712"
}
};

static const struct snd_soc_acpi_adr_device rt1712_3_single_adr[] = {
{
.adr = 0x000330025D171201ull,
Expand Down Expand Up @@ -363,6 +396,15 @@ static const struct snd_soc_acpi_link_adr mtl_712_l0[] = {
{}
};

static const struct snd_soc_acpi_link_adr mtl_712_vb_l0[] = {
{
.mask = BIT(0),
.num_adr = ARRAY_SIZE(rt712_vb_0_single_adr),
.adr_d = rt712_vb_0_single_adr,
},
{}
};

static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = {
{ /* Jack Playback Endpoint */
.num = 0,
Expand Down Expand Up @@ -774,6 +816,13 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = {
.drv_name = "sof_sdw",
.sof_tplg_filename = "sof-mtl-rt712-l0-rt1712-l3.tplg",
},
{
.link_mask = BIT(0),
.links = mtl_712_vb_l0,
.drv_name = "sof_sdw",
.machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb,
.sof_tplg_filename = "sof-mtl-rt712-vb-l0.tplg",
},
{
.link_mask = BIT(0),
.links = mtl_712_l0,
Expand Down Expand Up @@ -843,3 +892,5 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = {
{},
};
EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_mtl_sdw_machines);

MODULE_IMPORT_NS(SND_SOC_ACPI_INTEL_SDCA_QUIRKS);
42 changes: 42 additions & 0 deletions sound/soc/intel/common/soc-acpi-intel-sdca-quirks.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* soc-acpi-intel-sdca-quirks.c - tables and support for SDCA quirks
*
* Copyright (c) 2024, Intel Corporation.
*
*/

#include <linux/soundwire/sdw_intel.h>
#include <sound/sdca.h>
#include <sound/soc-acpi.h>
#include "soc-acpi-intel-sdca-quirks.h"

/*
* Pretend machine quirk. The argument type is not the traditional
* 'struct snd_soc_acpi_mach' pointer but instead the sdw_intel_ctx
* which contains the peripheral information required for the
* SoundWire/SDCA filter on the SMART_MIC setup and interface
* revision. When the return value is false, the entry in the
* 'snd_soc_acpi_mach' table needs to be skipped.
*/
bool snd_soc_acpi_intel_sdca_is_device_rt712_vb(void *arg)
{
struct sdw_intel_ctx *ctx = arg;
int i;

if (!ctx)
return false;

for (i = 0; i < ctx->peripherals->num_peripherals; i++) {
if (sdca_device_quirk_match(ctx->peripherals->array[i],
SDCA_QUIRKS_RT712_VB))
return true;
}

return false;
}
EXPORT_SYMBOL_NS(snd_soc_acpi_intel_sdca_is_device_rt712_vb, SND_SOC_ACPI_INTEL_SDCA_QUIRKS);

MODULE_DESCRIPTION("ASoC ACPI Intel SDCA quirks");
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(SND_SOC_SDCA);
14 changes: 14 additions & 0 deletions sound/soc/intel/common/soc-acpi-intel-sdca-quirks.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* soc-acpi-intel-sdca-quirks.h - tables and support for SDCA quirks
*
* Copyright (c) 2024, Intel Corporation.
*
*/

#ifndef _SND_SOC_ACPI_INTEL_SDCA_QUIRKS
#define _SND_SOC_ACPI_INTEL_SDCA_QUIRKS

bool snd_soc_acpi_intel_sdca_is_device_rt712_vb(void *arg);

#endif

0 comments on commit 7bb6fca

Please sign in to comment.