@@ -1801,12 +1801,13 @@ snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_sof_dai *dai
18011801 u32 linktype , u8 dir , u32 * * dst , u32 * len )
18021802{
18031803 struct sof_ipc4_fw_data * ipc4_data = sdev -> private ;
1804- struct nhlt_specific_cfg * cfg ;
1804+ struct nhlt_specific_cfg * cfg = NULL ;
1805+ struct snd_ipc4_nhlt * entry = NULL ;
18051806 int sample_rate , channel_count ;
18061807 bool format_change = false;
18071808 int bit_depth , ret ;
18081809 u32 nhlt_type ;
1809- int dev_type = 0 ;
1810+ int dev_type = - EINVAL ;
18101811
18111812 /* convert to NHLT type */
18121813 switch (linktype ) {
@@ -1837,10 +1838,17 @@ snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_sof_dai *dai
18371838 * Query the type for the port and then pass that information back
18381839 * to the blob lookup function.
18391840 */
1840- dev_type = intel_nhlt_ssp_device_type (sdev -> dev , ipc4_data -> nhlt ,
1841- dai_index );
1842- if (dev_type < 0 )
1841+ list_for_each_entry (entry , & ipc4_data -> nhlt_list , list ) {
1842+ dev_type = intel_nhlt_ssp_device_type (sdev -> dev , entry -> nhlt ,
1843+ dai_index );
1844+ if (dev_type >= 0 )
1845+ break ;
1846+ }
1847+ if (dev_type < 0 ) {
1848+ dev_err (sdev -> dev , "%s: No match for SSP%d in NHLT table\n" ,
1849+ __func__ , dai_index );
18431850 return dev_type ;
1851+ }
18441852 break ;
18451853 default :
18461854 return 0 ;
@@ -1850,9 +1858,14 @@ snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_sof_dai *dai
18501858 dai_index , nhlt_type , dir , dev_type );
18511859
18521860 /* find NHLT blob with matching params */
1853- cfg = intel_nhlt_get_endpoint_blob (sdev -> dev , ipc4_data -> nhlt , dai_index , nhlt_type ,
1854- bit_depth , bit_depth , channel_count , sample_rate ,
1855- dir , dev_type );
1861+ list_for_each_entry (entry , & ipc4_data -> nhlt_list , list ) {
1862+ cfg = intel_nhlt_get_endpoint_blob (sdev -> dev , entry -> nhlt , dai_index ,
1863+ nhlt_type , bit_depth , bit_depth ,
1864+ channel_count , sample_rate , dir ,
1865+ dev_type );
1866+ if (cfg )
1867+ break ;
1868+ }
18561869
18571870 if (!cfg ) {
18581871 bool get_new_blob = false;
@@ -1886,13 +1899,15 @@ snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_sof_dai *dai
18861899 }
18871900
18881901 if (get_new_blob ) {
1889- cfg = intel_nhlt_get_endpoint_blob (sdev -> dev , ipc4_data -> nhlt ,
1890- dai_index , nhlt_type ,
1891- bit_depth , bit_depth ,
1892- channel_count , sample_rate ,
1893- dir , dev_type );
1894- if (cfg )
1895- goto out ;
1902+ list_for_each_entry (entry , & ipc4_data -> nhlt_list , list ) {
1903+ cfg = intel_nhlt_get_endpoint_blob (sdev -> dev , entry -> nhlt ,
1904+ dai_index , nhlt_type ,
1905+ bit_depth , bit_depth ,
1906+ channel_count , sample_rate ,
1907+ dir , dev_type );
1908+ if (cfg )
1909+ goto out ;
1910+ }
18961911 }
18971912
18981913 dev_err (sdev -> dev ,
@@ -3912,6 +3927,7 @@ static int sof_ipc4_parse_manifest(struct snd_soc_component *scomp, int index,
39123927 struct snd_sof_dev * sdev = snd_soc_component_get_drvdata (scomp );
39133928 struct sof_ipc4_fw_data * ipc4_data = sdev -> private ;
39143929 struct sof_manifest_tlv * manifest_tlv ;
3930+ struct snd_ipc4_nhlt * tplg_nhlt ;
39153931 struct sof_manifest * manifest ;
39163932 u32 size = le32_to_cpu (man -> priv .size );
39173933 u8 * man_ptr = man -> priv .data ;
@@ -3947,13 +3963,20 @@ static int sof_ipc4_parse_manifest(struct snd_soc_component *scomp, int index,
39473963
39483964 switch (le32_to_cpu (manifest_tlv -> type )) {
39493965 case SOF_MANIFEST_DATA_TYPE_NHLT :
3950- /* no NHLT in BIOS, so use the one from topology manifest */
3951- if (ipc4_data -> nhlt )
3952- break ;
3953- ipc4_data -> nhlt = devm_kmemdup (sdev -> dev , manifest_tlv -> data ,
3966+ /* Get the nhlt from topology manifest */
3967+ tplg_nhlt = devm_kzalloc (sdev -> dev , sizeof (* tplg_nhlt ), GFP_KERNEL );
3968+ if (!tplg_nhlt )
3969+ return - ENOMEM ;
3970+
3971+ tplg_nhlt -> nhlt = devm_kmemdup (sdev -> dev , manifest_tlv -> data ,
39543972 le32_to_cpu (manifest_tlv -> size ), GFP_KERNEL );
3955- if (!ipc4_data -> nhlt )
3973+ if (!tplg_nhlt -> nhlt )
39563974 return - ENOMEM ;
3975+
3976+ tplg_nhlt -> from_acpi = false;
3977+
3978+ list_add (& tplg_nhlt -> list , & ipc4_data -> nhlt_list );
3979+
39573980 break ;
39583981 default :
39593982 dev_warn (scomp -> dev , "Skipping unknown manifest data type %d\n" ,
0 commit comments