diff --git a/drivers/dai/nxp/sai/sai.c b/drivers/dai/nxp/sai/sai.c index c61e6115a80..8deb17e06a1 100644 --- a/drivers/dai/nxp/sai/sai.c +++ b/drivers/dai/nxp/sai/sai.c @@ -696,7 +696,7 @@ static int sai_trigger_start(const struct device *dev, struct sai_data *data; const struct sai_config *cfg; uint32_t old_state; - int ret; + int ret, i; data = dev->data; cfg = dev->config; @@ -733,7 +733,12 @@ static int sai_trigger_start(const struct device *dev, SAI_TX_RX_ENABLE_DISABLE_IRQ(dir, data->regmap, kSAI_FIFOErrorInterruptEnable, true); - /* TODO: is there a need to write some words to the FIFO to avoid starvation? */ + /* avoid initial underrun by writing a frame's worth of 0s */ + if (dir == DAI_DIR_TX) { + for (i = 0; i < data->cfg.channels; i++) { + SAI_WriteData(UINT_TO_I2S(data->regmap), cfg->tx_dline, 0x0); + } + } /* TODO: for now, only DMA mode is supported */ SAI_TX_RX_DMA_ENABLE_DISABLE(dir, data->regmap, true);