ASoC: SOF: ipc4-pcm: Look for best matching hw_config for SSP#5395
Conversation
| /* best match found */ | ||
| break; | ||
| } else if (matching_params < 2 && | ||
| params_rate(params) == le32_to_cpu(hw_config->fsync_rate) && |
There was a problem hiding this comment.
Change second level to rate and channels and remove third level? Fail if first or second level match is not found. Copier can convert sample format but not rate and channels count.
There was a problem hiding this comment.
let me think about it a bit, this function was not able to fail before, even if it has not found the config.
There was a problem hiding this comment.
There could of course be some simple ranking about the formats if exact match is not found to prefer higher precision over lower, but in practice (only having s32 format available) this hardly matters.
There was a problem hiding this comment.
I think with this we will find the exact match and if no exact config available then we pick the first one which have matching rate and channels. It can be up to debate which non exact match is the best one, but I feel that if we don't have the exact match available then we are already in a 'this is not going to end up right' space..
69e23a6 to
bcba576
Compare
Instead of just looking for a hw_config with matching rate only it sounds better to try to find the best matching configuration. If we have multiple hw_configurations with the same rate, but each with different format for example then we have been picking the first config with the matching rate, which can be a problem and it wil depend on how the configs are ordered. Instead we should be trying to find the best match out of the configs 1. rate + format + channels are matching 2. rate + format are matching 3. rate matching Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
|
Changes since v1:
|
| /* best match found */ | ||
| break; | ||
| } else if (matching_params < 2 && | ||
| params_rate(params) == le32_to_cpu(hw_config->fsync_rate) && |
There was a problem hiding this comment.
There could of course be some simple ranking about the formats if exact match is not found to prefer higher precision over lower, but in practice (only having s32 format available) this hardly matters.
Instead of just looking for a hw_config with matching rate only it sounds better to try to find the best matching configuration.
If we have multiple hw_configurations with the same rate, but each with different format for example then we have been picking the first config with the matching rate, which can be a problem and it wil depend on how the configs are ordered.
Instead we should be trying to find the best match out of the configs