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
144145static 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