Sound Open Firmware
Loading...
Searching...
No Matches
Component API

Data Structures

struct  bind_info
struct  comp_ops
 Audio component operations. More...
struct  comp_driver
 Audio component base driver "class". More...
struct  comp_driver_info
 Holds constant pointer to component driver. More...
struct  comp_ipc_config
 Audio component base configuration from IPC at creation. More...
struct  comp_perf_data
struct  comp_dev
 Audio component base device "class". More...

Macros

#define COMP_PROCESSING_DOMAIN_LL   0
#define COMP_PROCESSING_DOMAIN_DP   1
#define comp_dev_for_each_producer(_dev, _producer)
#define comp_dev_for_each_producer_safe(_dev, _producer, _next_producer)
#define comp_dev_for_each_consumer(_dev, _consumer)
#define comp_dev_for_each_consumer_safe(_dev, _consumer, _next_consumer)

Enumerations

enum  comp_endpoint_type { COMP_ENDPOINT_HOST , COMP_ENDPOINT_DAI , COMP_ENDPOINT_NODE }
 Type of endpoint this component is connected to in a pipeline. More...
enum  comp_copy_type { COMP_COPY_INVALID = -1 , COMP_COPY_NORMAL = 0 , COMP_COPY_BLOCKING , COMP_COPY_ONE_SHOT }
 Type of next dma copy mode, changed on runtime. More...
enum  bind_type { COMP_BIND_TYPE_SOURCE , COMP_BIND_TYPE_SINK }

Functions

static struct comp_buffer * comp_dev_get_first_data_producer (struct comp_dev *component)
 Get a pointer to the first comp_buffer object providing data to the component The function will return NULL if there's no data provider.
static struct comp_buffer * comp_dev_get_next_data_producer (struct comp_dev *component, struct comp_buffer *producer)
 Get a pointer to the next comp_buffer object providing data to the component The function will return NULL if there're no more data providers _save version also checks if producer != NULL.
static struct comp_buffer * comp_dev_get_next_data_producer_safe (struct comp_dev *component, struct comp_buffer *producer)
static struct comp_buffer * comp_dev_get_first_data_consumer (struct comp_dev *component)
 Get a pointer to the first comp_buffer object receiving data from the component The function will return NULL if there's no data consumers.
static struct comp_buffer * comp_dev_get_next_data_consumer (struct comp_dev *component, struct comp_buffer *consumer)
 Get a pointer to the next comp_buffer object receiving data from the component The function will return NULL if there're no more data consumers _safe version also checks if consumer is != NULL.
static struct comp_buffer * comp_dev_get_next_data_consumer_safe (struct comp_dev *component, struct comp_buffer *consumer)

Standard Component Stream Commands

TODO: use IPC versions after 1.1

Most component stream commands match one-to-one IPC stream trigger commands. However we add two PRE_ and two POST_ commands to the set. They are issued internally without matching IPC commands. A single START IPC command is translated into a sequence of PRE_START and START component commands, etc. POST_* commands aren't used so far.

enum  {
  COMP_TRIGGER_STOP , COMP_TRIGGER_START , COMP_TRIGGER_PAUSE , COMP_TRIGGER_RELEASE ,
  COMP_TRIGGER_RESET , COMP_TRIGGER_PREPARE , COMP_TRIGGER_XRUN , COMP_TRIGGER_PRE_START ,
  COMP_TRIGGER_PRE_RELEASE , COMP_TRIGGER_POST_STOP , COMP_TRIGGER_POST_PAUSE , COMP_TRIGGER_NO_ACTION
}

Audio Component States

#define COMP_STATE_NOT_EXIST   0
 Component does not exist.
#define COMP_STATE_INIT   1
 Component being initialised.
#define COMP_STATE_READY   2
 Component inactive, but ready.
#define COMP_STATE_SUSPEND   3
 Component suspended.
#define COMP_STATE_PREPARE   4
 Component prepared.
#define COMP_STATE_PAUSED   5
 Component paused.
#define COMP_STATE_ACTIVE   6
 Component active.
#define COMP_STATE_PRE_ACTIVE   7
 Component after early initialisation.

Standard Component Control Commands

"Value" commands are standard ones, known to the driver while "Data" commands are opaque blobs transferred by the driver.

TODO: see also: ref to ipc data structures for commands.

#define COMP_CMD_SET_VALUE   100
 Set value to component.
#define COMP_CMD_GET_VALUE   101
 Get value from component.
#define COMP_CMD_SET_DATA   102
 Set data to component.
#define COMP_CMD_GET_DATA   103
 Get data from component.

MMAP IPC status

#define COMP_CMD_IPC_MMAP_RPOS   200
 Host read position.
#define COMP_CMD_IPC_MMAP_PPOS   201
 DAI presentation position.
#define COMP_CMD_IPC_MMAP_VOL(chan)
 Volume.

Component status

#define COMP_STATUS_STATE_ALREADY_SET   1
 Comp set state status.

Component attribute types

#define COMP_ATTR_COPY_TYPE   0
 Comp copy type attribute.
#define COMP_ATTR_HOST_BUFFER   1
 Comp host buffer attribute.
#define COMP_ATTR_COPY_DIR   2
 Comp copy direction.
#define COMP_ATTR_VDMA_INDEX   3
 Comp index of the virtual DMA at the gateway.
#define COMP_ATTR_BASE_CONFIG   4
 Component base config.
#define COMP_ATTR_IPC4_CONFIG   5
 Component ipc4 set/get config.

Trace macros

#define trace_comp_drv_get_tr_ctx(drv_p)
 Retrieves trace context from the component driver.
#define trace_comp_drv_get_id(drv_p)
 Retrieves id (-1 = undefined) from the component driver.
#define trace_comp_drv_get_subid(drv_p)
 Retrieves subid (-1 = undefined) from the component driver.
#define trace_comp_get_tr_ctx(comp_p)
 Retrieves trace context from the component device.
#define trace_comp_get_id(comp_p)
 Retrieves id (pipe id) from the component device.
#define trace_comp_get_subid(comp_p)
 Retrieves subid (comp id) from the component device.
#define comp_cl_err(drv_p, __e, ...)
 Trace error message from component driver (no comp instance).
#define comp_cl_warn(drv_p, __e, ...)
 Trace warning message from component driver (no comp instance).
#define comp_cl_info(drv_p, __e, ...)
 Trace info message from component driver (no comp instance).
#define comp_cl_dbg(drv_p, __e, ...)
 Trace debug message from component driver (no comp instance).
#define comp_err(comp_p, __e, ...)
 Trace error message from component device.
#define comp_warn(comp_p, __e, ...)
 Trace warning message from component device.
#define comp_info(comp_p, __e, ...)
 Trace info message from component device.
#define comp_dbg(comp_p, __e, ...)
 Trace debug message from component device.
#define comp_perf_info(pcd, comp_p)
#define comp_perf_avg_info(pcd, comp_p)

Detailed Description

Macro Definition Documentation

◆ COMP_ATTR_BASE_CONFIG

#define COMP_ATTR_BASE_CONFIG   4

Component base config.

◆ COMP_ATTR_COPY_DIR

#define COMP_ATTR_COPY_DIR   2

Comp copy direction.

◆ COMP_ATTR_COPY_TYPE

#define COMP_ATTR_COPY_TYPE   0

Comp copy type attribute.

◆ COMP_ATTR_HOST_BUFFER

#define COMP_ATTR_HOST_BUFFER   1

Comp host buffer attribute.

◆ COMP_ATTR_IPC4_CONFIG

#define COMP_ATTR_IPC4_CONFIG   5

Component ipc4 set/get config.

◆ COMP_ATTR_VDMA_INDEX

#define COMP_ATTR_VDMA_INDEX   3

Comp index of the virtual DMA at the gateway.

◆ comp_cl_dbg

#define comp_cl_dbg ( drv_p,
__e,
... )
Value:
drv_p, \
__e, ##__VA_ARGS__)
#define trace_comp_drv_get_subid(drv_p)
Retrieves subid (-1 = undefined) from the component driver.
Definition component.h:139
#define trace_comp_drv_get_tr_ctx(drv_p)
Retrieves trace context from the component driver.
Definition component.h:133
#define trace_comp_drv_get_id(drv_p)
Retrieves id (-1 = undefined) from the component driver.
Definition component.h:136
#define trace_dev_dbg(get_ctx_m, get_id_m, get_subid_m, dev, fmt,...)
Trace from a device on dbg level.
Definition trace-soflogger.h:310

Trace debug message from component driver (no comp instance).

◆ comp_cl_err

#define comp_cl_err ( drv_p,
__e,
... )
Value:
drv_p, \
__e, ##__VA_ARGS__)
#define trace_dev_err(get_ctx_m, get_id_m, get_subid_m, dev, fmt,...)
Trace from a device on err level.
Definition trace-soflogger.h:292

Trace error message from component driver (no comp instance).

◆ comp_cl_info

#define comp_cl_info ( drv_p,
__e,
... )
Value:
drv_p, \
__e, ##__VA_ARGS__)
#define trace_dev_info(get_ctx_m, get_id_m, get_subid_m, dev, fmt,...)
Trace from a device on info level.
Definition trace-soflogger.h:304

Trace info message from component driver (no comp instance).

◆ comp_cl_warn

#define comp_cl_warn ( drv_p,
__e,
... )
Value:
drv_p, \
__e, ##__VA_ARGS__)
#define trace_dev_warn(get_ctx_m, get_id_m, get_subid_m, dev, fmt,...)
Trace from a device on warning level.
Definition trace-soflogger.h:298

Trace warning message from component driver (no comp instance).

◆ COMP_CMD_GET_DATA

#define COMP_CMD_GET_DATA   103

Get data from component.

◆ COMP_CMD_GET_VALUE

#define COMP_CMD_GET_VALUE   101

Get value from component.

◆ COMP_CMD_IPC_MMAP_PPOS

#define COMP_CMD_IPC_MMAP_PPOS   201

DAI presentation position.

◆ COMP_CMD_IPC_MMAP_RPOS

#define COMP_CMD_IPC_MMAP_RPOS   200

Host read position.

◆ COMP_CMD_IPC_MMAP_VOL

#define COMP_CMD_IPC_MMAP_VOL ( chan)
Value:
(216 + chan)

Volume.

◆ COMP_CMD_SET_DATA

#define COMP_CMD_SET_DATA   102

Set data to component.

◆ COMP_CMD_SET_VALUE

#define COMP_CMD_SET_VALUE   100

Set value to component.

◆ comp_dbg

#define comp_dbg ( comp_p,
__e,
... )
Value:
trace_comp_get_subid, comp_p, __e, ##__VA_ARGS__)
#define trace_comp_get_id(comp_p)
Retrieves id (pipe id) from the component device.
Definition component.h:145
#define trace_comp_get_subid(comp_p)
Retrieves subid (comp id) from the component device.
Definition component.h:148
#define trace_comp_get_tr_ctx(comp_p)
Retrieves trace context from the component device.
Definition component.h:142

Trace debug message from component device.

◆ comp_dev_for_each_consumer

#define comp_dev_for_each_consumer ( _dev,
_consumer )
Value:
for (_consumer = comp_dev_get_first_data_consumer(_dev); \
_consumer != NULL; \
_consumer = comp_dev_get_next_data_consumer(_dev, _consumer)) \
static struct comp_buffer * comp_dev_get_next_data_consumer(struct comp_dev *component, struct comp_buffer *consumer)
Get a pointer to the next comp_buffer object receiving data from the component The function will retu...
Definition component.h:751
static struct comp_buffer * comp_dev_get_first_data_consumer(struct comp_dev *component)
Get a pointer to the first comp_buffer object receiving data from the component The function will ret...
Definition component.h:740

◆ comp_dev_for_each_consumer_safe

#define comp_dev_for_each_consumer_safe ( _dev,
_consumer,
_next_consumer )
Value:
for (_consumer = comp_dev_get_first_data_consumer(_dev), \
_next_consumer = comp_dev_get_next_data_consumer_safe(_dev, _consumer); \
_consumer != NULL; \
_consumer = _next_consumer, \
_next_consumer = comp_dev_get_next_data_consumer_safe(_dev, _consumer))
static struct comp_buffer * comp_dev_get_next_data_consumer_safe(struct comp_dev *component, struct comp_buffer *consumer)
Definition component.h:758

◆ comp_dev_for_each_producer

#define comp_dev_for_each_producer ( _dev,
_producer )
Value:
for (_producer = comp_dev_get_first_data_producer(_dev); \
_producer != NULL; \
_producer = comp_dev_get_next_data_producer(_dev, _producer))
static struct comp_buffer * comp_dev_get_first_data_producer(struct comp_dev *component)
Get a pointer to the first comp_buffer object providing data to the component The function will retur...
Definition component.h:712
static struct comp_buffer * comp_dev_get_next_data_producer(struct comp_dev *component, struct comp_buffer *producer)
Get a pointer to the next comp_buffer object providing data to the component The function will return...
Definition component.h:723

◆ comp_dev_for_each_producer_safe

#define comp_dev_for_each_producer_safe ( _dev,
_producer,
_next_producer )
Value:
for (_producer = comp_dev_get_first_data_producer(_dev), \
_next_producer = comp_dev_get_next_data_producer_safe(_dev, _producer); \
_producer != NULL; \
_producer = _next_producer, \
_next_producer = comp_dev_get_next_data_producer_safe(_dev, _producer))
static struct comp_buffer * comp_dev_get_next_data_producer_safe(struct comp_dev *component, struct comp_buffer *producer)
Definition component.h:730

◆ comp_err

#define comp_err ( comp_p,
__e,
... )
Value:

Trace error message from component device.

◆ comp_info

#define comp_info ( comp_p,
__e,
... )
Value:

Trace info message from component device.

◆ comp_perf_avg_info

#define comp_perf_avg_info ( pcd,
comp_p )
Value:
comp_info(comp_p, "perf comp_copy samples %u period %u cpu avg %u peak %u %u",\
(uint32_t)((comp_p)->frames), \
(uint32_t)((comp_p)->period), \
(uint32_t)((pcd)->cpu_delta_sum), \
(uint32_t)((pcd)->cpu_delta_peak), \
(uint32_t)((pcd)->peak_mcps_period_cnt))
#define comp_info(comp_p, __e,...)
Trace info message from component device.
Definition component.h:228

◆ comp_perf_info

#define comp_perf_info ( pcd,
comp_p )
Value:
comp_info(comp_p, "perf comp_copy peak plat %u cpu %u", \
(uint32_t)((pcd)->plat_delta_peak), \
(uint32_t)((pcd)->cpu_delta_peak))

◆ COMP_PROCESSING_DOMAIN_DP

#define COMP_PROCESSING_DOMAIN_DP   1

◆ COMP_PROCESSING_DOMAIN_LL

#define COMP_PROCESSING_DOMAIN_LL   0

◆ COMP_STATE_ACTIVE

#define COMP_STATE_ACTIVE   6

Component active.

◆ COMP_STATE_INIT

#define COMP_STATE_INIT   1

Component being initialised.

◆ COMP_STATE_NOT_EXIST

#define COMP_STATE_NOT_EXIST   0

Component does not exist.

◆ COMP_STATE_PAUSED

#define COMP_STATE_PAUSED   5

Component paused.

◆ COMP_STATE_PRE_ACTIVE

#define COMP_STATE_PRE_ACTIVE   7

Component after early initialisation.

◆ COMP_STATE_PREPARE

#define COMP_STATE_PREPARE   4

Component prepared.

◆ COMP_STATE_READY

#define COMP_STATE_READY   2

Component inactive, but ready.

◆ COMP_STATE_SUSPEND

#define COMP_STATE_SUSPEND   3

Component suspended.

◆ COMP_STATUS_STATE_ALREADY_SET

#define COMP_STATUS_STATE_ALREADY_SET   1

Comp set state status.

◆ comp_warn

#define comp_warn ( comp_p,
__e,
... )
Value:

Trace warning message from component device.

◆ trace_comp_drv_get_id

#define trace_comp_drv_get_id ( drv_p)
Value:
(-1)

Retrieves id (-1 = undefined) from the component driver.

◆ trace_comp_drv_get_subid

#define trace_comp_drv_get_subid ( drv_p)
Value:
(-1)

Retrieves subid (-1 = undefined) from the component driver.

◆ trace_comp_drv_get_tr_ctx

#define trace_comp_drv_get_tr_ctx ( drv_p)
Value:
((drv_p)->tctx)

Retrieves trace context from the component driver.

◆ trace_comp_get_id

#define trace_comp_get_id ( comp_p)
Value:
((comp_p)->ipc_config.pipeline_id)

Retrieves id (pipe id) from the component device.

◆ trace_comp_get_subid

#define trace_comp_get_subid ( comp_p)
Value:
((comp_p)->ipc_config.id)

Retrieves subid (comp id) from the component device.

◆ trace_comp_get_tr_ctx

#define trace_comp_get_tr_ctx ( comp_p)
Value:
(&(comp_p)->tctx)

Retrieves trace context from the component device.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
COMP_TRIGGER_STOP 

Stop component stream.

COMP_TRIGGER_START 

Start component stream.

COMP_TRIGGER_PAUSE 

Pause the component stream.

COMP_TRIGGER_RELEASE 

Release paused component stream.

COMP_TRIGGER_RESET 

Reset component.

COMP_TRIGGER_PREPARE 

Prepare component.

COMP_TRIGGER_XRUN 

XRUN component.

COMP_TRIGGER_PRE_START 

Prepare to start component stream.

COMP_TRIGGER_PRE_RELEASE 

Prepare to release paused component stream.

COMP_TRIGGER_POST_STOP 

Finalize stop component stream.

COMP_TRIGGER_POST_PAUSE 

Finalize pause component stream.

COMP_TRIGGER_NO_ACTION 

No action required.

◆ bind_type

enum bind_type
Enumerator
COMP_BIND_TYPE_SOURCE 
COMP_BIND_TYPE_SINK 

◆ comp_copy_type

Type of next dma copy mode, changed on runtime.

Supported by host as COMP_ATTR_COPY_TYPE parameter to comp_set_attribute().

Enumerator
COMP_COPY_INVALID 

Invalid.

COMP_COPY_NORMAL 

Normal.

COMP_COPY_BLOCKING 

Blocking.

COMP_COPY_ONE_SHOT 

One-shot.

◆ comp_endpoint_type

Type of endpoint this component is connected to in a pipeline.

Enumerator
COMP_ENDPOINT_HOST 

Connected to host dma.

COMP_ENDPOINT_DAI 

Connected to dai dma.

COMP_ENDPOINT_NODE 

No dma connection.

Function Documentation

◆ comp_dev_get_first_data_consumer()

struct comp_buffer * comp_dev_get_first_data_consumer ( struct comp_dev * component)
inlinestatic

Get a pointer to the first comp_buffer object receiving data from the component The function will return NULL if there's no data consumers.

◆ comp_dev_get_first_data_producer()

struct comp_buffer * comp_dev_get_first_data_producer ( struct comp_dev * component)
inlinestatic

Get a pointer to the first comp_buffer object providing data to the component The function will return NULL if there's no data provider.

◆ comp_dev_get_next_data_consumer()

struct comp_buffer * comp_dev_get_next_data_consumer ( struct comp_dev * component,
struct comp_buffer * consumer )
inlinestatic

Get a pointer to the next comp_buffer object receiving data from the component The function will return NULL if there're no more data consumers _safe version also checks if consumer is != NULL.

◆ comp_dev_get_next_data_consumer_safe()

struct comp_buffer * comp_dev_get_next_data_consumer_safe ( struct comp_dev * component,
struct comp_buffer * consumer )
inlinestatic

◆ comp_dev_get_next_data_producer()

struct comp_buffer * comp_dev_get_next_data_producer ( struct comp_dev * component,
struct comp_buffer * producer )
inlinestatic

Get a pointer to the next comp_buffer object providing data to the component The function will return NULL if there're no more data providers _save version also checks if producer != NULL.

◆ comp_dev_get_next_data_producer_safe()

struct comp_buffer * comp_dev_get_next_data_producer_safe ( struct comp_dev * component,
struct comp_buffer * producer )
inlinestatic