aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/spi/spi.h
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-10-04 19:23:12 -0400
committerMark Brown <broonie@linaro.org>2013-10-11 15:09:13 -0400
commit2841a5fc375e9c573d10b82db30fa8a4cc25301c (patch)
tree07f5051d922f46a8640e6b2221390bd7be48b309 /include/linux/spi/spi.h
parent31a2c46cd94c6463b2b57b476e5a0fd154fee439 (diff)
spi: Provide per-message prepare and unprepare operations
Many SPI drivers perform setup and tear down on every message, usually doing things like DMA mapping the message. Provide hooks for them to use to provide such operations. This is of limited value for drivers that implement transfer_one_message() but will be of much greater utility with future factoring out of standard implementations of that function. Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'include/linux/spi/spi.h')
-rw-r--r--include/linux/spi/spi.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 887116dbce2c..000b50bee6c0 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -257,6 +257,8 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
257 * @queue_lock: spinlock to syncronise access to message queue 257 * @queue_lock: spinlock to syncronise access to message queue
258 * @queue: message queue 258 * @queue: message queue
259 * @cur_msg: the currently in-flight message 259 * @cur_msg: the currently in-flight message
260 * @cur_msg_prepared: spi_prepare_message was called for the currently
261 * in-flight message
260 * @busy: message pump is busy 262 * @busy: message pump is busy
261 * @running: message pump is running 263 * @running: message pump is running
262 * @rt: whether this queue is set to run as a realtime task 264 * @rt: whether this queue is set to run as a realtime task
@@ -274,6 +276,10 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
274 * @unprepare_transfer_hardware: there are currently no more messages on the 276 * @unprepare_transfer_hardware: there are currently no more messages on the
275 * queue so the subsystem notifies the driver that it may relax the 277 * queue so the subsystem notifies the driver that it may relax the
276 * hardware by issuing this call 278 * hardware by issuing this call
279 * @prepare_message: set up the controller to transfer a single message,
280 * for example doing DMA mapping. Called from threaded
281 * context.
282 * @unprepare_message: undo any work done by prepare_message().
277 * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS 283 * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS
278 * number. Any individual value may be -ENOENT for CS lines that 284 * number. Any individual value may be -ENOENT for CS lines that
279 * are not GPIOs (driven by the SPI controller itself). 285 * are not GPIOs (driven by the SPI controller itself).
@@ -388,11 +394,16 @@ struct spi_master {
388 bool running; 394 bool running;
389 bool rt; 395 bool rt;
390 bool auto_runtime_pm; 396 bool auto_runtime_pm;
397 bool cur_msg_prepared;
391 398
392 int (*prepare_transfer_hardware)(struct spi_master *master); 399 int (*prepare_transfer_hardware)(struct spi_master *master);
393 int (*transfer_one_message)(struct spi_master *master, 400 int (*transfer_one_message)(struct spi_master *master,
394 struct spi_message *mesg); 401 struct spi_message *mesg);
395 int (*unprepare_transfer_hardware)(struct spi_master *master); 402 int (*unprepare_transfer_hardware)(struct spi_master *master);
403 int (*prepare_message)(struct spi_master *master,
404 struct spi_message *message);
405 int (*unprepare_message)(struct spi_master *master,
406 struct spi_message *message);
396 407
397 /* gpio chip select */ 408 /* gpio chip select */
398 int *cs_gpios; 409 int *cs_gpios;