-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get the device type before query endpoint blob #4667
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) { | ||
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hrm so, this change basically makes the dev_type check kind of bypassed at the end? What is expected if we have two sets of blobs for the same SSP index but one with dev_type=0 and the other with dev_type=4 in the NHLT blob? We will only going to be able to use the dev_type which is the first in the NHLT. Is this acceptable and OK? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes correct. In fact, dev_type is useless if we attach only one device to one SSP port. A SSP port could not be shared between cnvi BT and external codec (not sure if it still holds true on MTL). If the board does share the port between external BT and codec, the problem is the same (you always get the first set of blobs) even using fixed value 0 or 4 for all NHLT blobs. All devices attached to same SSP port need to share same one set of blob or we will get into trouble. That's my understanding. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, so this could be done in nhlt side just to ignore the dev_type? I don't see how this dev_type have anything to do with the SSP configuration. SSP does not car if there is anything connected to the I2S pins when it is the clock provider, in what way can possibly a mono, 16bit, 44.1KHz differs if the dev_type is BT offload or a codec? Do we have examples of SSP NHLT blobs from BIOS? Does that contains different sets of configurations for the same SSP port per dev_type? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After a bit of reading I think we are having this wrong when requesting the blob. The dev_type is not a selection parameter but it is a metadata in the NHLT which can be used by some OS, Linux is not using it. @plbossart, @ranj063, @kv2019i, you know better the NHLT and things around it, do you see it differently? OK, reading more and it is a bit more complicated than that, but the dev_type feels that it should not be a deciding factor when looking for the configuration of a SSP port. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The difference device types were used by another OS to load different drivers. Indeed that's not something we use. The only time we used the device type was to find which SSP was connected to the ES8336 codec. That wasn't to manage the SSP differently but rather select the relevant topology. The point is that we need to ignore the device type and that's precisely what this PR does. |
||
|
||
if (!cfg) { | ||
dev_err(sdev->dev, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would be cleaner:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. thanks for suggestion.