-
Notifications
You must be signed in to change notification settings - Fork 350
audio: base_fw_intel: fix incorrect DAI type usage #10540
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
Conversation
We have two enums with DAI types: enum sof_ipc_dai_type in SOF and enum dai_type in Zephyr. dai_get_device() expects the SOF enum sof_ipc_dai_type and then internally converts it to the Zephyr enum dai_type. This fix does not change any behavior as both DAI_INTEL_SSP and SOF_DAI_INTEL_SSP are currently declared as 1. However, there is a risk that those enums might go out of sync in the future. Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
Allow the compiler to issue a warning/error if the wrong DAI type enum is passed as a parameter, as it is easy to incorrectly use Zephyr's enum dai_type instead of the proper SOF enum sof_ipc_dai_type. Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
429263f to
a930b55
Compare
tmleman
left 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.
Maybe one of these enums should be removed? This seems to me like the best solution if it's duplication and they serve the same function.
SOF enum sof_ipc_dai_type is also used without Zephyr in dai-legacy. So we cannot remove it and just use enum dai_type from Zephyr. |
lgirdwood
left 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.
Good find @serhiy-katsyuba-intel is it easy enough to delete the SOF enum and just use the Zephyr enum or will this take a bit more work ?
I think dai-legacy has to stick around until the summer as it has a 1 year grace from TSC where it was agreed to give time for Zephyr native drivers. But, its just a number - so if its used internally only i.e. does not come from IPC then we could just use the Zephyr version. |
softwarecki
left 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.
Good catch!
Those SOF DAI types are definitely used with IPC3: they come as struct sof_ipc_dai_config::type which is sent from host. Not sure if those types can come in IPC4 message. Seems not, IPC4 uses enum ipc4_connector_node_id_type instead. |
|
looks like CI got stuck, will restart it. |
|
SOFCI TEST |
abonislawski
left 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.
SOF enum sof_ipc_dai_type is also used without Zephyr in dai-legacy. So we cannot remove it and just use enum dai_type from Zephyr.
Ok, so its only a matter of time.
We have two enums with DAI types: enum sof_ipc_dai_type in SOF and enum dai_type in Zephyr. dai_get_device() expects the SOF
enum sof_ipc_dai_type and then internally converts it to the Zephyr enum dai_type.
This fix does not change any behavior as both DAI_INTEL_SSP and SOF_DAI_INTEL_SSP are currently declared as 1. However, there is a risk that those enums might go out of sync in the future.