DAI Drivers API

group sof_dai_drivers

DAI Drivers API specification.

Defines

DAI_CLOCK_IN
DAI_CLOCK_OUT
DAI_DIR_PLAYBACK
DAI_DIR_CAPTURE
DAI_NUM_SLOT_MAPS
DAI_INFO_TYPE
DAI_INFO_DMA_CAPS
DAI_INFO_DMA_DEV
DAI_FLAGS_IRQ_CB

IRQ used for copy() timer.

DAI_CREAT

If the device does not exist it will be created.

trace_dai_get_id(dai_p)
trace_dai_get_subid(dai_p)
dai_cl_err(drv_p, __e, ...)
dai_cl_info(drv_p, __e, ...)
dai_cl_dbg(drv_p, __e, ...)
dai_err(dai_p, __e, ...)
dai_info(dai_p, __e, ...)
dai_dbg(dai_p, __e, ...)
dai_set_drvdata(dai, data)
dai_get_drvdata(dai)
dai_base(dai)
dai_irq(dai)
dai_fifo(dai, direction)

Functions

int dai_init(struct sof * sof)

API to initialize a platform DAI.

Parameters
  • sof: Pointer to firmware main context.

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

API to request a platform DAI.

Parameters
  • type: Type of requested DAI.
  • index: Index of requested DAI.
  • flags: Flags (CREATE)

void dai_put(struct dai * dai)

API to release a platform DAI.

Parameters
  • dai: DAI to relese.

static int dai_set_config(struct dai * dai, struct sof_ipc_dai_config * config)

Digital Audio interface formatting.

static int dai_trigger(struct dai * dai, int cmd, int direction)

Digital Audio interface trigger.

static int dai_pm_context_store(struct dai * dai)

Digital Audio interface PM context store.

static int dai_pm_context_restore(struct dai * dai)

Digital Audio interface PM context restore.

static int dai_get_hw_params(struct dai * dai, struct sof_ipc_stream_params * params)

Get Digital Audio interface stream parameters.

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

Get Digital Audio interface DMA Handshake.

static int dai_get_fifo(struct dai * dai, int direction, int stream_id)

Get Digital Audio interface FIFO address.

static int dai_probe(struct dai * dai)

Digital Audio interface Probe.

static int dai_remove(struct dai * dai)

Digital Audio interface Remove.

static int dai_get_info(struct dai * dai, int info)

Get driver specific DAI information.

static void dai_write(struct dai * dai, uint32_t reg, uint32_t value)
static uint32_t dai_read(struct dai * dai, uint32_t reg)
static void dai_update_bits(struct dai * dai, uint32_t reg, uint32_t mask, uint32_t value)
static const struct dai_info* dai_info_get(void)
struct dai_ops
#include <dai.h>

DAI operations - all optional.

Public Members

intset_config)(struct dai *dai, struct sof_ipc_dai_config *config)
inttrigger)(struct dai *dai, int cmd, int direction)
intpm_context_restore)(struct dai *dai)
intpm_context_store)(struct dai *dai)
intget_hw_params)(struct dai *dai, struct sof_ipc_stream_params *params)
intget_handshake)(struct dai *dai, int direction, int stream_id)
intget_fifo)(struct dai *dai, int direction, int stream_id)
intprobe)(struct dai *dai)
intremove)(struct dai *dai)
struct timestamp_cfg
#include <dai.h>

Public Members

uint32_t walclk_rate
int type
int direction
int index
int dma_id
int dma_chan_index
int dma_chan_count
struct timestamp_data
#include <dai.h>

Public Members

uint64_t walclk
uint64_t sample
uint32_t walclk_rate
struct timestamp_ops
#include <dai.h>

Public Members

intts_config)(struct dai *dai, struct timestamp_cfg *cfg)
intts_start)(struct dai *dai, struct timestamp_cfg *cfg)
intts_stop)(struct dai *dai, struct timestamp_cfg *cfg)
intts_get)(struct dai *dai, struct timestamp_cfg *cfg, struct timestamp_data *tsd)
struct dai_driver
#include <dai.h>

Public Members

uint32_t type

type, one of SOF_DAI_…

uint32_t dma_caps
uint32_t dma_dev
struct dai_ops ops
struct timestamp_ops ts_ops
struct dai_slot_map
#include <dai.h>

DAI slot map to audio channel.

Public Members

uint32_t channel

channel ID - CHAN_ID_

uint32_t slot

physical slot index

struct dai_plat_fifo_data
#include <dai.h>

Public Members

uint32_t offset
uint32_t width
uint32_t depth
uint32_t watermark
uint32_t handshake
struct dai_plat_data
#include <dai.h>

DAI platform data.

Public Members

uint32_t base
int irq
const char* irq_name
uint32_t flags
struct dai_plat_fifo_data dai_plat_data::fifo[2]
struct dai
#include <dai.h>

Public Members

uint32_t index

index

spinlock_t lock

locking mechanism

int sref

simple ref counter, guarded by lock

struct dai_plat_data plat_data
const struct dai_driver* drv
void* private
struct dai_type_info
#include <dai.h>

Array of DAIs grouped by type.

Public Members

uint32_t type

Type.

struct dai* dai_array

Array of DAIs.

size_t num_dais

Number of elements in dai_array.

struct dai_info
#include <dai.h>

Holds information about array of DAIs grouped by type.

Public Members

const struct dai_type_info* dai_type_array
size_t num_dai_types