drivers: amd: renoir: fix for Bo noise during stream start

Flush i2s fifo buffers before stream start.
Re-arrange host buffer DMA operations.

Signed-off-by: Balakishorepati <balaKishore.pati@amd.com>
This commit is contained in:
Balakishorepati 2022-05-05 10:14:28 +05:30 committed by Liam Girdwood
parent b4591ca8f4
commit a92355b499
2 changed files with 10 additions and 2 deletions

View File

@ -350,8 +350,6 @@ static int acp_dma_copy(struct dma_chan_data *channel, int bytes, uint32_t flags
}
ret = acp_dma_stop(channel);
}
notifier_event(channel, NOTIFIER_ID_DMA_COPY,
NOTIFIER_TARGET_CORE_LOCAL, &next, sizeof(next));
/* Reconfigure dma descriptors for stream channels only */
if (channel->index != DMA_TRACE_CHANNEL) {
/* Reconfigure the dma descriptors for next buffer of data after the call back */
@ -361,6 +359,8 @@ static int acp_dma_copy(struct dma_chan_data *channel, int bytes, uint32_t flags
/* Stop the dma for requested channel */
acp_dma_stop(channel);
}
notifier_event(channel, NOTIFIER_ID_DMA_COPY,
NOTIFIER_TARGET_CORE_LOCAL, &next, sizeof(next));
return ret;
}

View File

@ -39,6 +39,7 @@ DECLARE_SOF_UUID("acp-sp", acp_sp_uuid, 0x3ac07334, 0x41ce, 0x4447,
DECLARE_TR_CTX(acp_sp_tr, SOF_UUID(acp_sp_uuid), LOG_LEVEL_INFO);
#define SP_FIFO_SIZE 512
#define SP_IER_DISABLE 0x0
static uint64_t prev_tx_pos;
static uint64_t prev_rx_pos;
@ -169,6 +170,11 @@ static int acp_dai_sp_dma_stop(struct dma_chan_data *channel)
tr_err(&acp_sp_tr, " ACP: Stop direction not defined %d", channel->direction);
return -EINVAL;
}
sp_iter = (acp_i2stdm_iter_t)io_reg_read((PU_REGISTER_BASE + ACP_I2STDM_ITER));
sp_irer = (acp_i2stdm_irer_t)io_reg_read((PU_REGISTER_BASE + ACP_I2STDM_IRER));
if (!sp_iter.bits.i2stdm_txen && !sp_irer.bits.i2stdm_rx_en)
io_reg_write((PU_REGISTER_BASE + ACP_I2STDM_IER), SP_IER_DISABLE);
return 0;
}
@ -206,6 +212,7 @@ static int acp_dai_sp_dma_set_config(struct dma_chan_data *channel,
/* SP Transmit FIFO Address and FIFO Size*/
sp_fifo_addr = (uint32_t)(&pscratch_mem_cfg->acp_transmit_fifo_buffer);
memset((void *)sp_fifo_addr, 0, SP_FIFO_SIZE);
io_reg_write((PU_REGISTER_BASE + ACP_I2S_TX_FIFOADDR), sp_fifo_addr);
io_reg_write((PU_REGISTER_BASE + ACP_I2S_TX_FIFOSIZE), (uint32_t)(SP_FIFO_SIZE));
@ -225,6 +232,7 @@ static int acp_dai_sp_dma_set_config(struct dma_chan_data *channel,
/* SP Receive FIFO Address and FIFO Size*/
sp_fifo_addr = (uint32_t)(&pscratch_mem_cfg->acp_receive_fifo_buffer);
memset((void *)sp_fifo_addr, 0, SP_FIFO_SIZE);
io_reg_write((PU_REGISTER_BASE + ACP_I2S_RX_FIFOADDR), sp_fifo_addr);
io_reg_write((PU_REGISTER_BASE + ACP_I2S_RX_FIFOSIZE),
(uint32_t)(SP_FIFO_SIZE));