]> www.infradead.org Git - users/jedix/linux-maple.git/commit
spi: offload: add support for hardware triggers
authorDavid Lechner <dlechner@baylibre.com>
Fri, 7 Feb 2025 20:08:59 +0000 (14:08 -0600)
committerMark Brown <broonie@kernel.org>
Fri, 7 Feb 2025 20:17:08 +0000 (20:17 +0000)
commitd7231be4b4657e5f922a4c6dc11e8dffc71fee87
tree7d05466ee5f89c58b6ccaca2cfe61f4b65bfd342
parent8e02d188698851436f76038ea998b726193d1b10
spi: offload: add support for hardware triggers

Extend SPI offloading to support hardware triggers.

This allows an arbitrary hardware trigger to be used to start a SPI
transfer that was previously set up with spi_optimize_message().

A new struct spi_offload_trigger is introduced that can be used to
configure any type of trigger. It has a type discriminator and a union
to allow it to be extended in the future. Two trigger types are defined
to start with. One is a trigger that indicates that the SPI peripheral
is ready to read or write data. The other is a periodic trigger to
repeat a SPI message at a fixed rate.

There is also a spi_offload_hw_trigger_validate() function that works
similar to clk_round_rate(). It basically asks the question of if we
enabled the hardware trigger what would the actual parameters be. This
can be used to test if the requested trigger type is actually supported
by the hardware and for periodic triggers, it can be used to find the
actual rate that the hardware is capable of.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250207-dlech-mainline-spi-engine-offload-2-v8-2-e48a489be48c@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-offload.c
include/linux/spi/offload/consumer.h
include/linux/spi/offload/provider.h
include/linux/spi/offload/types.h