Skip to content

Conversation

@serhiy-katsyuba-intel
Copy link
Contributor

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.

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>
Copy link
Contributor

@tmleman tmleman left a 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.

@serhiy-katsyuba-intel
Copy link
Contributor Author

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.

Copy link
Member

@lgirdwood lgirdwood left a 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 ?

@lgirdwood
Copy link
Member

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.

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.

Copy link
Collaborator

@softwarecki softwarecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@serhiy-katsyuba-intel
Copy link
Contributor Author

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.

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.

@lgirdwood
Copy link
Member

looks like CI got stuck, will restart it.

@lgirdwood
Copy link
Member

SOFCI TEST

Copy link
Member

@abonislawski abonislawski left a 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.

@lgirdwood lgirdwood merged commit 465f6aa into thesofproject:main Feb 12, 2026
49 of 52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants