Skip to content

Commit 188ab4b

Browse files
brentlutiwai
authored andcommitted
ASoC: SOF: ipc4-topology: support NHLT device type
The endpoint in NHLT table for a SSP port could have the device type NHLT_DEVICE_BT or NHLT_DEVICE_I2S. Use intel_nhlt_ssp_device_type() function to retrieve the device type before querying the endpoint blob to make sure we are always using correct device type parameter. Signed-off-by: Brent Lu <[email protected]> Reviewed-by: Péter Ujfalusi <[email protected]> Reviewed-by: Pierre-Louis Bossart <[email protected]> Reviewed-by: Bard Liao <[email protected]> Signed-off-by: Peter Ujfalusi <[email protected]> Acked-by: Mark Brown <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> Message-ID: <[email protected]>
1 parent 02545bc commit 188ab4b

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

sound/soc/sof/ipc4-topology.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,6 +1356,7 @@ static int snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_s
13561356
int sample_rate, channel_count;
13571357
int bit_depth, ret;
13581358
u32 nhlt_type;
1359+
int dev_type = 0;
13591360

13601361
/* convert to NHLT type */
13611362
switch (linktype) {
@@ -1371,18 +1372,30 @@ static int snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_s
13711372
&bit_depth);
13721373
if (ret < 0)
13731374
return ret;
1375+
1376+
/*
1377+
* We need to know the type of the external device attached to a SSP
1378+
* port to retrieve the blob from NHLT. However, device type is not
1379+
* specified in topology.
1380+
* Query the type for the port and then pass that information back
1381+
* to the blob lookup function.
1382+
*/
1383+
dev_type = intel_nhlt_ssp_device_type(sdev->dev, ipc4_data->nhlt,
1384+
dai_index);
1385+
if (dev_type < 0)
1386+
return dev_type;
13741387
break;
13751388
default:
13761389
return 0;
13771390
}
13781391

1379-
dev_dbg(sdev->dev, "dai index %d nhlt type %d direction %d\n",
1380-
dai_index, nhlt_type, dir);
1392+
dev_dbg(sdev->dev, "dai index %d nhlt type %d direction %d dev type %d\n",
1393+
dai_index, nhlt_type, dir, dev_type);
13811394

13821395
/* find NHLT blob with matching params */
13831396
cfg = intel_nhlt_get_endpoint_blob(sdev->dev, ipc4_data->nhlt, dai_index, nhlt_type,
13841397
bit_depth, bit_depth, channel_count, sample_rate,
1385-
dir, 0);
1398+
dir, dev_type);
13861399

13871400
if (!cfg) {
13881401
dev_err(sdev->dev,

0 commit comments

Comments
 (0)