| @@ -12,6 +12,7 @@ · 11 unmodified lines |
| 12 | #include <linux/kthread.h> | 12 | #include <linux/kthread.h> |
| 13 | #include <linux/completion.h> | 13 | #include <linux/completion.h> |
| 14 | #include <linux/scatterlist.h> | 14 | #include <linux/scatterlist.h> |
| | 15 | #include <linux/gpio/consumer.h> |
| 15 | | 16 | |
| 16 | struct dma_chan; | 17 | struct dma_chan; |
| 17 | struct property_entry; | 18 | struct property_entry; |
| @@ -116,8 +117,13 @@ void spi_statistics_add_transfer_stats(struct spi_statistics *stats, · 98 unmodified lines |
| 116 | * @modalias: Name of the driver to use with this device, or an alias | 117 | * @modalias: Name of the driver to use with this device, or an alias |
| 117 | * for that name. This appears in the sysfs "modalias" attribute | 118 | * for that name. This appears in the sysfs "modalias" attribute |
| 118 | * for driver coldplugging, and in uevents used for hotplugging | 119 | * for driver coldplugging, and in uevents used for hotplugging |
| 119 | * @cs_gpio: gpio number of the chipselect line (optional, -ENOENT when | 120 | * @cs_gpio: LEGACY: gpio number of the chipselect line (optional, -ENOENT when |
| | 121 | * not using a GPIO line) use cs_gpiod in new drivers by opting in on |
| | 122 | * the spi_master. |
| | 123 | * @cs_gpiod: gpio descriptor of the chipselect line (optional, NULL when |
| 120 | * not using a GPIO line) | 124 | * not using a GPIO line) |
| | 125 | * @word_delay_usecs: microsecond delay to be inserted between consecutive |
| | 126 | * words of a transfer |
| 121 | * | 127 | * |
| 122 | * @statistics: statistics for the spi_device | 128 | * @statistics: statistics for the spi_device |
| 123 | * | 129 | * |
| @@ -163,7 +169,9 @@ struct spi_device { · 39 unmodified lines |
| 163 | void *controller_data; | 169 | void *controller_data; |
| 164 | char modalias[SPI_NAME_SIZE]; | 170 | char modalias[SPI_NAME_SIZE]; |
| 165 | const char *driver_override; | 171 | const char *driver_override; |
| 166 | int cs_gpio; /* chip select gpio */ | 172 | int cs_gpio; /* LEGACY: chip select gpio */ |
| | 173 | struct gpio_desc *cs_gpiod; /* chip select gpio desc */ |
| | 174 | uint8_t word_delay_usecs; /* inter-word delay */ |
| 167 | | 175 | |
| 168 | /* the statistics */ | 176 | /* the statistics */ |
| 169 | struct spi_statistics statistics; | 177 | struct spi_statistics statistics; |
| @@ -376,9 +384,17 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) · 206 unmodified lines |
| 376 | * controller has native support for memory like operations. | 384 | * controller has native support for memory like operations. |
| 377 | * @unprepare_message: undo any work done by prepare_message(). | 385 | * @unprepare_message: undo any work done by prepare_message(). |
| 378 | * @slave_abort: abort the ongoing transfer request on an SPI slave controller | 386 | * @slave_abort: abort the ongoing transfer request on an SPI slave controller |
| 379 | * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS | 387 | * @cs_gpios: LEGACY: array of GPIO descs to use as chip select lines; one per |
| 380 | * number. Any individual value may be -ENOENT for CS lines that | 388 | * CS number. Any individual value may be -ENOENT for CS lines that |
| | 389 | * are not GPIOs (driven by the SPI controller itself). Use the cs_gpiods |
| | 390 | * in new drivers. |
| | 391 | * @cs_gpiods: Array of GPIO descs to use as chip select lines; one per CS |
| | 392 | * number. Any individual value may be NULL for CS lines that |
| 381 | * are not GPIOs (driven by the SPI controller itself). | 393 | * are not GPIOs (driven by the SPI controller itself). |
| | 394 | * @use_gpio_descriptors: Turns on the code in the SPI core to parse and grab |
| | 395 | * GPIO descriptors rather than using global GPIO numbers grabbed by the |
| | 396 | * driver. This will fill in @cs_gpiods and @cs_gpios should not be used, |
| | 397 | * and SPI devices will have the cs_gpiod assigned rather than cs_gpio. |
| 382 | * @statistics: statistics for the spi_controller | 398 | * @statistics: statistics for the spi_controller |
| 383 | * @dma_tx: DMA transmit channel | 399 | * @dma_tx: DMA transmit channel |
| 384 | * @dma_rx: DMA receive channel | 400 | * @dma_rx: DMA receive channel |
| @@ -557,6 +573,8 @@ struct spi_controller { · 172 unmodified lines |
| 557 | | 573 | |
| 558 | /* gpio chip select */ | 574 | /* gpio chip select */ |
| 559 | int *cs_gpios; | 575 | int *cs_gpios; |
| | 576 | struct gpio_desc **cs_gpiods; |
| | 577 | bool use_gpio_descriptors; |
| 560 | | 578 | |
| 561 | /* statistics */ | 579 | /* statistics */ |
| 562 | struct spi_statistics statistics; | 580 | struct spi_statistics statistics; |
| @@ -706,6 +724,8 @@ extern void spi_res_release(struct spi_controller *ctlr, · 143 unmodified lines |
| 706 | * @delay_usecs: microseconds to delay after this transfer before | 724 | * @delay_usecs: microseconds to delay after this transfer before |
| 707 | * (optionally) changing the chipselect status, then starting | 725 | * (optionally) changing the chipselect status, then starting |
| 708 | * the next transfer or completing this @spi_message. | 726 | * the next transfer or completing this @spi_message. |
| | 727 | * @word_delay_usecs: microseconds to inter word delay after each word size |
| | 728 | * (set by bits_per_word) transmission. |
| 709 | * @word_delay: clock cycles to inter word delay after each word size | 729 | * @word_delay: clock cycles to inter word delay after each word size |
| 710 | * (set by bits_per_word) transmission. | 730 | * (set by bits_per_word) transmission. |
| 711 | * @transfer_list: transfers are sequenced through @spi_message.transfers | 731 | * @transfer_list: transfers are sequenced through @spi_message.transfers |
| @@ -788,6 +808,7 @@ struct spi_transfer { · 76 unmodified lines |
| 788 | #define SPI_NBITS_DUAL 0x02 /* 2bits transfer */ | 808 | #define SPI_NBITS_DUAL 0x02 /* 2bits transfer */ |
| 789 | #define SPI_NBITS_QUAD 0x04 /* 4bits transfer */ | 809 | #define SPI_NBITS_QUAD 0x04 /* 4bits transfer */ |
| 790 | u8 bits_per_word; | 810 | u8 bits_per_word; |
| | 811 | u8 word_delay_usecs; |
| 791 | u16 delay_usecs; | 812 | u16 delay_usecs; |
| 792 | u32 speed_hz; | 813 | u32 speed_hz; |
| 793 | u16 word_delay; | 814 | u16 word_delay; |