In order to support IDT 801034 QUAD PCM CODEC, implement trailing clock for the amount of requested bits. On fsl SPI, the minimum we can implement is a 4 bits shot. If the requested number is greated than 8, use 16. Signed-off-by: Christophe Leroy <christophe.leroy@xxxxxxxxxx> --- drivers/spi/spi-fsl-spi.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index bdf94cc7be1a..aefaea439672 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c @@ -424,13 +424,30 @@ static int fsl_spi_do_one_msg(struct spi_master *master, } } - m->status = status; - if (status || !cs_change) { ndelay(nsecs); fsl_spi_chipselect(spi, BITBANG_CS_INACTIVE); } + if (!status && spi->trailing_bits) { + struct spi_transfer t = { + .len = 1, + .tx_buf = empty_zero_page, + }; + + if (spi->trailing_bits < 4) + t.bits_per_word = 4; + else if (spi->trailing_bits > 8) + t.bits_per_word = 16; + else + t.bits_per_word = spi->trailing_bits; + + status = fsl_spi_setup_transfer(spi, &t); + if (!status) + status = fsl_spi_bufs(spi, &t, 0); + } + m->status = status; + fsl_spi_setup_transfer(spi, NULL); spi_finalize_current_message(master); return 0; -- 2.34.1