summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2024-04-22 09:55:47 +0900
committerMark Brown <broonie@kernel.org>2024-04-22 09:55:47 +0900
commitd3f36e78d7ba0ed3e8f518c62c4663650bf6cd6a (patch)
treecb39298e821b1a0019059ad96cd5497ea35911a5 /sound
parent27a153e0ec88bb64cb2199c55826624c42f6c6b9 (diff)
parentf5d20b253d1a51aadb8881d899caaaa989217e89 (diff)
downloadlinux-stable-d3f36e78d7ba0ed3e8f518c62c4663650bf6cd6a.tar.gz
linux-stable-d3f36e78d7ba0ed3e8f518c62c4663650bf6cd6a.tar.bz2
linux-stable-d3f36e78d7ba0ed3e8f518c62c4663650bf6cd6a.zip
ASoC: Intel: avs: Switch to acpi-nhlt
Merge series from Cezary Rojewski <cezary.rojewski@intel.com>: The change is based on rafael/acpi-nhlt [1] immutable branch which Rafael kindly prepared for me. Without the topmost changes to ACPI/NHLT, the patches present will fail to compile. Recent changes for the ACPI tree [2] refactored interfaces of the NHLT table. Currently we have two implementations - one found in acpi subsystem (unused) and one in sound/hda/. As NHLT is part of ACPI, idea is to make the former useful and then switch all users of existing sound/hda/intel-nhlt.c to this new interface over time and remove the duplicate afterward. [1]: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/?h=acpi-nhlt [2]: https://lore.kernel.org/linux-acpi/20240319083018.3159716-1-cezary.rojewski@intel.com/
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/intel/Kconfig1
-rw-r--r--sound/soc/intel/avs/avs.h1
-rw-r--r--sound/soc/intel/avs/board_selection.c7
-rw-r--r--sound/soc/intel/avs/core.c10
-rw-r--r--sound/soc/intel/avs/path.c32
5 files changed, 24 insertions, 27 deletions
diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig
index 4b9e498e3303..38b61dfd1487 100644
--- a/sound/soc/intel/Kconfig
+++ b/sound/soc/intel/Kconfig
@@ -214,6 +214,7 @@ config SND_SOC_INTEL_AVS
depends on X86 || COMPILE_TEST
depends on PCI
depends on COMMON_CLK
+ select ACPI_NHLT if ACPI
select SND_SOC_ACPI if ACPI
select SND_SOC_TOPOLOGY
select SND_SOC_HDA
diff --git a/sound/soc/intel/avs/avs.h b/sound/soc/intel/avs/avs.h
index c905ecd0a108..101b1902a715 100644
--- a/sound/soc/intel/avs/avs.h
+++ b/sound/soc/intel/avs/avs.h
@@ -150,7 +150,6 @@ struct avs_dev {
struct completion fw_ready;
struct work_struct probe_work;
- struct nhlt_acpi_table *nhlt;
struct list_head comp_list;
struct mutex comp_list_mutex;
struct list_head path_list;
diff --git a/sound/soc/intel/avs/board_selection.c b/sound/soc/intel/avs/board_selection.c
index 8360ce557401..290ea314ace8 100644
--- a/sound/soc/intel/avs/board_selection.c
+++ b/sound/soc/intel/avs/board_selection.c
@@ -10,10 +10,10 @@
#include <linux/module.h>
#include <linux/dmi.h>
#include <linux/pci.h>
+#include <acpi/nhlt.h>
#include <linux/platform_device.h>
#include <sound/hda_codec.h>
#include <sound/hda_register.h>
-#include <sound/intel-nhlt.h>
#include <sound/soc-acpi.h>
#include <sound/soc-component.h>
#include "avs.h"
@@ -434,8 +434,7 @@ static int avs_register_dmic_board(struct avs_dev *adev)
struct snd_soc_acpi_mach mach = {{0}};
int ret;
- if (!adev->nhlt ||
- !intel_nhlt_has_endpoint_type(adev->nhlt, NHLT_LINK_DMIC)) {
+ if (!acpi_nhlt_find_endpoint(ACPI_NHLT_LINKTYPE_PDM, -1, -1, -1)) {
dev_dbg(adev->dev, "no DMIC endpoints present\n");
return 0;
}
@@ -523,7 +522,7 @@ static int avs_register_i2s_boards(struct avs_dev *adev)
struct snd_soc_acpi_mach *mach;
int ret;
- if (!adev->nhlt || !intel_nhlt_has_endpoint_type(adev->nhlt, NHLT_LINK_SSP)) {
+ if (!acpi_nhlt_find_endpoint(ACPI_NHLT_LINKTYPE_SSP, -1, -1, -1)) {
dev_dbg(adev->dev, "no I2S endpoints present\n");
return 0;
}
diff --git a/sound/soc/intel/avs/core.c b/sound/soc/intel/avs/core.c
index a059bb6888d8..f56f9e19276a 100644
--- a/sound/soc/intel/avs/core.c
+++ b/sound/soc/intel/avs/core.c
@@ -14,15 +14,16 @@
// foundation of this driver
//
+#include <linux/acpi.h>
#include <linux/module.h>
#include <linux/pci.h>
+#include <acpi/nhlt.h>
#include <sound/hda_codec.h>
#include <sound/hda_i915.h>
#include <sound/hda_register.h>
#include <sound/hdaudio.h>
#include <sound/hdaudio_ext.h>
#include <sound/intel-dsp-config.h>
-#include <sound/intel-nhlt.h>
#include "../../codecs/hda.h"
#include "avs.h"
#include "cldma.h"
@@ -215,9 +216,7 @@ static void avs_hda_probe_work(struct work_struct *work)
if (ret < 0)
return;
- adev->nhlt = intel_nhlt_init(adev->dev);
- if (!adev->nhlt)
- dev_info(bus->dev, "platform has no NHLT\n");
+ acpi_nhlt_get_gbl_table();
avs_register_all_boards(adev);
@@ -543,8 +542,7 @@ static void avs_pci_remove(struct pci_dev *pci)
avs_unregister_all_boards(adev);
- if (adev->nhlt)
- intel_nhlt_free(adev->nhlt);
+ acpi_nhlt_put_gbl_table();
avs_debugfs_exit(adev);
if (avs_platattr_test(adev, CLDMA))
diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c
index fa3fec339548..0a34d63e262e 100644
--- a/sound/soc/intel/avs/path.c
+++ b/sound/soc/intel/avs/path.c
@@ -6,7 +6,8 @@
// Amadeusz Slawinski <amadeuszx.slawinski@linux.intel.com>
//
-#include <sound/intel-nhlt.h>
+#include <linux/acpi.h>
+#include <acpi/nhlt.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include "avs.h"
@@ -143,10 +144,10 @@ static bool avs_dma_type_is_input(u32 dma_type)
static int avs_copier_create(struct avs_dev *adev, struct avs_path_module *mod)
{
- struct nhlt_acpi_table *nhlt = adev->nhlt;
struct avs_tplg_module *t = mod->template;
struct avs_copier_cfg *cfg;
- struct nhlt_specific_cfg *ep_blob;
+ struct acpi_nhlt_format_config *ep_blob;
+ struct acpi_nhlt_endpoint *ep;
union avs_connector_node_id node_id = {0};
size_t cfg_size, data_size;
void *data = NULL;
@@ -175,18 +176,18 @@ static int avs_copier_create(struct avs_dev *adev, struct avs_path_module *mod)
else
fmt = t->cfg_ext->copier.out_fmt;
- ep_blob = intel_nhlt_get_endpoint_blob(adev->dev,
- nhlt, t->cfg_ext->copier.vindex.i2s.instance,
- NHLT_LINK_SSP, fmt->valid_bit_depth, fmt->bit_depth,
- fmt->num_channels, fmt->sampling_freq, direction,
- NHLT_DEVICE_I2S);
+ ep = acpi_nhlt_find_endpoint(ACPI_NHLT_LINKTYPE_SSP,
+ ACPI_NHLT_DEVICETYPE_CODEC, direction,
+ t->cfg_ext->copier.vindex.i2s.instance);
+ ep_blob = acpi_nhlt_endpoint_find_fmtcfg(ep, fmt->num_channels, fmt->sampling_freq,
+ fmt->valid_bit_depth, fmt->bit_depth);
if (!ep_blob) {
dev_err(adev->dev, "no I2S ep_blob found\n");
return -ENOENT;
}
- data = ep_blob->caps;
- data_size = ep_blob->size;
+ data = ep_blob->config.capabilities;
+ data_size = ep_blob->config.capabilities_size;
/* I2S gateway's vindex is statically assigned in topology */
node_id.vindex = t->cfg_ext->copier.vindex.val;
@@ -200,17 +201,16 @@ static int avs_copier_create(struct avs_dev *adev, struct avs_path_module *mod)
else
fmt = t->in_fmt;
- ep_blob = intel_nhlt_get_endpoint_blob(adev->dev, nhlt, 0,
- NHLT_LINK_DMIC, fmt->valid_bit_depth,
- fmt->bit_depth, fmt->num_channels,
- fmt->sampling_freq, direction, NHLT_DEVICE_DMIC);
+ ep = acpi_nhlt_find_endpoint(ACPI_NHLT_LINKTYPE_PDM, -1, direction, 0);
+ ep_blob = acpi_nhlt_endpoint_find_fmtcfg(ep, fmt->num_channels, fmt->sampling_freq,
+ fmt->valid_bit_depth, fmt->bit_depth);
if (!ep_blob) {
dev_err(adev->dev, "no DMIC ep_blob found\n");
return -ENOENT;
}
- data = ep_blob->caps;
- data_size = ep_blob->size;
+ data = ep_blob->config.capabilities;
+ data_size = ep_blob->config.capabilities_size;
/* DMIC gateway's vindex is statically assigned in topology */
node_id.vindex = t->cfg_ext->copier.vindex.val;