Commit f5d20b25 authored by Amadeusz Sławiński's avatar Amadeusz Sławiński Committed by Mark Brown

ASoC: Intel: avs: Switch to ACPI NHLT

Now that NHLT support in ACPI framework was introduced, migrate avs
driver to new API.
Signed-off-by: default avatarAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20240419084307.2718881-3-cezary.rojewski@intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent a640acab
...@@ -214,6 +214,7 @@ config SND_SOC_INTEL_AVS ...@@ -214,6 +214,7 @@ config SND_SOC_INTEL_AVS
depends on X86 || COMPILE_TEST depends on X86 || COMPILE_TEST
depends on PCI depends on PCI
depends on COMMON_CLK depends on COMMON_CLK
select ACPI_NHLT if ACPI
select SND_SOC_ACPI if ACPI select SND_SOC_ACPI if ACPI
select SND_SOC_TOPOLOGY select SND_SOC_TOPOLOGY
select SND_SOC_HDA select SND_SOC_HDA
......
...@@ -151,7 +151,6 @@ struct avs_dev { ...@@ -151,7 +151,6 @@ struct avs_dev {
struct completion fw_ready; struct completion fw_ready;
struct work_struct probe_work; struct work_struct probe_work;
struct nhlt_acpi_table *nhlt;
struct list_head comp_list; struct list_head comp_list;
struct mutex comp_list_mutex; struct mutex comp_list_mutex;
struct list_head path_list; struct list_head path_list;
......
...@@ -10,10 +10,10 @@ ...@@ -10,10 +10,10 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/dmi.h> #include <linux/dmi.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <acpi/nhlt.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <sound/hda_codec.h> #include <sound/hda_codec.h>
#include <sound/hda_register.h> #include <sound/hda_register.h>
#include <sound/intel-nhlt.h>
#include <sound/soc-acpi.h> #include <sound/soc-acpi.h>
#include <sound/soc-component.h> #include <sound/soc-component.h>
#include "avs.h" #include "avs.h"
...@@ -434,8 +434,7 @@ static int avs_register_dmic_board(struct avs_dev *adev) ...@@ -434,8 +434,7 @@ static int avs_register_dmic_board(struct avs_dev *adev)
struct snd_soc_acpi_mach mach = {{0}}; struct snd_soc_acpi_mach mach = {{0}};
int ret; int ret;
if (!adev->nhlt || if (!acpi_nhlt_find_endpoint(ACPI_NHLT_LINKTYPE_PDM, -1, -1, -1)) {
!intel_nhlt_has_endpoint_type(adev->nhlt, NHLT_LINK_DMIC)) {
dev_dbg(adev->dev, "no DMIC endpoints present\n"); dev_dbg(adev->dev, "no DMIC endpoints present\n");
return 0; return 0;
} }
...@@ -523,7 +522,7 @@ static int avs_register_i2s_boards(struct avs_dev *adev) ...@@ -523,7 +522,7 @@ static int avs_register_i2s_boards(struct avs_dev *adev)
struct snd_soc_acpi_mach *mach; struct snd_soc_acpi_mach *mach;
int ret; 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"); dev_dbg(adev->dev, "no I2S endpoints present\n");
return 0; return 0;
} }
......
...@@ -14,15 +14,16 @@ ...@@ -14,15 +14,16 @@
// foundation of this driver // foundation of this driver
// //
#include <linux/acpi.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <acpi/nhlt.h>
#include <sound/hda_codec.h> #include <sound/hda_codec.h>
#include <sound/hda_i915.h> #include <sound/hda_i915.h>
#include <sound/hda_register.h> #include <sound/hda_register.h>
#include <sound/hdaudio.h> #include <sound/hdaudio.h>
#include <sound/hdaudio_ext.h> #include <sound/hdaudio_ext.h>
#include <sound/intel-dsp-config.h> #include <sound/intel-dsp-config.h>
#include <sound/intel-nhlt.h>
#include "../../codecs/hda.h" #include "../../codecs/hda.h"
#include "avs.h" #include "avs.h"
#include "cldma.h" #include "cldma.h"
...@@ -214,9 +215,7 @@ static void avs_hda_probe_work(struct work_struct *work) ...@@ -214,9 +215,7 @@ static void avs_hda_probe_work(struct work_struct *work)
if (ret < 0) if (ret < 0)
return; return;
adev->nhlt = intel_nhlt_init(adev->dev); acpi_nhlt_get_gbl_table();
if (!adev->nhlt)
dev_info(bus->dev, "platform has no NHLT\n");
avs_debugfs_init(adev); avs_debugfs_init(adev);
avs_register_all_boards(adev); avs_register_all_boards(adev);
...@@ -549,8 +548,7 @@ static void avs_pci_remove(struct pci_dev *pci) ...@@ -549,8 +548,7 @@ static void avs_pci_remove(struct pci_dev *pci)
avs_unregister_all_boards(adev); avs_unregister_all_boards(adev);
avs_debugfs_exit(adev); avs_debugfs_exit(adev);
if (adev->nhlt) acpi_nhlt_put_gbl_table();
intel_nhlt_free(adev->nhlt);
if (avs_platattr_test(adev, CLDMA)) if (avs_platattr_test(adev, CLDMA))
hda_cldma_free(&code_loader); hda_cldma_free(&code_loader);
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
// Amadeusz Slawinski <amadeuszx.slawinski@linux.intel.com> // 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/pcm_params.h>
#include <sound/soc.h> #include <sound/soc.h>
#include "avs.h" #include "avs.h"
...@@ -143,10 +144,10 @@ static bool avs_dma_type_is_input(u32 dma_type) ...@@ -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) 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_tplg_module *t = mod->template;
struct avs_copier_cfg *cfg; 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}; union avs_connector_node_id node_id = {0};
size_t cfg_size, data_size = 0; size_t cfg_size, data_size = 0;
void *data = NULL; void *data = NULL;
...@@ -174,18 +175,18 @@ static int avs_copier_create(struct avs_dev *adev, struct avs_path_module *mod) ...@@ -174,18 +175,18 @@ static int avs_copier_create(struct avs_dev *adev, struct avs_path_module *mod)
else else
fmt = t->cfg_ext->copier.out_fmt; fmt = t->cfg_ext->copier.out_fmt;
ep_blob = intel_nhlt_get_endpoint_blob(adev->dev, ep = acpi_nhlt_find_endpoint(ACPI_NHLT_LINKTYPE_SSP,
nhlt, t->cfg_ext->copier.vindex.i2s.instance, ACPI_NHLT_DEVICETYPE_CODEC, direction,
NHLT_LINK_SSP, fmt->valid_bit_depth, fmt->bit_depth, t->cfg_ext->copier.vindex.i2s.instance);
fmt->num_channels, fmt->sampling_freq, direction, ep_blob = acpi_nhlt_endpoint_find_fmtcfg(ep, fmt->num_channels, fmt->sampling_freq,
NHLT_DEVICE_I2S); fmt->valid_bit_depth, fmt->bit_depth);
if (!ep_blob) { if (!ep_blob) {
dev_err(adev->dev, "no I2S ep_blob found\n"); dev_err(adev->dev, "no I2S ep_blob found\n");
return -ENOENT; return -ENOENT;
} }
data = ep_blob->caps; data = ep_blob->config.capabilities;
data_size = ep_blob->size; data_size = ep_blob->config.capabilities_size;
/* I2S gateway's vindex is statically assigned in topology */ /* I2S gateway's vindex is statically assigned in topology */
node_id.vindex = t->cfg_ext->copier.vindex.val; node_id.vindex = t->cfg_ext->copier.vindex.val;
...@@ -199,17 +200,16 @@ static int avs_copier_create(struct avs_dev *adev, struct avs_path_module *mod) ...@@ -199,17 +200,16 @@ static int avs_copier_create(struct avs_dev *adev, struct avs_path_module *mod)
else else
fmt = t->in_fmt; fmt = t->in_fmt;
ep_blob = intel_nhlt_get_endpoint_blob(adev->dev, nhlt, 0, ep = acpi_nhlt_find_endpoint(ACPI_NHLT_LINKTYPE_PDM, -1, direction, 0);
NHLT_LINK_DMIC, fmt->valid_bit_depth, ep_blob = acpi_nhlt_endpoint_find_fmtcfg(ep, fmt->num_channels, fmt->sampling_freq,
fmt->bit_depth, fmt->num_channels, fmt->valid_bit_depth, fmt->bit_depth);
fmt->sampling_freq, direction, NHLT_DEVICE_DMIC);
if (!ep_blob) { if (!ep_blob) {
dev_err(adev->dev, "no DMIC ep_blob found\n"); dev_err(adev->dev, "no DMIC ep_blob found\n");
return -ENOENT; return -ENOENT;
} }
data = ep_blob->caps; data = ep_blob->config.capabilities;
data_size = ep_blob->size; data_size = ep_blob->config.capabilities_size;
/* DMIC gateway's vindex is statically assigned in topology */ /* DMIC gateway's vindex is statically assigned in topology */
node_id.vindex = t->cfg_ext->copier.vindex.val; node_id.vindex = t->cfg_ext->copier.vindex.val;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment