Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: dai: sai: write some data into TX FIFO before start #72791

Merged
merged 1 commit into from
May 17, 2024
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
9 changes: 7 additions & 2 deletions drivers/dai/nxp/sai/sai.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Loading