ipc4: dai: initialized dma position in dai_config

The dma position is only used by ipc4 and host
requires it is initialized when the copier module
is initialized.

Signed-off-by: Rander Wang <rander.wang@intel.com>
This commit is contained in:
Rander Wang 2022-02-09 15:46:45 +08:00 committed by Liam Girdwood
parent 9edc5725fd
commit 79a9c873f8
4 changed files with 17 additions and 24 deletions

View File

@ -605,8 +605,6 @@ static int dai_config_prepare(struct comp_dev *dev)
comp_info(dev, "dai_config_prepare(): new configured dma channel index %d",
dd->chan->index);
dai_dma_position_init(dd);
/* setup callback */
notifier_register(dev, dd->chan, NOTIFIER_ID_DMA_COPY,
dai_dma_cb, 0);

View File

@ -520,11 +520,6 @@ int dai_assign_group(struct comp_dev *dev, uint32_t group_id);
*/
int dai_position(struct comp_dev *dev, struct sof_ipc_stream_posn *posn);
/**
* \brief init dai dma position for host driver.
*/
void dai_dma_position_init(struct dai_data *dd);
/**
* \brief update dai dma position for host driver.
*/

View File

@ -365,6 +365,4 @@ int dai_position(struct comp_dev *dev, struct sof_ipc_stream_posn *posn)
return 0;
}
void dai_dma_position_init(struct dai_data *dd) { }
void dai_dma_position_update(struct comp_dev *dev) { }

View File

@ -199,6 +199,21 @@ void dai_dma_release(struct comp_dev *dev)
}
}
static void dai_dma_position_init(struct dai_data *dd)
{
struct ipc4_llp_reading_slot slot;
uint32_t llp_reg_offset;
uint32_t node_id;
get_llp_reg_info(dd, &node_id, &llp_reg_offset);
if (!node_id)
return;
memset_s(&slot, sizeof(slot), 0, sizeof(slot));
slot.node_id = node_id;
mailbox_sw_regs_write(llp_reg_offset, &slot, sizeof(slot));
}
int dai_config(struct comp_dev *dev, struct ipc_config_dai *common_config,
void *spec_config)
{
@ -255,6 +270,8 @@ int dai_config(struct comp_dev *dev, struct ipc_config_dai *common_config,
}
}
dai_dma_position_init(dd);
return dai_set_config(dd->dai, common_config, copier_cfg->gtw_cfg.config_data);
}
@ -284,21 +301,6 @@ int dai_position(struct comp_dev *dev, struct sof_ipc_stream_posn *posn)
return 0;
}
void dai_dma_position_init(struct dai_data *dd)
{
struct ipc4_llp_reading_slot slot;
uint32_t llp_reg_offset;
uint32_t node_id;
get_llp_reg_info(dd, &node_id, &llp_reg_offset);
if (!node_id)
return;
memset_s(&slot, sizeof(slot), 0, sizeof(slot));
slot.node_id = node_id;
mailbox_sw_regs_write(llp_reg_offset, &slot, sizeof(slot));
}
void dai_dma_position_update(struct comp_dev *dev)
{
struct dai_data *dd = comp_get_drvdata(dev);