Skip to content

Commit

Permalink
ASoC: SOF: ipc4-topology: support NHLT device type
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
brentlu committed Nov 13, 2023
1 parent 1132ca3 commit 13cef15
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions sound/soc/sof/ipc4-topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,7 @@ static int snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_s
int sample_rate, channel_count;
int bit_depth, ret;
u32 nhlt_type;
int dev_type = 0;

/* convert to NHLT type */
switch (linktype) {
Expand All @@ -1357,18 +1358,30 @@ static int snd_sof_get_nhlt_endpoint_data(struct snd_sof_dev *sdev, struct snd_s
&bit_depth);
if (ret < 0)
return ret;

/*
* We need to know the type of the external device attached to a SSP
* port to retrieve the blob from NHLT. However, device type is not
* specified in topology.
* Query the type for the port and then pass that information back
* to the blob lookup function.
*/
dev_type = intel_nhlt_ssp_device_type(sdev->dev, ipc4_data->nhlt,
dai_index);
if (ret < 0)
return ret;
break;
default:
return 0;
}

dev_dbg(sdev->dev, "dai index %d nhlt type %d direction %d\n",
dai_index, nhlt_type, dir);
dev_dbg(sdev->dev, "dai index %d nhlt type %d direction %d dev type %d\n",
dai_index, nhlt_type, dir, dev_type);

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

if (!cfg) {
dev_err(sdev->dev,
Expand Down

0 comments on commit 13cef15

Please sign in to comment.