-
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
ASoC: soc_sdw_utils: skip the endpoint that doesn't present #5351
ASoC: soc_sdw_utils: skip the endpoint that doesn't present #5351
Conversation
sound/soc/sdw_utils/soc_sdw_utils.c
Outdated
else if (asoc_sdw_is_unique_device(adr_link, sdw_version, mfg_id, part_id, | ||
class_id, adr_index)) | ||
if (asoc_sdw_is_unique_device(adr_link, sdw_version, mfg_id, part_id, | ||
class_id, adr_index)) | ||
return devm_kasprintf(dev, GFP_KERNEL, "sdw:0:%01x:%04x:%04x:%02x", | ||
link_id, mfg_id, part_id, class_id); | ||
else |
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.
the else is redundant here
sound/soc/sdw_utils/soc_sdw_utils.c
Outdated
if (!slave) | ||
return -EINVAL; | ||
|
||
/* Mack sure BIOS provides SDCA properties */ |
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.
typo Make
sound/soc/sdw_utils/soc_sdw_utils.c
Outdated
for (k = 0; k < slave->sdca_data.num_functions; k++) { | ||
int dai_type = asoc_sdw_get_dai_type( | ||
slave->sdca_data.function[k].type); | ||
dev_dbg(&slave->dev, "function: %s dai_type %d\n", |
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.
you need a newline here
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.
And won't you be printing this debug for every endpoint match?
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.
Yes, will remove.
sound/soc/sdw_utils/soc_sdw_utils.c
Outdated
dev_dbg(&slave->dev, "function: %s dai_type %d\n", | ||
slave->sdca_data.function[k].name, dai_type); | ||
if (dai_type == dai_info->dai_type) { | ||
dev_dbg(&slave->dev, "DAI type %d found\n", |
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.
Maybe say something along the lines of SDCA device function found ?
sound/soc/sdw_utils/soc_sdw_utils.c
Outdated
} | ||
} | ||
if (k == slave->sdca_data.num_functions) { | ||
dev_dbg(&slave->dev, "DAI type %d not found, skip endpoint\n", |
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.
Also here, maybe "SDCA device function for DAI type %d not supported, skip endpoint"
5167bbe
to
b153c6f
Compare
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.
May need a little more in the logs
sound/soc/sdw_utils/soc_sdw_utils.c
Outdated
@@ -1204,6 +1228,55 @@ int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card, | |||
!(dai_info->quirk_exclude ^ !!(dai_info->quirk & ctx->mc_quirk))) | |||
continue; | |||
|
|||
/* No need to check SDCA functions if there is only 1 endpoint present */ | |||
if (adr_dev->num_endpoints == 1) |
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.
do we need a log entry here to state that only 1 endpoint is found and we assume it to be type X
Not sure what happened to PTLP_RVP_SDW tests. All playback/capture tests failed. And there is no dmesg. But, I run the test manually on the same DUT (ba-ptlh-rvp-01) and they passed. Also, the dmesg of https://sof-ci.01.org/linuxpr/PR5351/build6503/devicetest/index.html?model=PTLP_RVP_SDW&testcase=verify-kernel-boot-log looks good to me.
|
SOFCI TEST |
b153c6f
to
fc371ba
Compare
SOFCI TEST |
Currently asoc_sdw_get_codec_name will return codec_info->codec_name if it is set. However, in some case we need the sdw codec name no matter if codec_info->codec_name is set or not. _asoc_sdw_get_codec_name() will be used in the follow up commit. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
fc371ba
to
76db426
Compare
PTLP_RVP_SDW is not tested. Trigger CI test again. |
SOFCI TEST |
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.
@bardliao, will this work with already release topology files (where split ones are not available)?
sound/soc/sdw_utils/soc_sdw_utils.c
Outdated
/* Make sure BIOS provides SDCA properties */ | ||
if (!slave->sdca_data.interface_revision) { | ||
dev_warn(&slave->dev, | ||
"SDCA properties not found in the BIOS\n"); |
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.
Is every sdw device is SDCA?
I think this should be at most in info or even dbg level.
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.
Or check is it a SDCA codec first?
sound/soc/sdw_utils/soc_sdw_utils.c
Outdated
dai_info->dai_type); | ||
continue; | ||
} | ||
skip_sdca_function_check: |
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 don't know, but jumping within a loop does not sound right.
It might be better to move this new code into a sdca helper function.
In theory, yes. We use DMI quirk to set optional SDCA DAI types for all existing. We should get the same result with this PR is the BIOS is configured properly. |
76db426
to
8074dec
Compare
sound/soc/sdw_utils/soc_sdw_utils.c
Outdated
if (ret < 0) | ||
return ret; | ||
|
||
if (!ret) |
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.
is_sdca_function_present()
ret < 0 is error
ret == 0 is true
ret == 1 is false
?
I would swap the true/false with a comment.
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.
or not, I'm not sure what is going on ;)
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.
My first thought wat let is_sdca_function_present() return true/false only and it will be Intuitive. However, I would like to include the error checking in is_sdca_function_present(), so I changed the return type to int. Maybe we should rename is_sdca_function_present() as it is not just checking is SDCA function present. The purpose of the helper is to decide whether we should skip the endpoint. We should only skip the endpoint if there are more than 1 endpoints and we can get the SDCA supported functions and none of the supported functions matches the DAI type.
e3ee7ee
to
5756cb1
Compare
sound/soc/sdw_utils/soc_sdw_utils.c
Outdated
@@ -1203,6 +1306,22 @@ int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card, | |||
!(dai_info->quirk_exclude ^ !!(dai_info->quirk & ctx->mc_quirk))) | |||
continue; | |||
|
|||
/* | |||
* Don't check is sdca endpoint present if machine quirk is set | |||
* In other works, quirk should have higher priority than the sdca |
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.
typo: s/works/words
5756cb1
to
bc0821a
Compare
9348f77
to
dc21a44
Compare
sound/soc/sdw_utils/soc_sdw_utils.c
Outdated
@@ -1196,6 +1308,22 @@ int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card, | |||
!(dai_info->quirk_exclude ^ !!(dai_info->quirk & ctx->mc_quirk))) | |||
continue; | |||
|
|||
/* | |||
* Don't check is sdca endpoint present if machine quirk is set |
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.
*Don't check if
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.
*Don't check if
Changed
dc21a44
to
32d8a10
Compare
sound/soc/sdw_utils/soc_sdw_utils.c
Outdated
@@ -1203,6 +1308,22 @@ int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card, | |||
!(dai_info->quirk_exclude ^ !!(dai_info->quirk & ctx->mc_quirk))) | |||
continue; | |||
|
|||
/* | |||
* Don't check if sdca endpoint present if machine quirk is set |
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.
Don't check the sdca endpoint presence if machine quirk is set.
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.
Or
Skip the sdca endpoint presence check if machine quirk is set.
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
A codec endpoint may not be used. We could check the present SDCA functions to know if the endpoint is used or not. Skip the endpoint which is not used. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
32d8a10
to
eae45e1
Compare
@charleskeepax are you good with this PR? |
@bardliao I see some failures on PTL SDW that I do not see in other PRs. Do you think it is related to the changes here? |
SOFCI TEST |
No, it is related to display audio |
We can check the DisCo table and know what functions are used by the codec. Then skip the unused endpoints. And we can remove the dai quirk in codec_info_list[].