diff options
Diffstat (limited to 'include/linux/spi/spi.h')
| -rw-r--r-- | include/linux/spi/spi.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 97b60b37f445..92e52a1e6af3 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | #include <linux/device.h> | 22 | #include <linux/device.h> |
| 23 | #include <linux/mod_devicetable.h> | 23 | #include <linux/mod_devicetable.h> |
| 24 | #include <linux/slab.h> | ||
| 24 | 25 | ||
| 25 | /* | 26 | /* |
| 26 | * INTERFACES between SPI master-side drivers and SPI infrastructure. | 27 | * INTERFACES between SPI master-side drivers and SPI infrastructure. |
| @@ -212,6 +213,9 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) | |||
| 212 | * @dma_alignment: SPI controller constraint on DMA buffers alignment. | 213 | * @dma_alignment: SPI controller constraint on DMA buffers alignment. |
| 213 | * @mode_bits: flags understood by this controller driver | 214 | * @mode_bits: flags understood by this controller driver |
| 214 | * @flags: other constraints relevant to this driver | 215 | * @flags: other constraints relevant to this driver |
| 216 | * @bus_lock_spinlock: spinlock for SPI bus locking | ||
| 217 | * @bus_lock_mutex: mutex for SPI bus locking | ||
| 218 | * @bus_lock_flag: indicates that the SPI bus is locked for exclusive use | ||
| 215 | * @setup: updates the device mode and clocking records used by a | 219 | * @setup: updates the device mode and clocking records used by a |
| 216 | * device's SPI controller; protocol code may call this. This | 220 | * device's SPI controller; protocol code may call this. This |
| 217 | * must fail if an unrecognized or unsupported mode is requested. | 221 | * must fail if an unrecognized or unsupported mode is requested. |
| @@ -261,6 +265,13 @@ struct spi_master { | |||
| 261 | #define SPI_MASTER_NO_RX BIT(1) /* can't do buffer read */ | 265 | #define SPI_MASTER_NO_RX BIT(1) /* can't do buffer read */ |
| 262 | #define SPI_MASTER_NO_TX BIT(2) /* can't do buffer write */ | 266 | #define SPI_MASTER_NO_TX BIT(2) /* can't do buffer write */ |
| 263 | 267 | ||
| 268 | /* lock and mutex for SPI bus locking */ | ||
| 269 | spinlock_t bus_lock_spinlock; | ||
| 270 | struct mutex bus_lock_mutex; | ||
| 271 | |||
| 272 | /* flag indicating that the SPI bus is locked for exclusive use */ | ||
| 273 | bool bus_lock_flag; | ||
| 274 | |||
| 264 | /* Setup mode and clock, etc (spi driver may call many times). | 275 | /* Setup mode and clock, etc (spi driver may call many times). |
| 265 | * | 276 | * |
| 266 | * IMPORTANT: this may be called when transfers to another | 277 | * IMPORTANT: this may be called when transfers to another |
| @@ -541,6 +552,8 @@ static inline void spi_message_free(struct spi_message *m) | |||
| 541 | 552 | ||
| 542 | extern int spi_setup(struct spi_device *spi); | 553 | extern int spi_setup(struct spi_device *spi); |
| 543 | extern int spi_async(struct spi_device *spi, struct spi_message *message); | 554 | extern int spi_async(struct spi_device *spi, struct spi_message *message); |
| 555 | extern int spi_async_locked(struct spi_device *spi, | ||
| 556 | struct spi_message *message); | ||
| 544 | 557 | ||
| 545 | /*---------------------------------------------------------------------------*/ | 558 | /*---------------------------------------------------------------------------*/ |
| 546 | 559 | ||
| @@ -550,6 +563,9 @@ extern int spi_async(struct spi_device *spi, struct spi_message *message); | |||
| 550 | */ | 563 | */ |
| 551 | 564 | ||
| 552 | extern int spi_sync(struct spi_device *spi, struct spi_message *message); | 565 | extern int spi_sync(struct spi_device *spi, struct spi_message *message); |
| 566 | extern int spi_sync_locked(struct spi_device *spi, struct spi_message *message); | ||
| 567 | extern int spi_bus_lock(struct spi_master *master); | ||
| 568 | extern int spi_bus_unlock(struct spi_master *master); | ||
| 553 | 569 | ||
| 554 | /** | 570 | /** |
| 555 | * spi_write - SPI synchronous write | 571 | * spi_write - SPI synchronous write |
