Skip to content

[BUG] DAI types diverged between Zephyr and Linux kernel #9803

Closed

Description

@dbaluta

Describe the bug

DAI type is defined in Zephyr like this:

Zephyr path: include/zephyr/drivers/dai.h

enum dai_type {
»       DAI_LEGACY_I2S = 0,»    /**< Legacy I2S compatible with i2s.h */
»       DAI_INTEL_SSP,» »       /**< Intel SSP */ 
»       DAI_INTEL_DMIC,»»       /**< Intel DMIC */
»       DAI_INTEL_HDA,» »       /**< Intel HD/A */ 
»       DAI_INTEL_ALH,» »       /**< Intel ALH */
»       DAI_IMX_SAI,»   »       /**< i.MX SAI */                                                                                                                                        
»       DAI_IMX_ESAI,»  »       /**< i.MX ESAI */
»       DAI_AMD_BT,»    »       /**< Amd BT */
»       DAI_AMD_SP,»    »       /**< Amd SP */
»       DAI_AMD_DMIC,»  »       /**< Amd DMIC */
»       DAI_MEDIATEK_AFE,»      /**< Mtk AFE */
»       DAI_INTEL_SSP_NHLT,»    /**< nhlt ssp */
»       DAI_INTEL_DMIC_NHLT,»   /**< nhlt ssp */
»       DAI_INTEL_HDA_NHLT,»    /**< nhlt Intel HD/A */
»       DAI_IMX_MICFIL,»»       /**< i.MX PDM MICFIL */
»       DAI_INTEL_ALH_NHLT,»    /**< nhlt Intel ALH */
};

But they diverged at some point from the same definitions found in Linux kernel (or SOF initial drivers).

Linux kernel path: include/sound/sof/dai.h

/** \brief Types of DAI */
enum sof_ipc_dai_type {
»       SOF_DAI_INTEL_NONE = 0,»»       /**< None */
»       SOF_DAI_INTEL_SSP,»     »       /**< Intel SSP */
»       SOF_DAI_INTEL_DMIC,»    »       /**< Intel DMIC */
»       SOF_DAI_INTEL_HDA,»     »       /**< Intel HD/A */
»       SOF_DAI_INTEL_ALH,»     »       /**< Intel ALH  */
»       SOF_DAI_IMX_SAI,»       »       /**< i.MX SAI */
»       SOF_DAI_IMX_ESAI,»      »       /**< i.MX ESAI */
»       SOF_DAI_AMD_BT,»»       »       /**< AMD ACP BT*/
»       SOF_DAI_AMD_SP,»»       »       /**< AMD ACP SP */
»       SOF_DAI_AMD_DMIC,»      »       /**< AMD ACP DMIC */
»       SOF_DAI_MEDIATEK_AFE,»  »       /**< Mediatek AFE */
»       SOF_DAI_AMD_HS,»»       »       /**< Amd HS */
»       SOF_DAI_AMD_SP_VIRTUAL,»»       /**< AMD ACP SP VIRTUAL */
»       SOF_DAI_AMD_HS_VIRTUAL,»»       /**< AMD ACP HS VIRTUAL */
»       SOF_DAI_AMD_SDW,»       »       /**< AMD ACP SDW */
};

Environment

  1. Branch name and commit hash of the 2 repositories: sof (firmware/topology) and linux (kernel driver).

Activity

  1. added
    bugSomething isn't working as expected
    on Jan 29, 2025
  2. dbaluta commented on Jan 29, 2025

    @dbaluta
    CollaboratorAuthor

    @lgirdwood am I missing something about this?

    I'm trying to add a new type zephyrproject-rtos/zephyr@4411719 in Zephyr, but because this struct diverged I'm having trouble in probing the DAI driver.

  3. kv2019i commented on Feb 3, 2025

    @kv2019i
    Collaborator

    Hmm. @dbaluta I remember discusion about this is some SOF PR that these two enums should not be mixed as there's no guarantees for the two to stay in sync. I remember this been discussed in changed in base_fw_intel.com, but I wonder now whether we have missed some bigger miuse of the dai types. I think in SOF FW, there should be a translation between Zephyr DAI type and SOF IPC DAI type.

  4. kv2019i commented on Feb 3, 2025

    @kv2019i
    Collaborator

    Ack, sof/src/lib/dai.c:dai_get() is mixing SOF and Zephyr DAI types. It should do a look-up for DAI-types from IPC definition to Zephyr DAI interface.

    This went unnoticed when SOF_DAI_AMD_HS et al were added as these platforms did not have Zephyr support back then.

    It would seem existing DAI types used by SOF Zephyr configurations all work currnetly, but it's no impossible to add new definitions unless a translation layer is added to dai_get().

  5. added
    P2Critical bugs or normal features
    on Feb 3, 2025
  6. dbaluta commented on Feb 3, 2025

    @dbaluta
    CollaboratorAuthor

    @kv2019i Added this PR #9807

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Critical bugs or normal featuresbugSomething isn't working as expected

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions