Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions src/audio/chain_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <sof/schedule/schedule.h>
#include <rtos/task.h>
#include <sof/lib/dma.h>
#include <sof/lib/memory.h>
#include <ipc4/error_status.h>
#include <ipc4/module.h>
#include <ipc4/pipeline.h>
Expand Down Expand Up @@ -390,10 +391,12 @@ static int chain_task_pause(struct comp_dev *dev)
return ret;
}

static void chain_release(struct comp_dev *dev)
__cold static void chain_release(struct comp_dev *dev)
{
struct chain_dma_data *cd = comp_get_drvdata(dev);

assert_can_be_cold();

dma_release_channel(cd->chan_host->dma->z_dev, cd->chan_host->index);
sof_dma_put(cd->dma_host);
dma_release_channel(cd->chan_link->dma->z_dev, cd->chan_link->index);
Expand All @@ -406,12 +409,14 @@ static void chain_release(struct comp_dev *dev)
}

/* Retrieves host connector node id from dma id */
static int get_connector_node_id(uint32_t dma_id, bool host_type,
union ipc4_connector_node_id *connector_node_id)
__cold static int get_connector_node_id(uint32_t dma_id, bool host_type,
union ipc4_connector_node_id *connector_node_id)
{
uint32_t max_out, max_in;
uint8_t type, type2;

assert_can_be_cold();

if (host_type) {
type = ipc4_hda_host_output_class;
type2 = ipc4_hda_host_input_class;
Expand All @@ -437,7 +442,7 @@ static int get_connector_node_id(uint32_t dma_id, bool host_type,
return 0;
}

static int chain_init(struct comp_dev *dev, void *addr, size_t length)
__cold static int chain_init(struct comp_dev *dev, void *addr, size_t length)
{
struct chain_dma_data *cd = comp_get_drvdata(dev);
struct dma_block_config *dma_block_cfg_host = &cd->dma_block_cfg_host;
Expand All @@ -447,6 +452,8 @@ static int chain_init(struct comp_dev *dev, void *addr, size_t length)
int channel;
int err;

assert_can_be_cold();

memset(dma_cfg_host, 0, sizeof(*dma_cfg_host));
memset(dma_block_cfg_host, 0, sizeof(*dma_block_cfg_host));
dma_cfg_host->block_count = 1;
Expand Down Expand Up @@ -520,8 +527,8 @@ static int chain_init(struct comp_dev *dev, void *addr, size_t length)
return err;
}

static int chain_task_init(struct comp_dev *dev, uint8_t host_dma_id, uint8_t link_dma_id,
uint32_t fifo_size)
__cold static int chain_task_init(struct comp_dev *dev, uint8_t host_dma_id, uint8_t link_dma_id,
uint32_t fifo_size)
{
struct chain_dma_data *cd = comp_get_drvdata(dev);
uint32_t addr_align;
Expand All @@ -530,6 +537,8 @@ static int chain_task_init(struct comp_dev *dev, uint8_t host_dma_id, uint8_t li
uint32_t dir;
int ret;

assert_can_be_cold();

ret = get_connector_node_id(host_dma_id, true, &cd->host_connector_node_id);
if (ret < 0)
return ret;
Expand Down Expand Up @@ -643,9 +652,9 @@ static int chain_task_trigger(struct comp_dev *dev, int cmd)
}
}

static struct comp_dev *chain_task_create(const struct comp_driver *drv,
const struct comp_ipc_config *ipc_config,
const void *ipc_specific_config)
__cold static struct comp_dev *chain_task_create(const struct comp_driver *drv,
const struct comp_ipc_config *ipc_config,
const void *ipc_specific_config)
{
const struct ipc4_chain_dma *cdma = (struct ipc4_chain_dma *)ipc_specific_config;
const uint32_t host_dma_id = cdma->primary.r.host_dma_id;
Expand All @@ -656,6 +665,8 @@ static struct comp_dev *chain_task_create(const struct comp_driver *drv,
struct comp_dev *dev;
int ret;

assert_can_be_cold();

if (host_dma_id >= max_chain_number)
return NULL;

Expand Down Expand Up @@ -694,10 +705,12 @@ static struct comp_dev *chain_task_create(const struct comp_driver *drv,
return NULL;
}

static void chain_task_free(struct comp_dev *dev)
__cold static void chain_task_free(struct comp_dev *dev)
{
struct chain_dma_data *cd = comp_get_drvdata(dev);

assert_can_be_cold();

#if CONFIG_XRUN_NOTIFICATIONS_ENABLE
ipc_msg_free(cd->msg_xrun);
#endif
Expand Down