|
Sound Open Firmware
|
Digital Audio Interfaces (DAI), Direct Memory Access (DMA), and Power Management (PM) runtime. More...
Data Structures | |
| struct | dai |
| union | hdalink_cfg |
| struct | dai_group |
| DAI group information. More... | |
| struct | llp_slot_info |
| llp slot info for memory window More... | |
| struct | dai_data |
| DAI runtime data. More... | |
| struct | dma_sg_elem |
| Element of SG list (as array item). More... | |
| struct | dma_cb_data |
| Data used in DMA callbacks. More... | |
| struct | dma_sg_elem_array |
| SG elem array. More... | |
| struct | dma_sg_config |
| struct | dma_chan_status |
| struct | dma_plat_data |
| struct | dma |
| struct | dma_chan_data |
| struct | dma_info |
| struct | dma_copy |
Macros | |
| #define | DAI_CREAT BIT(0) |
| If the device does not exist it will be created. | |
| #define | SOF_DMA_DIR_MEM_TO_MEM BIT(0) |
| local memory copy | |
| #define | SOF_DMA_DIR_HMEM_TO_LMEM BIT(1) |
| host memory to local mem copy | |
| #define | SOF_DMA_DIR_LMEM_TO_HMEM BIT(2) |
| local mem to host mem copy | |
| #define | SOF_DMA_DIR_MEM_TO_DEV BIT(3) |
| local mem to dev copy | |
| #define | SOF_DMA_DIR_DEV_TO_MEM BIT(4) |
| dev to local mem copy | |
| #define | SOF_DMA_DIR_DEV_TO_DEV BIT(5) |
| dev to dev copy | |
| #define | SOF_DMA_CAP_HDA BIT(0) |
| HDA DMA. | |
| #define | SOF_DMA_CAP_GP_LP BIT(1) |
| GP LP DMA. | |
| #define | SOF_DMA_CAP_GP_HP BIT(2) |
| GP HP DMA. | |
| #define | SOF_DMA_CAP_BT BIT(3) |
| BT DMA. | |
| #define | SOF_DMA_CAP_SP BIT(4) |
| SP DMA. | |
| #define | SOF_DMA_CAP_DMIC BIT(5) |
| ACP DMA DMIC > | |
| #define | SOF_DMA_CAP_SP_VIRTUAL BIT(6) |
| SP VIRTUAL DMA. | |
| #define | SOF_DMA_CAP_HS_VIRTUAL BIT(7) |
| HS VIRTUAL DMA. | |
| #define | SOF_DMA_CAP_HS BIT(8) |
| HS DMA. | |
| #define | SOF_DMA_CAP_SW BIT(9) |
| SW DMA. | |
| #define | SOF_DMA_CAP_TDM BIT(10) |
| connectable to ACP TDM I2S | |
| #define | SOF_DMA_DEV_HOST BIT(0) |
| connectable to host | |
| #define | SOF_DMA_DEV_HDA BIT(1) |
| connectable to HD/A link | |
| #define | SOF_DMA_DEV_SSP BIT(2) |
| connectable to SSP fifo | |
| #define | SOF_DMA_DEV_DMIC BIT(3) |
| connectable to DMIC fifo | |
| #define | SOF_DMA_DEV_SSI BIT(4) |
| connectable to SSI / SPI fifo | |
| #define | SOF_DMA_DEV_ALH BIT(5) |
| connectable to ALH link | |
| #define | SOF_DMA_DEV_SAI BIT(6) |
| connectable to SAI fifo | |
| #define | SOF_DMA_DEV_ESAI BIT(7) |
| connectable to ESAI fifo | |
| #define | SOF_DMA_DEV_BT BIT(8) |
| connectable to ACP BT I2S | |
| #define | SOF_DMA_DEV_SP BIT(9) |
| connectable to ACP SP I2S | |
| #define | SOF_DMA_DEV_AFE_MEMIF BIT(10) |
| connectable to AFE fifo | |
| #define | SOF_DMA_DEV_SP_VIRTUAL BIT(11) |
| connectable to ACP SP VIRTUAL I2S | |
| #define | SOF_DMA_DEV_HS_VIRTUAL BIT(12) |
| connectable to ACP HS VIRTUAL I2S | |
| #define | SOF_DMA_DEV_HS BIT(13) |
| connectable to ACP HS I2S | |
| #define | SOF_DMA_DEV_MICFIL BIT(14) |
| connectable to MICFIL fifo | |
| #define | SOF_DMA_DEV_SW BIT(15) |
| connectable to ACP SW | |
| #define | SOF_DMA_DEV_TDM BIT(16) |
| connectable to ACP TDM I2S | |
| #define | SOF_DMA_ACCESS_EXCLUSIVE 1 |
| #define | SOF_DMA_ACCESS_SHARED 0 |
| #define | SOF_DMA_COPY_BLOCKING BIT(0) |
| #define | SOF_DMA_COPY_ONE_SHOT BIT(1) |
| #define | SOF_DMA_CHAN_INVALID 0xFFFFFFFF |
| #define | SOF_DMA_CORE_INVALID 0xFFFFFFFF |
Typedefs | |
| typedef int(* | channel_copy_func) (const struct audio_stream *src, unsigned int src_channel, struct audio_stream *dst, unsigned int dst_channel, unsigned int frames) |
| typedef int(* | dma_process_func) (const struct cir_buf_source *source, uint32_t src_channels, struct cir_buf_sink *sink, uint32_t sink_channels, size_t source_samples, uint32_t chmap) |
Enumerations | |
| enum | sof_dma_cb_status { SOF_DMA_CB_STATUS_RELOAD = 0 , SOF_DMA_CB_STATUS_END } |
| enum | pm_runtime_context { PM_RUNTIME_DSP } |
| Runtime power management context. More... | |
Functions | |
| static void | dai_write (struct dai *dai, uint32_t reg, uint32_t value) |
| Write a 32-bit register on the specified DAI controller. | |
| static uint32_t | dai_read (struct dai *dai, uint32_t reg) |
| Read a 32-bit register from the specified DAI controller. | |
| static void | dai_update_bits (struct dai *dai, uint32_t reg, uint32_t mask, uint32_t value) |
| Read-modify-write bit fields of a DAI register. | |
| struct dai_group * | dai_group_get (uint32_t group_id, uint32_t flags) |
| API to request DAI group. | |
| void | dai_group_put (struct dai_group *group) |
| API to release DAI group. | |
| static int | dai_init (struct sof *sof) |
| API to initialize a platform DAI. | |
| struct dai * | dai_get (uint32_t type, uint32_t index, uint32_t flags) |
| API to request a platform DAI. | |
| void | dai_put (struct dai *dai) |
| API to release a platform DAI. | |
| int | dai_set_config (struct dai *dai, struct ipc_config_dai *config, const void *spec_config, size_t size) |
| 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. | |
| void | dai_set_link_hda_config (uint16_t *link_config, struct ipc_config_dai *common_config, const void *spec_config) |
| 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 | |
| const struct device * | dai_get_device (enum sof_ipc_dai_type type, uint32_t index) |
| Retrieve a pointer to the Zephyr device structure for a DAI of a given type and index. | |
| const struct device ** | dai_get_device_list (size_t *count) |
| Retrieve the list of all DAI devices. | |
| int | platform_boot_complete (uint32_t boot_message) |
| Platform specific implementation of the On Boot Complete handler. | |
| int | platform_init (struct sof *sof) |
| Platform initialization entry, called during FW initialization. | |
| int | platform_context_save (struct sof *sof) |
| Platform specific context saving routine, called during DSP suspending. | |
| int | dmac_init (struct sof *sof) |
| API to initialize a platform DMA controllers. | |
| static void | dma_sg_init (struct dma_sg_elem_array *ea) |
| int | dma_sg_alloc (struct k_heap *heap, struct dma_sg_elem_array *ea, uint32_t flags, uint32_t direction, uint32_t buffer_count, uint32_t buffer_bytes, uintptr_t dma_buffer_addr, uintptr_t external_addr) |
| void | dma_sg_free (struct k_heap *heap, struct dma_sg_elem_array *ea) |
| static uint32_t | dma_sg_get_size (struct dma_sg_elem_array *ea) |
| Get the total size of SG buffer. | |
| int | dma_buffer_copy_from (struct comp_buffer *source, struct comp_buffer *sink, dma_process_func process, uint32_t source_bytes, uint32_t chmap) |
| int | stream_copy_from_no_consume (struct comp_dev *dev, struct comp_buffer *source, struct comp_buffer *sink, dma_process_func process, uint32_t source_bytes, uint32_t chmap) |
| int | dma_buffer_copy_to (struct comp_buffer *source, struct comp_buffer *sink, dma_process_func process, uint32_t sink_bytes, uint32_t chmap) |
| static const struct dma_info * | dma_info_get (void) |
| static void | pm_runtime_init (struct sof *sof) |
| Initializes runtime power management. | |
| void | pm_runtime_get (enum pm_runtime_context context, uint32_t index) |
| Retrieves power management resource (async). | |
| static void | pm_runtime_get_sync (enum pm_runtime_context context, uint32_t index) |
| Retrieves power management resource. | |
| void | pm_runtime_put (enum pm_runtime_context context, uint32_t index) |
| Releases power management resource (async). | |
| static void | pm_runtime_put_sync (enum pm_runtime_context context, uint32_t index) |
| Releases power management resource. | |
| void | pm_runtime_enable (enum pm_runtime_context context, uint32_t index) |
| Enables power management operations for the resource. | |
| void | pm_runtime_disable (enum pm_runtime_context context, uint32_t index) |
| Disables power management operations for the resource. | |
| bool | pm_runtime_is_active (enum pm_runtime_context context, uint32_t index) |
| Reports state of the power managed resource. | |
| static void | platform_pm_runtime_prepare_d0ix_en (uint32_t index) |
| Prepare platform hardware and power gating for D0ix idle entry. | |
Digital Audio Interfaces (DAI), Direct Memory Access (DMA), and Power Management (PM) runtime.
SOF PM runtime specification mapping for Zephyr builds.
SOF DMA Drivers API specification (deprecated interface, to be replaced by Zephyr zephyr/drivers/dma.h interface).
Platform API specification.
DAI Drivers API specification.
This interface is considered deprecated and native Zephyr interfaces should be used instead.
| #define DAI_CREAT BIT(0) |
If the device does not exist it will be created.
| #define SOF_DMA_ACCESS_EXCLUSIVE 1 |
| #define SOF_DMA_ACCESS_SHARED 0 |
| #define SOF_DMA_CAP_BT BIT(3) |
BT DMA.
| #define SOF_DMA_CAP_DMIC BIT(5) |
ACP DMA DMIC >
| #define SOF_DMA_CAP_GP_HP BIT(2) |
GP HP DMA.
| #define SOF_DMA_CAP_GP_LP BIT(1) |
GP LP DMA.
| #define SOF_DMA_CAP_HDA BIT(0) |
HDA DMA.
| #define SOF_DMA_CAP_HS BIT(8) |
HS DMA.
| #define SOF_DMA_CAP_HS_VIRTUAL BIT(7) |
HS VIRTUAL DMA.
| #define SOF_DMA_CAP_SP BIT(4) |
SP DMA.
| #define SOF_DMA_CAP_SP_VIRTUAL BIT(6) |
SP VIRTUAL DMA.
| #define SOF_DMA_CAP_SW BIT(9) |
SW DMA.
| #define SOF_DMA_CAP_TDM BIT(10) |
connectable to ACP TDM I2S
| #define SOF_DMA_CHAN_INVALID 0xFFFFFFFF |
| #define SOF_DMA_COPY_BLOCKING BIT(0) |
| #define SOF_DMA_COPY_ONE_SHOT BIT(1) |
| #define SOF_DMA_CORE_INVALID 0xFFFFFFFF |
| #define SOF_DMA_DEV_AFE_MEMIF BIT(10) |
connectable to AFE fifo
| #define SOF_DMA_DEV_ALH BIT(5) |
connectable to ALH link
| #define SOF_DMA_DEV_BT BIT(8) |
connectable to ACP BT I2S
| #define SOF_DMA_DEV_DMIC BIT(3) |
connectable to DMIC fifo
| #define SOF_DMA_DEV_ESAI BIT(7) |
connectable to ESAI fifo
| #define SOF_DMA_DEV_HDA BIT(1) |
connectable to HD/A link
| #define SOF_DMA_DEV_HOST BIT(0) |
connectable to host
| #define SOF_DMA_DEV_HS BIT(13) |
connectable to ACP HS I2S
| #define SOF_DMA_DEV_HS_VIRTUAL BIT(12) |
connectable to ACP HS VIRTUAL I2S
| #define SOF_DMA_DEV_MICFIL BIT(14) |
connectable to MICFIL fifo
| #define SOF_DMA_DEV_SAI BIT(6) |
connectable to SAI fifo
| #define SOF_DMA_DEV_SP BIT(9) |
connectable to ACP SP I2S
| #define SOF_DMA_DEV_SP_VIRTUAL BIT(11) |
connectable to ACP SP VIRTUAL I2S
| #define SOF_DMA_DEV_SSI BIT(4) |
connectable to SSI / SPI fifo
| #define SOF_DMA_DEV_SSP BIT(2) |
connectable to SSP fifo
| #define SOF_DMA_DEV_SW BIT(15) |
connectable to ACP SW
| #define SOF_DMA_DEV_TDM BIT(16) |
connectable to ACP TDM I2S
| #define SOF_DMA_DIR_DEV_TO_DEV BIT(5) |
dev to dev copy
| #define SOF_DMA_DIR_DEV_TO_MEM BIT(4) |
dev to local mem copy
| #define SOF_DMA_DIR_HMEM_TO_LMEM BIT(1) |
host memory to local mem copy
| #define SOF_DMA_DIR_LMEM_TO_HMEM BIT(2) |
local mem to host mem copy
| #define SOF_DMA_DIR_MEM_TO_DEV BIT(3) |
local mem to dev copy
| #define SOF_DMA_DIR_MEM_TO_MEM BIT(0) |
local memory copy
| typedef int(* channel_copy_func) (const struct audio_stream *src, unsigned int src_channel, struct audio_stream *dst, unsigned int dst_channel, unsigned int frames) |
| typedef int(* dma_process_func) (const struct cir_buf_source *source, uint32_t src_channels, struct cir_buf_sink *sink, uint32_t sink_channels, size_t source_samples, uint32_t chmap) |
| enum pm_runtime_context |
| enum sof_dma_cb_status |
Assign DAI to a group for simultaneous triggering.
| 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.
Configure DMA channel for DAI.
update dai dma position for host driver.
| struct dai * dai_get | ( | uint32_t | type, |
| uint32_t | index, | ||
| uint32_t | flags | ||
| ) |
API to request a platform DAI.
| [in] | type | Type of requested DAI. |
| [in] | index | Index of requested DAI. |
| [in] | flags | Flags (CREATE) |
| const struct device * dai_get_device | ( | enum sof_ipc_dai_type | type, |
| uint32_t | index | ||
| ) |
Retrieve a pointer to the Zephyr device structure for a DAI of a given type and index.
| const struct device ** dai_get_device_list | ( | size_t * | count | ) |
Retrieve the list of all DAI devices.
| count | Pointer to store the number of devices in the list. |
| int dai_get_fifo_depth | ( | struct dai * | dai, |
| int | direction | ||
| ) |
Get Digital Audio interface fifo depth.
| int dai_get_handshake | ( | struct dai * | dai, |
| int | direction, | ||
| int | stream_id | ||
| ) |
Get Digital Audio interface DMA Handshake.
| 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.
| 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.
| [in] | group_id | Group ID |
| [in] | flags | Flags (CREATE) |
| void dai_group_put | ( | struct dai_group * | group | ) |
API to release DAI group.
Decrements the DAI counter inside the group.
| [in] | group | Group |
|
inlinestatic |
API to initialize a platform DAI.
| [in] | sof | Pointer to firmware main context. |
| int dai_position | ( | struct comp_dev * | dev, |
| struct sof_ipc_stream_posn * | posn | ||
| ) |
dai position for host driver.
| void dai_put | ( | struct dai * | dai | ) |
API to release a platform DAI.
| [in] | dai | DAI to relese. |
|
inlinestatic |
Read a 32-bit register from the specified DAI controller.
| dai | Pointer to DAI device descriptor. |
| reg | Register offset. |
| void dai_release_llp_slot | ( | struct dai_data * | dd | ) |
release llp slot
| int dai_set_config | ( | struct dai * | dai, |
| struct ipc_config_dai * | config, | ||
| const void * | spec_config, | ||
| size_t | size | ||
| ) |
Digital Audio interface formatting.
| void dai_set_link_hda_config | ( | uint16_t * | link_config, |
| struct ipc_config_dai * | common_config, | ||
| const void * | spec_config | ||
| ) |
Configure HD Audio DMA params for DAI.
|
inlinestatic |
Read-modify-write bit fields of a DAI register.
| dai | Pointer to DAI device descriptor. |
| reg | Register offset. |
| mask | Bitmask of fields to modify. |
| value | New bit values to set within mask. |
|
inlinestatic |
Write a 32-bit register on the specified DAI controller.
| dai | Pointer to DAI device descriptor. |
| reg | Register offset. |
| value | 32-bit value to write. |
| int dma_buffer_copy_from | ( | struct comp_buffer * | source, |
| struct comp_buffer * | sink, | ||
| dma_process_func | process, | ||
| uint32_t | source_bytes, | ||
| uint32_t | chmap | ||
| ) |
| int dma_buffer_copy_to | ( | struct comp_buffer * | source, |
| struct comp_buffer * | sink, | ||
| dma_process_func | process, | ||
| uint32_t | sink_bytes, | ||
| uint32_t | chmap | ||
| ) |
|
inlinestatic |
| int dma_sg_alloc | ( | struct k_heap * | heap, |
| struct dma_sg_elem_array * | ea, | ||
| uint32_t | flags, | ||
| uint32_t | direction, | ||
| uint32_t | buffer_count, | ||
| uint32_t | buffer_bytes, | ||
| uintptr_t | dma_buffer_addr, | ||
| uintptr_t | external_addr | ||
| ) |
| void dma_sg_free | ( | struct k_heap * | heap, |
| struct dma_sg_elem_array * | ea | ||
| ) |
|
inlinestatic |
Get the total size of SG buffer.
| ea | Array of SG elements. |
|
inlinestatic |
| int dmac_init | ( | struct sof * | sof | ) |
API to initialize a platform DMA controllers.
| [in] | sof | Pointer to firmware main context. |
| int platform_boot_complete | ( | uint32_t | boot_message | ) |
Platform specific implementation of the On Boot Complete handler.
| [in] | boot_message | Boot status code. |
| int platform_context_save | ( | struct sof * | sof | ) |
Platform specific context saving routine, called during DSP suspending.
| [in] | sof | Context. |
| int platform_init | ( | struct sof * | sof | ) |
Platform initialization entry, called during FW initialization.
| [in] | sof | Context. |
|
inlinestatic |
Prepare platform hardware and power gating for D0ix idle entry.
| index | Index or context identifier for the target power-managed domain. |
| void pm_runtime_disable | ( | enum pm_runtime_context | context, |
| uint32_t | index | ||
| ) |
Disables power management operations for the resource.
| [in] | context | Type of power management context. |
| [in] | index | Index of the device. |
| void pm_runtime_enable | ( | enum pm_runtime_context | context, |
| uint32_t | index | ||
| ) |
Enables power management operations for the resource.
| [in] | context | Type of power management context. |
| [in] | index | Index of the device. |
| void pm_runtime_get | ( | enum pm_runtime_context | context, |
| uint32_t | index | ||
| ) |
Retrieves power management resource (async).
| [in] | context | Type of power management context. |
| [in] | index | Index of the device. |
|
inlinestatic |
Retrieves power management resource.
| [in] | context | Type of power management context. |
| [in] | index | Index of the device. |
|
inlinestatic |
Initializes runtime power management.
| bool pm_runtime_is_active | ( | enum pm_runtime_context | context, |
| uint32_t | index | ||
| ) |
Reports state of the power managed resource.
| context | Type of power management context. |
| index | Index of the resource. |
| void pm_runtime_put | ( | enum pm_runtime_context | context, |
| uint32_t | index | ||
| ) |
Releases power management resource (async).
| [in] | context | Type of power management context. |
| [in] | index | Index of the device. |
|
inlinestatic |
Releases power management resource.
| [in] | context | Type of power management context. |
| [in] | index | Index of the device. |
| int stream_copy_from_no_consume | ( | struct comp_dev * | dev, |
| struct comp_buffer * | source, | ||
| struct comp_buffer * | sink, | ||
| dma_process_func | process, | ||
| uint32_t | source_bytes, | ||
| uint32_t | chmap | ||
| ) |