spi: Add capability to perform some transfer with chipselect off
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Wed, 7 Sep 2022 14:11:25 +0000 (16:11 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 7 Sep 2022 14:18:48 +0000 (15:18 +0100)
commit5e0531f6b90ac096fedaf5bd0eae0bb4e5a39da5
tree2bd161ccc2de94ad813dfb9cb1549140b0117043
parent4b9ef436383e8aa910b71927b3f25ede9b190707
spi: Add capability to perform some transfer with chipselect off

Some components require a few clock cycles with chipselect off before
or/and after the data transfer done with CS on.

Typically IDT 801034 QUAD PCM CODEC datasheet states "Note *: CCLK
should have one cycle before CS goes low, and two cycles after
CS goes high".

The cycles "before" are implicitely provided by all previous activity
on the SPI bus. But the cycles "after" must be provided in order to
terminate the SPI transfer.

In order to use that kind of component, add a cs_off flag to
spi_transfer struct. When this flag is set, the transfer is performed
with chipselect off. This allows consummer to add a dummy transfer
at the end of the transfer list which is performed with chipselect
OFF, providing the required additional clock cycles.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Link: https://lore.kernel.org/r/434165c46f06d802690208a11e7ea2500e8da4c7.1662558898.git.christophe.leroy@csgroup.eu
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi.c
include/linux/spi/spi.h