diff options
author | Mark Brown <broonie@kernel.org> | 2024-10-18 21:01:45 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2024-10-18 21:01:45 +0100 |
commit | 478fc2f4212e1dc1c247f3bff6856146305850df (patch) | |
tree | 7343964f57ddd0b1f011d0b0a26ab46812fc229e /sound/soc/intel | |
parent | 42fb51612f8298d24232b1ac2cf7ce303d4cfc7e (diff) | |
parent | e92edcf8023d425c7abcf1d7abb5dcac53d106f5 (diff) |
ASoC/soundwire: add initial support for SDCA
Merge series from Bard Liao <yung-chuan.liao@linux.intel.com>:
We need to get rt712 version by reading SDCA version and functions.
This patch series adds initial support for SDCA and add a helper to tell
if the codec is RT712_VB.
This series may go via the ASoC tree with Vinod's Acked-by tag.
Bard Liao (1):
soundwire: sdw_intel: include linux/acpi.h
Pierre-Louis Bossart (10):
ASoC/soundwire: remove sdw_slave_extended_id
ASoC: SDCA: add initial module
soundwire: slave: lookup SDCA version and functions
ASoC: SDCA: add quirk function for RT712_VB match
ASoC: rt712-sdca: detect the SMART_MIC function during the probe stage
ASoC: soc-acpi: introduce new 'machine check' callback
ASoC: sdw_utils: add SmartMic DAI for RT712 VB
ASoC: sdw_utils: add SmartMic DAI for RT713 VB
ASoC: Intel: soc-acpi: add is_device_rt712_vb() helper
ASoC: SOF: Intel: hda: use machine_check() for SoundWire
drivers/soundwire/Kconfig | 1 +
drivers/soundwire/amd_init.c | 12 +-
drivers/soundwire/intel_init.c | 13 +-
drivers/soundwire/slave.c | 14 ++
include/linux/soundwire/sdw.h | 9 +-
include/linux/soundwire/sdw_amd.h | 7 +-
include/linux/soundwire/sdw_intel.h | 8 +-
include/sound/sdca.h | 62 +++++++
include/sound/sdca_function.h | 55 ++++++
include/sound/soc-acpi.h | 8 +-
sound/soc/Kconfig | 1 +
sound/soc/Makefile | 1 +
sound/soc/amd/ps/pci-ps.c | 3 +-
sound/soc/codecs/rt712-sdca-sdw.c | 1 +
sound/soc/codecs/rt712-sdca.c | 38 +++-
sound/soc/codecs/rt712-sdca.h | 1 +
sound/soc/intel/Kconfig | 5 +
sound/soc/intel/common/Makefile | 3 +
.../intel/common/soc-acpi-intel-mtl-match.c | 51 ++++++
.../intel/common/soc-acpi-intel-sdca-quirks.c | 42 +++++
.../intel/common/soc-acpi-intel-sdca-quirks.h | 14 ++
sound/soc/sdca/Kconfig | 11 ++
sound/soc/sdca/Makefile | 5 +
sound/soc/sdca/sdca_device.c | 67 +++++++
sound/soc/sdca/sdca_functions.c | 173 ++++++++++++++++++
sound/soc/sdw_utils/soc_sdw_utils.c | 18 +-
sound/soc/soc-acpi.c | 30 +--
sound/soc/sof/amd/acp-common.c | 3 +-
sound/soc/sof/intel/hda.c | 19 +-
29 files changed, 610 insertions(+), 65 deletions(-)
create mode 100644 include/sound/sdca.h
create mode 100644 include/sound/sdca_function.h
create mode 100644 sound/soc/intel/common/soc-acpi-intel-sdca-quirks.c
create mode 100644 sound/soc/intel/common/soc-acpi-intel-sdca-quirks.h
create mode 100644 sound/soc/sdca/Kconfig
create mode 100644 sound/soc/sdca/Makefile
create mode 100644 sound/soc/sdca/sdca_device.c
create mode 100644 sound/soc/sdca/sdca_functions.c
--
2.43.0
Diffstat (limited to 'sound/soc/intel')
-rw-r--r-- | sound/soc/intel/Kconfig | 5 | ||||
-rw-r--r-- | sound/soc/intel/common/Makefile | 3 | ||||
-rw-r--r-- | sound/soc/intel/common/soc-acpi-intel-mtl-match.c | 51 | ||||
-rw-r--r-- | sound/soc/intel/common/soc-acpi-intel-sdca-quirks.c | 42 | ||||
-rw-r--r-- | sound/soc/intel/common/soc-acpi-intel-sdca-quirks.h | 14 |
5 files changed, 115 insertions, 0 deletions
diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig index 5bb7047c170f..14461dee3e52 100644 --- a/sound/soc/intel/Kconfig +++ b/sound/soc/intel/Kconfig @@ -71,9 +71,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 diff --git a/sound/soc/intel/common/Makefile b/sound/soc/intel/common/Makefile index da551144ec0f..0afd114be9e5 100644 --- a/sound/soc/intel/common/Makefile +++ b/sound/soc/intel/common/Makefile @@ -16,4 +16,7 @@ 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_ACPI_INTEL_MATCH) += snd-soc-acpi-intel-match.o +obj-$(CONFIG_SND_SOC_ACPI_INTEL_SDCA_QUIRKS) += snd-soc-acpi-intel-sdca-quirks.o diff --git a/sound/soc/intel/common/soc-acpi-intel-mtl-match.c b/sound/soc/intel/common/soc-acpi-intel-mtl-match.c index fd02c864e25e..0b37465b6c53 100644 --- a/sound/soc/intel/common/soc-acpi-intel-mtl-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-mtl-match.c @@ -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 = { @@ -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. @@ -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, @@ -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, @@ -776,6 +818,13 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = { }, { .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, .drv_name = "sof_sdw", .sof_tplg_filename = "sof-mtl-rt712-l0.tplg", @@ -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); diff --git a/sound/soc/intel/common/soc-acpi-intel-sdca-quirks.c b/sound/soc/intel/common/soc-acpi-intel-sdca-quirks.c new file mode 100644 index 000000000000..0b7076606d66 --- /dev/null +++ b/sound/soc/intel/common/soc-acpi-intel-sdca-quirks.c @@ -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); diff --git a/sound/soc/intel/common/soc-acpi-intel-sdca-quirks.h b/sound/soc/intel/common/soc-acpi-intel-sdca-quirks.h new file mode 100644 index 000000000000..bead5ec6243f --- /dev/null +++ b/sound/soc/intel/common/soc-acpi-intel-sdca-quirks.h @@ -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 |