aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/spi
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-07-28 09:47:02 -0400
committerMark Brown <broonie@linaro.org>2013-07-29 12:59:20 -0400
commit49834de234f3cf592c3d242c889ca603db8e7050 (patch)
tree5a8563efa8626d982039a3fe9b570b7e61edf7bc /include/linux/spi
parentbafe886936a8982f5780330c901889a37bba7d4c (diff)
spi: Provide core support for runtime PM during transfers
Most SPI drivers that implement runtime PM support use identical code to do so: they acquire a runtime PM lock in prepare_transfer_hardware() and then they release it in unprepare_transfer_hardware(). The variations in this are mostly missing error checking and the choice to use autosuspend. Since these runtime PM calls are normally the only thing in the prepare and unprepare callbacks and the autosuspend API transparently does the right thing on devices with autosuspend disabled factor all of this out into the core with a flag to enable the behaviour. Signed-off-by: Mark Brown <broonie@linaro.org> Reviewed-by: Stephen Warren <swarren@nvidia.com> Acked-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'include/linux/spi')
-rw-r--r--include/linux/spi/spi.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 28e440be1c07..bf0204c00053 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -254,6 +254,9 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
254 * @busy: message pump is busy 254 * @busy: message pump is busy
255 * @running: message pump is running 255 * @running: message pump is running
256 * @rt: whether this queue is set to run as a realtime task 256 * @rt: whether this queue is set to run as a realtime task
257 * @auto_runtime_pm: the core should ensure a runtime PM reference is held
258 * while the hardware is prepared, using the parent
259 * device for the spidev
257 * @prepare_transfer_hardware: a message will soon arrive from the queue 260 * @prepare_transfer_hardware: a message will soon arrive from the queue
258 * so the subsystem requests the driver to prepare the transfer hardware 261 * so the subsystem requests the driver to prepare the transfer hardware
259 * by issuing this call 262 * by issuing this call
@@ -374,11 +377,13 @@ struct spi_master {
374 bool busy; 377 bool busy;
375 bool running; 378 bool running;
376 bool rt; 379 bool rt;
380 bool auto_runtime_pm;
377 381
378 int (*prepare_transfer_hardware)(struct spi_master *master); 382 int (*prepare_transfer_hardware)(struct spi_master *master);
379 int (*transfer_one_message)(struct spi_master *master, 383 int (*transfer_one_message)(struct spi_master *master,
380 struct spi_message *mesg); 384 struct spi_message *mesg);
381 int (*unprepare_transfer_hardware)(struct spi_master *master); 385 int (*unprepare_transfer_hardware)(struct spi_master *master);
386
382 /* gpio chip select */ 387 /* gpio chip select */
383 int *cs_gpios; 388 int *cs_gpios;
384}; 389};