ASoC: soc_sdw_utils: skip the endpoint that doesn't present#5351
ASoC: soc_sdw_utils: skip the endpoint that doesn't present#5351bardliao merged 2 commits intothesofproject:topic/sof-devfrom
Conversation
sound/soc/sdw_utils/soc_sdw_utils.c
Outdated
| 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.
the else is redundant here
sound/soc/sdw_utils/soc_sdw_utils.c
Outdated
| if (!slave) | ||
| return -EINVAL; | ||
|
|
||
| /* Mack sure BIOS provides SDCA properties */ |
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.
And won't you be printing this debug for every endpoint match?
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.
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.
Also here, maybe "SDCA device function for DAI type %d not supported, skip endpoint"
5167bbe to
b153c6f
Compare
lgirdwood
left a comment
There was a problem hiding this comment.
May need a little more in the logs
sound/soc/sdw_utils/soc_sdw_utils.c
Outdated
| 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.
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 |
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.
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.
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.
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.
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.
or not, I'm not sure what is going on ;)
There was a problem hiding this comment.
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
|
|
||
| /* | ||
| * Don't check is sdca endpoint present if machine quirk is set | ||
| * In other works, quirk should have higher priority than the sdca |
5756cb1 to
bc0821a
Compare
9348f77 to
dc21a44
Compare
sound/soc/sdw_utils/soc_sdw_utils.c
Outdated
| continue; | ||
|
|
||
| /* | ||
| * Don't check is sdca endpoint present if machine quirk is set |
There was a problem hiding this comment.
*Don't check if
Changed
dc21a44 to
32d8a10
Compare
sound/soc/sdw_utils/soc_sdw_utils.c
Outdated
| continue; | ||
|
|
||
| /* | ||
| * Don't check if sdca endpoint present if machine quirk is set |
There was a problem hiding this comment.
Don't check the sdca endpoint presence if machine quirk is set.
There was a problem hiding this comment.
Or
Skip the sdca endpoint presence check if machine quirk is set.
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[].