Sound Open Firmware
Loading...
Searching...
No Matches
Static Audio Pipeline Engine

The Static Audio Pipeline subsystem provides compile-time and runtime declarative topology construction for hostless, microcontroller, and standalone embedded platforms running Sound Open Firmware. More...

Data Structures

struct  sof_static_caps
 Audio stream format and sample rate capability descriptor. More...
 
struct  sof_static_comp
 Declarative component descriptor. More...
 
struct  sof_static_module_ops
 Static pipeline module driver operations. More...
 
struct  sof_static_buffer
 Declarative intermediate audio buffer descriptor. More...
 
struct  sof_static_route
 Declarative graph route connecting an upstream component to a downstream component. More...
 
struct  sof_static_pcm
 Declarative PCM endpoint descriptor. More...
 
struct  sof_static_kcontrol
 Declarative static kcontrol descriptor. More...
 
struct  sof_static_pipeline_desc
 Declarative audio pipeline descriptor. More...
 
struct  sof_static_topology
 Top-level static audio topology descriptor. More...
 

Macros

#define SOF_STATIC_RATE_8K   SOF_RATE_8000
 Supported sample rate bitmasks for static capability negotiation.
 
#define SOF_STATIC_RATE_11K   SOF_RATE_11025
 11025 Hz
 
#define SOF_STATIC_RATE_12K   SOF_RATE_12000
 12000 Hz
 
#define SOF_STATIC_RATE_16K   SOF_RATE_16000
 16000 Hz
 
#define SOF_STATIC_RATE_22K   SOF_RATE_22050
 22050 Hz
 
#define SOF_STATIC_RATE_24K   SOF_RATE_24000
 24000 Hz
 
#define SOF_STATIC_RATE_32K   SOF_RATE_32000
 32000 Hz
 
#define SOF_STATIC_RATE_44K1   SOF_RATE_44100
 44100 Hz
 
#define SOF_STATIC_RATE_48K   SOF_RATE_48000
 48000 Hz
 
#define SOF_STATIC_RATE_64K   SOF_RATE_64000
 64000 Hz
 
#define SOF_STATIC_RATE_88K2   SOF_RATE_88200
 88200 Hz
 
#define SOF_STATIC_RATE_96K   SOF_RATE_96000
 96000 Hz
 
#define SOF_STATIC_RATE_176K4   SOF_RATE_176400
 176400 Hz
 
#define SOF_STATIC_RATE_192K   SOF_RATE_192000
 192000 Hz
 
#define SOF_STATIC_RATE_384K   (1 << 14)
 384000 Hz
 
#define SOF_STATIC_FMT_S16_LE   BIT(SOF_IPC_FRAME_S16_LE)
 Supported PCM frame format bitmasks (matching enum sof_ipc_frame)
 
#define SOF_STATIC_FMT_S24_4LE   BIT(SOF_IPC_FRAME_S24_4LE)
 
#define SOF_STATIC_FMT_S32_LE   BIT(SOF_IPC_FRAME_S32_LE)
 
#define SOF_STATIC_FMT_FLOAT   BIT(SOF_IPC_FRAME_FLOAT)
 
#define SOF_STATIC_FMT_S24_3LE   BIT(SOF_IPC_FRAME_S24_3LE)
 
#define SOF_STATIC_FMT_S24_4LE_MSB   BIT(SOF_IPC_FRAME_S24_4LE_MSB)
 
#define SOF_STATIC_FMT_U8   BIT(SOF_IPC_FRAME_U8)
 
#define SOF_STATIC_FMT_S16_4LE   BIT(SOF_IPC_FRAME_S16_4LE)
 
#define SOF_STATIC_FMT_A_LAW   BIT(SOF_IPC_FRAME_A_LAW)
 
#define SOF_STATIC_FMT_MU_LAW   BIT(SOF_IPC_FRAME_MU_LAW)
 
#define SOF_STATIC_RATE_MASK_ALL
 Mask covering all supported sample rates.
 
#define SOF_STATIC_FMT_MASK_ALL
 Mask covering all supported frame formats.
 
#define SOF_STATIC_CAPS(_fmt, _rate, _ch)
 Helper macro to initialize a static capability structure.
 
#define SOF_STATIC_COMP_MODULE(...)    { .type = SOF_STATIC_COMP_MODULE, __VA_ARGS__ }
 Declare a processing module component.
 
#define SOF_STATIC_COMP_HOST(...)    { .type = SOF_STATIC_COMP_HOST, .ep_type = SOF_STATIC_EP_USB_TERMINAL, __VA_ARGS__ }
 Declare a USB/Host streaming endpoint component.
 
#define SOF_STATIC_COMP_DAI(...)    { .type = SOF_STATIC_COMP_DAI, .ep_type = SOF_STATIC_EP_DAI, __VA_ARGS__ }
 Declare a hardware DAI endpoint component.
 
#define SOF_STATIC_MODULE(_id, _ppl, _name, _dir, _uuid, _fmt, _rate, _ch, _blob, _blob_sz)
 Generic constructor macro for an audio processing module component.
 
#define SOF_STATIC_MODULE_RATE_CONV(_id, _ppl, _name, _dir, _uuid, _fmt, _in_rate, _out_rate, _ch)
 Generic constructor macro for a sample rate converter component (SRC / ASRC).
 
#define SOF_STATIC_ENDPOINT_USB(_id, _ppl, _name, _dir, _fmt, _rate, _ch, _term_id)
 Simple constructor macro for a USB / UAC2 streaming endpoint.
 
#define SOF_STATIC_ENDPOINT_DAI(_id, _ppl, _name, _dir, _fmt, _rate, _ch, _type, _idx, _clk_fmt)
 Generic constructor macro for a hardware Digital Audio Interface (DAI) endpoint.
 
#define SOF_STATIC_ENDPOINT_DAI_CFG(_id, _ppl, _name, _dir, _fmt, _rate, _ch, _type, _idx, _clk_fmt, _cfg_fn)
 Constructor macro for a hardware DAI endpoint with custom platform configuration callback.
 
#define DECLARE_STATIC_MODULE_OPS(name, ops)
 Macro to automatically register static module operations at system startup.
 
#define SOF_STATIC_BUFFER(...)    { .flags = SOF_MEM_FLAG_DMA | SOF_MEM_FLAG_USER, .fmt = SOF_IPC_FRAME_INVALID, __VA_ARGS__ }
 Helper macro to declare an intermediate audio buffer with standard flags.
 
#define SOF_STATIC_ROUTE(...)    { __VA_ARGS__ }
 Helper macro to declare a connection route.
 
#define SOF_STATIC_PCM(...)    { __VA_ARGS__ }
 Helper macro to declare a static PCM stream.
 
#define SOF_STATIC_KCONTROL_VOLUME(...)    { .type = SOF_STATIC_CTRL_VOLUME, __VA_ARGS__ }
 Helper macro to declare a volume kcontrol.
 
#define SOF_STATIC_KCONTROL_SWITCH(...)    { .type = SOF_STATIC_CTRL_SWITCH, __VA_ARGS__ }
 Helper macro to declare a boolean switch/bypass kcontrol.
 
#define SOF_STATIC_KCONTROL_ENUM(...)    { .type = SOF_STATIC_CTRL_ENUM, __VA_ARGS__ }
 Helper macro to declare an enumeration selector kcontrol.
 
#define SOF_STATIC_KCONTROL_BINARY(...)    { .type = SOF_STATIC_CTRL_BINARY, __VA_ARGS__ }
 Helper macro to declare a binary configuration kcontrol.
 

Typedefs

typedef int(* sof_static_kcontrol_handler_fn) (const struct sof_static_kcontrol *ctl, int32_t val, void *priv)
 Custom kcontrol callback handler type.
 

Enumerations

enum  sof_static_comp_type { SOF_STATIC_COMP_MODULE = 0 , SOF_STATIC_COMP_HOST , SOF_STATIC_COMP_DAI }
 Category of a static pipeline component. More...
 
enum  sof_static_ep_type { SOF_STATIC_EP_NONE = 0 , SOF_STATIC_EP_USB_TERMINAL , SOF_STATIC_EP_DAI }
 Hardware endpoint binding type. More...
 
enum  sof_static_ctrl_type { SOF_STATIC_CTRL_VOLUME = 0 , SOF_STATIC_CTRL_SWITCH , SOF_STATIC_CTRL_ENUM , SOF_STATIC_CTRL_BINARY }
 Type of static kcontrol. More...
 

Functions

int sof_static_topology_init (const struct sof_static_topology *topo)
 Initialize and instantiate the static topology graph.
 
const struct sof_static_topology * sof_static_topology_get (void)
 Retrieve the currently active static topology descriptor.
 
struct pipeline * sof_static_pipeline_get (uint32_t pipeline_id)
 Retrieve a pipeline instance by its pipeline ID.
 
struct comp_dev * sof_static_comp_get (uint32_t comp_id)
 Retrieve a component device instance by its component ID.
 
struct comp_buffer * sof_static_buffer_get (uint32_t buffer_id)
 Retrieve an intermediate buffer instance by its buffer ID.
 
int sof_static_register_module_ops (struct sof_static_module_ops *ops)
 Register static module operations for an audio component.
 
const struct sof_static_module_ops * sof_static_find_module_ops (const struct sof_uuid *uuid)
 Find registered static module operations by component UUID.
 
void sof_static_init_base_cfg (struct ipc4_base_module_cfg *base_cfg, const struct sof_static_comp *cdesc, uint32_t period_us)
 Synthesize standard IPC4 base module configuration structure.
 
struct comp_dev * sof_static_module_create_default (const struct comp_driver *drv, struct comp_ipc_config *cfg, const struct sof_static_comp *cdesc, uint32_t period_us)
 Default fallback creation for standard IPC4 module adapters.
 
int sof_static_kcontrol_set (uint32_t ctrl_id, int32_t val)
 Set kcontrol value by control ID.
 
int sof_static_kcontrol_set_chan (uint32_t ctrl_id, uint32_t channel, int32_t val)
 Set kcontrol value for a specific audio channel.
 
int sof_static_kcontrol_set_binary (uint32_t ctrl_id, const void *data, size_t size)
 Set binary raw configuration blob on a static kcontrol by control ID.
 
int sof_static_kcontrol_get (uint32_t ctrl_id, int32_t *val)
 Retrieve cached kcontrol value by control ID.
 
int sof_static_kcontrol_find_by_name (const char *name)
 Find kcontrol ID by human-readable name.
 
int sof_static_kcontrol_set_by_uac2 (uint8_t entity_id, uint8_t channel, int32_t val, bool is_volume)
 Dispatch UAC2 feature unit control to registered kcontrols.
 
int sof_static_kcontrol_get_by_uac2 (uint8_t entity_id, uint8_t channel, int32_t *val, bool is_volume)
 Retrieve kcontrol value formatted for UAC2 feature unit response.
 
int sof_static_pipeline_trigger_by_uac2_term (uint8_t terminal_id, bool start)
 Trigger pipeline start or stop associated with a UAC2 terminal ID.
 
int sof_static_pipeline_start (uint32_t pipeline_id)
 Start a static pipeline by pipeline ID.
 
int sof_static_pipeline_stop (uint32_t pipeline_id)
 Stop a static pipeline by pipeline ID.
 
int sof_static_pipeline_trigger (uint32_t pipeline_id, bool start)
 Directly trigger a static pipeline start or stop by pipeline ID.
 
int sof_static_pipeline_set_sample_rate (uint32_t pipeline_id, uint32_t rate)
 Re-negotiate the stream sample rate for a specific static pipeline.
 
uint32_t sof_static_pipeline_get_sample_rate (uint32_t pipeline_id)
 Retrieve the current stream sample rate for a specific static pipeline.
 
int sof_static_set_sample_rate (uint32_t rate)
 Set global sample rate across active static pipelines.
 
uint32_t sof_static_get_sample_rate (void)
 Retrieve current primary sample rate.
 

Detailed Description

The Static Audio Pipeline subsystem provides compile-time and runtime declarative topology construction for hostless, microcontroller, and standalone embedded platforms running Sound Open Firmware.

It allows platforms to construct complete SOF processing graphs (pipelines, modules, DAIs, intermediate buffers, routes, and kcontrols) directly at boot without requiring dynamic IPC topology commands from a host operating system.

Macro Definition Documentation

◆ DECLARE_STATIC_MODULE_OPS

#define DECLARE_STATIC_MODULE_OPS (   name,
  ops 
)
Value:
static int _static_ops_init_##name(void) \
{ \
} \
SYS_INIT(_static_ops_init_##name, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY)
int sof_static_register_module_ops(struct sof_static_module_ops *ops)
Register static module operations for an audio component.

Macro to automatically register static module operations at system startup.

In Zephyr RTOS environments, registers using SYS_INIT at APPLICATION level. In non-Zephyr environments (e.g. POSIX tests), registers using constructor attribute.

Parameters
nameUnique identifier suffix for initialization routine.
opsPointer to struct sof_static_module_ops.

◆ SOF_STATIC_BUFFER

#define SOF_STATIC_BUFFER (   ...)     { .flags = SOF_MEM_FLAG_DMA | SOF_MEM_FLAG_USER, .fmt = SOF_IPC_FRAME_INVALID, __VA_ARGS__ }

Helper macro to declare an intermediate audio buffer with standard flags.

Initializes memory allocation flags to standard DMA and user memory, and defaults the format to SOF_IPC_FRAME_INVALID to inherit the PCM format from the upstream producer.

◆ SOF_STATIC_CAPS

#define SOF_STATIC_CAPS (   _fmt,
  _rate,
  _ch 
)
Value:
{ \
.formats = BIT(_fmt), \
.rates = (_rate == 8000) ? SOF_STATIC_RATE_8K : \
(_rate == 11025) ? SOF_STATIC_RATE_11K : \
(_rate == 12000) ? SOF_STATIC_RATE_12K : \
(_rate == 16000) ? SOF_STATIC_RATE_16K : \
(_rate == 22050) ? SOF_STATIC_RATE_22K : \
(_rate == 24000) ? SOF_STATIC_RATE_24K : \
(_rate == 32000) ? SOF_STATIC_RATE_32K : \
(_rate == 44100) ? SOF_STATIC_RATE_44K1 : \
(_rate == 48000) ? SOF_STATIC_RATE_48K : \
(_rate == 64000) ? SOF_STATIC_RATE_64K : \
(_rate == 88200) ? SOF_STATIC_RATE_88K2 : \
(_rate == 96000) ? SOF_STATIC_RATE_96K : \
(_rate == 176400) ? SOF_STATIC_RATE_176K4 : \
(_rate == 192000) ? SOF_STATIC_RATE_192K : \
(_rate == 384000) ? SOF_STATIC_RATE_384K : SOF_STATIC_RATE_48K, \
.min_channels = (_ch), \
.max_channels = (_ch), \
.default_rate = (_rate), \
.default_fmt = (_fmt), \
}
#define SOF_STATIC_RATE_192K
192000 Hz
Definition static_pipeline.h:60
#define SOF_STATIC_RATE_44K1
44100 Hz
Definition static_pipeline.h:54
#define SOF_STATIC_RATE_88K2
88200 Hz
Definition static_pipeline.h:57
#define SOF_STATIC_RATE_384K
384000 Hz
Definition static_pipeline.h:61
#define SOF_STATIC_RATE_8K
Supported sample rate bitmasks for static capability negotiation.
Definition static_pipeline.h:47
#define SOF_STATIC_RATE_96K
96000 Hz
Definition static_pipeline.h:58
#define SOF_STATIC_RATE_24K
24000 Hz
Definition static_pipeline.h:52
#define SOF_STATIC_RATE_176K4
176400 Hz
Definition static_pipeline.h:59
#define SOF_STATIC_RATE_11K
11025 Hz
Definition static_pipeline.h:48
#define SOF_STATIC_RATE_32K
32000 Hz
Definition static_pipeline.h:53
#define SOF_STATIC_RATE_64K
64000 Hz
Definition static_pipeline.h:56
#define SOF_STATIC_RATE_22K
22050 Hz
Definition static_pipeline.h:51
#define SOF_STATIC_RATE_12K
12000 Hz
Definition static_pipeline.h:49
#define SOF_STATIC_RATE_48K
48000 Hz
Definition static_pipeline.h:55
#define SOF_STATIC_RATE_16K
16000 Hz
Definition static_pipeline.h:50

Helper macro to initialize a static capability structure.

Parameters
_fmtFrame format (e.g. SOF_IPC_FRAME_S16_LE or SOF_IPC_FRAME_FLOAT).
_rateDefault sample rate in Hz (e.g. 48000).
_chNumber of audio channels (e.g. 2).

◆ SOF_STATIC_COMP_DAI

#define SOF_STATIC_COMP_DAI (   ...)     { .type = SOF_STATIC_COMP_DAI, .ep_type = SOF_STATIC_EP_DAI, __VA_ARGS__ }

Declare a hardware DAI endpoint component.

◆ SOF_STATIC_COMP_HOST

#define SOF_STATIC_COMP_HOST (   ...)     { .type = SOF_STATIC_COMP_HOST, .ep_type = SOF_STATIC_EP_USB_TERMINAL, __VA_ARGS__ }

Declare a USB/Host streaming endpoint component.

◆ SOF_STATIC_COMP_MODULE

#define SOF_STATIC_COMP_MODULE (   ...)     { .type = SOF_STATIC_COMP_MODULE, __VA_ARGS__ }

Declare a processing module component.

◆ SOF_STATIC_ENDPOINT_DAI

#define SOF_STATIC_ENDPOINT_DAI (   _id,
  _ppl,
  _name,
  _dir,
  _fmt,
  _rate,
  _ch,
  _type,
  _idx,
  _clk_fmt 
)
Value:
{ \
.id = (_id), \
.pipeline_id = (_ppl), \
.name = (_name), \
.direction = (_dir), \
.caps = SOF_STATIC_CAPS((_fmt), (_rate), (_ch)), \
.ep_type = SOF_STATIC_EP_DAI, \
.ep.dai.dai_type = (_type), \
.ep.dai.dai_index = (_idx), \
.ep.dai.format = (_clk_fmt), \
}
static uint32_t pipeline_id(struct pipeline *p)
Retrieves pipeline ID from pipeline structure.
Definition pipeline.h:291
#define SOF_STATIC_COMP_DAI(...)
Declare a hardware DAI endpoint component.
Definition static_pipeline.h:201
#define SOF_STATIC_CAPS(_fmt, _rate, _ch)
Helper macro to initialize a static capability structure.
Definition static_pipeline.h:109
@ SOF_STATIC_EP_DAI
Physical hardware DAI controller.
Definition static_pipeline.h:152
uint32_t type
Message type, symmetric to the incoming request.
Definition header.h:8

Generic constructor macro for a hardware Digital Audio Interface (DAI) endpoint.

Parameters
_idUnique component ID.
_pplOwning pipeline ID.
_nameHuman-readable component name.
_dirStream direction (SOF_IPC_STREAM_PLAYBACK or SOF_IPC_STREAM_CAPTURE).
_fmtDefault PCM frame format (enum sof_ipc_frame).
_rateStream sample rate in Hz.
_chChannel count.
_typeHardware DAI type (e.g. SOF_DAI_INTEL_SSP, SOF_DAI_ESP32_I2S, etc.).
_idxHardware DAI controller instance index.
_clk_fmtDAI clock format flags (e.g. SOF_DAI_FMT_I2S | SOF_DAI_FMT_CBC_CFC).

◆ SOF_STATIC_ENDPOINT_DAI_CFG

#define SOF_STATIC_ENDPOINT_DAI_CFG (   _id,
  _ppl,
  _name,
  _dir,
  _fmt,
  _rate,
  _ch,
  _type,
  _idx,
  _clk_fmt,
  _cfg_fn 
)
Value:
{ \
.id = (_id), \
.pipeline_id = (_ppl), \
.name = (_name), \
.direction = (_dir), \
.caps = SOF_STATIC_CAPS((_fmt), (_rate), (_ch)), \
.ep_type = SOF_STATIC_EP_DAI, \
.ep.dai.dai_type = (_type), \
.ep.dai.dai_index = (_idx), \
.ep.dai.format = (_clk_fmt), \
.ep.dai.configure = (_cfg_fn), \
}

Constructor macro for a hardware DAI endpoint with custom platform configuration callback.

Parameters
_idUnique component ID.
_pplOwning pipeline ID.
_nameHuman-readable component name.
_dirStream direction (SOF_IPC_STREAM_PLAYBACK or SOF_IPC_STREAM_CAPTURE).
_fmtDefault PCM frame format (enum sof_ipc_frame).
_rateStream sample rate in Hz.
_chChannel count.
_typeHardware DAI type (e.g. SOF_DAI_INTEL_SSP, SOF_DAI_ESP32_I2S, etc.).
_idxHardware DAI controller instance index.
_clk_fmtDAI clock format flags (e.g. SOF_DAI_FMT_I2S | SOF_DAI_FMT_CBC_CFC).
_cfg_fnEndpoint configuration callback function pointer.

◆ SOF_STATIC_ENDPOINT_USB

#define SOF_STATIC_ENDPOINT_USB (   _id,
  _ppl,
  _name,
  _dir,
  _fmt,
  _rate,
  _ch,
  _term_id 
)
Value:
{ \
.id = (_id), \
.pipeline_id = (_ppl), \
.name = (_name), \
.direction = (_dir), \
.caps = SOF_STATIC_CAPS((_fmt), (_rate), (_ch)), \
.ep.usb.terminal_id = (_term_id), \
}
#define SOF_STATIC_COMP_HOST(...)
Declare a USB/Host streaming endpoint component.
Definition static_pipeline.h:195
@ SOF_STATIC_EP_USB_TERMINAL
USB Audio Class 2 (UAC2) streaming terminal.
Definition static_pipeline.h:151

Simple constructor macro for a USB / UAC2 streaming endpoint.

Parameters
_idUnique component ID.
_pplOwning pipeline ID.
_nameHuman-readable component name.
_dirStream direction (SOF_IPC_STREAM_PLAYBACK or SOF_IPC_STREAM_CAPTURE).
_fmtDefault PCM frame format (enum sof_ipc_frame).
_rateStream sample rate in Hz.
_chChannel count.
_term_idUSB Audio Class Terminal ID.

◆ SOF_STATIC_FMT_A_LAW

#define SOF_STATIC_FMT_A_LAW   BIT(SOF_IPC_FRAME_A_LAW)

◆ SOF_STATIC_FMT_FLOAT

#define SOF_STATIC_FMT_FLOAT   BIT(SOF_IPC_FRAME_FLOAT)

◆ SOF_STATIC_FMT_MASK_ALL

#define SOF_STATIC_FMT_MASK_ALL
Value:
#define SOF_STATIC_FMT_U8
Definition static_pipeline.h:70
#define SOF_STATIC_FMT_S32_LE
Definition static_pipeline.h:66
#define SOF_STATIC_FMT_S24_3LE
Definition static_pipeline.h:68
#define SOF_STATIC_FMT_S16_LE
Supported PCM frame format bitmasks (matching enum sof_ipc_frame)
Definition static_pipeline.h:64
#define SOF_STATIC_FMT_MU_LAW
Definition static_pipeline.h:73
#define SOF_STATIC_FMT_S24_4LE_MSB
Definition static_pipeline.h:69
#define SOF_STATIC_FMT_FLOAT
Definition static_pipeline.h:67
#define SOF_STATIC_FMT_A_LAW
Definition static_pipeline.h:72
#define SOF_STATIC_FMT_S16_4LE
Definition static_pipeline.h:71
#define SOF_STATIC_FMT_S24_4LE
Definition static_pipeline.h:65

Mask covering all supported frame formats.

◆ SOF_STATIC_FMT_MU_LAW

#define SOF_STATIC_FMT_MU_LAW   BIT(SOF_IPC_FRAME_MU_LAW)

◆ SOF_STATIC_FMT_S16_4LE

#define SOF_STATIC_FMT_S16_4LE   BIT(SOF_IPC_FRAME_S16_4LE)

◆ SOF_STATIC_FMT_S16_LE

#define SOF_STATIC_FMT_S16_LE   BIT(SOF_IPC_FRAME_S16_LE)

Supported PCM frame format bitmasks (matching enum sof_ipc_frame)

◆ SOF_STATIC_FMT_S24_3LE

#define SOF_STATIC_FMT_S24_3LE   BIT(SOF_IPC_FRAME_S24_3LE)

◆ SOF_STATIC_FMT_S24_4LE

#define SOF_STATIC_FMT_S24_4LE   BIT(SOF_IPC_FRAME_S24_4LE)

◆ SOF_STATIC_FMT_S24_4LE_MSB

#define SOF_STATIC_FMT_S24_4LE_MSB   BIT(SOF_IPC_FRAME_S24_4LE_MSB)

◆ SOF_STATIC_FMT_S32_LE

#define SOF_STATIC_FMT_S32_LE   BIT(SOF_IPC_FRAME_S32_LE)

◆ SOF_STATIC_FMT_U8

#define SOF_STATIC_FMT_U8   BIT(SOF_IPC_FRAME_U8)

◆ SOF_STATIC_KCONTROL_BINARY

#define SOF_STATIC_KCONTROL_BINARY (   ...)     { .type = SOF_STATIC_CTRL_BINARY, __VA_ARGS__ }

Helper macro to declare a binary configuration kcontrol.

◆ SOF_STATIC_KCONTROL_ENUM

#define SOF_STATIC_KCONTROL_ENUM (   ...)     { .type = SOF_STATIC_CTRL_ENUM, __VA_ARGS__ }

Helper macro to declare an enumeration selector kcontrol.

◆ SOF_STATIC_KCONTROL_SWITCH

#define SOF_STATIC_KCONTROL_SWITCH (   ...)     { .type = SOF_STATIC_CTRL_SWITCH, __VA_ARGS__ }

Helper macro to declare a boolean switch/bypass kcontrol.

◆ SOF_STATIC_KCONTROL_VOLUME

#define SOF_STATIC_KCONTROL_VOLUME (   ...)     { .type = SOF_STATIC_CTRL_VOLUME, __VA_ARGS__ }

Helper macro to declare a volume kcontrol.

◆ SOF_STATIC_MODULE

#define SOF_STATIC_MODULE (   _id,
  _ppl,
  _name,
  _dir,
  _uuid,
  _fmt,
  _rate,
  _ch,
  _blob,
  _blob_sz 
)
Value:
{ \
.id = (_id), \
.pipeline_id = (_ppl), \
.name = (_name), \
.uuid = (_uuid), \
.direction = (_dir), \
.caps = SOF_STATIC_CAPS((_fmt), (_rate), (_ch)), \
.init_blob = (_blob), \
.init_blob_size = (_blob_sz), \
}
#define SOF_STATIC_COMP_MODULE(...)
Declare a processing module component.
Definition static_pipeline.h:189

Generic constructor macro for an audio processing module component.

Parameters
_idUnique component ID.
_pplOwning pipeline ID.
_nameHuman-readable component name string.
_dirStream direction (SOF_IPC_STREAM_PLAYBACK or SOF_IPC_STREAM_CAPTURE).
_uuidPointer to component driver UUID (e.g. &volume_uuid).
_fmtDefault PCM frame format (enum sof_ipc_frame).
_rateDefault stream sample rate in Hz.
_chDefault channel count.
_blobOptional pointer to initial configuration blob (or NULL).
_blob_szSize of initial configuration blob in bytes (or 0).

◆ SOF_STATIC_MODULE_RATE_CONV

#define SOF_STATIC_MODULE_RATE_CONV (   _id,
  _ppl,
  _name,
  _dir,
  _uuid,
  _fmt,
  _in_rate,
  _out_rate,
  _ch 
)
Value:
{ \
.id = (_id), \
.pipeline_id = (_ppl), \
.name = (_name), \
.uuid = (_uuid), \
.direction = (_dir), \
.caps = { \
.formats = BIT(_fmt), \
.min_channels = (_ch), \
.max_channels = (_ch), \
.default_rate = (_in_rate), \
.sink_rate = (_out_rate), \
.default_fmt = (_fmt), \
}, \
}
#define SOF_STATIC_RATE_MASK_ALL
Mask covering all supported sample rates.
Definition static_pipeline.h:76

Generic constructor macro for a sample rate converter component (SRC / ASRC).

Parameters
_idUnique component ID.
_pplOwning pipeline ID.
_nameHuman-readable component name string.
_dirStream direction (SOF_IPC_STREAM_PLAYBACK or SOF_IPC_STREAM_CAPTURE).
_uuidPointer to component driver UUID (e.g. &src_uuid, &asrc_uuid).
_fmtDefault PCM frame format (enum sof_ipc_frame).
_in_rateSource/input sample rate in Hz.
_out_rateSink/output sample rate in Hz.
_chChannel count.

◆ SOF_STATIC_PCM

#define SOF_STATIC_PCM (   ...)     { __VA_ARGS__ }

Helper macro to declare a static PCM stream.

◆ SOF_STATIC_RATE_11K

#define SOF_STATIC_RATE_11K   SOF_RATE_11025

11025 Hz

◆ SOF_STATIC_RATE_12K

#define SOF_STATIC_RATE_12K   SOF_RATE_12000

12000 Hz

◆ SOF_STATIC_RATE_16K

#define SOF_STATIC_RATE_16K   SOF_RATE_16000

16000 Hz

◆ SOF_STATIC_RATE_176K4

#define SOF_STATIC_RATE_176K4   SOF_RATE_176400

176400 Hz

◆ SOF_STATIC_RATE_192K

#define SOF_STATIC_RATE_192K   SOF_RATE_192000

192000 Hz

◆ SOF_STATIC_RATE_22K

#define SOF_STATIC_RATE_22K   SOF_RATE_22050

22050 Hz

◆ SOF_STATIC_RATE_24K

#define SOF_STATIC_RATE_24K   SOF_RATE_24000

24000 Hz

◆ SOF_STATIC_RATE_32K

#define SOF_STATIC_RATE_32K   SOF_RATE_32000

32000 Hz

◆ SOF_STATIC_RATE_384K

#define SOF_STATIC_RATE_384K   (1 << 14)

384000 Hz

◆ SOF_STATIC_RATE_44K1

#define SOF_STATIC_RATE_44K1   SOF_RATE_44100

44100 Hz

◆ SOF_STATIC_RATE_48K

#define SOF_STATIC_RATE_48K   SOF_RATE_48000

48000 Hz

◆ SOF_STATIC_RATE_64K

#define SOF_STATIC_RATE_64K   SOF_RATE_64000

64000 Hz

◆ SOF_STATIC_RATE_88K2

#define SOF_STATIC_RATE_88K2   SOF_RATE_88200

88200 Hz

◆ SOF_STATIC_RATE_8K

#define SOF_STATIC_RATE_8K   SOF_RATE_8000

Supported sample rate bitmasks for static capability negotiation.

8000 Hz

◆ SOF_STATIC_RATE_96K

#define SOF_STATIC_RATE_96K   SOF_RATE_96000

96000 Hz

◆ SOF_STATIC_RATE_MASK_ALL

◆ SOF_STATIC_ROUTE

#define SOF_STATIC_ROUTE (   ...)     { __VA_ARGS__ }

Helper macro to declare a connection route.

Typedef Documentation

◆ sof_static_kcontrol_handler_fn

typedef int(* sof_static_kcontrol_handler_fn) (const struct sof_static_kcontrol *ctl, int32_t val, void *priv)

Custom kcontrol callback handler type.

Allows platforms or applications to register custom kcontrol dispatch logic for non-module controls (e.g. clock modes, routes, injector switches).

Parameters
[in]ctlPointer to the static kcontrol descriptor.
[in]valValue to write.
[in,out]privPrivate user/platform context.
Returns
0 on success, negative errno on failure.

Enumeration Type Documentation

◆ sof_static_comp_type

Category of a static pipeline component.

Enumerator
SOF_STATIC_COMP_MODULE 

Audio processing module (Volume, EQ, DRC, etc.)

SOF_STATIC_COMP_HOST 

Host or USB streaming endpoint.

SOF_STATIC_COMP_DAI 

Hardware Digital Audio Interface (I2S, PDM, SAI, SPDIF)

◆ sof_static_ctrl_type

Type of static kcontrol.

Enumerator
SOF_STATIC_CTRL_VOLUME 

Linear or dB volume fader.

SOF_STATIC_CTRL_SWITCH 

Boolean mute or module bypass switch.

SOF_STATIC_CTRL_ENUM 

Multi-value enumeration selector.

SOF_STATIC_CTRL_BINARY 

Raw binary parameter or coefficient blob.

◆ sof_static_ep_type

Hardware endpoint binding type.

Enumerator
SOF_STATIC_EP_NONE 

Standard internal processing module.

SOF_STATIC_EP_USB_TERMINAL 

USB Audio Class 2 (UAC2) streaming terminal.

SOF_STATIC_EP_DAI 

Physical hardware DAI controller.

Function Documentation

◆ sof_static_buffer_get()

struct comp_buffer * sof_static_buffer_get ( uint32_t  buffer_id)

Retrieve an intermediate buffer instance by its buffer ID.

Parameters
[in]buffer_idUnique buffer ID.
Returns
Pointer to struct comp_buffer, or NULL if not found.

◆ sof_static_comp_get()

struct comp_dev * sof_static_comp_get ( uint32_t  comp_id)

Retrieve a component device instance by its component ID.

Parameters
[in]comp_idUnique component ID.
Returns
Pointer to struct comp_dev, or NULL if not found.

◆ sof_static_find_module_ops()

const struct sof_static_module_ops * sof_static_find_module_ops ( const struct sof_uuid *  uuid)

Find registered static module operations by component UUID.

Parameters
[in]uuidUUID of target component.
Returns
Pointer to registered ops, or NULL if not found.

◆ sof_static_get_sample_rate()

uint32_t sof_static_get_sample_rate ( void  )

Retrieve current primary sample rate.

Returns
Current sample rate in Hz.

◆ sof_static_init_base_cfg()

void sof_static_init_base_cfg ( struct ipc4_base_module_cfg *  base_cfg,
const struct sof_static_comp *  cdesc,
uint32_t  period_us 
)

Synthesize standard IPC4 base module configuration structure.

Parameters
[out]base_cfgTarget base configuration to populate.
[in]cdescStatic component descriptor with format and rate capabilities.
[in]period_usPipeline scheduling period in microseconds.

◆ sof_static_kcontrol_find_by_name()

int sof_static_kcontrol_find_by_name ( const char *  name)

Find kcontrol ID by human-readable name.

Parameters
[in]nameControl name string to search for.
Returns
Control ID >= 0 if found, -ENOENT if not found.

◆ sof_static_kcontrol_get()

int sof_static_kcontrol_get ( uint32_t  ctrl_id,
int32_t *  val 
)

Retrieve cached kcontrol value by control ID.

Parameters
[in]ctrl_idUnique control ID.
[out]valPointer to store retrieved control value.
Returns
0 on success, negative errno on failure.

◆ sof_static_kcontrol_get_by_uac2()

int sof_static_kcontrol_get_by_uac2 ( uint8_t  entity_id,
uint8_t  channel,
int32_t *  val,
bool  is_volume 
)

Retrieve kcontrol value formatted for UAC2 feature unit response.

Parameters
[in]entity_idUAC2 Feature Unit Entity ID.
[in]channelAudio channel index.
[out]valPointer to store retrieved value.
[in]is_volumeTrue for volume query, false for mute query.
Returns
0 on success, negative errno on failure.

◆ sof_static_kcontrol_set()

int sof_static_kcontrol_set ( uint32_t  ctrl_id,
int32_t  val 
)

Set kcontrol value by control ID.

Dispatches to the target module via its registered static operations (struct sof_static_module_ops), or invokes the topology's custom_control_handler.

Parameters
[in]ctrl_idUnique control ID.
[in]valValue to apply.
Returns
0 on success, negative errno on failure.

◆ sof_static_kcontrol_set_binary()

int sof_static_kcontrol_set_binary ( uint32_t  ctrl_id,
const void *  data,
size_t  size 
)

Set binary raw configuration blob on a static kcontrol by control ID.

Dispatches the raw binary configuration blob to the target component associated with the designated kcontrol via apply_binary or module adapter large config.

Parameters
[in]ctrl_idTarget kcontrol identifier.
[in]dataPointer to raw configuration blob.
[in]sizeSize of data blob in bytes.
Returns
0 on success, negative errno on failure.

◆ sof_static_kcontrol_set_by_uac2()

int sof_static_kcontrol_set_by_uac2 ( uint8_t  entity_id,
uint8_t  channel,
int32_t  val,
bool  is_volume 
)

Dispatch UAC2 feature unit control to registered kcontrols.

Parameters
[in]entity_idUAC2 Feature Unit Entity ID.
[in]channelAudio channel index (0 = master/all).
[in]valValue from USB request (e.g. 8.8 fixed-point dB volume or boolean mute).
[in]is_volumeTrue for volume command, false for mute command.
Returns
0 on success, negative errno on failure.

◆ sof_static_kcontrol_set_chan()

int sof_static_kcontrol_set_chan ( uint32_t  ctrl_id,
uint32_t  channel,
int32_t  val 
)

Set kcontrol value for a specific audio channel.

Dispatches control value to a specific audio channel of the target component via apply_volume_chan, apply_switch_chan, or apply_enum.

Parameters
[in]ctrl_idUnique control ID.
[in]channelChannel index (0-based).
[in]valValue to apply.
Returns
0 on success, negative errno on failure.

◆ sof_static_module_create_default()

struct comp_dev * sof_static_module_create_default ( const struct comp_driver *  drv,
struct comp_ipc_config *  cfg,
const struct sof_static_comp *  cdesc,
uint32_t  period_us 
)

Default fallback creation for standard IPC4 module adapters.

Parameters
[in]drvSOF component driver.
[in]cfgIPC component configuration.
[in]cdescStatic component descriptor.
[in]period_usOwning pipeline scheduling period in microseconds.
Returns
Created comp_dev pointer, or NULL on failure.

◆ sof_static_pipeline_get()

struct pipeline * sof_static_pipeline_get ( uint32_t  pipeline_id)

Retrieve a pipeline instance by its pipeline ID.

Parameters
[in]pipeline_idUnique pipeline ID.
Returns
Pointer to struct pipeline, or NULL if not found.

◆ sof_static_pipeline_get_sample_rate()

uint32_t sof_static_pipeline_get_sample_rate ( uint32_t  pipeline_id)

Retrieve the current stream sample rate for a specific static pipeline.

Parameters
[in]pipeline_idTarget pipeline identifier.
Returns
Pipeline sample rate in Hz, or 0 if pipeline not found.

◆ sof_static_pipeline_set_sample_rate()

int sof_static_pipeline_set_sample_rate ( uint32_t  pipeline_id,
uint32_t  rate 
)

Re-negotiate the stream sample rate for a specific static pipeline.

Re-negotiates the sample rate for the designated pipeline and its constituent components and buffers while the pipeline is in paused or stopped state. Validates that all constituent components support the requested rate according to their capability masks, reconfigures buffer period sizes, and propagates pipeline_params() and pipeline_prepare() through the pipeline graph.

Parameters
[in]pipeline_idTarget pipeline identifier.
[in]rateTarget sample rate in Hz (e.g. 16000, 44100, 48000, 96000).
Returns
0 on success, -EBUSY if the pipeline is currently active, -EINVAL if the rate is unsupported by component capabilities, or negative errno on failure.

◆ sof_static_pipeline_start()

int sof_static_pipeline_start ( uint32_t  pipeline_id)

Start a static pipeline by pipeline ID.

Prepares the pipeline and constituent components if needed, propagates start triggers, transitions state to COMP_STATE_ACTIVE, and activates scheduling copy tasks.

Parameters
[in]pipeline_idTarget pipeline ID.
Returns
0 on success, negative errno on failure.

◆ sof_static_pipeline_stop()

int sof_static_pipeline_stop ( uint32_t  pipeline_id)

Stop a static pipeline by pipeline ID.

Propagates stop triggers, cancels scheduling copy tasks, and transitions pipeline state to COMP_STATE_PAUSED.

Parameters
[in]pipeline_idTarget pipeline ID.
Returns
0 on success, negative errno on failure.

◆ sof_static_pipeline_trigger()

int sof_static_pipeline_trigger ( uint32_t  pipeline_id,
bool  start 
)

Directly trigger a static pipeline start or stop by pipeline ID.

Synchronously transitions the pipeline state machine, propagates triggers to all constituent components, and manages scheduling task execution. Dispatches directly to sof_static_pipeline_start() or sof_static_pipeline_stop().

Parameters
[in]pipeline_idTarget pipeline ID.
[in]startTrue to start pipeline, false to stop.
Returns
0 on success, negative errno on failure.

◆ sof_static_pipeline_trigger_by_uac2_term()

int sof_static_pipeline_trigger_by_uac2_term ( uint8_t  terminal_id,
bool  start 
)

Trigger pipeline start or stop associated with a UAC2 terminal ID.

Parameters
[in]terminal_idBound UAC2 Terminal Entity ID.
[in]startTrue to start pipeline, false to pause/stop.
Returns
0 on success, negative errno on failure.

◆ sof_static_register_module_ops()

int sof_static_register_module_ops ( struct sof_static_module_ops *  ops)

Register static module operations for an audio component.

Audio processing modules register static operations at boot or module load time to handle static component instantiation and kcontrol dispatch without hardcoded component logic in the generic pipeline engine.

Parameters
[in,out]opsPointer to module operations structure.
Returns
0 on success, negative error code on failure.

◆ sof_static_set_sample_rate()

int sof_static_set_sample_rate ( uint32_t  rate)

Set global sample rate across active static pipelines.

In pipelines with sample rate converters (SRC / ASRC), individual pipeline sections maintain their distinct sample rates according to their component capabilities and buffer configurations.

Parameters
[in]rateTarget primary sample rate in Hz (e.g. 48000).
Returns
0 on success, negative errno on failure.

◆ sof_static_topology_get()

const struct sof_static_topology * sof_static_topology_get ( void  )

Retrieve the currently active static topology descriptor.

Returns
Pointer to active topology descriptor, or NULL if uninitialized.

◆ sof_static_topology_init()

int sof_static_topology_init ( const struct sof_static_topology *  topo)

Initialize and instantiate the static topology graph.

Allocates pipelines, instantiates components from the driver registry, initializes intermediate buffers, establishes graph connections, negotiates component stream parameters, and prepares all pipelines for streaming.

Parameters
[in]topoPointer to the target static topology definition.
Returns
0 on success, negative errno on failure.