Skip to content

Commit f5d20b2

Browse files
Amadeusz Sławińskibroonie
authored andcommitted
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: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://lore.kernel.org/r/20240419084307.2718881-3-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent a640aca commit f5d20b2

5 files changed

Lines changed: 24 additions & 27 deletions

File tree

sound/soc/intel/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ config SND_SOC_INTEL_AVS
214214
depends on X86 || COMPILE_TEST
215215
depends on PCI
216216
depends on COMMON_CLK
217+
select ACPI_NHLT if ACPI
217218
select SND_SOC_ACPI if ACPI
218219
select SND_SOC_TOPOLOGY
219220
select SND_SOC_HDA

sound/soc/intel/avs/avs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ struct avs_dev {
151151
struct completion fw_ready;
152152
struct work_struct probe_work;
153153

154-
struct nhlt_acpi_table *nhlt;
155154
struct list_head comp_list;
156155
struct mutex comp_list_mutex;
157156
struct list_head path_list;

sound/soc/intel/avs/board_selection.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
#include <linux/module.h>
1111
#include <linux/dmi.h>
1212
#include <linux/pci.h>
13+
#include <acpi/nhlt.h>
1314
#include <linux/platform_device.h>
1415
#include <sound/hda_codec.h>
1516
#include <sound/hda_register.h>
16-
#include <sound/intel-nhlt.h>
1717
#include <sound/soc-acpi.h>
1818
#include <sound/soc-component.h>
1919
#include "avs.h"
@@ -434,8 +434,7 @@ static int avs_register_dmic_board(struct avs_dev *adev)
434434
struct snd_soc_acpi_mach mach = {{0}};
435435
int ret;
436436

437-
if (!adev->nhlt ||
438-
!intel_nhlt_has_endpoint_type(adev->nhlt, NHLT_LINK_DMIC)) {
437+
if (!acpi_nhlt_find_endpoint(ACPI_NHLT_LINKTYPE_PDM, -1, -1, -1)) {
439438
dev_dbg(adev->dev, "no DMIC endpoints present\n");
440439
return 0;
441440
}
@@ -523,7 +522,7 @@ static int avs_register_i2s_boards(struct avs_dev *adev)
523522
struct snd_soc_acpi_mach *mach;
524523
int ret;
525524

526-
if (!adev->nhlt || !intel_nhlt_has_endpoint_type(adev->nhlt, NHLT_LINK_SSP)) {
525+
if (!acpi_nhlt_find_endpoint(ACPI_NHLT_LINKTYPE_SSP, -1, -1, -1)) {
527526
dev_dbg(adev->dev, "no I2S endpoints present\n");
528527
return 0;
529528
}

sound/soc/intel/avs/core.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@
1414
// foundation of this driver
1515
//
1616

17+
#include <linux/acpi.h>
1718
#include <linux/module.h>
1819
#include <linux/pci.h>
20+
#include <acpi/nhlt.h>
1921
#include <sound/hda_codec.h>
2022
#include <sound/hda_i915.h>
2123
#include <sound/hda_register.h>
2224
#include <sound/hdaudio.h>
2325
#include <sound/hdaudio_ext.h>
2426
#include <sound/intel-dsp-config.h>
25-
#include <sound/intel-nhlt.h>
2627
#include "../../codecs/hda.h"
2728
#include "avs.h"
2829
#include "cldma.h"
@@ -214,9 +215,7 @@ static void avs_hda_probe_work(struct work_struct *work)
214215
if (ret < 0)
215216
return;
216217

217-
adev->nhlt = intel_nhlt_init(adev->dev);
218-
if (!adev->nhlt)
219-
dev_info(bus->dev, "platform has no NHLT\n");
218+
acpi_nhlt_get_gbl_table();
220219
avs_debugfs_init(adev);
221220

222221
avs_register_all_boards(adev);
@@ -549,8 +548,7 @@ static void avs_pci_remove(struct pci_dev *pci)
549548
avs_unregister_all_boards(adev);
550549

551550
avs_debugfs_exit(adev);
552-
if (adev->nhlt)
553-
intel_nhlt_free(adev->nhlt);
551+
acpi_nhlt_put_gbl_table();
554552

555553
if (avs_platattr_test(adev, CLDMA))
556554
hda_cldma_free(&code_loader);

sound/soc/intel/avs/path.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
// Amadeusz Slawinski <amadeuszx.slawinski@linux.intel.com>
77
//
88

9-
#include <sound/intel-nhlt.h>
9+
#include <linux/acpi.h>
10+
#include <acpi/nhlt.h>
1011
#include <sound/pcm_params.h>
1112
#include <sound/soc.h>
1213
#include "avs.h"
@@ -143,10 +144,10 @@ static bool avs_dma_type_is_input(u32 dma_type)
143144

144145
static int avs_copier_create(struct avs_dev *adev, struct avs_path_module *mod)
145146
{
146-
struct nhlt_acpi_table *nhlt = adev->nhlt;
147147
struct avs_tplg_module *t = mod->template;
148148
struct avs_copier_cfg *cfg;
149-
struct nhlt_specific_cfg *ep_blob;
149+
struct acpi_nhlt_format_config *ep_blob;
150+
struct acpi_nhlt_endpoint *ep;
150151
union avs_connector_node_id node_id = {0};
151152
size_t cfg_size, data_size = 0;
152153
void *data = NULL;
@@ -174,18 +175,18 @@ static int avs_copier_create(struct avs_dev *adev, struct avs_path_module *mod)
174175
else
175176
fmt = t->cfg_ext->copier.out_fmt;
176177

177-
ep_blob = intel_nhlt_get_endpoint_blob(adev->dev,
178-
nhlt, t->cfg_ext->copier.vindex.i2s.instance,
179-
NHLT_LINK_SSP, fmt->valid_bit_depth, fmt->bit_depth,
180-
fmt->num_channels, fmt->sampling_freq, direction,
181-
NHLT_DEVICE_I2S);
178+
ep = acpi_nhlt_find_endpoint(ACPI_NHLT_LINKTYPE_SSP,
179+
ACPI_NHLT_DEVICETYPE_CODEC, direction,
180+
t->cfg_ext->copier.vindex.i2s.instance);
181+
ep_blob = acpi_nhlt_endpoint_find_fmtcfg(ep, fmt->num_channels, fmt->sampling_freq,
182+
fmt->valid_bit_depth, fmt->bit_depth);
182183
if (!ep_blob) {
183184
dev_err(adev->dev, "no I2S ep_blob found\n");
184185
return -ENOENT;
185186
}
186187

187-
data = ep_blob->caps;
188-
data_size = ep_blob->size;
188+
data = ep_blob->config.capabilities;
189+
data_size = ep_blob->config.capabilities_size;
189190
/* I2S gateway's vindex is statically assigned in topology */
190191
node_id.vindex = t->cfg_ext->copier.vindex.val;
191192

@@ -199,17 +200,16 @@ static int avs_copier_create(struct avs_dev *adev, struct avs_path_module *mod)
199200
else
200201
fmt = t->in_fmt;
201202

202-
ep_blob = intel_nhlt_get_endpoint_blob(adev->dev, nhlt, 0,
203-
NHLT_LINK_DMIC, fmt->valid_bit_depth,
204-
fmt->bit_depth, fmt->num_channels,
205-
fmt->sampling_freq, direction, NHLT_DEVICE_DMIC);
203+
ep = acpi_nhlt_find_endpoint(ACPI_NHLT_LINKTYPE_PDM, -1, direction, 0);
204+
ep_blob = acpi_nhlt_endpoint_find_fmtcfg(ep, fmt->num_channels, fmt->sampling_freq,
205+
fmt->valid_bit_depth, fmt->bit_depth);
206206
if (!ep_blob) {
207207
dev_err(adev->dev, "no DMIC ep_blob found\n");
208208
return -ENOENT;
209209
}
210210

211-
data = ep_blob->caps;
212-
data_size = ep_blob->size;
211+
data = ep_blob->config.capabilities;
212+
data_size = ep_blob->config.capabilities_size;
213213
/* DMIC gateway's vindex is statically assigned in topology */
214214
node_id.vindex = t->cfg_ext->copier.vindex.val;
215215

0 commit comments

Comments
 (0)