DAI Drivers API

group sof_dai_drivers

DAI Drivers API specification.



If the device does not exist it will be created.


static inline void dai_write(struct dai *dai, uint32_t reg, uint32_t value)
static inline uint32_t dai_read(struct dai *dai, uint32_t reg)
static inline void dai_update_bits(struct dai *dai, uint32_t reg, uint32_t mask, uint32_t value)
struct dai_group *dai_group_get(uint32_t group_id, uint32_t flags)

API to request DAI group.

Returns a DAI group for the given ID and increments the counter of DAIs in the group.

If a group for the given ID doesn’t exist, it will either return NULL or allocate a new group structure if the CREATE flag is supplied.

  • group_id[in] Group ID

  • flags[in] Flags (CREATE)

void dai_group_put(struct dai_group *group)

API to release DAI group.

Decrements the DAI counter inside the group.


group[in] Group

static inline int dai_init(struct sof *sof)

API to initialize a platform DAI.


sof[in] Pointer to firmware main context.

struct dai *dai_get(uint32_t type, uint32_t index, uint32_t flags)

API to request a platform DAI.

  • type[in] Type of requested DAI.

  • index[in] Index of requested DAI.

  • flags[in] Flags (CREATE)

void dai_put(struct dai *dai)

API to release a platform DAI.


dai[in] DAI to relese.

int dai_set_config(struct dai *dai, struct ipc_config_dai *config, const void *spec_config)

Digital Audio interface formatting.

int dai_get_handshake(struct dai *dai, int direction, int stream_id)

Get Digital Audio interface DMA Handshake.

int dai_get_fifo_depth(struct dai *dai, int direction)

Get Digital Audio interface fifo depth.

uint32_t dai_get_init_delay_ms(struct dai *dai)

Get DAI initial delay in milliseconds.

int dai_get_stream_id(struct dai *dai, int direction)

Get DAI stream id.

int dai_config_dma_channel(struct dai_data *dd, struct comp_dev *dev, const void *config)

Configure DMA channel for DAI.

Configure HD Audio DMA params for DAI.

void dai_dma_release(struct dai_data *dd, struct comp_dev *dev)

Reset DAI DMA config.

int dai_config(struct dai_data *dd, struct comp_dev *dev, struct ipc_config_dai *common_cfg, const void *spec_cfg)

Configure DAI physical interface.

int dai_assign_group(struct dai_data *dd, struct comp_dev *dev, uint32_t group_id)

Assign DAI to a group for simultaneous triggering.

int dai_position(struct comp_dev *dev, struct sof_ipc_stream_posn *posn)

dai position for host driver.

void dai_dma_position_update(struct dai_data *dd, struct comp_dev *dev)

update dai dma position for host driver.

void dai_release_llp_slot(struct dai_data *dd)

release llp slot

struct dai
#include <dai-zephyr.h>

Public Members

uint32_t index
uint32_t type
uint32_t dma_caps
uint32_t dma_dev
const struct device *dev
const struct dai_data *dd
struct k_spinlock lock
#include <dai-zephyr.h>

Public Members

struct dai_group
#include <dai-zephyr.h>

DAI group information.

Public Members

uint32_t group_id

Group ID.

uint32_t num_dais

Number of DAIs in this group.

uint32_t trigger_counter

Number of DAIs to receive a trigger before processing begins.

int trigger_cmd

Trigger command to propagate.

int trigger_ret

Last trigger error.

struct list_item list

Group list.

struct llp_slot_info
#include <dai-zephyr.h>

llp slot info for memory window

Public Members

uint32_t node_id
uint32_t reg_offset
struct dai_data
#include <dai-zephyr.h>

DAI runtime data.

Public Members

struct dma_chan_data *chan
uint32_t stream_id
struct dma_sg_config config
struct dma_config *z_config
struct comp_dev *dai_dev
struct comp_buffer *dma_buffer
struct comp_buffer *local_buffer
struct dai_ts_cfg ts_config
struct dai *dai
struct dma *dma
struct dai_group *group
int xrun
pcm_converter_func process
uint32_t period_bytes
uint64_t total_data_processed
struct ipc_config_dai ipc_config
void *dai_spec_config
uint64_t wallclock
bool delayed_dma_stop
struct llp_slot_info slot_info
uint32_t sampling
bool fast_mode