Lines Matching defs:spi

16 #include <linux/spi/spi.h>
17 #include <linux/spi/spi_bitbang.h>
43 u32 (*txrx_word)(struct spi_device *spi, unsigned nsecs,
47 struct spi_device *spi,
56 struct spi_device *spi,
57 u32 (*txrx_word)(struct spi_device *spi,
76 word = txrx_word(spi, ns, word, bits, flags);
85 struct spi_device *spi,
86 u32 (*txrx_word)(struct spi_device *spi,
105 word = txrx_word(spi, ns, word, bits, flags);
114 struct spi_device *spi,
115 u32 (*txrx_word)(struct spi_device *spi,
134 word = txrx_word(spi, ns, word, bits, flags);
142 int spi_bitbang_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
144 struct spi_bitbang_cs *cs = spi->controller_state;
158 bits_per_word = spi->bits_per_word;
170 hz = spi->max_speed_hz;
184 int spi_bitbang_setup(struct spi_device *spi)
186 struct spi_bitbang_cs *cs = spi->controller_state;
191 bitbang = spi_controller_get_devdata(spi->controller);
197 spi->controller_state = cs;
202 cs->txrx_word = bitbang->txrx_word[spi->mode & (SPI_CPOL|SPI_CPHA)];
209 retval = bitbang->setup_transfer(spi, NULL);
214 dev_dbg(&spi->dev, "%s, %u nsec/bit\n", __func__, 2 * cs->nsecs);
228 void spi_bitbang_cleanup(struct spi_device *spi)
230 kfree(spi->controller_state);
234 static int spi_bitbang_bufs(struct spi_device *spi, struct spi_transfer *t)
236 struct spi_bitbang_cs *cs = spi->controller_state;
240 bitbang = spi_controller_get_devdata(spi->controller);
244 err = bitbang->set_line_direction(spi, !!(t->tx_buf));
249 if (spi->mode & SPI_3WIRE) {
253 return cs->txrx_bufs(spi, cs->txrx_word, nsecs, t, flags);
255 return cs->txrx_bufs(spi, cs->txrx_word, nsecs, t, 0);
272 static int spi_bitbang_prepare_hardware(struct spi_controller *spi)
276 bitbang = spi_controller_get_devdata(spi);
286 struct spi_device *spi,
293 status = bitbang->setup_transfer(spi, transfer);
299 status = bitbang->txrx_bufs(spi, transfer);
312 static int spi_bitbang_unprepare_hardware(struct spi_controller *spi)
316 bitbang = spi_controller_get_devdata(spi);
325 static void spi_bitbang_set_cs(struct spi_device *spi, bool enable)
327 struct spi_bitbang *bitbang = spi_controller_get_devdata(spi->controller);
331 * spi device driver takes care of handling SPI_CS_HIGH
333 enable = (!!(spi->mode & SPI_CS_HIGH) == enable);
336 bitbang->chipselect(spi, enable ? BITBANG_CS_ACTIVE :
445 * spi_bitbang_stop - stops the task providing spi communication