drivers: imx: sai: esai: Implement get_hw_params

Add proper implementation for [e]sai_get_hw_params. This function is
required for all DAI drivers and lacks even assert checks.

Without this implementation we would have a jump to address 0, which
manifested itself as a hang on i.MX8MP (did not test the other platforms
but they are all broken).

Fixes: 55866f28 "comp: dai: implement dai_get_hw_params() function"
Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
This commit is contained in:
Paul Olaru 2020-03-06 16:23:17 +02:00 committed by Daniel Baluta
parent aba0bb2051
commit ee0fac6e91
2 changed files with 28 additions and 0 deletions

View File

@ -426,6 +426,19 @@ static int esai_get_fifo(struct dai *dai, int direction, int stream_id)
} }
} }
static int esai_get_hw_params(struct dai *dai,
struct sof_ipc_stream_params *params,
int dir)
{
/* ESAI only currently supports these parameters */
params->rate = 48000;
params->channels = 2;
params->buffer_fmt = 0;
params->frame_fmt = SOF_IPC_FRAME_S24_4LE;
return 0;
}
const struct dai_driver esai_driver = { const struct dai_driver esai_driver = {
.type = SOF_DAI_IMX_ESAI, .type = SOF_DAI_IMX_ESAI,
.dma_dev = DMA_DEV_ESAI, .dma_dev = DMA_DEV_ESAI,
@ -437,5 +450,6 @@ const struct dai_driver esai_driver = {
.probe = esai_probe, .probe = esai_probe,
.get_handshake = esai_get_handshake, .get_handshake = esai_get_handshake,
.get_fifo = esai_get_fifo, .get_fifo = esai_get_fifo,
.get_hw_params = esai_get_hw_params,
}, },
}; };

View File

@ -320,6 +320,19 @@ static int sai_get_fifo(struct dai *dai, int direction, int stream_id)
} }
} }
static int sai_get_hw_params(struct dai *dai,
struct sof_ipc_stream_params *params,
int dir)
{
/* SAI only currently supports these parameters */
params->rate = 48000;
params->channels = 2;
params->buffer_fmt = 0;
params->frame_fmt = SOF_IPC_FRAME_S32_LE;
return 0;
}
const struct dai_driver sai_driver = { const struct dai_driver sai_driver = {
.type = SOF_DAI_IMX_SAI, .type = SOF_DAI_IMX_SAI,
.dma_dev = DMA_DEV_SAI, .dma_dev = DMA_DEV_SAI,
@ -331,5 +344,6 @@ const struct dai_driver sai_driver = {
.probe = sai_probe, .probe = sai_probe,
.get_handshake = sai_get_handshake, .get_handshake = sai_get_handshake,
.get_fifo = sai_get_fifo, .get_fifo = sai_get_fifo,
.get_hw_params = sai_get_hw_params,
}, },
}; };