Searched refs:spi (Results 1 - 200 of 771) sorted by relevance

1234

/linux-4.4.14/drivers/spi/
H A DMakefile9 obj-$(CONFIG_SPI_MASTER) += spi.o
13 obj-$(CONFIG_SPI_ALTERA) += spi-altera.o
14 obj-$(CONFIG_SPI_ATMEL) += spi-atmel.o
15 obj-$(CONFIG_SPI_ATH79) += spi-ath79.o
16 obj-$(CONFIG_SPI_AU1550) += spi-au1550.o
17 obj-$(CONFIG_SPI_BCM2835) += spi-bcm2835.o
18 obj-$(CONFIG_SPI_BCM2835AUX) += spi-bcm2835aux.o
19 obj-$(CONFIG_SPI_BCM53XX) += spi-bcm53xx.o
20 obj-$(CONFIG_SPI_BCM63XX) += spi-bcm63xx.o
21 obj-$(CONFIG_SPI_BCM63XX_HSSPI) += spi-bcm63xx-hsspi.o
22 obj-$(CONFIG_SPI_BFIN5XX) += spi-bfin5xx.o
23 obj-$(CONFIG_SPI_ADI_V3) += spi-adi-v3.o
24 obj-$(CONFIG_SPI_BFIN_SPORT) += spi-bfin-sport.o
25 obj-$(CONFIG_SPI_BITBANG) += spi-bitbang.o
26 obj-$(CONFIG_SPI_BUTTERFLY) += spi-butterfly.o
27 obj-$(CONFIG_SPI_CADENCE) += spi-cadence.o
28 obj-$(CONFIG_SPI_CLPS711X) += spi-clps711x.o
29 obj-$(CONFIG_SPI_COLDFIRE_QSPI) += spi-coldfire-qspi.o
30 obj-$(CONFIG_SPI_DAVINCI) += spi-davinci.o
31 obj-$(CONFIG_SPI_DLN2) += spi-dln2.o
32 obj-$(CONFIG_SPI_DESIGNWARE) += spi-dw.o
33 obj-$(CONFIG_SPI_DW_MMIO) += spi-dw-mmio.o
34 obj-$(CONFIG_SPI_DW_PCI) += spi-dw-midpci.o
35 spi-dw-midpci-objs := spi-dw-pci.o spi-dw-mid.o
36 obj-$(CONFIG_SPI_EFM32) += spi-efm32.o
37 obj-$(CONFIG_SPI_EP93XX) += spi-ep93xx.o
38 obj-$(CONFIG_SPI_FALCON) += spi-falcon.o
39 obj-$(CONFIG_SPI_FSL_CPM) += spi-fsl-cpm.o
40 obj-$(CONFIG_SPI_FSL_DSPI) += spi-fsl-dspi.o
41 obj-$(CONFIG_SPI_FSL_LIB) += spi-fsl-lib.o
42 obj-$(CONFIG_SPI_FSL_ESPI) += spi-fsl-espi.o
43 obj-$(CONFIG_SPI_FSL_SPI) += spi-fsl-spi.o
44 obj-$(CONFIG_SPI_GPIO) += spi-gpio.o
45 obj-$(CONFIG_SPI_IMG_SPFI) += spi-img-spfi.o
46 obj-$(CONFIG_SPI_IMX) += spi-imx.o
47 obj-$(CONFIG_SPI_LM70_LLP) += spi-lm70llp.o
48 obj-$(CONFIG_SPI_MESON_SPIFC) += spi-meson-spifc.o
49 obj-$(CONFIG_SPI_MPC512x_PSC) += spi-mpc512x-psc.o
50 obj-$(CONFIG_SPI_MPC52xx_PSC) += spi-mpc52xx-psc.o
51 obj-$(CONFIG_SPI_MPC52xx) += spi-mpc52xx.o
52 obj-$(CONFIG_SPI_MT65XX) += spi-mt65xx.o
53 obj-$(CONFIG_SPI_MXS) += spi-mxs.o
54 obj-$(CONFIG_SPI_NUC900) += spi-nuc900.o
55 obj-$(CONFIG_SPI_OC_TINY) += spi-oc-tiny.o
56 obj-$(CONFIG_SPI_OCTEON) += spi-octeon.o
57 obj-$(CONFIG_SPI_OMAP_UWIRE) += spi-omap-uwire.o
58 obj-$(CONFIG_SPI_OMAP_100K) += spi-omap-100k.o
59 obj-$(CONFIG_SPI_OMAP24XX) += spi-omap2-mcspi.o
60 obj-$(CONFIG_SPI_TI_QSPI) += spi-ti-qspi.o
61 obj-$(CONFIG_SPI_ORION) += spi-orion.o
62 obj-$(CONFIG_SPI_PL022) += spi-pl022.o
63 obj-$(CONFIG_SPI_PPC4xx) += spi-ppc4xx.o
64 spi-pxa2xx-platform-objs := spi-pxa2xx.o
65 spi-pxa2xx-platform-$(CONFIG_SPI_PXA2XX_DMA) += spi-pxa2xx-dma.o
66 obj-$(CONFIG_SPI_PXA2XX) += spi-pxa2xx-platform.o
67 obj-$(CONFIG_SPI_PXA2XX_PCI) += spi-pxa2xx-pci.o
68 obj-$(CONFIG_SPI_QUP) += spi-qup.o
69 obj-$(CONFIG_SPI_ROCKCHIP) += spi-rockchip.o
70 obj-$(CONFIG_SPI_RB4XX) += spi-rb4xx.o
71 obj-$(CONFIG_SPI_RSPI) += spi-rspi.o
72 obj-$(CONFIG_SPI_S3C24XX) += spi-s3c24xx-hw.o
73 spi-s3c24xx-hw-y := spi-s3c24xx.o
74 spi-s3c24xx-hw-$(CONFIG_SPI_S3C24XX_FIQ) += spi-s3c24xx-fiq.o
75 obj-$(CONFIG_SPI_S3C64XX) += spi-s3c64xx.o
76 obj-$(CONFIG_SPI_SC18IS602) += spi-sc18is602.o
77 obj-$(CONFIG_SPI_SH) += spi-sh.o
78 obj-$(CONFIG_SPI_SH_HSPI) += spi-sh-hspi.o
79 obj-$(CONFIG_SPI_SH_MSIOF) += spi-sh-msiof.o
80 obj-$(CONFIG_SPI_SH_SCI) += spi-sh-sci.o
81 obj-$(CONFIG_SPI_SIRF) += spi-sirf.o
82 obj-$(CONFIG_SPI_ST_SSC4) += spi-st-ssc4.o
83 obj-$(CONFIG_SPI_SUN4I) += spi-sun4i.o
84 obj-$(CONFIG_SPI_SUN6I) += spi-sun6i.o
85 obj-$(CONFIG_SPI_TEGRA114) += spi-tegra114.o
86 obj-$(CONFIG_SPI_TEGRA20_SFLASH) += spi-tegra20-sflash.o
87 obj-$(CONFIG_SPI_TEGRA20_SLINK) += spi-tegra20-slink.o
88 obj-$(CONFIG_SPI_TLE62X0) += spi-tle62x0.o
89 obj-$(CONFIG_SPI_TOPCLIFF_PCH) += spi-topcliff-pch.o
90 obj-$(CONFIG_SPI_TXX9) += spi-txx9.o
91 obj-$(CONFIG_SPI_XCOMM) += spi-xcomm.o
92 obj-$(CONFIG_SPI_XILINX) += spi-xilinx.o
93 obj-$(CONFIG_SPI_XLP) += spi-xlp.o
94 obj-$(CONFIG_SPI_XTENSA_XTFPGA) += spi-xtensa-xtfpga.o
95 obj-$(CONFIG_SPI_ZYNQMP_GQSPI) += spi-zynqmp-gqspi.o
H A Dspi-omap2-mcspi.c37 #include <linux/spi/spi.h>
40 #include <linux/platform_data/spi-omap2-mcspi.h>
169 static inline void mcspi_write_cs_reg(const struct spi_device *spi, mcspi_write_cs_reg() argument
172 struct omap2_mcspi_cs *cs = spi->controller_state; mcspi_write_cs_reg()
177 static inline u32 mcspi_read_cs_reg(const struct spi_device *spi, int idx) mcspi_read_cs_reg() argument
179 struct omap2_mcspi_cs *cs = spi->controller_state; mcspi_read_cs_reg()
184 static inline u32 mcspi_cached_chconf0(const struct spi_device *spi) mcspi_cached_chconf0() argument
186 struct omap2_mcspi_cs *cs = spi->controller_state; mcspi_cached_chconf0()
191 static inline void mcspi_write_chconf0(const struct spi_device *spi, u32 val) mcspi_write_chconf0() argument
193 struct omap2_mcspi_cs *cs = spi->controller_state; mcspi_write_chconf0()
196 mcspi_write_cs_reg(spi, OMAP2_MCSPI_CHCONF0, val); mcspi_write_chconf0()
197 mcspi_read_cs_reg(spi, OMAP2_MCSPI_CHCONF0); mcspi_write_chconf0()
210 static void omap2_mcspi_set_dma_req(const struct spi_device *spi, omap2_mcspi_set_dma_req() argument
215 l = mcspi_cached_chconf0(spi); omap2_mcspi_set_dma_req()
227 mcspi_write_chconf0(spi, l); omap2_mcspi_set_dma_req()
230 static void omap2_mcspi_set_enable(const struct spi_device *spi, int enable) omap2_mcspi_set_enable() argument
232 struct omap2_mcspi_cs *cs = spi->controller_state; omap2_mcspi_set_enable()
241 mcspi_write_cs_reg(spi, OMAP2_MCSPI_CHCTRL0, cs->chctrl0); omap2_mcspi_set_enable()
243 mcspi_read_cs_reg(spi, OMAP2_MCSPI_CHCTRL0); omap2_mcspi_set_enable()
246 static void omap2_mcspi_set_cs(struct spi_device *spi, bool enable) omap2_mcspi_set_cs() argument
248 struct omap2_mcspi *mcspi = spi_master_get_devdata(spi->master); omap2_mcspi_set_cs()
255 if (spi->mode & SPI_CS_HIGH) omap2_mcspi_set_cs()
258 if (spi->controller_state) { omap2_mcspi_set_cs()
265 l = mcspi_cached_chconf0(spi); omap2_mcspi_set_cs()
272 mcspi_write_chconf0(spi, l); omap2_mcspi_set_cs()
297 static void omap2_mcspi_set_fifo(const struct spi_device *spi, omap2_mcspi_set_fifo() argument
300 struct spi_master *master = spi->master; omap2_mcspi_set_fifo()
301 struct omap2_mcspi_cs *cs = spi->controller_state; omap2_mcspi_set_fifo()
309 chconf = mcspi_cached_chconf0(spi); omap2_mcspi_set_fifo()
339 mcspi_write_chconf0(spi, chconf); omap2_mcspi_set_fifo()
352 mcspi_write_chconf0(spi, chconf); omap2_mcspi_set_fifo()
389 struct spi_device *spi = data; omap2_mcspi_rx_callback() local
390 struct omap2_mcspi *mcspi = spi_master_get_devdata(spi->master); omap2_mcspi_rx_callback()
391 struct omap2_mcspi_dma *mcspi_dma = &mcspi->dma_channels[spi->chip_select]; omap2_mcspi_rx_callback()
394 omap2_mcspi_set_dma_req(spi, 1, 0); omap2_mcspi_rx_callback()
401 struct spi_device *spi = data; omap2_mcspi_tx_callback() local
402 struct omap2_mcspi *mcspi = spi_master_get_devdata(spi->master); omap2_mcspi_tx_callback()
403 struct omap2_mcspi_dma *mcspi_dma = &mcspi->dma_channels[spi->chip_select]; omap2_mcspi_tx_callback()
406 omap2_mcspi_set_dma_req(spi, 0, 0); omap2_mcspi_tx_callback()
411 static void omap2_mcspi_tx_dma(struct spi_device *spi, omap2_mcspi_tx_dma() argument
419 mcspi = spi_master_get_devdata(spi->master); omap2_mcspi_tx_dma()
420 mcspi_dma = &mcspi->dma_channels[spi->chip_select]; omap2_mcspi_tx_dma()
437 tx->callback_param = spi; omap2_mcspi_tx_dma()
444 omap2_mcspi_set_dma_req(spi, 0, 1); omap2_mcspi_tx_dma()
449 omap2_mcspi_rx_dma(struct spi_device *spi, struct spi_transfer *xfer, omap2_mcspi_rx_dma() argument
459 struct omap2_mcspi_cs *cs = spi->controller_state; omap2_mcspi_rx_dma()
460 mcspi = spi_master_get_devdata(spi->master); omap2_mcspi_rx_dma()
461 mcspi_dma = &mcspi->dma_channels[spi->chip_select]; omap2_mcspi_rx_dma()
469 l = mcspi_cached_chconf0(spi); omap2_mcspi_rx_dma()
496 tx->callback_param = spi; omap2_mcspi_rx_dma()
504 omap2_mcspi_set_dma_req(spi, 1, 1); omap2_mcspi_rx_dma()
513 omap2_mcspi_set_enable(spi, 0); omap2_mcspi_rx_dma()
520 if (likely(mcspi_read_cs_reg(spi, OMAP2_MCSPI_CHSTAT0) omap2_mcspi_rx_dma()
524 w = mcspi_read_cs_reg(spi, OMAP2_MCSPI_RX0); omap2_mcspi_rx_dma()
533 dev_err(&spi->dev, "DMA RX penultimate word empty\n"); omap2_mcspi_rx_dma()
535 omap2_mcspi_set_enable(spi, 1); omap2_mcspi_rx_dma()
539 if (likely(mcspi_read_cs_reg(spi, OMAP2_MCSPI_CHSTAT0) omap2_mcspi_rx_dma()
543 w = mcspi_read_cs_reg(spi, OMAP2_MCSPI_RX0); omap2_mcspi_rx_dma()
551 dev_err(&spi->dev, "DMA RX last word empty\n"); omap2_mcspi_rx_dma()
554 omap2_mcspi_set_enable(spi, 1); omap2_mcspi_rx_dma()
559 omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer) omap2_mcspi_txrx_dma() argument
562 struct omap2_mcspi_cs *cs = spi->controller_state; omap2_mcspi_txrx_dma()
576 mcspi = spi_master_get_devdata(spi->master); omap2_mcspi_txrx_dma()
577 mcspi_dma = &mcspi->dma_channels[spi->chip_select]; omap2_mcspi_txrx_dma()
578 l = mcspi_cached_chconf0(spi); omap2_mcspi_txrx_dma()
614 omap2_mcspi_tx_dma(spi, xfer, cfg); omap2_mcspi_txrx_dma()
617 count = omap2_mcspi_rx_dma(spi, xfer, cfg, es); omap2_mcspi_txrx_dma()
629 dev_err(&spi->dev, "EOW timed out\n"); omap2_mcspi_txrx_dma()
642 dev_err(&spi->dev, "TXFFE timed out\n"); omap2_mcspi_txrx_dma()
647 dev_err(&spi->dev, "TXS timed out\n"); omap2_mcspi_txrx_dma()
652 dev_err(&spi->dev, "EOT timed out\n"); omap2_mcspi_txrx_dma()
659 omap2_mcspi_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer) omap2_mcspi_txrx_pio() argument
662 struct omap2_mcspi_cs *cs = spi->controller_state; omap2_mcspi_txrx_pio()
671 mcspi = spi_master_get_devdata(spi->master); omap2_mcspi_txrx_pio()
676 l = mcspi_cached_chconf0(spi); omap2_mcspi_txrx_pio()
699 dev_err(&spi->dev, "TXS timed out\n"); omap2_mcspi_txrx_pio()
702 dev_vdbg(&spi->dev, "write-%d %02x\n", omap2_mcspi_txrx_pio()
709 dev_err(&spi->dev, "RXS timed out\n"); omap2_mcspi_txrx_pio()
715 omap2_mcspi_set_enable(spi, 0); omap2_mcspi_txrx_pio()
717 dev_vdbg(&spi->dev, "read-%d %02x\n", omap2_mcspi_txrx_pio()
721 dev_err(&spi->dev, omap2_mcspi_txrx_pio()
727 omap2_mcspi_set_enable(spi, 0); omap2_mcspi_txrx_pio()
731 dev_vdbg(&spi->dev, "read-%d %02x\n", omap2_mcspi_txrx_pio()
746 dev_err(&spi->dev, "TXS timed out\n"); omap2_mcspi_txrx_pio()
749 dev_vdbg(&spi->dev, "write-%d %04x\n", omap2_mcspi_txrx_pio()
756 dev_err(&spi->dev, "RXS timed out\n"); omap2_mcspi_txrx_pio()
762 omap2_mcspi_set_enable(spi, 0); omap2_mcspi_txrx_pio()
764 dev_vdbg(&spi->dev, "read-%d %04x\n", omap2_mcspi_txrx_pio()
768 dev_err(&spi->dev, omap2_mcspi_txrx_pio()
774 omap2_mcspi_set_enable(spi, 0); omap2_mcspi_txrx_pio()
778 dev_vdbg(&spi->dev, "read-%d %04x\n", omap2_mcspi_txrx_pio()
793 dev_err(&spi->dev, "TXS timed out\n"); omap2_mcspi_txrx_pio()
796 dev_vdbg(&spi->dev, "write-%d %08x\n", omap2_mcspi_txrx_pio()
803 dev_err(&spi->dev, "RXS timed out\n"); omap2_mcspi_txrx_pio()
809 omap2_mcspi_set_enable(spi, 0); omap2_mcspi_txrx_pio()
811 dev_vdbg(&spi->dev, "read-%d %08x\n", omap2_mcspi_txrx_pio()
815 dev_err(&spi->dev, omap2_mcspi_txrx_pio()
821 omap2_mcspi_set_enable(spi, 0); omap2_mcspi_txrx_pio()
825 dev_vdbg(&spi->dev, "read-%d %08x\n", omap2_mcspi_txrx_pio()
835 dev_err(&spi->dev, "TXS timed out\n"); omap2_mcspi_txrx_pio()
838 dev_err(&spi->dev, "EOT timed out\n"); omap2_mcspi_txrx_pio()
844 omap2_mcspi_set_enable(spi, 0); omap2_mcspi_txrx_pio()
847 omap2_mcspi_set_enable(spi, 1); omap2_mcspi_txrx_pio()
863 static int omap2_mcspi_setup_transfer(struct spi_device *spi, omap2_mcspi_setup_transfer() argument
866 struct omap2_mcspi_cs *cs = spi->controller_state; omap2_mcspi_setup_transfer()
870 u8 word_len = spi->bits_per_word; omap2_mcspi_setup_transfer()
871 u32 speed_hz = spi->max_speed_hz; omap2_mcspi_setup_transfer()
873 mcspi = spi_master_get_devdata(spi->master); omap2_mcspi_setup_transfer()
897 l = mcspi_cached_chconf0(spi); omap2_mcspi_setup_transfer()
917 if (!(spi->mode & SPI_CS_HIGH)) omap2_mcspi_setup_transfer()
932 mcspi_write_cs_reg(spi, OMAP2_MCSPI_CHCTRL0, cs->chctrl0); omap2_mcspi_setup_transfer()
936 if (spi->mode & SPI_CPOL) omap2_mcspi_setup_transfer()
940 if (spi->mode & SPI_CPHA) omap2_mcspi_setup_transfer()
945 mcspi_write_chconf0(spi, l); omap2_mcspi_setup_transfer()
947 cs->mode = spi->mode; omap2_mcspi_setup_transfer()
949 dev_dbg(&spi->dev, "setup: speed %d, sample %s edge, clk %s\n", omap2_mcspi_setup_transfer()
951 (spi->mode & SPI_CPHA) ? "trailing" : "leading", omap2_mcspi_setup_transfer()
952 (spi->mode & SPI_CPOL) ? "inverted" : "normal"); omap2_mcspi_setup_transfer()
961 static int omap2_mcspi_request_dma(struct spi_device *spi) omap2_mcspi_request_dma() argument
963 struct spi_master *master = spi->master; omap2_mcspi_request_dma()
970 mcspi_dma = mcspi->dma_channels + spi->chip_select; omap2_mcspi_request_dma()
1001 dev_warn(&spi->dev, "not using DMA for McSPI\n"); omap2_mcspi_request_dma()
1005 static int omap2_mcspi_setup(struct spi_device *spi) omap2_mcspi_setup() argument
1008 struct omap2_mcspi *mcspi = spi_master_get_devdata(spi->master); omap2_mcspi_setup()
1011 struct omap2_mcspi_cs *cs = spi->controller_state; omap2_mcspi_setup()
1013 mcspi_dma = &mcspi->dma_channels[spi->chip_select]; omap2_mcspi_setup()
1019 cs->base = mcspi->base + spi->chip_select * 0x14; omap2_mcspi_setup()
1020 cs->phys = mcspi->phys + spi->chip_select * 0x14; omap2_mcspi_setup()
1024 spi->controller_state = cs; omap2_mcspi_setup()
1028 if (gpio_is_valid(spi->cs_gpio)) { omap2_mcspi_setup()
1029 ret = gpio_request(spi->cs_gpio, dev_name(&spi->dev)); omap2_mcspi_setup()
1031 dev_err(&spi->dev, "failed to request gpio\n"); omap2_mcspi_setup()
1034 gpio_direction_output(spi->cs_gpio, omap2_mcspi_setup()
1035 !(spi->mode & SPI_CS_HIGH)); omap2_mcspi_setup()
1040 ret = omap2_mcspi_request_dma(spi); omap2_mcspi_setup()
1049 ret = omap2_mcspi_setup_transfer(spi, NULL); omap2_mcspi_setup()
1056 static void omap2_mcspi_cleanup(struct spi_device *spi) omap2_mcspi_cleanup() argument
1062 mcspi = spi_master_get_devdata(spi->master); omap2_mcspi_cleanup()
1064 if (spi->controller_state) { omap2_mcspi_cleanup()
1066 cs = spi->controller_state; omap2_mcspi_cleanup()
1072 if (spi->chip_select < spi->master->num_chipselect) { omap2_mcspi_cleanup()
1073 mcspi_dma = &mcspi->dma_channels[spi->chip_select]; omap2_mcspi_cleanup()
1085 if (gpio_is_valid(spi->cs_gpio)) omap2_mcspi_cleanup()
1086 gpio_free(spi->cs_gpio); omap2_mcspi_cleanup()
1090 struct spi_device *spi, struct spi_transfer *t) omap2_mcspi_work_one()
1108 master = spi->master; omap2_mcspi_work_one()
1109 mcspi_dma = mcspi->dma_channels + spi->chip_select; omap2_mcspi_work_one()
1110 cs = spi->controller_state; omap2_mcspi_work_one()
1111 cd = spi->controller_data; omap2_mcspi_work_one()
1114 * The slave driver could have changed spi->mode in which case omap2_mcspi_work_one()
1120 if (spi->mode != cs->mode) omap2_mcspi_work_one()
1123 omap2_mcspi_set_enable(spi, 0); omap2_mcspi_work_one()
1125 if (gpio_is_valid(spi->cs_gpio)) omap2_mcspi_work_one()
1126 omap2_mcspi_set_cs(spi, spi->mode & SPI_CS_HIGH); omap2_mcspi_work_one()
1129 (t->speed_hz != spi->max_speed_hz) || omap2_mcspi_work_one()
1130 (t->bits_per_word != spi->bits_per_word)) { omap2_mcspi_work_one()
1132 status = omap2_mcspi_setup_transfer(spi, t); omap2_mcspi_work_one()
1135 if (t->speed_hz == spi->max_speed_hz && omap2_mcspi_work_one()
1136 t->bits_per_word == spi->bits_per_word) omap2_mcspi_work_one()
1144 mcspi_read_cs_reg(spi, OMAP2_MCSPI_MODULCTRL); omap2_mcspi_work_one()
1147 chconf = mcspi_cached_chconf0(spi); omap2_mcspi_work_one()
1162 mcspi_write_chconf0(spi, chconf); omap2_mcspi_work_one()
1169 omap2_mcspi_set_fifo(spi, t, 1); omap2_mcspi_work_one()
1171 omap2_mcspi_set_enable(spi, 1); omap2_mcspi_work_one()
1180 count = omap2_mcspi_txrx_dma(spi, t); omap2_mcspi_work_one()
1182 count = omap2_mcspi_txrx_pio(spi, t); omap2_mcspi_work_one()
1190 omap2_mcspi_set_enable(spi, 0); omap2_mcspi_work_one()
1193 omap2_mcspi_set_fifo(spi, t, 0); omap2_mcspi_work_one()
1199 status = omap2_mcspi_setup_transfer(spi, NULL); omap2_mcspi_work_one()
1207 mcspi_read_cs_reg(spi, OMAP2_MCSPI_MODULCTRL); omap2_mcspi_work_one()
1210 omap2_mcspi_set_enable(spi, 0); omap2_mcspi_work_one()
1212 if (gpio_is_valid(spi->cs_gpio)) omap2_mcspi_work_one()
1213 omap2_mcspi_set_cs(spi, !(spi->mode & SPI_CS_HIGH)); omap2_mcspi_work_one()
1216 omap2_mcspi_set_fifo(spi, t, 0); omap2_mcspi_work_one()
1234 if (msg->spi->controller_state == cs) omap2_mcspi_prepare_message()
1249 struct spi_device *spi, struct spi_transfer *t) omap2_mcspi_transfer_one()
1258 mcspi_dma = mcspi->dma_channels + spi->chip_select; omap2_mcspi_transfer_one()
1296 return omap2_mcspi_work_one(mcspi, spi, t); omap2_mcspi_transfer_one()
1370 /* the spi->mode bits understood by this driver: */ omap2_mcspi_probe()
1393 of_property_read_u32(node, "ti,spi-num-cs", &num_cs); omap2_mcspi_probe()
1089 omap2_mcspi_work_one(struct omap2_mcspi *mcspi, struct spi_device *spi, struct spi_transfer *t) omap2_mcspi_work_one() argument
1248 omap2_mcspi_transfer_one(struct spi_master *master, struct spi_device *spi, struct spi_transfer *t) omap2_mcspi_transfer_one() argument
H A Dspi-ath79.c6 * This driver has been based on the spi-gpio.c:
21 #include <linux/spi/spi.h>
22 #include <linux/spi/spi_bitbang.h>
31 #define DRV_NAME "ath79-spi"
55 static inline struct ath79_spi *ath79_spidev_to_sp(struct spi_device *spi) ath79_spidev_to_sp() argument
57 return spi_master_get_devdata(spi->master); ath79_spidev_to_sp()
66 static void ath79_spi_chipselect(struct spi_device *spi, int is_active) ath79_spi_chipselect() argument
68 struct ath79_spi *sp = ath79_spidev_to_sp(spi); ath79_spi_chipselect()
69 int cs_high = (spi->mode & SPI_CS_HIGH) ? is_active : !is_active; ath79_spi_chipselect()
73 if (spi->mode & SPI_CPOL) ath79_spi_chipselect()
81 if (spi->chip_select) { ath79_spi_chipselect()
83 gpio_set_value(spi->cs_gpio, cs_high); ath79_spi_chipselect()
116 static int ath79_spi_setup_cs(struct spi_device *spi) ath79_spi_setup_cs() argument
118 struct ath79_spi *sp = ath79_spidev_to_sp(spi); ath79_spi_setup_cs()
121 if (spi->chip_select && !gpio_is_valid(spi->cs_gpio)) ath79_spi_setup_cs()
125 if (spi->chip_select) { ath79_spi_setup_cs()
129 if (spi->mode & SPI_CS_HIGH) ath79_spi_setup_cs()
134 status = gpio_request_one(spi->cs_gpio, flags, ath79_spi_setup_cs()
135 dev_name(&spi->dev)); ath79_spi_setup_cs()
137 if (spi->mode & SPI_CS_HIGH) ath79_spi_setup_cs()
148 static void ath79_spi_cleanup_cs(struct spi_device *spi) ath79_spi_cleanup_cs() argument
150 if (spi->chip_select) { ath79_spi_cleanup_cs()
151 gpio_free(spi->cs_gpio); ath79_spi_cleanup_cs()
155 static int ath79_spi_setup(struct spi_device *spi) ath79_spi_setup() argument
159 if (!spi->controller_state) { ath79_spi_setup()
160 status = ath79_spi_setup_cs(spi); ath79_spi_setup()
165 status = spi_bitbang_setup(spi); ath79_spi_setup()
166 if (status && !spi->controller_state) ath79_spi_setup()
167 ath79_spi_cleanup_cs(spi); ath79_spi_setup()
172 static void ath79_spi_cleanup(struct spi_device *spi) ath79_spi_cleanup() argument
174 ath79_spi_cleanup_cs(spi); ath79_spi_cleanup()
175 spi_bitbang_cleanup(spi); ath79_spi_cleanup()
178 static u32 ath79_spi_txrx_mode0(struct spi_device *spi, unsigned nsecs, ath79_spi_txrx_mode0() argument
181 struct ath79_spi *sp = ath79_spidev_to_sp(spi); ath79_spi_txrx_mode0()
218 dev_err(&pdev->dev, "failed to allocate spi master\n"); ath79_spi_probe()
304 { .compatible = "qca,ar7100-spi", },
H A Dspi-orion.c17 #include <linux/spi/spi.h>
71 * have both is for managing the armada-370-spi case with old
115 static int orion_spi_baudrate_set(struct spi_device *spi, unsigned int speed) orion_spi_baudrate_set() argument
124 orion_spi = spi_master_get_devdata(spi->master); orion_spi_baudrate_set()
188 orion_spi_mode_set(struct spi_device *spi) orion_spi_mode_set() argument
193 orion_spi = spi_master_get_devdata(spi->master); orion_spi_mode_set()
197 if (spi->mode & SPI_CPOL) orion_spi_mode_set()
199 if (spi->mode & SPI_CPHA) orion_spi_mode_set()
205 orion_spi_50mhz_ac_timing_erratum(struct spi_device *spi, unsigned int speed) orion_spi_50mhz_ac_timing_erratum() argument
210 orion_spi = spi_master_get_devdata(spi->master); orion_spi_50mhz_ac_timing_erratum()
230 speed == 50000000 && spi->mode & SPI_CPOL && orion_spi_50mhz_ac_timing_erratum()
231 spi->mode & SPI_CPHA) orion_spi_50mhz_ac_timing_erratum()
243 orion_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t) orion_spi_setup_transfer() argument
246 unsigned int speed = spi->max_speed_hz; orion_spi_setup_transfer()
247 unsigned int bits_per_word = spi->bits_per_word; orion_spi_setup_transfer()
250 orion_spi = spi_master_get_devdata(spi->master); orion_spi_setup_transfer()
258 orion_spi_mode_set(spi); orion_spi_setup_transfer()
261 orion_spi_50mhz_ac_timing_erratum(spi, speed); orion_spi_setup_transfer()
263 rc = orion_spi_baudrate_set(spi, speed); orion_spi_setup_transfer()
277 static void orion_spi_set_cs(struct spi_device *spi, bool enable) orion_spi_set_cs() argument
281 orion_spi = spi_master_get_devdata(spi->master); orion_spi_set_cs()
285 ORION_SPI_CS(spi->chip_select)); orion_spi_set_cs()
309 orion_spi_write_read_8bit(struct spi_device *spi, orion_spi_write_read_8bit() argument
315 orion_spi = spi_master_get_devdata(spi->master); orion_spi_write_read_8bit()
329 dev_err(&spi->dev, "TXS timed out\n"); orion_spi_write_read_8bit()
340 orion_spi_write_read_16bit(struct spi_device *spi, orion_spi_write_read_16bit() argument
346 orion_spi = spi_master_get_devdata(spi->master); orion_spi_write_read_16bit()
360 dev_err(&spi->dev, "TXS timed out\n"); orion_spi_write_read_16bit()
371 orion_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer) orion_spi_write_read() argument
376 word_len = spi->bits_per_word; orion_spi_write_read()
384 if (orion_spi_write_read_8bit(spi, &tx, &rx) < 0) orion_spi_write_read()
393 if (orion_spi_write_read_16bit(spi, &tx, &rx) < 0) orion_spi_write_read()
404 struct spi_device *spi, orion_spi_transfer_one()
409 status = orion_spi_setup_transfer(spi, t); orion_spi_transfer_one()
414 orion_spi_write_read(spi, t); orion_spi_transfer_one()
419 static int orion_spi_setup(struct spi_device *spi) orion_spi_setup() argument
421 return orion_spi_setup_transfer(spi, NULL); orion_spi_setup()
470 .compatible = "marvell,orion-spi",
474 .compatible = "marvell,armada-370-spi",
478 .compatible = "marvell,armada-375-spi",
482 .compatible = "marvell,armada-380-spi",
486 .compatible = "marvell,armada-390-spi",
490 .compatible = "marvell,armada-xp-spi",
503 struct orion_spi *spi; orion_spi_probe() local
508 master = spi_alloc_master(&pdev->dev, sizeof(*spi)); orion_spi_probe()
535 spi = spi_master_get_devdata(master); orion_spi_probe()
536 spi->master = master; orion_spi_probe()
540 spi->devdata = devdata; orion_spi_probe()
542 spi->clk = devm_clk_get(&pdev->dev, NULL); orion_spi_probe()
543 if (IS_ERR(spi->clk)) { orion_spi_probe()
544 status = PTR_ERR(spi->clk); orion_spi_probe()
548 status = clk_prepare_enable(spi->clk); orion_spi_probe()
552 tclk_hz = clk_get_rate(spi->clk); orion_spi_probe()
555 * With old device tree, armada-370-spi could be used with orion_spi_probe()
562 "marvell,armada-370-spi")) orion_spi_probe()
573 spi->base = devm_ioremap_resource(&pdev->dev, r); orion_spi_probe()
574 if (IS_ERR(spi->base)) { orion_spi_probe()
575 status = PTR_ERR(spi->base); orion_spi_probe()
584 status = orion_spi_reset(spi); orion_spi_probe()
601 clk_disable_unprepare(spi->clk); orion_spi_probe()
611 struct orion_spi *spi = spi_master_get_devdata(master); orion_spi_remove() local
614 clk_disable_unprepare(spi->clk); orion_spi_remove()
628 struct orion_spi *spi = spi_master_get_devdata(master); orion_spi_runtime_suspend() local
630 clk_disable_unprepare(spi->clk); orion_spi_runtime_suspend()
637 struct orion_spi *spi = spi_master_get_devdata(master); orion_spi_runtime_resume() local
639 return clk_prepare_enable(spi->clk); orion_spi_runtime_resume()
403 orion_spi_transfer_one(struct spi_master *master, struct spi_device *spi, struct spi_transfer *t) orion_spi_transfer_one() argument
H A Dspi-bitbang.c24 #include <linux/spi/spi.h>
25 #include <linux/spi/spi_bitbang.h>
51 u32 (*txrx_word)(struct spi_device *spi, unsigned nsecs,
55 struct spi_device *spi,
62 struct spi_device *spi, bitbang_txrx_8()
63 u32 (*txrx_word)(struct spi_device *spi, bitbang_txrx_8()
79 word = txrx_word(spi, ns, word, bits); bitbang_txrx_8()
88 struct spi_device *spi, bitbang_txrx_16()
89 u32 (*txrx_word)(struct spi_device *spi, bitbang_txrx_16()
105 word = txrx_word(spi, ns, word, bits); bitbang_txrx_16()
114 struct spi_device *spi, bitbang_txrx_32()
115 u32 (*txrx_word)(struct spi_device *spi, bitbang_txrx_32()
131 word = txrx_word(spi, ns, word, bits); bitbang_txrx_32()
139 int spi_bitbang_setup_transfer(struct spi_device *spi, struct spi_transfer *t) spi_bitbang_setup_transfer() argument
141 struct spi_bitbang_cs *cs = spi->controller_state; spi_bitbang_setup_transfer()
155 bits_per_word = spi->bits_per_word; spi_bitbang_setup_transfer()
167 hz = spi->max_speed_hz; spi_bitbang_setup_transfer()
181 int spi_bitbang_setup(struct spi_device *spi) spi_bitbang_setup() argument
183 struct spi_bitbang_cs *cs = spi->controller_state; spi_bitbang_setup()
186 bitbang = spi_master_get_devdata(spi->master); spi_bitbang_setup()
192 spi->controller_state = cs; spi_bitbang_setup()
196 cs->txrx_word = bitbang->txrx_word[spi->mode & (SPI_CPOL|SPI_CPHA)]; spi_bitbang_setup()
201 int retval = bitbang->setup_transfer(spi, NULL); spi_bitbang_setup()
206 dev_dbg(&spi->dev, "%s, %u nsec/bit\n", __func__, 2 * cs->nsecs); spi_bitbang_setup()
216 bitbang->chipselect(spi, BITBANG_CS_INACTIVE); spi_bitbang_setup()
228 void spi_bitbang_cleanup(struct spi_device *spi) spi_bitbang_cleanup() argument
230 kfree(spi->controller_state); spi_bitbang_cleanup()
234 static int spi_bitbang_bufs(struct spi_device *spi, struct spi_transfer *t) spi_bitbang_bufs() argument
236 struct spi_bitbang_cs *cs = spi->controller_state; spi_bitbang_bufs()
239 return cs->txrx_bufs(spi, cs->txrx_word, nsecs, t); spi_bitbang_bufs()
256 static int spi_bitbang_prepare_hardware(struct spi_master *spi) spi_bitbang_prepare_hardware() argument
260 bitbang = spi_master_get_devdata(spi); spi_bitbang_prepare_hardware()
270 struct spi_device *spi, spi_bitbang_transfer_one()
277 status = bitbang->setup_transfer(spi, transfer); spi_bitbang_transfer_one()
283 status = bitbang->txrx_bufs(spi, transfer); spi_bitbang_transfer_one()
296 static int spi_bitbang_unprepare_hardware(struct spi_master *spi) spi_bitbang_unprepare_hardware() argument
300 bitbang = spi_master_get_devdata(spi); spi_bitbang_unprepare_hardware()
309 static void spi_bitbang_set_cs(struct spi_device *spi, bool enable) spi_bitbang_set_cs() argument
311 struct spi_bitbang *bitbang = spi_master_get_devdata(spi->master); spi_bitbang_set_cs()
315 * spi device driver takes care of handling SPI_CS_HIGH spi_bitbang_set_cs()
317 enable = (!!(spi->mode & SPI_CS_HIGH) == enable); spi_bitbang_set_cs()
320 bitbang->chipselect(spi, enable ? BITBANG_CS_ACTIVE : spi_bitbang_set_cs()
342 * spi_bitbang_cleanup and spi_bitbang_setup_transfer to handle those spi
400 * spi_bitbang_stop - stops the task providing spi communication
61 bitbang_txrx_8( struct spi_device *spi, u32 (*txrx_word)(struct spi_device *spi, unsigned nsecs, u32 word, u8 bits), unsigned ns, struct spi_transfer *t ) bitbang_txrx_8() argument
87 bitbang_txrx_16( struct spi_device *spi, u32 (*txrx_word)(struct spi_device *spi, unsigned nsecs, u32 word, u8 bits), unsigned ns, struct spi_transfer *t ) bitbang_txrx_16() argument
113 bitbang_txrx_32( struct spi_device *spi, u32 (*txrx_word)(struct spi_device *spi, unsigned nsecs, u32 word, u8 bits), unsigned ns, struct spi_transfer *t ) bitbang_txrx_32() argument
269 spi_bitbang_transfer_one(struct spi_master *master, struct spi_device *spi, struct spi_transfer *transfer) spi_bitbang_transfer_one() argument
H A Dspi-gpio.c24 #include <linux/spi/spi.h>
25 #include <linux/spi/spi_bitbang.h>
26 #include <linux/spi/spi_gpio.h>
37 * spi->controller_state ... reserved for bitbang framework code
38 * spi->controller_data ... holds chipselect GPIO
40 * spi->master->dev.driver_data ... points to spi_gpio->bitbang
72 * #include "spi-gpio.c"
92 spi_to_spi_gpio(const struct spi_device *spi) spi_to_spi_gpio() argument
97 bang = spi_master_get_devdata(spi->master); spi_to_spi_gpio()
103 spi_to_pdata(const struct spi_device *spi) spi_to_pdata() argument
105 return &spi_to_spi_gpio(spi)->pdata; spi_to_pdata()
109 #define pdata spi_to_pdata(spi)
111 static inline void setsck(const struct spi_device *spi, int is_on) setsck() argument
116 static inline void setmosi(const struct spi_device *spi, int is_on) setmosi() argument
121 static inline int getmiso(const struct spi_device *spi) getmiso() argument
136 #include "spi-bitbang-txrx.h"
152 static u32 spi_gpio_txrx_word_mode0(struct spi_device *spi, spi_gpio_txrx_word_mode0() argument
155 return bitbang_txrx_be_cpha0(spi, nsecs, 0, 0, word, bits); spi_gpio_txrx_word_mode0()
158 static u32 spi_gpio_txrx_word_mode1(struct spi_device *spi, spi_gpio_txrx_word_mode1() argument
161 return bitbang_txrx_be_cpha1(spi, nsecs, 0, 0, word, bits); spi_gpio_txrx_word_mode1()
164 static u32 spi_gpio_txrx_word_mode2(struct spi_device *spi, spi_gpio_txrx_word_mode2() argument
167 return bitbang_txrx_be_cpha0(spi, nsecs, 1, 0, word, bits); spi_gpio_txrx_word_mode2()
170 static u32 spi_gpio_txrx_word_mode3(struct spi_device *spi, spi_gpio_txrx_word_mode3() argument
173 return bitbang_txrx_be_cpha1(spi, nsecs, 1, 0, word, bits); spi_gpio_txrx_word_mode3()
186 static u32 spi_gpio_spec_txrx_word_mode0(struct spi_device *spi, spi_gpio_spec_txrx_word_mode0() argument
189 unsigned flags = spi->master->flags; spi_gpio_spec_txrx_word_mode0()
190 return bitbang_txrx_be_cpha0(spi, nsecs, 0, flags, word, bits); spi_gpio_spec_txrx_word_mode0()
193 static u32 spi_gpio_spec_txrx_word_mode1(struct spi_device *spi, spi_gpio_spec_txrx_word_mode1() argument
196 unsigned flags = spi->master->flags; spi_gpio_spec_txrx_word_mode1()
197 return bitbang_txrx_be_cpha1(spi, nsecs, 0, flags, word, bits); spi_gpio_spec_txrx_word_mode1()
200 static u32 spi_gpio_spec_txrx_word_mode2(struct spi_device *spi, spi_gpio_spec_txrx_word_mode2() argument
203 unsigned flags = spi->master->flags; spi_gpio_spec_txrx_word_mode2()
204 return bitbang_txrx_be_cpha0(spi, nsecs, 1, flags, word, bits); spi_gpio_spec_txrx_word_mode2()
207 static u32 spi_gpio_spec_txrx_word_mode3(struct spi_device *spi, spi_gpio_spec_txrx_word_mode3() argument
210 unsigned flags = spi->master->flags; spi_gpio_spec_txrx_word_mode3()
211 return bitbang_txrx_be_cpha1(spi, nsecs, 1, flags, word, bits); spi_gpio_spec_txrx_word_mode3()
216 static void spi_gpio_chipselect(struct spi_device *spi, int is_active) spi_gpio_chipselect() argument
218 struct spi_gpio *spi_gpio = spi_to_spi_gpio(spi); spi_gpio_chipselect()
219 unsigned long cs = spi_gpio->cs_gpios[spi->chip_select]; spi_gpio_chipselect()
223 setsck(spi, spi->mode & SPI_CPOL); spi_gpio_chipselect()
227 gpio_set_value_cansleep(cs, (spi->mode & SPI_CS_HIGH) ? is_active : !is_active); spi_gpio_chipselect()
231 static int spi_gpio_setup(struct spi_device *spi) spi_gpio_setup() argument
235 struct spi_gpio *spi_gpio = spi_to_spi_gpio(spi); spi_gpio_setup()
236 struct device_node *np = spi->master->dev.of_node; spi_gpio_setup()
243 cs = spi_gpio->cs_gpios[spi->chip_select]; spi_gpio_setup()
246 * ... otherwise, take it from spi->controller_data spi_gpio_setup()
248 cs = (uintptr_t) spi->controller_data; spi_gpio_setup()
251 if (!spi->controller_state) { spi_gpio_setup()
253 status = gpio_request(cs, dev_name(&spi->dev)); spi_gpio_setup()
257 !(spi->mode & SPI_CS_HIGH)); spi_gpio_setup()
262 spi_gpio->cs_gpios[spi->chip_select] = cs; spi_gpio_setup()
263 status = spi_bitbang_setup(spi); spi_gpio_setup()
267 if (!spi->controller_state && cs != SPI_GPIO_NO_CHIPSELECT) spi_gpio_setup()
273 static void spi_gpio_cleanup(struct spi_device *spi) spi_gpio_cleanup() argument
275 struct spi_gpio *spi_gpio = spi_to_spi_gpio(spi); spi_gpio_cleanup()
276 unsigned long cs = spi_gpio->cs_gpios[spi->chip_select]; spi_gpio_cleanup()
280 spi_bitbang_cleanup(spi); spi_gpio_cleanup()
340 { .compatible = "spi-gpio" },
H A Dspi-mpc512x-psc.c28 #include <linux/spi/spi.h>
59 void (*cs_control)(struct spi_device *spi, bool on);
83 static int mpc512x_psc_spi_transfer_setup(struct spi_device *spi, mpc512x_psc_spi_transfer_setup() argument
86 struct mpc512x_psc_spi_cs *cs = spi->controller_state; mpc512x_psc_spi_transfer_setup()
89 ? t->speed_hz : spi->max_speed_hz; mpc512x_psc_spi_transfer_setup()
91 ? t->bits_per_word : spi->bits_per_word; mpc512x_psc_spi_transfer_setup()
96 static void mpc512x_psc_spi_activate_cs(struct spi_device *spi) mpc512x_psc_spi_activate_cs() argument
98 struct mpc512x_psc_spi_cs *cs = spi->controller_state; mpc512x_psc_spi_activate_cs()
99 struct mpc512x_psc_spi *mps = spi_master_get_devdata(spi->master); mpc512x_psc_spi_activate_cs()
108 if (spi->mode & SPI_CPHA) mpc512x_psc_spi_activate_cs()
113 if (spi->mode & SPI_CPOL) mpc512x_psc_spi_activate_cs()
118 if (spi->mode & SPI_LSB_FIRST) mpc512x_psc_spi_activate_cs()
135 if (mps->cs_control && gpio_is_valid(spi->cs_gpio)) mpc512x_psc_spi_activate_cs()
136 mps->cs_control(spi, (spi->mode & SPI_CS_HIGH) ? 1 : 0); mpc512x_psc_spi_activate_cs()
139 static void mpc512x_psc_spi_deactivate_cs(struct spi_device *spi) mpc512x_psc_spi_deactivate_cs() argument
141 struct mpc512x_psc_spi *mps = spi_master_get_devdata(spi->master); mpc512x_psc_spi_deactivate_cs()
143 if (mps->cs_control && gpio_is_valid(spi->cs_gpio)) mpc512x_psc_spi_deactivate_cs()
144 mps->cs_control(spi, (spi->mode & SPI_CS_HIGH) ? 0 : 1); mpc512x_psc_spi_deactivate_cs()
153 static int mpc512x_psc_spi_transfer_rxtx(struct spi_device *spi, mpc512x_psc_spi_transfer_rxtx() argument
156 struct mpc512x_psc_spi *mps = spi_master_get_devdata(spi->master); mpc512x_psc_spi_transfer_rxtx()
274 dev_warn(&spi->dev, mpc512x_psc_spi_transfer_rxtx()
296 struct spi_device *spi; mpc512x_psc_spi_msg_xfer() local
301 spi = m->spi; mpc512x_psc_spi_msg_xfer()
305 status = mpc512x_psc_spi_transfer_setup(spi, t); mpc512x_psc_spi_msg_xfer()
310 mpc512x_psc_spi_activate_cs(spi); mpc512x_psc_spi_msg_xfer()
313 status = mpc512x_psc_spi_transfer_rxtx(spi, t); mpc512x_psc_spi_msg_xfer()
322 mpc512x_psc_spi_deactivate_cs(spi); mpc512x_psc_spi_msg_xfer()
330 mpc512x_psc_spi_deactivate_cs(spi); mpc512x_psc_spi_msg_xfer()
332 mpc512x_psc_spi_transfer_setup(spi, NULL); mpc512x_psc_spi_msg_xfer()
368 static int mpc512x_psc_spi_setup(struct spi_device *spi) mpc512x_psc_spi_setup() argument
370 struct mpc512x_psc_spi_cs *cs = spi->controller_state; mpc512x_psc_spi_setup()
373 if (spi->bits_per_word % 8) mpc512x_psc_spi_setup()
381 if (gpio_is_valid(spi->cs_gpio)) { mpc512x_psc_spi_setup()
382 ret = gpio_request(spi->cs_gpio, dev_name(&spi->dev)); mpc512x_psc_spi_setup()
384 dev_err(&spi->dev, "can't get CS gpio: %d\n", mpc512x_psc_spi_setup()
389 gpio_direction_output(spi->cs_gpio, mpc512x_psc_spi_setup()
390 spi->mode & SPI_CS_HIGH ? 0 : 1); mpc512x_psc_spi_setup()
393 spi->controller_state = cs; mpc512x_psc_spi_setup()
396 cs->bits_per_word = spi->bits_per_word; mpc512x_psc_spi_setup()
397 cs->speed_hz = spi->max_speed_hz; mpc512x_psc_spi_setup()
402 static void mpc512x_psc_spi_cleanup(struct spi_device *spi) mpc512x_psc_spi_cleanup() argument
404 if (gpio_is_valid(spi->cs_gpio)) mpc512x_psc_spi_cleanup()
405 gpio_free(spi->cs_gpio); mpc512x_psc_spi_cleanup()
406 kfree(spi->controller_state); mpc512x_psc_spi_cleanup()
484 static void mpc512x_spi_cs_control(struct spi_device *spi, bool onoff) mpc512x_spi_cs_control() argument
486 gpio_set_value(spi->cs_gpio, onoff); mpc512x_spi_cs_control()
534 "mpc512x-psc-spi", mps); mpc512x_psc_spi_do_probe()
613 { .compatible = "fsl,mpc5121-psc-spi", .data = (void *)TYPE_MPC5121 },
614 { .compatible = "fsl,mpc5125-psc-spi", .data = (void *)TYPE_MPC5125 },
624 .name = "mpc512x-psc-spi",
H A Dspi-fsl-spi.c38 #include <linux/spi/spi.h>
39 #include <linux/spi/spi_bitbang.h>
42 #include "spi-fsl-lib.h"
43 #include "spi-fsl-cpm.h"
44 #include "spi-fsl-spi.h"
63 .compatible = "fsl,spi",
86 static void fsl_spi_change_mode(struct spi_device *spi) fsl_spi_change_mode() argument
88 struct mpc8xxx_spi *mspi = spi_master_get_devdata(spi->master); fsl_spi_change_mode()
89 struct spi_mpc8xxx_cs *cs = spi->controller_state; fsl_spi_change_mode()
111 static void fsl_spi_chipselect(struct spi_device *spi, int value) fsl_spi_chipselect() argument
113 struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); fsl_spi_chipselect()
115 bool pol = spi->mode & SPI_CS_HIGH; fsl_spi_chipselect()
116 struct spi_mpc8xxx_cs *cs = spi->controller_state; fsl_spi_chipselect()
118 pdata = spi->dev.parent->parent->platform_data; fsl_spi_chipselect()
122 pdata->cs_control(spi, !pol); fsl_spi_chipselect()
131 fsl_spi_change_mode(spi); fsl_spi_chipselect()
134 pdata->cs_control(spi, pol); fsl_spi_chipselect()
173 struct spi_device *spi, mspi_apply_cpu_mode_quirks()
194 !(spi->mode & SPI_LSB_FIRST)); mspi_apply_cpu_mode_quirks()
205 struct spi_device *spi, mspi_apply_qe_mode_quirks()
214 if (spi->mode & SPI_LSB_FIRST && mspi_apply_qe_mode_quirks()
222 static int fsl_spi_setup_transfer(struct spi_device *spi, fsl_spi_setup_transfer() argument
229 struct spi_mpc8xxx_cs *cs = spi->controller_state; fsl_spi_setup_transfer()
231 mpc8xxx_spi = spi_master_get_devdata(spi->master); fsl_spi_setup_transfer()
240 bits_per_word = spi->bits_per_word; fsl_spi_setup_transfer()
243 hz = spi->max_speed_hz; fsl_spi_setup_transfer()
246 bits_per_word = mspi_apply_cpu_mode_quirks(cs, spi, fsl_spi_setup_transfer()
250 bits_per_word = mspi_apply_qe_mode_quirks(cs, spi, fsl_spi_setup_transfer()
272 "Will use %d Hz instead.\n", dev_name(&spi->dev), fsl_spi_setup_transfer()
284 fsl_spi_change_mode(spi); fsl_spi_setup_transfer()
306 static int fsl_spi_bufs(struct spi_device *spi, struct spi_transfer *t, fsl_spi_bufs() argument
309 struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); fsl_spi_bufs()
316 bits_per_word = spi->bits_per_word; fsl_spi_bufs()
359 struct spi_device *spi = m->spi; fsl_spi_do_one_msg() local
371 dev_err(&spi->dev, fsl_spi_do_one_msg()
382 status = fsl_spi_setup_transfer(spi, t); fsl_spi_do_one_msg()
388 fsl_spi_chipselect(spi, BITBANG_CS_ACTIVE); fsl_spi_do_one_msg()
393 status = fsl_spi_bufs(spi, t, m->is_dma_mapped); fsl_spi_do_one_msg()
405 fsl_spi_chipselect(spi, BITBANG_CS_INACTIVE); fsl_spi_do_one_msg()
415 fsl_spi_chipselect(spi, BITBANG_CS_INACTIVE); fsl_spi_do_one_msg()
418 fsl_spi_setup_transfer(spi, NULL); fsl_spi_do_one_msg()
422 static int fsl_spi_setup(struct spi_device *spi) fsl_spi_setup() argument
428 struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi); fsl_spi_setup()
430 if (!spi->max_speed_hz) fsl_spi_setup()
437 spi_set_ctldata(spi, cs); fsl_spi_setup()
439 mpc8xxx_spi = spi_master_get_devdata(spi->master); fsl_spi_setup()
449 if (spi->mode & SPI_CPHA) fsl_spi_setup()
451 if (spi->mode & SPI_CPOL) fsl_spi_setup()
453 if (!(spi->mode & SPI_LSB_FIRST)) fsl_spi_setup()
455 if (spi->mode & SPI_LOOP) fsl_spi_setup()
458 retval = fsl_spi_setup_transfer(spi, NULL); fsl_spi_setup()
465 if (gpio_is_valid(spi->cs_gpio)) { fsl_spi_setup()
468 retval = gpio_request(spi->cs_gpio, fsl_spi_setup()
469 dev_name(&spi->dev)); fsl_spi_setup()
473 desel = !(spi->mode & SPI_CS_HIGH); fsl_spi_setup()
474 retval = gpio_direction_output(spi->cs_gpio, desel); fsl_spi_setup()
476 gpio_free(spi->cs_gpio); fsl_spi_setup()
479 } else if (spi->cs_gpio != -ENOENT) { fsl_spi_setup()
480 if (spi->cs_gpio < 0) fsl_spi_setup()
481 return spi->cs_gpio; fsl_spi_setup()
484 /* When spi->cs_gpio == -ENOENT, a hole in the phandle list fsl_spi_setup()
491 fsl_spi_chipselect(spi, BITBANG_CS_INACTIVE); fsl_spi_setup()
496 static void fsl_spi_cleanup(struct spi_device *spi) fsl_spi_cleanup() argument
498 struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); fsl_spi_cleanup()
499 struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi); fsl_spi_cleanup()
501 if (mpc8xxx_spi->type == TYPE_GRLIB && gpio_is_valid(spi->cs_gpio)) fsl_spi_cleanup()
502 gpio_free(spi->cs_gpio); fsl_spi_cleanup()
505 spi_set_ctldata(spi, NULL); fsl_spi_cleanup()
562 static void fsl_spi_grlib_cs_control(struct spi_device *spi, bool on) fsl_spi_grlib_cs_control() argument
564 struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); fsl_spi_grlib_cs_control()
567 u16 cs = spi->chip_select; fsl_spi_grlib_cs_control()
569 if (gpio_is_valid(spi->cs_gpio)) { fsl_spi_grlib_cs_control()
570 gpio_set_value(spi->cs_gpio, on); fsl_spi_grlib_cs_control()
699 static void fsl_spi_cs_control(struct spi_device *spi, bool on) fsl_spi_cs_control() argument
701 struct device *dev = spi->dev.parent->parent; fsl_spi_cs_control()
704 u16 cs = spi->chip_select; fsl_spi_cs_control()
172 mspi_apply_cpu_mode_quirks(struct spi_mpc8xxx_cs *cs, struct spi_device *spi, struct mpc8xxx_spi *mpc8xxx_spi, int bits_per_word) mspi_apply_cpu_mode_quirks() argument
204 mspi_apply_qe_mode_quirks(struct spi_mpc8xxx_cs *cs, struct spi_device *spi, int bits_per_word) mspi_apply_qe_mode_quirks() argument
H A Dspidev.c33 #include <linux/spi/spi.h>
34 #include <linux/spi/spidev.h>
78 struct spi_device *spi; member in struct:spidev_data
103 struct spi_device *spi; spidev_sync() local
106 spi = spidev->spi; spidev_sync()
109 if (spi == NULL) spidev_sync()
112 status = spi_sync(spi, message); spidev_sync()
286 dev_dbg(&spidev->spi->dev, spidev_message()
292 u_tmp->bits_per_word ? : spidev->spi->bits_per_word, spidev_message()
294 u_tmp->speed_hz ? : spidev->spi->max_speed_hz); spidev_message()
360 struct spi_device *spi; spidev_ioctl() local
387 spi = spi_dev_get(spidev->spi); spidev_ioctl()
390 if (spi == NULL) spidev_ioctl()
404 retval = __put_user(spi->mode & SPI_MODE_MASK, spidev_ioctl()
408 retval = __put_user(spi->mode & SPI_MODE_MASK, spidev_ioctl()
412 retval = __put_user((spi->mode & SPI_LSB_FIRST) ? 1 : 0, spidev_ioctl()
416 retval = __put_user(spi->bits_per_word, (__u8 __user *)arg); spidev_ioctl()
430 u32 save = spi->mode; spidev_ioctl()
437 tmp |= spi->mode & ~SPI_MODE_MASK; spidev_ioctl()
438 spi->mode = (u16)tmp; spidev_ioctl()
439 retval = spi_setup(spi); spidev_ioctl()
441 spi->mode = save; spidev_ioctl()
443 dev_dbg(&spi->dev, "spi mode %x\n", tmp); spidev_ioctl()
449 u32 save = spi->mode; spidev_ioctl()
452 spi->mode |= SPI_LSB_FIRST; spidev_ioctl()
454 spi->mode &= ~SPI_LSB_FIRST; spidev_ioctl()
455 retval = spi_setup(spi); spidev_ioctl()
457 spi->mode = save; spidev_ioctl()
459 dev_dbg(&spi->dev, "%csb first\n", spidev_ioctl()
466 u8 save = spi->bits_per_word; spidev_ioctl()
468 spi->bits_per_word = tmp; spidev_ioctl()
469 retval = spi_setup(spi); spidev_ioctl()
471 spi->bits_per_word = save; spidev_ioctl()
473 dev_dbg(&spi->dev, "%d bits per word\n", tmp); spidev_ioctl()
479 u32 save = spi->max_speed_hz; spidev_ioctl()
481 spi->max_speed_hz = tmp; spidev_ioctl()
482 retval = spi_setup(spi); spidev_ioctl()
486 dev_dbg(&spi->dev, "%d Hz (max)\n", tmp); spidev_ioctl()
487 spi->max_speed_hz = save; spidev_ioctl()
510 spi_dev_put(spi); spidev_ioctl()
522 struct spi_device *spi; spidev_compat_ioc_message() local
535 spi = spi_dev_get(spidev->spi); spidev_compat_ioc_message()
538 if (spi == NULL) spidev_compat_ioc_message()
565 spi_dev_put(spi); spidev_compat_ioc_message()
605 dev_dbg(&spidev->spi->dev, "open/ENOMEM\n"); spidev_open()
614 dev_dbg(&spidev->spi->dev, "open/ENOMEM\n"); spidev_open()
655 if (spidev->spi) spidev_release()
656 spidev->speed_hz = spidev->spi->max_speed_hz; spidev_release()
659 dofree = (spidev->spi == NULL); spidev_release()
705 static int spidev_probe(struct spi_device *spi) spidev_probe() argument
716 if (spi->dev.of_node && !of_match_device(spidev_dt_ids, &spi->dev)) { spidev_probe()
717 dev_err(&spi->dev, "buggy DT: spidev listed directly in DT\n"); spidev_probe()
718 WARN_ON(spi->dev.of_node && spidev_probe()
719 !of_match_device(spidev_dt_ids, &spi->dev)); spidev_probe()
728 spidev->spi = spi; spidev_probe()
743 dev = device_create(spidev_class, &spi->dev, spidev->devt, spidev_probe()
745 spi->master->bus_num, spi->chip_select); spidev_probe()
748 dev_dbg(&spi->dev, "no minor number available!\n"); spidev_probe()
757 spidev->speed_hz = spi->max_speed_hz; spidev_probe()
760 spi_set_drvdata(spi, spidev); spidev_probe()
767 static int spidev_remove(struct spi_device *spi) spidev_remove() argument
769 struct spidev_data *spidev = spi_get_drvdata(spi); spidev_remove()
773 spidev->spi = NULL; spidev_remove()
814 status = register_chrdev(SPIDEV_MAJOR, "spi", &spidev_fops); spidev_init()
844 MODULE_ALIAS("spi:spidev");
H A Dspi-mpc52xx-psc.c24 #include <linux/spi/spi.h>
35 void (*cs_control)(struct spi_device *spi, bool on);
63 static int mpc52xx_psc_spi_transfer_setup(struct spi_device *spi, mpc52xx_psc_spi_transfer_setup() argument
66 struct mpc52xx_psc_spi_cs *cs = spi->controller_state; mpc52xx_psc_spi_transfer_setup()
69 ? t->speed_hz : spi->max_speed_hz; mpc52xx_psc_spi_transfer_setup()
71 ? t->bits_per_word : spi->bits_per_word; mpc52xx_psc_spi_transfer_setup()
76 static void mpc52xx_psc_spi_activate_cs(struct spi_device *spi) mpc52xx_psc_spi_activate_cs() argument
78 struct mpc52xx_psc_spi_cs *cs = spi->controller_state; mpc52xx_psc_spi_activate_cs()
79 struct mpc52xx_psc_spi *mps = spi_master_get_devdata(spi->master); mpc52xx_psc_spi_activate_cs()
87 if (spi->mode & SPI_CPHA) mpc52xx_psc_spi_activate_cs()
91 if (spi->mode & SPI_CPOL) mpc52xx_psc_spi_activate_cs()
96 if (spi->mode & SPI_LSB_FIRST) mpc52xx_psc_spi_activate_cs()
116 mps->cs_control(spi, (spi->mode & SPI_CS_HIGH) ? 1 : 0); mpc52xx_psc_spi_activate_cs()
119 static void mpc52xx_psc_spi_deactivate_cs(struct spi_device *spi) mpc52xx_psc_spi_deactivate_cs() argument
121 struct mpc52xx_psc_spi *mps = spi_master_get_devdata(spi->master); mpc52xx_psc_spi_deactivate_cs()
124 mps->cs_control(spi, (spi->mode & SPI_CS_HIGH) ? 0 : 1); mpc52xx_psc_spi_deactivate_cs()
131 static int mpc52xx_psc_spi_transfer_rxtx(struct spi_device *spi, mpc52xx_psc_spi_transfer_rxtx() argument
134 struct mpc52xx_psc_spi *mps = spi_master_get_devdata(spi->master); mpc52xx_psc_spi_transfer_rxtx()
161 dev_dbg(&spi->dev, "send %d bytes...\n", send_at_once); mpc52xx_psc_spi_transfer_rxtx()
188 dev_dbg(&spi->dev, "%d bytes received\n", recv_at_once); mpc52xx_psc_spi_transfer_rxtx()
214 struct spi_device *spi; mpc52xx_psc_spi_work() local
223 spi = m->spi; mpc52xx_psc_spi_work()
228 status = mpc52xx_psc_spi_transfer_setup(spi, t); mpc52xx_psc_spi_work()
234 mpc52xx_psc_spi_activate_cs(spi); mpc52xx_psc_spi_work()
237 status = mpc52xx_psc_spi_transfer_rxtx(spi, t); mpc52xx_psc_spi_work()
246 mpc52xx_psc_spi_deactivate_cs(spi); mpc52xx_psc_spi_work()
254 mpc52xx_psc_spi_deactivate_cs(spi); mpc52xx_psc_spi_work()
256 mpc52xx_psc_spi_transfer_setup(spi, NULL); mpc52xx_psc_spi_work()
264 static int mpc52xx_psc_spi_setup(struct spi_device *spi) mpc52xx_psc_spi_setup() argument
266 struct mpc52xx_psc_spi *mps = spi_master_get_devdata(spi->master); mpc52xx_psc_spi_setup()
267 struct mpc52xx_psc_spi_cs *cs = spi->controller_state; mpc52xx_psc_spi_setup()
270 if (spi->bits_per_word%8) mpc52xx_psc_spi_setup()
277 spi->controller_state = cs; mpc52xx_psc_spi_setup()
280 cs->bits_per_word = spi->bits_per_word; mpc52xx_psc_spi_setup()
281 cs->speed_hz = spi->max_speed_hz; mpc52xx_psc_spi_setup()
285 mpc52xx_psc_spi_deactivate_cs(spi); mpc52xx_psc_spi_setup()
291 static int mpc52xx_psc_spi_transfer(struct spi_device *spi, mpc52xx_psc_spi_transfer() argument
294 struct mpc52xx_psc_spi *mps = spi_master_get_devdata(spi->master); mpc52xx_psc_spi_transfer()
308 static void mpc52xx_psc_spi_cleanup(struct spi_device *spi) mpc52xx_psc_spi_cleanup() argument
310 kfree(spi->controller_state); mpc52xx_psc_spi_cleanup()
381 /* the spi->mode bits understood by this driver: */ mpc52xx_psc_spi_do_probe()
412 ret = request_irq(mps->irq, mpc52xx_psc_spi_isr, 0, "mpc52xx-psc-spi", mpc52xx_psc_spi_do_probe()
499 { .compatible = "fsl,mpc5200-psc-spi", },
500 { .compatible = "mpc5200-psc-spi", }, /* old */
510 .name = "mpc52xx-psc-spi",
H A Dspi-xtensa-xtfpga.c16 #include <linux/spi/spi.h>
17 #include <linux/spi/spi_bitbang.h>
34 static inline void xtfpga_spi_write32(const struct xtfpga_spi *spi, xtfpga_spi_write32() argument
37 __raw_writel(val, spi->regs + addr); xtfpga_spi_write32()
40 static inline unsigned int xtfpga_spi_read32(const struct xtfpga_spi *spi, xtfpga_spi_read32() argument
43 return __raw_readl(spi->regs + addr); xtfpga_spi_read32()
56 static u32 xtfpga_spi_txrx_word(struct spi_device *spi, unsigned nsecs, xtfpga_spi_txrx_word() argument
59 struct xtfpga_spi *xspi = spi_master_get_devdata(spi->master); xtfpga_spi_txrx_word()
75 static void xtfpga_spi_chipselect(struct spi_device *spi, int is_on) xtfpga_spi_chipselect() argument
77 struct xtfpga_spi *xspi = spi_master_get_devdata(spi->master); xtfpga_spi_chipselect()
152 { .compatible = "cdns,xtfpga-spi", },
H A Dspi-xcomm.c14 #include <linux/spi/spi.h>
60 struct spi_device *spi, int is_active) spi_xcomm_chipselect()
62 unsigned long cs = spi->chip_select; spi_xcomm_chipselect()
74 struct spi_device *spi, struct spi_transfer *t, unsigned int *settings) spi_xcomm_setup_transfer()
93 if (spi->mode & SPI_CPOL) spi_xcomm_setup_transfer()
98 if (spi->mode & SPI_CPHA) spi_xcomm_setup_transfer()
103 if (spi->mode & SPI_3WIRE) spi_xcomm_setup_transfer()
112 struct spi_device *spi, struct spi_transfer *t) spi_xcomm_txrx_bufs()
141 struct spi_device *spi = msg->spi; spi_xcomm_transfer_one() local
148 spi_xcomm_chipselect(spi_xcomm, spi, true); spi_xcomm_transfer_one()
157 status = spi_xcomm_setup_transfer(spi_xcomm, spi, t, &settings); spi_xcomm_transfer_one()
182 status = spi_xcomm_txrx_bufs(spi_xcomm, spi, t); spi_xcomm_transfer_one()
199 spi_xcomm_chipselect(spi_xcomm, spi, false); spi_xcomm_transfer_one()
237 { "spi-xcomm" },
244 .name = "spi-xcomm",
59 spi_xcomm_chipselect(struct spi_xcomm *spi_xcomm, struct spi_device *spi, int is_active) spi_xcomm_chipselect() argument
73 spi_xcomm_setup_transfer(struct spi_xcomm *spi_xcomm, struct spi_device *spi, struct spi_transfer *t, unsigned int *settings) spi_xcomm_setup_transfer() argument
111 spi_xcomm_txrx_bufs(struct spi_xcomm *spi_xcomm, struct spi_device *spi, struct spi_transfer *t) spi_xcomm_txrx_bufs() argument
H A Dspi-mxs.c17 * Based on spi-stmp.c, which is:
49 #include <linux/spi/spi.h>
50 #include <linux/spi/mxs-spi.h>
52 #define DRIVER_NAME "mxs-spi"
75 struct mxs_spi *spi = spi_master_get_devdata(dev->master); mxs_spi_setup_transfer() local
76 struct mxs_ssp *ssp = &spi->ssp; mxs_spi_setup_transfer()
84 if (hz != spi->sck) { mxs_spi_setup_transfer()
91 spi->sck = hz; mxs_spi_setup_transfer()
133 static int mxs_ssp_wait(struct mxs_spi *spi, int offset, int mask, bool set) mxs_ssp_wait() argument
136 struct mxs_ssp *ssp = &spi->ssp; mxs_ssp_wait()
156 struct mxs_spi *spi = param; mxs_ssp_dma_irq_callback() local
158 complete(&spi->c); mxs_ssp_dma_irq_callback()
172 static int mxs_spi_txrx_dma(struct mxs_spi *spi, mxs_spi_txrx_dma() argument
176 struct mxs_ssp *ssp = &spi->ssp; mxs_spi_txrx_dma()
197 reinit_completion(&spi->c); mxs_spi_txrx_dma()
279 desc->callback_param = spi; mxs_spi_txrx_dma()
285 if (!wait_for_completion_timeout(&spi->c, mxs_spi_txrx_dma()
307 static int mxs_spi_txrx_pio(struct mxs_spi *spi, mxs_spi_txrx_pio() argument
311 struct mxs_ssp *ssp = &spi->ssp; mxs_spi_txrx_pio()
340 if (mxs_ssp_wait(spi, HW_SSP_CTRL0, BM_SSP_CTRL0_RUN, 1)) mxs_spi_txrx_pio()
350 if (mxs_ssp_wait(spi, HW_SSP_STATUS(ssp), mxs_spi_txrx_pio()
357 if (mxs_ssp_wait(spi, HW_SSP_CTRL0, BM_SSP_CTRL0_RUN, 0)) mxs_spi_txrx_pio()
372 struct mxs_spi *spi = spi_master_get_devdata(master); mxs_spi_transfer_one() local
373 struct mxs_ssp *ssp = &spi->ssp; mxs_spi_transfer_one()
381 writel(mxs_spi_cs_to_reg(m->spi->chip_select), mxs_spi_transfer_one()
386 status = mxs_spi_setup_transfer(m->spi, t); mxs_spi_transfer_one()
409 status = mxs_spi_txrx_pio(spi, mxs_spi_transfer_one()
413 status = mxs_spi_txrx_pio(spi, mxs_spi_transfer_one()
422 status = mxs_spi_txrx_dma(spi, mxs_spi_transfer_one()
426 status = mxs_spi_txrx_dma(spi, mxs_spi_transfer_one()
446 { .compatible = "fsl,imx23-spi", .data = (void *) IMX23_SSP, },
447 { .compatible = "fsl,imx28-spi", .data = (void *) IMX28_SSP, },
458 struct mxs_spi *spi; mxs_spi_probe() local
492 master = spi_alloc_master(&pdev->dev, sizeof(*spi)); mxs_spi_probe()
503 spi = spi_master_get_devdata(master); mxs_spi_probe()
504 ssp = &spi->ssp; mxs_spi_probe()
510 init_completion(&spi->c); mxs_spi_probe()
556 struct mxs_spi *spi; mxs_spi_remove() local
560 spi = spi_master_get_devdata(master); mxs_spi_remove()
561 ssp = &spi->ssp; mxs_spi_remove()
583 MODULE_ALIAS("platform:mxs-spi");
H A Dspi-sh-sci.c21 #include <linux/spi/spi.h>
22 #include <linux/spi/spi_bitbang.h>
25 #include <asm/spi.h>
80 #include "spi-bitbang-txrx.h"
82 static u32 sh_sci_spi_txrx_mode0(struct spi_device *spi, sh_sci_spi_txrx_mode0() argument
85 return bitbang_txrx_be_cpha0(spi, nsecs, 0, 0, word, bits); sh_sci_spi_txrx_mode0()
88 static u32 sh_sci_spi_txrx_mode1(struct spi_device *spi, sh_sci_spi_txrx_mode1() argument
91 return bitbang_txrx_be_cpha1(spi, nsecs, 0, 0, word, bits); sh_sci_spi_txrx_mode1()
94 static u32 sh_sci_spi_txrx_mode2(struct spi_device *spi, sh_sci_spi_txrx_mode2() argument
97 return bitbang_txrx_be_cpha0(spi, nsecs, 1, 0, word, bits); sh_sci_spi_txrx_mode2()
100 static u32 sh_sci_spi_txrx_mode3(struct spi_device *spi, sh_sci_spi_txrx_mode3() argument
103 return bitbang_txrx_be_cpha1(spi, nsecs, 1, 0, word, bits); sh_sci_spi_txrx_mode3()
123 dev_err(&dev->dev, "failed to allocate spi master\n"); sh_sci_spi_probe()
138 /* setup spi bitbang adaptor */ sh_sci_spi_probe()
H A Dspi-s3c64xx.c25 #include <linux/spi/spi.h>
30 #include <linux/platform_data/spi-s3c64xx.h>
149 * differ in some aspects such as the size of the fifo and spi bus clock
164 * @clk: Pointer to the spi clock.
314 static int s3c64xx_spi_prepare_transfer(struct spi_master *spi) s3c64xx_spi_prepare_transfer() argument
316 struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(spi); s3c64xx_spi_prepare_transfer()
334 spi->dma_rx = sdd->rx_dma.ch; s3c64xx_spi_prepare_transfer()
343 spi->dma_tx = sdd->tx_dma.ch; s3c64xx_spi_prepare_transfer()
354 static int s3c64xx_spi_unprepare_transfer(struct spi_master *spi) s3c64xx_spi_unprepare_transfer() argument
356 struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(spi); s3c64xx_spi_unprepare_transfer()
368 struct spi_device *spi, s3c64xx_spi_can_dma()
377 struct spi_device *spi, enable_datapath()
652 struct spi_device *spi = msg->spi; s3c64xx_spi_prepare_message() local
653 struct s3c64xx_spi_csinfo *cs = spi->controller_data; s3c64xx_spi_prepare_message()
656 if (sdd->cur_speed != spi->max_speed_hz s3c64xx_spi_prepare_message()
657 || sdd->cur_mode != spi->mode s3c64xx_spi_prepare_message()
658 || sdd->cur_bpw != spi->bits_per_word) { s3c64xx_spi_prepare_message()
659 sdd->cur_bpw = spi->bits_per_word; s3c64xx_spi_prepare_message()
660 sdd->cur_speed = spi->max_speed_hz; s3c64xx_spi_prepare_message()
661 sdd->cur_mode = spi->mode; s3c64xx_spi_prepare_message()
672 struct spi_device *spi, s3c64xx_spi_transfer_one()
707 enable_datapath(sdd, spi, xfer, use_dma); s3c64xx_spi_transfer_one()
725 dev_err(&spi->dev, "I/O Error: rx-%d tx-%d res:rx-%c tx-%c len-%d\n", s3c64xx_spi_transfer_one()
747 struct spi_device *spi) s3c64xx_get_slave_ctrldata()
753 slave_np = spi->dev.of_node; s3c64xx_get_slave_ctrldata()
755 dev_err(&spi->dev, "device node not found\n"); s3c64xx_get_slave_ctrldata()
761 dev_err(&spi->dev, "child node 'controller-data' not found\n"); s3c64xx_get_slave_ctrldata()
771 of_property_read_u32(data_np, "samsung,spi-feedback-delay", &fb_delay); s3c64xx_get_slave_ctrldata()
783 static int s3c64xx_spi_setup(struct spi_device *spi) s3c64xx_spi_setup() argument
785 struct s3c64xx_spi_csinfo *cs = spi->controller_data; s3c64xx_spi_setup()
790 sdd = spi_master_get_devdata(spi->master); s3c64xx_spi_setup()
791 if (spi->dev.of_node) { s3c64xx_spi_setup()
792 cs = s3c64xx_get_slave_ctrldata(spi); s3c64xx_spi_setup()
793 spi->controller_data = cs; s3c64xx_spi_setup()
795 /* On non-DT platforms the SPI core will set spi->cs_gpio s3c64xx_spi_setup()
797 * is defined by using platform data so spi->cs_gpio value s3c64xx_spi_setup()
800 spi->cs_gpio = cs->line; s3c64xx_spi_setup()
804 dev_err(&spi->dev, "No CS for SPI(%d)\n", spi->chip_select); s3c64xx_spi_setup()
808 if (!spi_get_ctldata(spi)) { s3c64xx_spi_setup()
809 if (gpio_is_valid(spi->cs_gpio)) { s3c64xx_spi_setup()
810 err = gpio_request_one(spi->cs_gpio, GPIOF_OUT_INIT_HIGH, s3c64xx_spi_setup()
811 dev_name(&spi->dev)); s3c64xx_spi_setup()
813 dev_err(&spi->dev, s3c64xx_spi_setup()
815 spi->cs_gpio, err); s3c64xx_spi_setup()
820 spi_set_ctldata(spi, cs); s3c64xx_spi_setup()
834 if (spi->max_speed_hz > speed) s3c64xx_spi_setup()
835 spi->max_speed_hz = speed; s3c64xx_spi_setup()
837 psr = clk_get_rate(sdd->src_clk) / 2 / spi->max_speed_hz - 1; s3c64xx_spi_setup()
843 if (spi->max_speed_hz < speed) { s3c64xx_spi_setup()
853 if (spi->max_speed_hz >= speed) { s3c64xx_spi_setup()
854 spi->max_speed_hz = speed; s3c64xx_spi_setup()
856 dev_err(&spi->dev, "Can't set %dHz transfer speed\n", s3c64xx_spi_setup()
857 spi->max_speed_hz); s3c64xx_spi_setup()
876 if (gpio_is_valid(spi->cs_gpio)) s3c64xx_spi_setup()
877 gpio_free(spi->cs_gpio); s3c64xx_spi_setup()
878 spi_set_ctldata(spi, NULL); s3c64xx_spi_setup()
881 if (spi->dev.of_node) s3c64xx_spi_setup()
887 static void s3c64xx_spi_cleanup(struct spi_device *spi) s3c64xx_spi_cleanup() argument
889 struct s3c64xx_spi_csinfo *cs = spi_get_ctldata(spi); s3c64xx_spi_cleanup()
891 if (gpio_is_valid(spi->cs_gpio)) { s3c64xx_spi_cleanup()
892 gpio_free(spi->cs_gpio); s3c64xx_spi_cleanup()
893 if (spi->dev.of_node) s3c64xx_spi_cleanup()
897 * spi->cs_gpio to -ENOENT and .setup() s3c64xx_spi_cleanup()
901 spi->cs_gpio = -ENOENT; s3c64xx_spi_cleanup()
905 spi_set_ctldata(spi, NULL); s3c64xx_spi_cleanup()
911 struct spi_master *spi = sdd->master; s3c64xx_spi_irq() local
918 dev_err(&spi->dev, "RX overrun\n"); s3c64xx_spi_irq()
922 dev_err(&spi->dev, "RX underrun\n"); s3c64xx_spi_irq()
926 dev_err(&spi->dev, "TX overrun\n"); s3c64xx_spi_irq()
930 dev_err(&spi->dev, "TX underrun\n"); s3c64xx_spi_irq()
989 if (of_property_read_u32(dev->of_node, "samsung,spi-src-clk", &temp)) { s3c64xx_spi_parse_dt()
990 dev_warn(dev, "spi bus clock parent not specified, using clock at index 0 as parent\n"); s3c64xx_spi_parse_dt()
1077 ret = of_alias_get_id(pdev->dev.of_node, "spi"); s3c64xx_spi_probe()
1121 /* the spi->mode bits understood by this driver: */ s3c64xx_spi_probe()
1140 sdd->clk = devm_clk_get(&pdev->dev, "spi"); s3c64xx_spi_probe()
1142 dev_err(&pdev->dev, "Unable to acquire clock 'spi'\n"); s3c64xx_spi_probe()
1148 dev_err(&pdev->dev, "Couldn't enable clock 'spi'\n"); s3c64xx_spi_probe()
1181 "spi-s3c64xx", sdd); s3c64xx_spi_probe()
1368 .name = "s3c2443-spi",
1371 .name = "s3c6410-spi",
1374 .name = "s5pv210-spi",
1377 .name = "exynos4210-spi",
1384 { .compatible = "samsung,s3c2443-spi",
1387 { .compatible = "samsung,s3c6410-spi",
1390 { .compatible = "samsung,s5pv210-spi",
1393 { .compatible = "samsung,exynos4210-spi",
1396 { .compatible = "samsung,exynos5440-spi",
1399 { .compatible = "samsung,exynos7-spi",
1408 .name = "s3c64xx-spi",
1416 MODULE_ALIAS("platform:s3c64xx-spi");
367 s3c64xx_spi_can_dma(struct spi_master *master, struct spi_device *spi, struct spi_transfer *xfer) s3c64xx_spi_can_dma() argument
376 enable_datapath(struct s3c64xx_spi_driver_data *sdd, struct spi_device *spi, struct spi_transfer *xfer, int dma_mode) enable_datapath() argument
671 s3c64xx_spi_transfer_one(struct spi_master *master, struct spi_device *spi, struct spi_transfer *xfer) s3c64xx_spi_transfer_one() argument
746 s3c64xx_get_slave_ctrldata( struct spi_device *spi) s3c64xx_get_slave_ctrldata() argument
H A Dspi-oc-tiny.c22 #include <linux/spi/spi.h>
23 #include <linux/spi/spi_bitbang.h>
24 #include <linux/spi/spi_oc_tiny.h>
65 static unsigned int tiny_spi_baud(struct spi_device *spi, unsigned int hz) tiny_spi_baud() argument
67 struct tiny_spi *hw = tiny_spi_to_hw(spi); tiny_spi_baud()
72 static void tiny_spi_chipselect(struct spi_device *spi, int is_active) tiny_spi_chipselect() argument
74 struct tiny_spi *hw = tiny_spi_to_hw(spi); tiny_spi_chipselect()
77 gpio_set_value(hw->gpio_cs[spi->chip_select], tiny_spi_chipselect()
78 (spi->mode & SPI_CS_HIGH) ? is_active : !is_active); tiny_spi_chipselect()
82 static int tiny_spi_setup_transfer(struct spi_device *spi, tiny_spi_setup_transfer() argument
85 struct tiny_spi *hw = tiny_spi_to_hw(spi); tiny_spi_setup_transfer()
90 baud = tiny_spi_baud(spi, t->speed_hz); tiny_spi_setup_transfer()
97 static int tiny_spi_setup(struct spi_device *spi) tiny_spi_setup() argument
99 struct tiny_spi *hw = tiny_spi_to_hw(spi); tiny_spi_setup()
101 if (spi->max_speed_hz != hw->speed_hz) { tiny_spi_setup()
102 hw->speed_hz = spi->max_speed_hz; tiny_spi_setup()
103 hw->baud = tiny_spi_baud(spi, hw->speed_hz); tiny_spi_setup()
105 hw->mode = spi->mode & (SPI_CPOL | SPI_CPHA); tiny_spi_setup()
123 static int tiny_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) tiny_spi_txrx_bufs() argument
125 struct tiny_spi *hw = tiny_spi_to_hw(spi); tiny_spi_txrx_bufs()
308 /* register our spi controller */ tiny_spi_probe()
339 { .compatible = "opencores,tiny-spi-rtlsvn2", },
H A Dspi-st-ssc4.c25 #include <linux/spi/spi.h>
26 #include <linux/spi/spi_bitbang.h>
148 struct spi_device *spi, struct spi_transfer *t) spi_st_transfer_one()
157 if (spi->bits_per_word > 8) { spi_st_transfer_one()
165 } else if (spi->bits_per_word == 8 && !(t->len & 0x1)) { spi_st_transfer_one()
197 spi_finalize_current_transfer(spi->master); spi_st_transfer_one()
202 static void spi_st_cleanup(struct spi_device *spi) spi_st_cleanup() argument
204 int cs = spi->cs_gpio; spi_st_cleanup()
207 devm_gpio_free(&spi->dev, cs); spi_st_cleanup()
210 /* the spi->mode bits understood by this driver: */
212 static int spi_st_setup(struct spi_device *spi) spi_st_setup() argument
214 struct spi_st *spi_st = spi_master_get_devdata(spi->master); spi_st_setup()
216 u32 hz = spi->max_speed_hz; spi_st_setup()
217 int cs = spi->cs_gpio; spi_st_setup()
221 dev_err(&spi->dev, "max_speed_hz unspecified\n"); spi_st_setup()
226 dev_err(&spi->dev, "%d is not a valid gpio\n", cs); spi_st_setup()
230 if (devm_gpio_request(&spi->dev, cs, dev_name(&spi->dev))) { spi_st_setup()
231 dev_err(&spi->dev, "could not request gpio:%d\n", cs); spi_st_setup()
235 ret = gpio_direction_output(cs, spi->mode & SPI_CS_HIGH); spi_st_setup()
244 dev_err(&spi->dev, spi_st_setup()
255 dev_dbg(&spi->dev, spi_st_setup()
263 if (spi->mode & SPI_CPOL) spi_st_setup()
268 if (spi->mode & SPI_CPHA) spi_st_setup()
273 if ((spi->mode & SPI_LSB_FIRST) == 0) spi_st_setup()
278 if (spi->mode & SPI_LOOP) spi_st_setup()
284 var |= (spi->bits_per_word - 1); spi_st_setup()
486 { .compatible = "st,comms-ssc4-spi", },
493 .name = "spi-st",
147 spi_st_transfer_one(struct spi_master *master, struct spi_device *spi, struct spi_transfer *t) spi_st_transfer_one() argument
H A Dspi.c30 #include <linux/spi/spi.h>
42 #include <trace/events/spi.h>
46 struct spi_device *spi = to_spi_device(dev); spidev_release() local
48 /* spi masters may cleanup for released devices */ spidev_release()
49 if (spi->master->cleanup) spidev_release()
50 spi->master->cleanup(spi); spidev_release()
52 spi_master_put(spi->master); spidev_release()
53 kfree(spi); spidev_release()
59 const struct spi_device *spi = to_spi_device(dev); modalias_show() local
66 return sprintf(buf, "%s%s\n", SPI_MODULE_PREFIX, spi->modalias); modalias_show()
87 struct spi_device *spi = container_of(dev, \
89 return spi_statistics_##field##_show(&spi->statistics, buf); \
292 const struct spi_device *spi = to_spi_device(dev); spi_match_device() local
304 return !!spi_match_id(sdrv->id_table, spi); spi_match_device()
306 return strcmp(spi->modalias, drv->name) == 0; spi_match_device()
311 const struct spi_device *spi = to_spi_device(dev); spi_uevent() local
318 add_uevent_var(env, "MODALIAS=%s%s", SPI_MODULE_PREFIX, spi->modalias); spi_uevent()
323 .name = "spi",
334 struct spi_device *spi = to_spi_device(dev); spi_drv_probe() local
342 spi->irq = of_irq_get(dev->of_node, 0); spi_drv_probe()
343 if (spi->irq == -EPROBE_DEFER) spi_drv_probe()
345 if (spi->irq < 0) spi_drv_probe()
346 spi->irq = 0; spi_drv_probe()
351 ret = sdrv->probe(spi); spi_drv_probe()
440 struct spi_device *spi; spi_alloc_device() local
445 spi = kzalloc(sizeof(*spi), GFP_KERNEL); spi_alloc_device()
446 if (!spi) { spi_alloc_device()
451 spi->master = master; spi_alloc_device()
452 spi->dev.parent = &master->dev; spi_alloc_device()
453 spi->dev.bus = &spi_bus_type; spi_alloc_device()
454 spi->dev.release = spidev_release; spi_alloc_device()
455 spi->cs_gpio = -ENOENT; spi_alloc_device()
457 spin_lock_init(&spi->statistics.lock); spi_alloc_device()
459 device_initialize(&spi->dev); spi_alloc_device()
460 return spi; spi_alloc_device()
464 static void spi_dev_set_name(struct spi_device *spi) spi_dev_set_name() argument
466 struct acpi_device *adev = ACPI_COMPANION(&spi->dev); spi_dev_set_name()
469 dev_set_name(&spi->dev, "spi-%s", acpi_dev_name(adev)); spi_dev_set_name()
473 dev_set_name(&spi->dev, "%s.%u", dev_name(&spi->master->dev), spi_dev_set_name()
474 spi->chip_select); spi_dev_set_name()
479 struct spi_device *spi = to_spi_device(dev); spi_dev_check() local
482 if (spi->master == new_spi->master && spi_dev_check()
483 spi->chip_select == new_spi->chip_select) spi_dev_check()
490 * @spi: spi_device to register
493 * spi_alloc_device can be added onto the spi bus with this function.
497 int spi_add_device(struct spi_device *spi) spi_add_device() argument
500 struct spi_master *master = spi->master; spi_add_device()
505 if (spi->chip_select >= master->num_chipselect) { spi_add_device()
507 spi->chip_select, spi_add_device()
513 spi_dev_set_name(spi); spi_add_device()
521 status = bus_for_each_dev(&spi_bus_type, NULL, spi, spi_dev_check); spi_add_device()
524 spi->chip_select); spi_add_device()
529 spi->cs_gpio = master->cs_gpios[spi->chip_select]; spi_add_device()
535 status = spi_setup(spi); spi_add_device()
538 dev_name(&spi->dev), status); spi_add_device()
543 status = device_add(&spi->dev); spi_add_device()
546 dev_name(&spi->dev), status); spi_add_device()
548 dev_dbg(dev, "registered child %s\n", dev_name(&spi->dev)); spi_add_device()
671 static void spi_set_cs(struct spi_device *spi, bool enable) spi_set_cs() argument
673 if (spi->mode & SPI_CS_HIGH) spi_set_cs()
676 if (gpio_is_valid(spi->cs_gpio)) spi_set_cs()
677 gpio_set_value(spi->cs_gpio, !enable); spi_set_cs()
678 else if (spi->master->set_cs) spi_set_cs()
679 spi->master->set_cs(spi, !enable); spi_set_cs()
772 if (!master->can_dma(master, msg->spi, xfer)) __spi_map_msg()
819 if (!master->can_dma(master, msg->spi, xfer)) __spi_unmap_msg()
926 struct spi_statistics *stats = &msg->spi->statistics; spi_transfer_one_message()
928 spi_set_cs(msg->spi, true); spi_transfer_one_message()
942 ret = master->transfer_one(master, msg->spi, xfer); spi_transfer_one_message()
948 dev_err(&msg->spi->dev, spi_transfer_one_message()
967 dev_err(&msg->spi->dev, spi_transfer_one_message()
973 dev_err(&msg->spi->dev, spi_transfer_one_message()
991 spi_set_cs(msg->spi, false); spi_transfer_one_message()
993 spi_set_cs(msg->spi, true); spi_transfer_one_message()
1002 spi_set_cs(msg->spi, false); spi_transfer_one_message()
1030 * __spi_pump_messages - function which processes spi message queue
1034 * This function checks if there is any spi message in the queue that
1168 * spi_pump_messages - kthread work function which processes spi message queue
1356 static int __spi_queued_transfer(struct spi_device *spi, __spi_queued_transfer() argument
1360 struct spi_master *master = spi->master; __spi_queued_transfer()
1382 * @spi: spi device which is requesting transfer
1383 * @msg: spi message which is to handled is queued to driver queue
1387 static int spi_queued_transfer(struct spi_device *spi, struct spi_message *msg) spi_queued_transfer() argument
1389 return __spi_queued_transfer(spi, msg, true); spi_queued_transfer()
1427 struct spi_device *spi; of_register_spi_device() local
1432 spi = spi_alloc_device(master); of_register_spi_device()
1433 if (!spi) { of_register_spi_device()
1441 rc = of_modalias_node(nc, spi->modalias, of_register_spi_device()
1442 sizeof(spi->modalias)); of_register_spi_device()
1456 spi->chip_select = value; of_register_spi_device()
1459 if (of_find_property(nc, "spi-cpha", NULL)) of_register_spi_device()
1460 spi->mode |= SPI_CPHA; of_register_spi_device()
1461 if (of_find_property(nc, "spi-cpol", NULL)) of_register_spi_device()
1462 spi->mode |= SPI_CPOL; of_register_spi_device()
1463 if (of_find_property(nc, "spi-cs-high", NULL)) of_register_spi_device()
1464 spi->mode |= SPI_CS_HIGH; of_register_spi_device()
1465 if (of_find_property(nc, "spi-3wire", NULL)) of_register_spi_device()
1466 spi->mode |= SPI_3WIRE; of_register_spi_device()
1467 if (of_find_property(nc, "spi-lsb-first", NULL)) of_register_spi_device()
1468 spi->mode |= SPI_LSB_FIRST; of_register_spi_device()
1471 if (!of_property_read_u32(nc, "spi-tx-bus-width", &value)) { of_register_spi_device()
1476 spi->mode |= SPI_TX_DUAL; of_register_spi_device()
1479 spi->mode |= SPI_TX_QUAD; of_register_spi_device()
1483 "spi-tx-bus-width %d not supported\n", of_register_spi_device()
1489 if (!of_property_read_u32(nc, "spi-rx-bus-width", &value)) { of_register_spi_device()
1494 spi->mode |= SPI_RX_DUAL; of_register_spi_device()
1497 spi->mode |= SPI_RX_QUAD; of_register_spi_device()
1501 "spi-rx-bus-width %d not supported\n", of_register_spi_device()
1508 rc = of_property_read_u32(nc, "spi-max-frequency", &value); of_register_spi_device()
1510 dev_err(&master->dev, "%s has no valid 'spi-max-frequency' property (%d)\n", of_register_spi_device()
1514 spi->max_speed_hz = value; of_register_spi_device()
1518 spi->dev.of_node = nc; of_register_spi_device()
1521 rc = spi_add_device(spi); of_register_spi_device()
1528 return spi; of_register_spi_device()
1531 spi_dev_put(spi); of_register_spi_device()
1544 struct spi_device *spi; of_register_spi_devices() local
1551 spi = of_register_spi_device(master, nc); of_register_spi_devices()
1552 if (IS_ERR(spi)) of_register_spi_devices()
1564 struct spi_device *spi = data; acpi_spi_add_resource() local
1571 spi->chip_select = sb->device_selection; acpi_spi_add_resource()
1572 spi->max_speed_hz = sb->connection_speed; acpi_spi_add_resource()
1575 spi->mode |= SPI_CPHA; acpi_spi_add_resource()
1577 spi->mode |= SPI_CPOL; acpi_spi_add_resource()
1579 spi->mode |= SPI_CS_HIGH; acpi_spi_add_resource()
1581 } else if (spi->irq < 0) { acpi_spi_add_resource()
1585 spi->irq = r.start; acpi_spi_add_resource()
1598 struct spi_device *spi; acpi_spi_add_device() local
1606 spi = spi_alloc_device(master); acpi_spi_add_device()
1607 if (!spi) { acpi_spi_add_device()
1613 ACPI_COMPANION_SET(&spi->dev, adev); acpi_spi_add_device()
1614 spi->irq = -1; acpi_spi_add_device()
1618 acpi_spi_add_resource, spi); acpi_spi_add_device()
1621 if (ret < 0 || !spi->max_speed_hz) { acpi_spi_add_device()
1622 spi_dev_put(spi); acpi_spi_add_device()
1627 strlcpy(spi->modalias, acpi_device_hid(adev), sizeof(spi->modalias)); acpi_spi_add_device()
1628 if (spi_add_device(spi)) { acpi_spi_add_device()
1632 spi_dev_put(spi); acpi_spi_add_device()
1800 master->bus_num = of_alias_get_id(master->dev.of_node, "spi"); spi_register_master()
1823 dev_set_name(&master->dev, "spi%u", master->bus_num); spi_register_master()
2017 * @spi: the device whose settings are being modified
2026 * or from it. When this function returns, the spi device is deselected.
2035 int spi_setup(struct spi_device *spi) spi_setup() argument
2042 if (((spi->mode & SPI_TX_DUAL) && (spi->mode & SPI_TX_QUAD)) || spi_setup()
2043 ((spi->mode & SPI_RX_DUAL) && (spi->mode & SPI_RX_QUAD))) { spi_setup()
2044 dev_err(&spi->dev, spi_setup()
2050 if ((spi->mode & SPI_3WIRE) && (spi->mode & spi_setup()
2056 bad_bits = spi->mode & ~spi->master->mode_bits; spi_setup()
2060 dev_warn(&spi->dev, spi_setup()
2063 spi->mode &= ~ugly_bits; spi_setup()
2067 dev_err(&spi->dev, "setup: unsupported mode bits %x\n", spi_setup()
2072 if (!spi->bits_per_word) spi_setup()
2073 spi->bits_per_word = 8; spi_setup()
2075 status = __spi_validate_bits_per_word(spi->master, spi->bits_per_word); spi_setup()
2079 if (!spi->max_speed_hz) spi_setup()
2080 spi->max_speed_hz = spi->master->max_speed_hz; spi_setup()
2082 if (spi->master->setup) spi_setup()
2083 status = spi->master->setup(spi); spi_setup()
2085 spi_set_cs(spi, false); spi_setup()
2087 dev_dbg(&spi->dev, "setup mode %d, %s%s%s%s%u bits/w, %u Hz max --> %d\n", spi_setup()
2088 (int) (spi->mode & (SPI_CPOL | SPI_CPHA)), spi_setup()
2089 (spi->mode & SPI_CS_HIGH) ? "cs_high, " : "", spi_setup()
2090 (spi->mode & SPI_LSB_FIRST) ? "lsb, " : "", spi_setup()
2091 (spi->mode & SPI_3WIRE) ? "3wire, " : "", spi_setup()
2092 (spi->mode & SPI_LOOP) ? "loopback, " : "", spi_setup()
2093 spi->bits_per_word, spi->max_speed_hz, spi_setup()
2100 static int __spi_validate(struct spi_device *spi, struct spi_message *message) __spi_validate() argument
2102 struct spi_master *master = spi->master; __spi_validate()
2115 || (spi->mode & SPI_3WIRE)) { __spi_validate()
2129 * Set transfer bits_per_word and max speed as spi device default if __spi_validate()
2138 xfer->bits_per_word = spi->bits_per_word; __spi_validate()
2141 xfer->speed_hz = spi->max_speed_hz; __spi_validate()
2185 !(spi->mode & (SPI_TX_DUAL | SPI_TX_QUAD))) __spi_validate()
2188 !(spi->mode & SPI_TX_QUAD)) __spi_validate()
2198 !(spi->mode & (SPI_RX_DUAL | SPI_RX_QUAD))) __spi_validate()
2201 !(spi->mode & SPI_RX_QUAD)) __spi_validate()
2211 static int __spi_async(struct spi_device *spi, struct spi_message *message) __spi_async() argument
2213 struct spi_master *master = spi->master; __spi_async()
2215 message->spi = spi; __spi_async()
2218 SPI_STATISTICS_INCREMENT_FIELD(&spi->statistics, spi_async); __spi_async()
2222 return master->transfer(spi, message); __spi_async()
2227 * @spi: device with which data will be exchanged
2256 int spi_async(struct spi_device *spi, struct spi_message *message) spi_async() argument
2258 struct spi_master *master = spi->master; spi_async()
2262 ret = __spi_validate(spi, message); spi_async()
2271 ret = __spi_async(spi, message); spi_async()
2281 * @spi: device with which data will be exchanged
2310 int spi_async_locked(struct spi_device *spi, struct spi_message *message) spi_async_locked() argument
2312 struct spi_master *master = spi->master; spi_async_locked()
2316 ret = __spi_validate(spi, message); spi_async_locked()
2322 ret = __spi_async(spi, message); spi_async_locked()
2344 static int __spi_sync(struct spi_device *spi, struct spi_message *message, __spi_sync() argument
2349 struct spi_master *master = spi->master; __spi_sync()
2352 status = __spi_validate(spi, message); __spi_sync()
2358 message->spi = spi; __spi_sync()
2361 SPI_STATISTICS_INCREMENT_FIELD(&spi->statistics, spi_sync); __spi_sync()
2376 status = __spi_queued_transfer(spi, message, false); __spi_sync()
2380 status = spi_async_locked(spi, message); __spi_sync()
2393 SPI_STATISTICS_INCREMENT_FIELD(&spi->statistics, __spi_sync()
2407 * @spi: device with which data will be exchanged
2426 int spi_sync(struct spi_device *spi, struct spi_message *message) spi_sync() argument
2428 return __spi_sync(spi, message, 0); spi_sync()
2434 * @spi: device with which data will be exchanged
2448 int spi_sync_locked(struct spi_device *spi, struct spi_message *message) spi_sync_locked() argument
2450 return __spi_sync(spi, message, 1); spi_sync_locked()
2515 * @spi: device with which data will be exchanged
2534 int spi_write_then_read(struct spi_device *spi, spi_write_then_read() argument
2575 status = spi_sync(spi, &message); spi_write_then_read()
2609 /* the spi masters are not using spi_bus, so we find it with another way */ of_find_spi_master_by_node()
2628 struct spi_device *spi; of_spi_notify() local
2636 spi = of_register_spi_device(master, rd->dn); of_spi_notify()
2639 if (IS_ERR(spi)) { of_spi_notify()
2642 return notifier_from_errno(PTR_ERR(spi)); of_spi_notify()
2648 spi = of_find_spi_device_by_node(rd->dn); of_spi_notify()
2649 if (spi == NULL) of_spi_notify()
2653 spi_unregister_device(spi); of_spi_notify()
2656 put_device(&spi->dev); of_spi_notify()
H A Dspi-bitbang-txrx.h46 bitbang_txrx_be_cpha0(struct spi_device *spi, bitbang_txrx_be_cpha0() argument
59 setmosi(spi, word & (1 << 31)); bitbang_txrx_be_cpha0()
65 setsck(spi, !cpol); bitbang_txrx_be_cpha0()
71 word |= getmiso(spi); bitbang_txrx_be_cpha0()
72 setsck(spi, cpol); bitbang_txrx_be_cpha0()
78 bitbang_txrx_be_cpha1(struct spi_device *spi, bitbang_txrx_be_cpha1() argument
89 setsck(spi, !cpol); bitbang_txrx_be_cpha1()
92 setmosi(spi, word & (1 << 31)); bitbang_txrx_be_cpha1()
98 setsck(spi, cpol); bitbang_txrx_be_cpha1()
104 word |= getmiso(spi); bitbang_txrx_be_cpha1()
H A Dspi-omap-100k.c34 #include <linux/spi/spi.h>
188 omap1_spi100k_txrx_pio(struct spi_device *spi, struct spi_transfer *xfer) omap1_spi100k_txrx_pio() argument
190 struct omap1_spi100k_cs *cs = spi->controller_state; omap1_spi100k_txrx_pio()
207 spi100k_write_data(spi->master, word_len, *tx++); omap1_spi100k_txrx_pio()
209 *rx++ = spi100k_read_data(spi->master, word_len); omap1_spi100k_txrx_pio()
220 spi100k_write_data(spi->master, word_len, *tx++); omap1_spi100k_txrx_pio()
222 *rx++ = spi100k_read_data(spi->master, word_len); omap1_spi100k_txrx_pio()
233 spi100k_write_data(spi->master, word_len, *tx); omap1_spi100k_txrx_pio()
235 *rx = spi100k_read_data(spi->master, word_len); omap1_spi100k_txrx_pio()
242 static int omap1_spi100k_setup_transfer(struct spi_device *spi, omap1_spi100k_setup_transfer() argument
245 struct omap1_spi100k *spi100k = spi_master_get_devdata(spi->master); omap1_spi100k_setup_transfer()
246 struct omap1_spi100k_cs *cs = spi->controller_state; omap1_spi100k_setup_transfer()
252 word_len = spi->bits_per_word; omap1_spi100k_setup_transfer()
254 if (spi->bits_per_word > 32) omap1_spi100k_setup_transfer()
266 /* the spi->mode bits understood by this driver: */
269 static int omap1_spi100k_setup(struct spi_device *spi) omap1_spi100k_setup() argument
273 struct omap1_spi100k_cs *cs = spi->controller_state; omap1_spi100k_setup()
275 spi100k = spi_master_get_devdata(spi->master); omap1_spi100k_setup()
278 cs = devm_kzalloc(&spi->dev, sizeof(*cs), GFP_KERNEL); omap1_spi100k_setup()
281 cs->base = spi100k->base + spi->chip_select * 0x14; omap1_spi100k_setup()
282 spi->controller_state = cs; omap1_spi100k_setup()
285 spi100k_open(spi->master); omap1_spi100k_setup()
290 ret = omap1_spi100k_setup_transfer(spi, NULL); omap1_spi100k_setup()
302 struct spi_device *spi = m->spi; omap1_spi100k_transfer_one_message() local
312 status = omap1_spi100k_setup_transfer(spi, t); omap1_spi100k_transfer_one_message()
324 count = omap1_spi100k_txrx_pio(spi, t); omap1_spi100k_transfer_one_message()
344 status = omap1_spi100k_setup_transfer(spi, NULL); omap1_spi100k_transfer_one_message()
H A Dspi-butterfly.c24 #include <linux/spi/spi.h>
25 #include <linux/spi/spi_bitbang.h>
26 #include <linux/spi/flash.h>
36 * See Documentation/spi/butterfly for information about how to build
57 static inline struct butterfly *spidev_to_pp(struct spi_device *spi) spidev_to_pp() argument
59 return spi->controller_data; spidev_to_pp()
81 setsck(struct spi_device *spi, int is_on) setsck() argument
83 struct butterfly *pp = spidev_to_pp(spi); setsck()
97 setmosi(struct spi_device *spi, int is_on) setmosi() argument
99 struct butterfly *pp = spidev_to_pp(spi); setmosi()
112 static inline int getmiso(struct spi_device *spi) getmiso() argument
114 struct butterfly *pp = spidev_to_pp(spi); getmiso()
125 static void butterfly_chipselect(struct spi_device *spi, int value) butterfly_chipselect() argument
127 struct butterfly *pp = spidev_to_pp(spi); butterfly_chipselect()
131 setsck(spi, spi->mode & SPI_CPOL); butterfly_chipselect()
149 #include "spi-bitbang-txrx.h"
152 butterfly_txrx_word_mode0(struct spi_device *spi, butterfly_txrx_word_mode0() argument
156 return bitbang_txrx_be_cpha0(spi, nsecs, 0, 0, word, bits); butterfly_txrx_word_mode0()
274 * (firmware resets at45, acts as spi slave) or neither (we ignore butterfly_attach()
H A Dspi-txx9.c24 #include <linux/spi/spi.h>
96 static void txx9spi_cs_func(struct spi_device *spi, struct txx9spi *c, txx9spi_cs_func() argument
99 int val = (spi->mode & SPI_CS_HIGH) ? on : !on; txx9spi_cs_func()
106 c->last_chipselect = spi->chip_select; txx9spi_cs_func()
112 gpio_set_value(spi->chip_select, val); txx9spi_cs_func()
116 static int txx9spi_setup(struct spi_device *spi) txx9spi_setup() argument
118 struct txx9spi *c = spi_master_get_devdata(spi->master); txx9spi_setup()
120 if (!spi->max_speed_hz) txx9spi_setup()
123 if (gpio_direction_output(spi->chip_select, txx9spi_setup()
124 !(spi->mode & SPI_CS_HIGH))) { txx9spi_setup()
125 dev_err(&spi->dev, "Cannot setup GPIO for chipselect.\n"); txx9spi_setup()
131 txx9spi_cs_func(spi, c, 0, (NSEC_PER_SEC / 2) / spi->max_speed_hz); txx9spi_setup()
150 struct spi_device *spi = m->spi; txx9spi_work_one() local
160 cs_delay = 100 + (NSEC_PER_SEC / 2) / spi->max_speed_hz; txx9spi_work_one()
164 dev_err(&spi->dev, "Bad mode.\n"); txx9spi_work_one()
173 | ((spi->mode & SPI_CPOL) ? TXx9_SPCR0_SPOL : 0) txx9spi_work_one()
174 | ((spi->mode & SPI_CPHA) ? TXx9_SPCR0_SPHA : 0) txx9spi_work_one()
206 txx9spi_cs_func(spi, c, 1, cs_delay); txx9spi_work_one()
262 txx9spi_cs_func(spi, c, 0, cs_delay); txx9spi_work_one()
275 txx9spi_cs_func(spi, c, 0, cs_delay); txx9spi_work_one()
301 static int txx9spi_transfer(struct spi_device *spi, struct spi_message *m) txx9spi_transfer() argument
303 struct spi_master *master = spi->master; txx9spi_transfer()
344 c->clk = devm_clk_get(&dev->dev, "spi-baseclk"); txx9spi_probe()
387 /* the spi->mode bits understood by this driver: */ txx9spi_probe()
H A Dspi-bcm63xx-hsspi.c20 #include <linux/spi/spi.h>
126 struct spi_device *spi, int hz) bcm63xx_hsspi_set_clk()
128 unsigned profile = spi->chip_select; bcm63xx_hsspi_set_clk()
146 if (spi->mode & SPI_CPOL) bcm63xx_hsspi_set_clk()
152 static int bcm63xx_hsspi_do_txrx(struct spi_device *spi, struct spi_transfer *t) bcm63xx_hsspi_do_txrx() argument
154 struct bcm63xx_hsspi *bs = spi_master_get_devdata(spi->master); bcm63xx_hsspi_do_txrx()
155 unsigned chip_select = spi->chip_select; bcm63xx_hsspi_do_txrx()
162 bcm63xx_hsspi_set_clk(bs, spi, t->speed_hz); bcm63xx_hsspi_do_txrx()
163 bcm63xx_hsspi_set_cs(bs, spi->chip_select, true); bcm63xx_hsspi_do_txrx()
220 static int bcm63xx_hsspi_setup(struct spi_device *spi) bcm63xx_hsspi_setup() argument
222 struct bcm63xx_hsspi *bs = spi_master_get_devdata(spi->master); bcm63xx_hsspi_setup()
226 HSSPI_PROFILE_SIGNAL_CTRL_REG(spi->chip_select)); bcm63xx_hsspi_setup()
228 if (spi->mode & SPI_CPHA) bcm63xx_hsspi_setup()
233 HSSPI_PROFILE_SIGNAL_CTRL_REG(spi->chip_select)); bcm63xx_hsspi_setup()
240 if (spi->mode & SPI_CS_HIGH) bcm63xx_hsspi_setup()
241 reg |= BIT(spi->chip_select); bcm63xx_hsspi_setup()
243 reg &= ~BIT(spi->chip_select); bcm63xx_hsspi_setup()
247 if (spi->mode & SPI_CS_HIGH) bcm63xx_hsspi_setup()
248 bs->cs_polarity |= BIT(spi->chip_select); bcm63xx_hsspi_setup()
250 bs->cs_polarity &= ~BIT(spi->chip_select); bcm63xx_hsspi_setup()
262 struct spi_device *spi = msg->spi; bcm63xx_hsspi_transfer_one() local
281 dummy_cs = !spi->chip_select; bcm63xx_hsspi_transfer_one()
285 status = bcm63xx_hsspi_do_txrx(spi, t); bcm63xx_hsspi_transfer_one()
295 bcm63xx_hsspi_set_cs(bs, spi->chip_select, false); bcm63xx_hsspi_transfer_one()
125 bcm63xx_hsspi_set_clk(struct bcm63xx_hsspi *bs, struct spi_device *spi, int hz) bcm63xx_hsspi_set_clk() argument
H A Dspi-ppc4xx.c8 * Based in part on drivers/spi/spi_s3c24xx.c
39 #include <linux/spi/spi.h>
40 #include <linux/spi/spi_bitbang.h>
145 static int spi_ppc4xx_txrx(struct spi_device *spi, struct spi_transfer *t) spi_ppc4xx_txrx() argument
150 dev_dbg(&spi->dev, "txrx: tx %p, rx %p, len %d\n", spi_ppc4xx_txrx()
153 hw = spi_master_get_devdata(spi->master); spi_ppc4xx_txrx()
169 static int spi_ppc4xx_setupxfer(struct spi_device *spi, struct spi_transfer *t) spi_ppc4xx_setupxfer() argument
171 struct ppc4xx_spi *hw = spi_master_get_devdata(spi->master); spi_ppc4xx_setupxfer()
172 struct spi_ppc4xx_cs *cs = spi->controller_state; spi_ppc4xx_setupxfer()
179 bits_per_word = spi->bits_per_word; spi_ppc4xx_setupxfer()
180 speed = spi->max_speed_hz; spi_ppc4xx_setupxfer()
191 speed = min(t->speed_hz, spi->max_speed_hz); spi_ppc4xx_setupxfer()
194 if (!speed || (speed > spi->max_speed_hz)) { spi_ppc4xx_setupxfer()
195 dev_err(&spi->dev, "invalid speed_hz (%d)\n", speed); spi_ppc4xx_setupxfer()
208 dev_dbg(&spi->dev, "setting pre-scaler to %d (hz %d)\n", cdm, speed); spi_ppc4xx_setupxfer()
215 hw->bitbang.chipselect(spi, BITBANG_CS_INACTIVE); spi_ppc4xx_setupxfer()
223 static int spi_ppc4xx_setup(struct spi_device *spi) spi_ppc4xx_setup() argument
225 struct spi_ppc4xx_cs *cs = spi->controller_state; spi_ppc4xx_setup()
227 if (!spi->max_speed_hz) { spi_ppc4xx_setup()
228 dev_err(&spi->dev, "invalid max_speed_hz (must be non-zero)\n"); spi_ppc4xx_setup()
236 spi->controller_state = cs; spi_ppc4xx_setup()
245 switch (spi->mode & (SPI_CPHA | SPI_CPOL)) { spi_ppc4xx_setup()
260 if (spi->mode & SPI_LSB_FIRST) spi_ppc4xx_setup()
266 static void spi_ppc4xx_chipsel(struct spi_device *spi, int value) spi_ppc4xx_chipsel() argument
268 struct ppc4xx_spi *hw = spi_master_get_devdata(spi->master); spi_ppc4xx_chipsel()
269 unsigned int cs = spi->chip_select; spi_ppc4xx_chipsel()
280 cspol = spi->mode & SPI_CS_HIGH ? 1 : 0; spi_ppc4xx_chipsel()
310 dev_dbg(hw->dev, "got interrupt but spi still busy?\n"); spi_ppc4xx_int()
348 static void spi_ppc4xx_cleanup(struct spi_device *spi) spi_ppc4xx_cleanup() argument
350 kfree(spi->controller_state); spi_ppc4xx_cleanup()
407 * Note that of_gpio_count counts all gpios assigned to this spi master. spi_ppc4xx_of_probe()
459 /* the spi->mode bits understood by this driver: */ spi_ppc4xx_of_probe()
525 /* Finally register our spi controller */ spi_ppc4xx_of_probe()
567 { .compatible = "ibm,ppc4xx-spi", },
H A Dspi-davinci.c30 #include <linux/spi/spi.h>
31 #include <linux/spi/spi_bitbang.h>
34 #include <linux/platform_data/spi-davinci.h>
211 static void davinci_spi_chipselect(struct spi_device *spi, int value) davinci_spi_chipselect() argument
215 struct davinci_spi_config *spicfg = spi->controller_data; davinci_spi_chipselect()
216 u8 chip_sel = spi->chip_select; davinci_spi_chipselect()
219 dspi = spi_master_get_devdata(spi->master); davinci_spi_chipselect()
230 if (spi->cs_gpio >= 0) { davinci_spi_chipselect()
232 gpio_set_value(spi->cs_gpio, spi->mode & SPI_CS_HIGH); davinci_spi_chipselect()
234 gpio_set_value(spi->cs_gpio, davinci_spi_chipselect()
235 !(spi->mode & SPI_CS_HIGH)); davinci_spi_chipselect()
272 * @spi: spi device on which data transfer to be done
273 * @t: spi transfer in which transfer info is filled
279 static int davinci_spi_setup_transfer(struct spi_device *spi, davinci_spi_setup_transfer() argument
289 dspi = spi_master_get_devdata(spi->master); davinci_spi_setup_transfer()
290 spicfg = spi->controller_data; davinci_spi_setup_transfer()
301 bits_per_word = spi->bits_per_word; davinci_spi_setup_transfer()
310 dspi->bytes_per_word[spi->chip_select] = 1; davinci_spi_setup_transfer()
314 dspi->bytes_per_word[spi->chip_select] = 2; davinci_spi_setup_transfer()
318 hz = spi->max_speed_hz; davinci_spi_setup_transfer()
328 if (spi->mode & SPI_LSB_FIRST) davinci_spi_setup_transfer()
331 if (spi->mode & SPI_CPOL) davinci_spi_setup_transfer()
334 if (!(spi->mode & SPI_CPHA)) davinci_spi_setup_transfer()
377 if (spi->mode & SPI_READY) { davinci_spi_setup_transfer()
393 static int davinci_spi_of_setup(struct spi_device *spi) davinci_spi_of_setup() argument
395 struct davinci_spi_config *spicfg = spi->controller_data; davinci_spi_of_setup()
396 struct device_node *np = spi->dev.of_node; davinci_spi_of_setup()
405 if (!of_property_read_u32(np, "ti,spi-wdelay", &prop)) davinci_spi_of_setup()
407 spi->controller_data = spicfg; davinci_spi_of_setup()
415 * @spi: spi device on which data transfer to be done
419 static int davinci_spi_setup(struct spi_device *spi) davinci_spi_setup() argument
424 struct spi_master *master = spi->master; davinci_spi_setup()
425 struct device_node *np = spi->dev.of_node; davinci_spi_setup()
428 dspi = spi_master_get_devdata(spi->master); davinci_spi_setup()
431 if (!(spi->mode & SPI_NO_CS)) { davinci_spi_setup()
432 if (np && (master->cs_gpios != NULL) && (spi->cs_gpio >= 0)) { davinci_spi_setup()
434 spi->cs_gpio, !(spi->mode & SPI_CS_HIGH)); davinci_spi_setup()
437 spi->chip_select < pdata->num_chipselect && davinci_spi_setup()
438 pdata->chip_sel[spi->chip_select] != SPI_INTERN_CS) { davinci_spi_setup()
439 spi->cs_gpio = pdata->chip_sel[spi->chip_select]; davinci_spi_setup()
441 spi->cs_gpio, !(spi->mode & SPI_CS_HIGH)); davinci_spi_setup()
446 dev_err(&spi->dev, "GPIO %d setup failed (%d)\n", davinci_spi_setup()
447 spi->cs_gpio, retval); davinci_spi_setup()
452 set_io_bits(dspi->base + SPIPC0, 1 << spi->chip_select); davinci_spi_setup()
455 if (spi->mode & SPI_READY) davinci_spi_setup()
458 if (spi->mode & SPI_LOOP) davinci_spi_setup()
463 return davinci_spi_of_setup(spi); davinci_spi_setup()
466 static void davinci_spi_cleanup(struct spi_device *spi) davinci_spi_cleanup() argument
468 struct davinci_spi_config *spicfg = spi->controller_data; davinci_spi_cleanup()
470 spi->controller_data = NULL; davinci_spi_cleanup()
471 if (spi->dev.of_node) davinci_spi_cleanup()
573 * @spi: spi device on which data transfer to be done
574 * @t: spi transfer in which transfer info is filled
580 static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t) davinci_spi_bufs() argument
592 dspi = spi_master_get_devdata(spi->master); davinci_spi_bufs()
594 spicfg = (struct davinci_spi_config *)spi->controller_data; davinci_spi_bufs()
599 data_type = dspi->bytes_per_word[spi->chip_select]; davinci_spi_bufs()
652 t->rx_dma = dma_map_single(&spi->dev, buf, davinci_spi_bufs()
666 t->tx_dma = dma_map_single(&spi->dev, buf, davinci_spi_bufs()
720 dma_unmap_single(&spi->dev, t->rx_dma, davinci_spi_bufs()
722 dma_unmap_single(&spi->dev, t->tx_dma, davinci_spi_bufs()
737 dev_name(&spi->dev)); davinci_spi_bufs()
742 dev_err(&spi->dev, "SPI data transfer error\n"); davinci_spi_bufs()
749 dma_unmap_single(&spi->dev, t->tx_dma, t->len, DMA_TO_DEVICE); davinci_spi_bufs()
751 dma_unmap_single(&spi->dev, t->rx_dma, t->len, DMA_FROM_DEVICE); davinci_spi_bufs()
855 .compatible = "ti,dm6441-spi",
859 .compatible = "ti,da830-spi",
863 .compatible = "ti,keystone-spi",
908 of_property_read_u32(node, "ti,davinci-spi-intr-line", &intr_line); spi_davinci_get_pdata()
H A Dspi-tle62x0.c17 #include <linux/spi/spi.h>
18 #include <linux/spi/tle62x0.h>
242 static int tle62x0_probe(struct spi_device *spi) tle62x0_probe() argument
249 pdata = dev_get_platdata(&spi->dev); tle62x0_probe()
251 dev_err(&spi->dev, "no device data specified\n"); tle62x0_probe()
259 st->us = spi; tle62x0_probe()
265 ret = device_create_file(&spi->dev, &dev_attr_status_show); tle62x0_probe()
267 dev_err(&spi->dev, "cannot create status attribute\n"); tle62x0_probe()
272 ret = device_create_file(&spi->dev, gpio_attrs[ptr]); tle62x0_probe()
274 dev_err(&spi->dev, "cannot create gpio attribute\n"); tle62x0_probe()
280 spi_set_drvdata(spi, st); tle62x0_probe()
285 device_remove_file(&spi->dev, gpio_attrs[ptr]); tle62x0_probe()
287 device_remove_file(&spi->dev, &dev_attr_status_show); tle62x0_probe()
294 static int tle62x0_remove(struct spi_device *spi) tle62x0_remove() argument
296 struct tle62x0_state *st = spi_get_drvdata(spi); tle62x0_remove()
300 device_remove_file(&spi->dev, gpio_attrs[ptr]); tle62x0_remove()
302 device_remove_file(&spi->dev, &dev_attr_status_show); tle62x0_remove()
320 MODULE_ALIAS("spi:tle62x0");
H A Dspi-clps711x.c22 #include <linux/spi/spi.h>
23 #include <linux/platform_data/spi-clps711x.h>
25 #define DRIVER_NAME "spi-clps711x"
41 static int spi_clps711x_setup(struct spi_device *spi) spi_clps711x_setup() argument
44 gpio_direction_output(spi->cs_gpio, !(spi->mode & SPI_CS_HIGH)); spi_clps711x_setup()
53 struct spi_device *spi = msg->spi; spi_clps711x_prepare_message() local
57 (spi->mode & SPI_CPHA) ? spi_clps711x_prepare_message()
62 struct spi_device *spi, spi_clps711x_transfer_one()
68 clk_set_rate(hw->spi_clk, xfer->speed_hz ? : spi->max_speed_hz); spi_clps711x_transfer_one()
61 spi_clps711x_transfer_one(struct spi_master *master, struct spi_device *spi, struct spi_transfer *xfer) spi_clps711x_transfer_one() argument
H A Dspi-s3c24xx.c23 #include <linux/spi/spi.h>
24 #include <linux/spi/spi_bitbang.h>
25 #include <linux/spi/s3c24xx.h>
28 #include <plat/regs-spi.h>
32 #include "spi-s3c24xx-fiq.h"
70 void (*set_cs)(struct s3c2410_spi_info *spi,
92 static void s3c24xx_spi_gpiocs(struct s3c2410_spi_info *spi, int cs, int pol) s3c24xx_spi_gpiocs() argument
94 gpio_set_value(spi->pin_cs, pol); s3c24xx_spi_gpiocs()
97 static void s3c24xx_spi_chipsel(struct spi_device *spi, int value) s3c24xx_spi_chipsel() argument
99 struct s3c24xx_spi_devstate *cs = spi->controller_state; s3c24xx_spi_chipsel()
100 struct s3c24xx_spi *hw = to_hw(spi); s3c24xx_spi_chipsel()
101 unsigned int cspol = spi->mode & SPI_CS_HIGH ? 1 : 0; s3c24xx_spi_chipsel()
103 /* change the chipselect state and the state of the spi engine clock */ s3c24xx_spi_chipsel()
107 hw->set_cs(hw->pdata, spi->chip_select, cspol^1); s3c24xx_spi_chipsel()
114 hw->set_cs(hw->pdata, spi->chip_select, cspol); s3c24xx_spi_chipsel()
119 static int s3c24xx_spi_update_state(struct spi_device *spi, s3c24xx_spi_update_state() argument
122 struct s3c24xx_spi *hw = to_hw(spi); s3c24xx_spi_update_state()
123 struct s3c24xx_spi_devstate *cs = spi->controller_state; s3c24xx_spi_update_state()
128 hz = t ? t->speed_hz : spi->max_speed_hz; s3c24xx_spi_update_state()
131 hz = spi->max_speed_hz; s3c24xx_spi_update_state()
133 if (spi->mode != cs->mode) { s3c24xx_spi_update_state()
136 if (spi->mode & SPI_CPHA) s3c24xx_spi_update_state()
139 if (spi->mode & SPI_CPOL) s3c24xx_spi_update_state()
142 cs->mode = spi->mode; s3c24xx_spi_update_state()
153 dev_dbg(&spi->dev, "pre-scaler=%d (wanted %d, got %ld)\n", s3c24xx_spi_update_state()
163 static int s3c24xx_spi_setupxfer(struct spi_device *spi, s3c24xx_spi_setupxfer() argument
166 struct s3c24xx_spi_devstate *cs = spi->controller_state; s3c24xx_spi_setupxfer()
167 struct s3c24xx_spi *hw = to_hw(spi); s3c24xx_spi_setupxfer()
170 ret = s3c24xx_spi_update_state(spi, t); s3c24xx_spi_setupxfer()
177 static int s3c24xx_spi_setup(struct spi_device *spi) s3c24xx_spi_setup() argument
179 struct s3c24xx_spi_devstate *cs = spi->controller_state; s3c24xx_spi_setup()
180 struct s3c24xx_spi *hw = to_hw(spi); s3c24xx_spi_setup()
185 cs = devm_kzalloc(&spi->dev, s3c24xx_spi_setup()
193 spi->controller_state = cs; s3c24xx_spi_setup()
197 ret = s3c24xx_spi_update_state(spi, NULL); s3c24xx_spi_setup()
203 hw->bitbang.chipselect(spi, BITBANG_CS_INACTIVE); s3c24xx_spi_setup()
384 * @spi: The hardware state.
389 static inline bool s3c24xx_spi_usingfiq(struct s3c24xx_spi *spi) s3c24xx_spi_usingfiq() argument
391 return spi->fiq_inuse; s3c24xx_spi_usingfiq()
402 static int s3c24xx_spi_txrx(struct spi_device *spi, struct spi_transfer *t) s3c24xx_spi_txrx() argument
404 struct s3c24xx_spi *hw = to_hw(spi); s3c24xx_spi_txrx()
437 dev_dbg(hw->dev, "spi not ready for tx?\n"); s3c24xx_spi_irq()
524 /* the spi->mode bits understood by this driver: */ s3c24xx_spi_probe()
564 hw->clk = devm_clk_get(&pdev->dev, "spi"); s3c24xx_spi_probe()
594 /* register our spi controller */ s3c24xx_spi_probe()
659 MODULE_ALIAS("platform:s3c2410-spi");
664 .name = "s3c2410-spi",
H A Dspi-octeon.c11 #include <linux/spi/spi.h>
52 struct spi_device *spi = msg->spi; octeon_spi_do_transfer() local
64 mode = spi->mode; octeon_spi_do_transfer()
82 if (spi->chip_select < 4) octeon_spi_do_transfer()
83 p->cs_enax |= 1ull << (12 + spi->chip_select); octeon_spi_do_transfer()
103 mpi_tx.s.csid = spi->chip_select; octeon_spi_do_transfer()
128 mpi_tx.s.csid = spi->chip_select; octeon_spi_do_transfer()
242 { .compatible = "cavium,octeon-3010-spi", },
249 .name = "spi-octeon",
H A Dspi-sirf.c21 #include <linux/spi/spi.h>
22 #include <linux/spi/spi_bitbang.h>
460 static void spi_sirfsoc_cmd_transfer(struct spi_device *spi, spi_sirfsoc_cmd_transfer() argument
467 sspi = spi_master_get_devdata(spi->master); spi_sirfsoc_cmd_transfer()
471 if (sspi->word_width == 1 && !(spi->mode & SPI_LSB_FIRST)) spi_sirfsoc_cmd_transfer()
475 (!(spi->mode & SPI_LSB_FIRST))) spi_sirfsoc_cmd_transfer()
483 dev_err(&spi->dev, "cmd transfer timeout\n"); spi_sirfsoc_cmd_transfer()
489 static void spi_sirfsoc_dma_transfer(struct spi_device *spi, spi_sirfsoc_dma_transfer() argument
496 sspi = spi_master_get_devdata(spi->master); spi_sirfsoc_dma_transfer()
548 sspi->dst_start = dma_map_single(&spi->dev, sspi->rx, t->len, spi_sirfsoc_dma_transfer()
557 sspi->src_start = dma_map_single(&spi->dev, (void *)sspi->tx, t->len, spi_sirfsoc_dma_transfer()
580 dev_err(&spi->dev, "transfer timeout\n"); spi_sirfsoc_dma_transfer()
590 dev_err(&spi->dev, "transfer timeout\n"); spi_sirfsoc_dma_transfer()
596 dma_unmap_single(&spi->dev, sspi->src_start, t->len, DMA_TO_DEVICE); spi_sirfsoc_dma_transfer()
597 dma_unmap_single(&spi->dev, sspi->dst_start, t->len, DMA_FROM_DEVICE); spi_sirfsoc_dma_transfer()
608 static void spi_sirfsoc_pio_transfer(struct spi_device *spi, spi_sirfsoc_pio_transfer() argument
615 sspi = spi_master_get_devdata(spi->master); spi_sirfsoc_pio_transfer()
687 dev_err(&spi->dev, "transfer timeout\n"); spi_sirfsoc_pio_transfer()
705 static int spi_sirfsoc_transfer(struct spi_device *spi, struct spi_transfer *t) spi_sirfsoc_transfer() argument
709 sspi = spi_master_get_devdata(spi->master); spi_sirfsoc_transfer()
721 spi_sirfsoc_cmd_transfer(spi, t); spi_sirfsoc_transfer()
723 spi_sirfsoc_dma_transfer(spi, t); spi_sirfsoc_transfer()
725 spi_sirfsoc_pio_transfer(spi, t); spi_sirfsoc_transfer()
730 static void spi_sirfsoc_chipselect(struct spi_device *spi, int value) spi_sirfsoc_chipselect() argument
732 struct sirfsoc_spi *sspi = spi_master_get_devdata(spi->master); spi_sirfsoc_chipselect()
742 if (spi->mode & SPI_CS_HIGH) spi_sirfsoc_chipselect()
748 if (spi->mode & SPI_CS_HIGH) spi_sirfsoc_chipselect()
762 if (spi->mode & SPI_CS_HIGH) spi_sirfsoc_chipselect()
768 if (spi->mode & SPI_CS_HIGH) spi_sirfsoc_chipselect()
781 gpio_direction_output(spi->cs_gpio, spi_sirfsoc_chipselect()
782 spi->mode & SPI_CS_HIGH ? 1 : 0); spi_sirfsoc_chipselect()
785 gpio_direction_output(spi->cs_gpio, spi_sirfsoc_chipselect()
786 spi->mode & SPI_CS_HIGH ? 0 : 1); spi_sirfsoc_chipselect()
792 static int spi_sirfsoc_config_mode(struct spi_device *spi) spi_sirfsoc_config_mode() argument
797 sspi = spi_master_get_devdata(spi->master); spi_sirfsoc_config_mode()
800 if (!(spi->mode & SPI_CS_HIGH)) { spi_sirfsoc_config_mode()
807 if (!(spi->mode & SPI_LSB_FIRST)) { spi_sirfsoc_config_mode()
814 if (spi->mode & SPI_CPOL) { spi_sirfsoc_config_mode()
825 if (((spi->mode & SPI_CPOL) && (spi->mode & SPI_CPHA)) || spi_sirfsoc_config_mode()
826 (!(spi->mode & SPI_CPOL) && !(spi->mode & SPI_CPHA))) { spi_sirfsoc_config_mode()
871 spi_sirfsoc_setup_transfer(struct spi_device *spi, struct spi_transfer *t) spi_sirfsoc_setup_transfer() argument
878 sspi = spi_master_get_devdata(spi->master); spi_sirfsoc_setup_transfer()
880 bits_per_word = (t) ? t->bits_per_word : spi->bits_per_word; spi_sirfsoc_setup_transfer()
881 hz = t && t->speed_hz ? t->speed_hz : spi->max_speed_hz; spi_sirfsoc_setup_transfer()
885 dev_err(&spi->dev, "Speed %d not supported\n", hz); spi_sirfsoc_setup_transfer()
908 dev_err(&spi->dev, "bpw %d not supported\n", bits_per_word); spi_sirfsoc_setup_transfer()
964 spi_sirfsoc_config_mode(spi); spi_sirfsoc_setup_transfer()
995 static int spi_sirfsoc_setup(struct spi_device *spi) spi_sirfsoc_setup() argument
1000 sspi = spi_master_get_devdata(spi->master); spi_sirfsoc_setup()
1001 if (spi->cs_gpio == -ENOENT) spi_sirfsoc_setup()
1005 if (!spi_get_ctldata(spi)) { spi_sirfsoc_setup()
1011 ret = gpio_is_valid(spi->cs_gpio); spi_sirfsoc_setup()
1013 dev_err(&spi->dev, "no valid gpio\n"); spi_sirfsoc_setup()
1017 ret = gpio_request(spi->cs_gpio, DRIVER_NAME); spi_sirfsoc_setup()
1019 dev_err(&spi->dev, "failed to request gpio\n"); spi_sirfsoc_setup()
1022 spi_set_ctldata(spi, cs); spi_sirfsoc_setup()
1025 spi_sirfsoc_config_mode(spi); spi_sirfsoc_setup()
1026 spi_sirfsoc_chipselect(spi, BITBANG_CS_INACTIVE); spi_sirfsoc_setup()
1031 static void spi_sirfsoc_cleanup(struct spi_device *spi) spi_sirfsoc_cleanup() argument
1033 if (spi_get_ctldata(spi)) { spi_sirfsoc_cleanup()
1034 gpio_free(spi->cs_gpio); spi_sirfsoc_cleanup()
1035 kfree(spi_get_ctldata(spi)); spi_sirfsoc_cleanup()
1063 { .compatible = "sirf,prima2-spi", .data = &sirf_real_spi},
1064 { .compatible = "sirf,prima2-usp-spi", .data = &sirf_usp_spi_p2},
1065 { .compatible = "sirf,atlas7-usp-spi", .data = &sirf_usp_spi_a7},
H A Dspi-omap-uwire.c42 #include <linux/spi/spi.h>
43 #include <linux/spi/spi_bitbang.h>
174 static void uwire_chipselect(struct spi_device *spi, int value) uwire_chipselect() argument
176 struct uwire_state *ust = spi->controller_state; uwire_chipselect()
185 if (value == BITBANG_CS_INACTIVE || old_cs != spi->chip_select) { uwire_chipselect()
194 if (spi->mode & SPI_CPOL) uwire_chipselect()
199 w = spi->chip_select << 10; uwire_chipselect()
205 static int uwire_txrx(struct spi_device *spi, struct spi_transfer *t) uwire_txrx() argument
216 w = spi->chip_select << 10; uwire_txrx()
239 dev_name(&spi->dev), bits, val); uwire_txrx()
299 dev_name(&spi->dev), bits, val); uwire_txrx()
309 static int uwire_setup_transfer(struct spi_device *spi, struct spi_transfer *t) uwire_setup_transfer() argument
311 struct uwire_state *ust = spi->controller_state; uwire_setup_transfer()
321 uwire = spi_master_get_devdata(spi->master); uwire_setup_transfer()
327 if (spi->mode & SPI_CS_HIGH) uwire_setup_transfer()
330 if (spi->mode & SPI_CPOL) uwire_setup_transfer()
333 switch (spi->mode & (SPI_CPOL | SPI_CPHA)) { uwire_setup_transfer()
350 hz = spi->max_speed_hz; uwire_setup_transfer()
353 pr_debug("%s: zero speed?\n", dev_name(&spi->dev)); uwire_setup_transfer()
381 dev_name(&spi->dev), rate / 10 / 8, hz); uwire_setup_transfer()
414 omap_uwire_configure_mode(spi->chip_select, flags); uwire_setup_transfer()
424 static int uwire_setup(struct spi_device *spi) uwire_setup() argument
426 struct uwire_state *ust = spi->controller_state; uwire_setup()
432 spi->controller_state = ust; uwire_setup()
435 return uwire_setup_transfer(spi, NULL); uwire_setup()
438 static void uwire_cleanup(struct spi_device *spi) uwire_cleanup() argument
440 kfree(spi->controller_state); uwire_cleanup()
487 /* the spi->mode bits understood by this driver: */ uwire_probe()
/linux-4.4.14/drivers/media/pci/netup_unidvb/
H A Dnetup_unidvb_spi.c22 #include <linux/spi/spi.h>
23 #include <linux/spi/flash.h>
78 irqreturn_t netup_spi_interrupt(struct netup_spi *spi) netup_spi_interrupt() argument
83 if (!spi) netup_spi_interrupt()
86 spin_lock_irqsave(&spi->lock, flags); netup_spi_interrupt()
87 reg = readw(&spi->regs->control_stat); netup_spi_interrupt()
89 spin_unlock_irqrestore(&spi->lock, flags); netup_spi_interrupt()
90 dev_dbg(&spi->master->dev, netup_spi_interrupt()
94 writew(reg | NETUP_SPI_CTRL_IRQ, &spi->regs->control_stat); netup_spi_interrupt()
95 reg = readw(&spi->regs->control_stat); netup_spi_interrupt()
96 writew(reg & ~NETUP_SPI_CTRL_IMASK, &spi->regs->control_stat); netup_spi_interrupt()
97 spi->state = SPI_STATE_DONE; netup_spi_interrupt()
98 wake_up(&spi->waitq); netup_spi_interrupt()
99 spin_unlock_irqrestore(&spi->lock, flags); netup_spi_interrupt()
100 dev_dbg(&spi->master->dev, netup_spi_interrupt()
108 struct netup_spi *spi = spi_master_get_devdata(master); netup_spi_transfer() local
114 writew(NETUP_SPI_CTRL_LAST_CS, &spi->regs->control_stat); netup_spi_transfer()
115 writew(0, &spi->regs->control_stat); netup_spi_transfer()
120 u32 frag_size = (tr_size > sizeof(spi->regs->data)) ? netup_spi_transfer()
121 sizeof(spi->regs->data) : tr_size; netup_spi_transfer()
130 memcpy_toio(spi->regs->data, netup_spi_transfer()
134 memset_io(spi->regs->data, netup_spi_transfer()
137 spi->state = SPI_STATE_START; netup_spi_transfer()
142 &spi->regs->control_stat); netup_spi_transfer()
143 dev_dbg(&spi->master->dev, netup_spi_transfer()
145 __func__, readw(&spi->regs->control_stat)); netup_spi_transfer()
146 wait_event_timeout(spi->waitq, netup_spi_transfer()
147 spi->state != SPI_STATE_START, netup_spi_transfer()
149 if (spi->state == SPI_STATE_DONE) { netup_spi_transfer()
152 spi->regs->data, frag_size); netup_spi_transfer()
155 if (spi->state == SPI_STATE_START) { netup_spi_transfer()
156 dev_dbg(&spi->master->dev, netup_spi_transfer()
160 dev_dbg(&spi->master->dev, netup_spi_transfer()
162 __func__, spi->state); netup_spi_transfer()
177 static int netup_spi_setup(struct spi_device *spi) netup_spi_setup() argument
206 ndev->spi = nspi; netup_spi_init()
208 ndev->spi = NULL; netup_spi_init()
220 ndev->spi = NULL; netup_spi_init()
233 struct netup_spi *spi = ndev->spi; netup_spi_release() local
235 if (!spi) netup_spi_release()
238 spin_lock_irqsave(&spi->lock, flags); netup_spi_release()
239 reg = readw(&spi->regs->control_stat); netup_spi_release()
240 writew(reg | NETUP_SPI_CTRL_IRQ, &spi->regs->control_stat); netup_spi_release()
241 reg = readw(&spi->regs->control_stat); netup_spi_release()
242 writew(reg & ~NETUP_SPI_CTRL_IMASK, &spi->regs->control_stat); netup_spi_release()
243 spin_unlock_irqrestore(&spi->lock, flags); netup_spi_release()
244 spi_unregister_master(spi->master); netup_spi_release()
245 ndev->spi = NULL; netup_spi_release()
/linux-4.4.14/drivers/iio/gyro/
H A Dbmg160_spi.c1 #include <linux/spi/spi.h>
14 static int bmg160_spi_probe(struct spi_device *spi) bmg160_spi_probe() argument
17 const struct spi_device_id *id = spi_get_device_id(spi); bmg160_spi_probe()
19 regmap = devm_regmap_init_spi(spi, &bmg160_regmap_spi_conf); bmg160_spi_probe()
21 dev_err(&spi->dev, "Failed to register spi regmap %d\n", bmg160_spi_probe()
26 return bmg160_core_probe(&spi->dev, regmap, spi->irq, id->name); bmg160_spi_probe()
29 static int bmg160_spi_remove(struct spi_device *spi) bmg160_spi_remove() argument
31 bmg160_core_remove(&spi->dev); bmg160_spi_remove()
42 MODULE_DEVICE_TABLE(spi, bmg160_spi_id);
H A Dst_gyro_spi.c14 #include <linux/spi/spi.h>
21 static int st_gyro_spi_probe(struct spi_device *spi) st_gyro_spi_probe() argument
27 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*gdata)); st_gyro_spi_probe()
33 st_sensors_spi_configure(indio_dev, spi, gdata); st_gyro_spi_probe()
42 static int st_gyro_spi_remove(struct spi_device *spi) st_gyro_spi_remove() argument
44 st_gyro_common_remove(spi_get_drvdata(spi)); st_gyro_spi_remove()
59 MODULE_DEVICE_TABLE(spi, st_gyro_id_table);
63 .name = "st-gyro-spi",
72 MODULE_DESCRIPTION("STMicroelectronics gyroscopes spi driver");
H A Dadis16130.c11 #include <linux/spi/spi.h>
143 static int adis16130_probe(struct spi_device *spi) adis16130_probe() argument
149 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); adis16130_probe()
154 spi_set_drvdata(spi, indio_dev); adis16130_probe()
155 st->us = spi; adis16130_probe()
157 indio_dev->name = spi->dev.driver->name; adis16130_probe()
160 indio_dev->dev.parent = &spi->dev; adis16130_probe()
164 return devm_iio_device_register(&spi->dev, indio_dev); adis16130_probe()
178 MODULE_ALIAS("spi:adis16130");
H A Dadis16080.c12 #include <linux/spi/spi.h>
187 static int adis16080_probe(struct spi_device *spi) adis16080_probe() argument
189 const struct spi_device_id *id = spi_get_device_id(spi); adis16080_probe()
194 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); adis16080_probe()
199 spi_set_drvdata(spi, indio_dev); adis16080_probe()
202 st->us = spi; adis16080_probe()
205 indio_dev->name = spi->dev.driver->name; adis16080_probe()
208 indio_dev->dev.parent = &spi->dev; adis16080_probe()
215 static int adis16080_remove(struct spi_device *spi) adis16080_remove() argument
217 iio_device_unregister(spi_get_drvdata(spi)); adis16080_remove()
226 MODULE_DEVICE_TABLE(spi, adis16080_ids);
/linux-4.4.14/sound/soc/codecs/
H A Dadav801.c10 #include <linux/spi/spi.h>
21 MODULE_DEVICE_TABLE(spi, adav80x_spi_id);
23 static int adav80x_spi_probe(struct spi_device *spi) adav80x_spi_probe() argument
30 return adav80x_bus_probe(&spi->dev, devm_regmap_init_spi(spi, &config)); adav80x_spi_probe()
33 static int adav80x_spi_remove(struct spi_device *spi) adav80x_spi_remove() argument
35 snd_soc_unregister_codec(&spi->dev); adav80x_spi_remove()
H A Dtlv320aic23-spi.c16 #include <linux/spi/spi.h>
21 static int aic23_spi_probe(struct spi_device *spi) aic23_spi_probe() argument
26 dev_dbg(&spi->dev, "probing tlv320aic23 spi device\n"); aic23_spi_probe()
28 spi->mode = SPI_MODE_0; aic23_spi_probe()
29 ret = spi_setup(spi); aic23_spi_probe()
33 regmap = devm_regmap_init_spi(spi, &tlv320aic23_regmap); aic23_spi_probe()
34 return tlv320aic23_probe(&spi->dev, regmap); aic23_spi_probe()
37 static int aic23_spi_remove(struct spi_device *spi) aic23_spi_remove() argument
39 snd_soc_unregister_codec(&spi->dev); aic23_spi_remove()
H A Dssm2602-spi.c10 #include <linux/spi/spi.h>
17 static int ssm2602_spi_probe(struct spi_device *spi) ssm2602_spi_probe() argument
19 return ssm2602_probe(&spi->dev, SSM2602, ssm2602_spi_probe()
20 devm_regmap_init_spi(spi, &ssm2602_regmap_config)); ssm2602_spi_probe()
23 static int ssm2602_spi_remove(struct spi_device *spi) ssm2602_spi_remove() argument
25 snd_soc_unregister_codec(&spi->dev); ssm2602_spi_remove()
H A Dad193x-spi.c10 #include <linux/spi/spi.h>
17 static int ad193x_spi_probe(struct spi_device *spi) ad193x_spi_probe() argument
19 const struct spi_device_id *id = spi_get_device_id(spi); ad193x_spi_probe()
28 return ad193x_probe(&spi->dev, devm_regmap_init_spi(spi, &config), ad193x_spi_probe()
32 static int ad193x_spi_remove(struct spi_device *spi) ad193x_spi_remove() argument
34 snd_soc_unregister_codec(&spi->dev); ad193x_spi_remove()
47 MODULE_DEVICE_TABLE(spi, ad193x_spi_id);
H A Dadau1761-spi.c13 #include <linux/spi/spi.h>
20 struct spi_device *spi = to_spi_device(dev); adau1761_spi_switch_mode() local
26 spi_w8r8(spi, 0x00); adau1761_spi_switch_mode()
27 spi_w8r8(spi, 0x00); adau1761_spi_switch_mode()
28 spi_w8r8(spi, 0x00); adau1761_spi_switch_mode()
31 static int adau1761_spi_probe(struct spi_device *spi) adau1761_spi_probe() argument
33 const struct spi_device_id *id = spi_get_device_id(spi); adau1761_spi_probe()
44 return adau1761_probe(&spi->dev, adau1761_spi_probe()
45 devm_regmap_init_spi(spi, &config), adau1761_spi_probe()
49 static int adau1761_spi_remove(struct spi_device *spi) adau1761_spi_remove() argument
51 snd_soc_unregister_codec(&spi->dev); adau1761_spi_remove()
62 MODULE_DEVICE_TABLE(spi, adau1761_spi_id);
H A Dadau1781-spi.c13 #include <linux/spi/spi.h>
20 struct spi_device *spi = to_spi_device(dev); adau1781_spi_switch_mode() local
26 spi_w8r8(spi, 0x00); adau1781_spi_switch_mode()
27 spi_w8r8(spi, 0x00); adau1781_spi_switch_mode()
28 spi_w8r8(spi, 0x00); adau1781_spi_switch_mode()
31 static int adau1781_spi_probe(struct spi_device *spi) adau1781_spi_probe() argument
33 const struct spi_device_id *id = spi_get_device_id(spi); adau1781_spi_probe()
44 return adau1781_probe(&spi->dev, adau1781_spi_probe()
45 devm_regmap_init_spi(spi, &config), adau1781_spi_probe()
49 static int adau1781_spi_remove(struct spi_device *spi) adau1781_spi_remove() argument
51 snd_soc_unregister_codec(&spi->dev); adau1781_spi_remove()
60 MODULE_DEVICE_TABLE(spi, adau1781_spi_id);
H A Dadau1977-spi.c13 #include <linux/spi/spi.h>
20 struct spi_device *spi = to_spi_device(dev); adau1977_spi_switch_mode() local
26 spi_w8r8(spi, 0x00); adau1977_spi_switch_mode()
27 spi_w8r8(spi, 0x00); adau1977_spi_switch_mode()
28 spi_w8r8(spi, 0x00); adau1977_spi_switch_mode()
31 static int adau1977_spi_probe(struct spi_device *spi) adau1977_spi_probe() argument
33 const struct spi_device_id *id = spi_get_device_id(spi); adau1977_spi_probe()
44 return adau1977_probe(&spi->dev, adau1977_spi_probe()
45 devm_regmap_init_spi(spi, &config), adau1977_spi_probe()
49 static int adau1977_spi_remove(struct spi_device *spi) adau1977_spi_remove() argument
51 snd_soc_unregister_codec(&spi->dev); adau1977_spi_remove()
61 MODULE_DEVICE_TABLE(spi, adau1977_spi_ids);
H A Dwm8804-spi.c2 * wm8804-spi.c -- WM8804 S/PDIF transceiver driver - SPI
15 #include <linux/spi/spi.h>
19 static int wm8804_spi_probe(struct spi_device *spi) wm8804_spi_probe() argument
23 regmap = devm_regmap_init_spi(spi, &wm8804_regmap_config); wm8804_spi_probe()
27 return wm8804_probe(&spi->dev, regmap); wm8804_spi_probe()
30 static int wm8804_spi_remove(struct spi_device *spi) wm8804_spi_remove() argument
32 wm8804_remove(&spi->dev); wm8804_spi_remove()
H A Des8328-spi.c15 #include <linux/spi/spi.h>
25 static int es8328_spi_probe(struct spi_device *spi) es8328_spi_probe() argument
27 return es8328_probe(&spi->dev, es8328_spi_probe()
28 devm_regmap_init_spi(spi, &es8328_regmap_config)); es8328_spi_probe()
31 static int es8328_spi_remove(struct spi_device *spi) es8328_spi_remove() argument
33 snd_soc_unregister_codec(&spi->dev); es8328_spi_remove()
H A Dpcm512x-spi.c19 #include <linux/spi/spi.h>
23 static int pcm512x_spi_probe(struct spi_device *spi) pcm512x_spi_probe() argument
28 regmap = devm_regmap_init_spi(spi, &pcm512x_regmap); pcm512x_spi_probe()
34 return pcm512x_probe(&spi->dev, regmap); pcm512x_spi_probe()
37 static int pcm512x_spi_remove(struct spi_device *spi) pcm512x_spi_remove() argument
39 pcm512x_remove(&spi->dev); pcm512x_spi_remove()
50 MODULE_DEVICE_TABLE(spi, pcm512x_spi_id);
H A Dcs4271-spi.c18 #include <linux/spi/spi.h>
23 static int cs4271_spi_probe(struct spi_device *spi) cs4271_spi_probe() argument
33 return cs4271_probe(&spi->dev, devm_regmap_init_spi(spi, &config)); cs4271_spi_probe()
36 static int cs4271_spi_remove(struct spi_device *spi) cs4271_spi_remove() argument
38 snd_soc_unregister_codec(&spi->dev); cs4271_spi_remove()
H A Dtlv320aic26.c15 #include <linux/spi/spi.h>
31 struct spi_device *spi; member in struct:aic26
72 dev_dbg(&aic26->spi->dev, "aic26_hw_params(substream=%p, params=%p)\n", aic26_hw_params()
74 dev_dbg(&aic26->spi->dev, "rate=%i width=%d\n", params_rate(params), aic26_hw_params()
88 dev_dbg(&aic26->spi->dev, "bad rate\n"); return -EINVAL; aic26_hw_params()
98 dev_dbg(&aic26->spi->dev, "bad format\n"); return -EINVAL; aic26_hw_params()
112 dev_dbg(&aic26->spi->dev, "Setting PLLM to %d.%04d\n", jval, dval); aic26_hw_params()
142 dev_dbg(&aic26->spi->dev, "aic26_mute(dai=%p, mute=%i)\n", aic26_mute()
160 dev_dbg(&aic26->spi->dev, "aic26_set_sysclk(dai=%p, clk_id==%i," aic26_set_sysclk()
177 dev_dbg(&aic26->spi->dev, "aic26_set_fmt(dai=%p, fmt==%i)\n", aic26_set_fmt()
185 dev_dbg(&aic26->spi->dev, "bad master\n"); return -EINVAL; aic26_set_fmt()
195 dev_dbg(&aic26->spi->dev, "bad format\n"); return -EINVAL; aic26_set_fmt()
341 static int aic26_spi_probe(struct spi_device *spi) aic26_spi_probe() argument
346 dev_dbg(&spi->dev, "probing tlv320aic26 spi device\n"); aic26_spi_probe()
349 aic26 = devm_kzalloc(&spi->dev, sizeof *aic26, GFP_KERNEL); aic26_spi_probe()
353 aic26->regmap = devm_regmap_init_spi(spi, &aic26_regmap); aic26_spi_probe()
358 aic26->spi = spi; aic26_spi_probe()
359 dev_set_drvdata(&spi->dev, aic26); aic26_spi_probe()
362 ret = snd_soc_register_codec(&spi->dev, aic26_spi_probe()
367 static int aic26_spi_remove(struct spi_device *spi) aic26_spi_remove() argument
369 snd_soc_unregister_codec(&spi->dev); aic26_spi_remove()
H A Dpcm1792a.c23 #include <linux/spi/spi.h>
222 static int pcm1792a_spi_probe(struct spi_device *spi) pcm1792a_spi_probe() argument
227 pcm1792a = devm_kzalloc(&spi->dev, sizeof(struct pcm1792a_private), pcm1792a_spi_probe()
232 spi_set_drvdata(spi, pcm1792a); pcm1792a_spi_probe()
234 pcm1792a->regmap = devm_regmap_init_spi(spi, &pcm1792a_regmap); pcm1792a_spi_probe()
237 dev_err(&spi->dev, "Failed to register regmap: %d\n", ret); pcm1792a_spi_probe()
241 return snd_soc_register_codec(&spi->dev, pcm1792a_spi_probe()
245 static int pcm1792a_spi_remove(struct spi_device *spi) pcm1792a_spi_remove() argument
247 snd_soc_unregister_codec(&spi->dev); pcm1792a_spi_remove()
255 MODULE_DEVICE_TABLE(spi, pcm1792a_spi_ids);
H A Dak4104.c14 #include <linux/spi/spi.h>
265 static int ak4104_spi_probe(struct spi_device *spi) ak4104_spi_probe() argument
267 struct device_node *np = spi->dev.of_node; ak4104_spi_probe()
272 spi->bits_per_word = 8; ak4104_spi_probe()
273 spi->mode = SPI_MODE_0; ak4104_spi_probe()
274 ret = spi_setup(spi); ak4104_spi_probe()
278 ak4104 = devm_kzalloc(&spi->dev, sizeof(struct ak4104_private), ak4104_spi_probe()
283 ak4104->regulator = devm_regulator_get(&spi->dev, "vdd"); ak4104_spi_probe()
286 dev_err(&spi->dev, "Unable to get Vdd regulator: %d\n", ret); ak4104_spi_probe()
290 ak4104->regmap = devm_regmap_init_spi(spi, &ak4104_regmap); ak4104_spi_probe()
301 ret = devm_gpio_request_one(&spi->dev, gpio, ak4104_spi_probe()
319 spi_set_drvdata(spi, ak4104); ak4104_spi_probe()
321 ret = snd_soc_register_codec(&spi->dev, ak4104_spi_probe()
326 static int ak4104_spi_remove(struct spi_device *spi) ak4104_spi_remove() argument
328 snd_soc_unregister_codec(&spi->dev); ak4104_spi_remove()
342 MODULE_DEVICE_TABLE(spi, ak4104_id_table);
/linux-4.4.14/drivers/input/touchscreen/
H A Dtsc2005.c23 #include <linux/spi/spi.h>
36 struct spi_device *spi = to_spi_device(dev); tsc2005_cmd() local
42 error = spi_sync(spi, &msg); tsc2005_cmd()
44 dev_err(dev, "%s: failed, command: %x, spi error: %d\n", tsc2005_cmd()
52 static int tsc2005_probe(struct spi_device *spi) tsc2005_probe() argument
56 spi->mode = SPI_MODE_0; tsc2005_probe()
57 spi->bits_per_word = 8; tsc2005_probe()
58 if (!spi->max_speed_hz) tsc2005_probe()
59 spi->max_speed_hz = TSC2005_SPI_MAX_SPEED_HZ; tsc2005_probe()
61 error = spi_setup(spi); tsc2005_probe()
65 return tsc200x_probe(&spi->dev, spi->irq, BUS_SPI, tsc2005_probe()
66 devm_regmap_init_spi(spi, &tsc200x_regmap_config), tsc2005_probe()
70 static int tsc2005_remove(struct spi_device *spi) tsc2005_remove() argument
72 return tsc200x_remove(&spi->dev); tsc2005_remove()
88 MODULE_ALIAS("spi:tsc2005");
H A Dad7879-spi.c11 #include <linux/spi/spi.h>
30 static int ad7879_spi_xfer(struct spi_device *spi, ad7879_spi_xfer() argument
72 ret = spi_sync(spi, &msg); ad7879_spi_xfer()
85 struct spi_device *spi = to_spi_device(dev); ad7879_spi_multi_read() local
87 return ad7879_spi_xfer(spi, AD7879_READCMD(first_reg), count, NULL, buf); ad7879_spi_multi_read()
92 struct spi_device *spi = to_spi_device(dev); ad7879_spi_read() local
95 return ad7879_spi_xfer(spi, AD7879_READCMD(reg), 1, &dummy, &ret) ? : ret; ad7879_spi_read()
100 struct spi_device *spi = to_spi_device(dev); ad7879_spi_write() local
103 return ad7879_spi_xfer(spi, AD7879_WRITECMD(reg), 1, &val, &dummy); ad7879_spi_write()
113 static int ad7879_spi_probe(struct spi_device *spi) ad7879_spi_probe() argument
119 if (spi->max_speed_hz > MAX_SPI_FREQ_HZ) { ad7879_spi_probe()
120 dev_err(&spi->dev, "SPI CLK %d Hz?\n", spi->max_speed_hz); ad7879_spi_probe()
124 spi->bits_per_word = 16; ad7879_spi_probe()
125 err = spi_setup(spi); ad7879_spi_probe()
127 dev_dbg(&spi->dev, "spi master doesn't support 16 bits/word\n"); ad7879_spi_probe()
131 ts = ad7879_probe(&spi->dev, AD7879_DEVID, spi->irq, &ad7879_spi_bus_ops); ad7879_spi_probe()
135 spi_set_drvdata(spi, ts); ad7879_spi_probe()
140 static int ad7879_spi_remove(struct spi_device *spi) ad7879_spi_remove() argument
142 struct ad7879 *ts = spi_get_drvdata(spi); ad7879_spi_remove()
163 MODULE_ALIAS("spi:ad7879");
H A Dcyttsp_spi.c31 #include <linux/spi/spi.h>
46 struct spi_device *spi = to_spi_device(dev); cyttsp_spi_xfer() local
99 retval = spi_sync(spi, &msg); cyttsp_spi_xfer()
148 static int cyttsp_spi_probe(struct spi_device *spi) cyttsp_spi_probe() argument
154 spi->bits_per_word = CY_SPI_BITS_PER_WORD; cyttsp_spi_probe()
155 spi->mode = SPI_MODE_0; cyttsp_spi_probe()
156 error = spi_setup(spi); cyttsp_spi_probe()
158 dev_err(&spi->dev, "%s: SPI setup error %d\n", cyttsp_spi_probe()
163 ts = cyttsp_probe(&cyttsp_spi_bus_ops, &spi->dev, spi->irq, cyttsp_spi_probe()
168 spi_set_drvdata(spi, ts); cyttsp_spi_probe()
173 static int cyttsp_spi_remove(struct spi_device *spi) cyttsp_spi_remove() argument
175 struct cyttsp *ts = spi_get_drvdata(spi); cyttsp_spi_remove()
196 MODULE_ALIAS("spi:cyttsp");
H A Dad7877.c45 #include <linux/spi/spi.h>
46 #include <linux/spi/ad7877.h>
174 struct spi_device *spi; member in struct:ad7877
213 static int ad7877_read(struct spi_device *spi, u16 reg) ad7877_read() argument
236 status = spi_sync(spi, &req->msg); ad7877_read()
244 static int ad7877_write(struct spi_device *spi, u16 reg, u16 val) ad7877_write() argument
261 status = spi_sync(spi, &req->msg); ad7877_write()
268 static int ad7877_read_adc(struct spi_device *spi, unsigned command) ad7877_read_adc() argument
270 struct ad7877 *ts = spi_get_drvdata(spi); ad7877_read_adc()
323 status = spi_sync(spi, &req->msg); ad7877_read_adc()
347 * The size of the averaging filter is programmable. (dev.platform_data, see linux/spi/ad7877.h) ad7877_process_data()
404 error = spi_sync(ts->spi, &ts->msg); ad7877_irq()
406 dev_err(&ts->spi->dev, "spi_sync --> %d\n", error); ad7877_irq()
426 disable_irq(ts->spi->irq); ad7877_disable()
446 enable_irq(ts->spi->irq); ad7877_enable()
456 ssize_t v = ad7877_read_adc(ts->spi, \
524 ad7877_write(ts->spi, AD7877_REG_DAC, (ts->dac << 4) | AD7877_DAC_CONF); ad7877_dac_store()
554 ad7877_write(ts->spi, AD7877_REG_EXTWRITE, AD7877_EXTW_GPIO_DATA | ad7877_gpio3_store()
585 ad7877_write(ts->spi, AD7877_REG_EXTWRITE, AD7877_EXTW_GPIO_DATA | ad7877_gpio4_store()
630 static void ad7877_setup_ts_def_msg(struct spi_device *spi, struct ad7877 *ts) ad7877_setup_ts_def_msg() argument
642 ad7877_write(spi, AD7877_REG_CTRL2, ts->cmd_crtl2); ad7877_setup_ts_def_msg()
648 ad7877_write(spi, AD7877_REG_CTRL1, ts->cmd_crtl1); ad7877_setup_ts_def_msg()
679 static int ad7877_probe(struct spi_device *spi) ad7877_probe() argument
683 struct ad7877_platform_data *pdata = dev_get_platdata(&spi->dev); ad7877_probe()
687 if (!spi->irq) { ad7877_probe()
688 dev_dbg(&spi->dev, "no IRQ?\n"); ad7877_probe()
693 dev_dbg(&spi->dev, "no platform data?\n"); ad7877_probe()
698 if (spi->max_speed_hz > MAX_SPI_FREQ_HZ) { ad7877_probe()
699 dev_dbg(&spi->dev, "SPI CLK %d Hz?\n",spi->max_speed_hz); ad7877_probe()
703 spi->bits_per_word = 16; ad7877_probe()
704 err = spi_setup(spi); ad7877_probe()
706 dev_dbg(&spi->dev, "spi master doesn't support 16 bits/word\n"); ad7877_probe()
717 spi_set_drvdata(spi, ts); ad7877_probe()
718 ts->spi = spi; ad7877_probe()
736 snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(&spi->dev)); ad7877_probe()
740 input_dev->dev.parent = &spi->dev; ad7877_probe()
760 ad7877_write(spi, AD7877_REG_SEQ1, AD7877_MM_SEQUENCE); ad7877_probe()
762 verify = ad7877_read(spi, AD7877_REG_SEQ1); ad7877_probe()
765 dev_err(&spi->dev, "%s: Failed to probe %s\n", ad7877_probe()
766 dev_name(&spi->dev), input_dev->name); ad7877_probe()
772 ad7877_write(spi, AD7877_REG_EXTWRITE, AD7877_EXTW_GPIO_3_CONF); ad7877_probe()
774 ad7877_setup_ts_def_msg(spi, ts); ad7877_probe()
778 err = request_threaded_irq(spi->irq, NULL, ad7877_irq, ad7877_probe()
780 spi->dev.driver->name, ts); ad7877_probe()
782 dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq); ad7877_probe()
786 err = sysfs_create_group(&spi->dev.kobj, &ad7877_attr_group); ad7877_probe()
797 sysfs_remove_group(&spi->dev.kobj, &ad7877_attr_group); ad7877_probe()
799 free_irq(spi->irq, ts); ad7877_probe()
806 static int ad7877_remove(struct spi_device *spi) ad7877_remove() argument
808 struct ad7877 *ts = spi_get_drvdata(spi); ad7877_remove()
810 sysfs_remove_group(&spi->dev.kobj, &ad7877_attr_group); ad7877_remove()
813 free_irq(ts->spi->irq, ts); ad7877_remove()
818 dev_dbg(&spi->dev, "unregistered touchscreen\n"); ad7877_remove()
857 MODULE_ALIAS("spi:ad7877");
H A Dcyttsp4_spi.c31 #include <linux/spi/spi.h>
49 struct spi_device *spi = to_spi_device(dev); cyttsp_spi_xfer() local
102 retval = spi_sync(spi, &msg); cyttsp_spi_xfer()
156 static int cyttsp4_spi_probe(struct spi_device *spi) cyttsp4_spi_probe() argument
162 spi->bits_per_word = CY_SPI_BITS_PER_WORD; cyttsp4_spi_probe()
163 spi->mode = SPI_MODE_0; cyttsp4_spi_probe()
164 error = spi_setup(spi); cyttsp4_spi_probe()
166 dev_err(&spi->dev, "%s: SPI setup error %d\n", cyttsp4_spi_probe()
171 ts = cyttsp4_probe(&cyttsp_spi_bus_ops, &spi->dev, spi->irq, cyttsp4_spi_probe()
177 static int cyttsp4_spi_remove(struct spi_device *spi) cyttsp4_spi_remove() argument
179 struct cyttsp4 *ts = spi_get_drvdata(spi); cyttsp4_spi_remove()
199 MODULE_ALIAS("spi:cyttsp4");
H A Dads7846.c33 #include <linux/spi/spi.h>
34 #include <linux/spi/ads7846.h>
91 /* for ads7845 with mpc5121 psc spi we use 3-byte buffers */
100 struct spi_device *spi; member in struct:ads7846
210 disable_irq(ts->spi->irq); ads7846_stop()
221 enable_irq(ts->spi->irq); ads7846_restart()
244 dev_err(&ts->spi->dev, "Failed to enable supply: %d\n", error); __ads7846_enable()
314 struct spi_device *spi = to_spi_device(dev); ads7846_read12_ser() local
371 status = spi_sync(spi, &req->msg); ads7846_read12_ser()
388 struct spi_device *spi = to_spi_device(dev); ads7845_read12_ser() local
407 status = spi_sync(spi, &req->msg); ads7845_read12_ser()
428 ssize_t v = ads7846_read12_ser(&ts->spi->dev, \
508 static int ads784x_hwmon_register(struct spi_device *spi, struct ads7846 *ts) ads784x_hwmon_register() argument
514 dev_dbg(&spi->dev, "assuming 2.5V internal vREF\n"); ads784x_hwmon_register()
522 dev_warn(&spi->dev, ads784x_hwmon_register()
530 ts->hwmon = hwmon_device_register_with_groups(&spi->dev, spi->modalias, ads784x_hwmon_register()
536 static void ads784x_hwmon_unregister(struct spi_device *spi, ads784x_hwmon_unregister() argument
544 static inline int ads784x_hwmon_register(struct spi_device *spi, ads784x_hwmon_register() argument
550 static inline void ads784x_hwmon_unregister(struct spi_device *spi, ads784x_hwmon_unregister() argument
709 error = spi_sync(ts->spi, m); ads7846_read_state()
711 dev_err(&ts->spi->dev, "spi_sync --> %d\n", error); ads7846_read_state()
783 dev_vdbg(&ts->spi->dev, "x/y: %d/%d, PD %d\n", x, y, Rt); ads7846_report_state()
802 dev_vdbg(&ts->spi->dev, "ignored %d pressure %d\n", ads7846_report_state()
835 dev_vdbg(&ts->spi->dev, "DOWN\n"); ads7846_report_state()
843 dev_vdbg(&ts->spi->dev, "%4d/%4d/%4d\n", x, y, Rt); ads7846_report_state()
882 dev_vdbg(&ts->spi->dev, "UP\n"); ads7846_irq()
899 if (device_may_wakeup(&ts->spi->dev)) ads7846_suspend()
900 enable_irq_wake(ts->spi->irq); ads7846_suspend()
920 if (device_may_wakeup(&ts->spi->dev)) ads7846_resume()
921 disable_irq_wake(ts->spi->irq); ads7846_resume()
934 static int ads7846_setup_pendown(struct spi_device *spi, ads7846_setup_pendown() argument
953 dev_err(&spi->dev, ads7846_setup_pendown()
965 dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n"); ads7846_setup_pendown()
1254 static int ads7846_probe(struct spi_device *spi) ads7846_probe() argument
1263 if (!spi->irq) { ads7846_probe()
1264 dev_dbg(&spi->dev, "no IRQ?\n"); ads7846_probe()
1269 if (spi->max_speed_hz > (125000 * SAMPLE_BITS)) { ads7846_probe()
1270 dev_err(&spi->dev, "f(sample) %d KHz?\n", ads7846_probe()
1271 (spi->max_speed_hz/SAMPLE_BITS)/1000); ads7846_probe()
1280 spi->bits_per_word = 8; ads7846_probe()
1281 spi->mode = SPI_MODE_0; ads7846_probe()
1282 err = spi_setup(spi); ads7846_probe()
1294 spi_set_drvdata(spi, ts); ads7846_probe()
1297 ts->spi = spi; ads7846_probe()
1303 pdata = dev_get_platdata(&spi->dev); ads7846_probe()
1305 pdata = ads7846_probe_dt(&spi->dev); ads7846_probe()
1340 err = ads7846_setup_pendown(spi, ts, pdata); ads7846_probe()
1350 snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(&spi->dev)); ads7846_probe()
1355 input_dev->dev.parent = &spi->dev; ads7846_probe()
1372 ts->reg = regulator_get(&spi->dev, "vcc"); ads7846_probe()
1375 dev_err(&spi->dev, "unable to get regulator: %d\n", err); ads7846_probe()
1381 dev_err(&spi->dev, "unable to enable regulator: %d\n", err); ads7846_probe()
1388 err = request_threaded_irq(spi->irq, ads7846_hard_irq, ads7846_irq, ads7846_probe()
1389 irq_flags, spi->dev.driver->name, ts); ads7846_probe()
1391 dev_info(&spi->dev, ads7846_probe()
1392 "trying pin change workaround on irq %d\n", spi->irq); ads7846_probe()
1394 err = request_threaded_irq(spi->irq, ads7846_probe()
1396 irq_flags, spi->dev.driver->name, ts); ads7846_probe()
1400 dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq); ads7846_probe()
1404 err = ads784x_hwmon_register(spi, ts); ads7846_probe()
1408 dev_info(&spi->dev, "touchscreen, irq %d\n", spi->irq); ads7846_probe()
1415 ads7845_read12_ser(&spi->dev, PWRDOWN); ads7846_probe()
1417 (void) ads7846_read12_ser(&spi->dev, READ_12BIT_SER(vaux)); ads7846_probe()
1419 err = sysfs_create_group(&spi->dev.kobj, &ads784x_attr_group); ads7846_probe()
1427 device_init_wakeup(&spi->dev, pdata->wakeup); ads7846_probe()
1433 if (!dev_get_platdata(&spi->dev)) ads7846_probe()
1434 devm_kfree(&spi->dev, (void *)pdata); ads7846_probe()
1439 sysfs_remove_group(&spi->dev.kobj, &ads784x_attr_group); ads7846_probe()
1441 ads784x_hwmon_unregister(spi, ts); ads7846_probe()
1443 free_irq(spi->irq, ts); ads7846_probe()
1461 static int ads7846_remove(struct spi_device *spi) ads7846_remove() argument
1463 struct ads7846 *ts = spi_get_drvdata(spi); ads7846_remove()
1465 device_init_wakeup(&spi->dev, false); ads7846_remove()
1467 sysfs_remove_group(&spi->dev.kobj, &ads784x_attr_group); ads7846_remove()
1470 free_irq(ts->spi->irq, ts); ads7846_remove()
1474 ads784x_hwmon_unregister(spi, ts); ads7846_remove()
1493 dev_dbg(&spi->dev, "unregistered touchscreen\n"); ads7846_remove()
1512 MODULE_ALIAS("spi:ads7846");
/linux-4.4.14/drivers/input/misc/
H A Dadxl34x-spi.c12 #include <linux/spi/spi.h>
28 struct spi_device *spi = to_spi_device(dev); adxl34x_spi_read() local
33 return spi_w8r8(spi, cmd); adxl34x_spi_read()
39 struct spi_device *spi = to_spi_device(dev); adxl34x_spi_write() local
45 return spi_write(spi, buf, sizeof(buf)); adxl34x_spi_write()
52 struct spi_device *spi = to_spi_device(dev); adxl34x_spi_read_block() local
56 status = spi_write_then_read(spi, &reg, 1, buf, count); adxl34x_spi_read_block()
68 static int adxl34x_spi_probe(struct spi_device *spi) adxl34x_spi_probe() argument
73 if (spi->max_speed_hz > MAX_SPI_FREQ_HZ) { adxl34x_spi_probe()
74 dev_err(&spi->dev, "SPI CLK %d Hz too fast\n", spi->max_speed_hz); adxl34x_spi_probe()
78 ac = adxl34x_probe(&spi->dev, spi->irq, adxl34x_spi_probe()
79 spi->max_speed_hz > MAX_FREQ_NO_FIFODELAY, adxl34x_spi_probe()
85 spi_set_drvdata(spi, ac); adxl34x_spi_probe()
90 static int adxl34x_spi_remove(struct spi_device *spi) adxl34x_spi_remove() argument
92 struct adxl34x *ac = spi_get_drvdata(spi); adxl34x_spi_remove()
99 struct spi_device *spi = to_spi_device(dev); adxl34x_spi_suspend() local
100 struct adxl34x *ac = spi_get_drvdata(spi); adxl34x_spi_suspend()
109 struct spi_device *spi = to_spi_device(dev); adxl34x_spi_resume() local
110 struct adxl34x *ac = spi_get_drvdata(spi); adxl34x_spi_resume()
H A Dad714x-spi.c11 #include <linux/spi/spi.h>
34 struct spi_device *spi = to_spi_device(chip->dev); ad714x_spi_read() local
53 error = spi_sync(spi, &message); ad714x_spi_read()
68 struct spi_device *spi = to_spi_device(chip->dev); ad714x_spi_write() local
74 error = spi_write(spi, (u8 *)chip->xfer_buf, ad714x_spi_write()
84 static int ad714x_spi_probe(struct spi_device *spi) ad714x_spi_probe() argument
89 spi->bits_per_word = 8; ad714x_spi_probe()
90 err = spi_setup(spi); ad714x_spi_probe()
94 chip = ad714x_probe(&spi->dev, BUS_SPI, spi->irq, ad714x_spi_probe()
99 spi_set_drvdata(spi, chip); ad714x_spi_probe()
/linux-4.4.14/drivers/media/i2c/s5c73m3/
H A DMakefile1 s5c73m3-objs := s5c73m3-core.o s5c73m3-spi.o s5c73m3-ctrls.o
H A Ds5c73m3-spi.c24 #include <linux/spi/spi.h>
120 static int s5c73m3_spi_probe(struct spi_device *spi) s5c73m3_spi_probe() argument
123 struct s5c73m3 *state = container_of(spi->dev.driver, struct s5c73m3, s5c73m3_spi_probe()
125 spi->bits_per_word = 32; s5c73m3_spi_probe()
127 r = spi_setup(spi); s5c73m3_spi_probe()
129 dev_err(&spi->dev, "spi_setup() failed\n"); s5c73m3_spi_probe()
134 state->spi_dev = spi; s5c73m3_spi_probe()
141 static int s5c73m3_spi_remove(struct spi_device *spi) s5c73m3_spi_remove() argument
/linux-4.4.14/include/linux/iio/common/
H A Dst_sensors_spi.h2 * STMicroelectronics sensors spi library driver
14 #include <linux/spi/spi.h>
18 struct spi_device *spi, struct st_sensor_data *sdata);
/linux-4.4.14/drivers/iio/accel/
H A Dst_accel_spi.c14 #include <linux/spi/spi.h>
21 static int st_accel_spi_probe(struct spi_device *spi) st_accel_spi_probe() argument
27 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*adata)); st_accel_spi_probe()
33 st_sensors_spi_configure(indio_dev, spi, adata); st_accel_spi_probe()
42 static int st_accel_spi_remove(struct spi_device *spi) st_accel_spi_remove() argument
44 st_accel_common_remove(spi_get_drvdata(spi)); st_accel_spi_remove()
63 MODULE_DEVICE_TABLE(spi, st_accel_id_table);
67 .name = "st-accel-spi",
76 MODULE_DESCRIPTION("STMicroelectronics accelerometers spi driver");
H A Dbmc150-accel-spi.c24 #include <linux/spi/spi.h>
34 static int bmc150_accel_probe(struct spi_device *spi) bmc150_accel_probe() argument
37 const struct spi_device_id *id = spi_get_device_id(spi); bmc150_accel_probe()
39 regmap = devm_regmap_init_spi(spi, &bmc150_spi_regmap_conf); bmc150_accel_probe()
41 dev_err(&spi->dev, "Failed to initialize spi regmap\n"); bmc150_accel_probe()
45 return bmc150_accel_core_probe(&spi->dev, regmap, spi->irq, id->name, bmc150_accel_probe()
49 static int bmc150_accel_remove(struct spi_device *spi) bmc150_accel_remove() argument
51 return bmc150_accel_core_remove(&spi->dev); bmc150_accel_remove()
75 MODULE_DEVICE_TABLE(spi, bmc150_accel_id);
H A Dkxsd9.c21 #include <linux/spi/spi.h>
49 * @us: spi device
222 static int kxsd9_probe(struct spi_device *spi) kxsd9_probe() argument
227 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); kxsd9_probe()
232 spi_set_drvdata(spi, indio_dev); kxsd9_probe()
234 st->us = spi; kxsd9_probe()
238 indio_dev->name = spi_get_device_id(spi)->name; kxsd9_probe()
239 indio_dev->dev.parent = &spi->dev; kxsd9_probe()
243 spi->mode = SPI_MODE_0; kxsd9_probe()
244 spi_setup(spi); kxsd9_probe()
250 static int kxsd9_remove(struct spi_device *spi) kxsd9_remove() argument
252 iio_device_unregister(spi_get_drvdata(spi)); kxsd9_remove()
261 MODULE_DEVICE_TABLE(spi, kxsd9_id);
/linux-4.4.14/drivers/iio/magnetometer/
H A Dst_magn_spi.c14 #include <linux/spi/spi.h>
21 static int st_magn_spi_probe(struct spi_device *spi) st_magn_spi_probe() argument
27 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*mdata)); st_magn_spi_probe()
33 st_sensors_spi_configure(indio_dev, spi, mdata); st_magn_spi_probe()
42 static int st_magn_spi_remove(struct spi_device *spi) st_magn_spi_remove() argument
44 struct iio_dev *indio_dev = spi_get_drvdata(spi); st_magn_spi_remove()
57 MODULE_DEVICE_TABLE(spi, st_magn_id_table);
61 .name = "st-magn-spi",
70 MODULE_DESCRIPTION("STMicroelectronics magnetometers spi driver");
/linux-4.4.14/drivers/iio/pressure/
H A Dst_pressure_spi.c14 #include <linux/spi/spi.h>
21 static int st_press_spi_probe(struct spi_device *spi) st_press_spi_probe() argument
27 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*press_data)); st_press_spi_probe()
33 st_sensors_spi_configure(indio_dev, spi, press_data); st_press_spi_probe()
42 static int st_press_spi_remove(struct spi_device *spi) st_press_spi_remove() argument
44 st_press_common_remove(spi_get_drvdata(spi)); st_press_spi_remove()
55 MODULE_DEVICE_TABLE(spi, st_press_id_table);
59 .name = "st-press-spi",
68 MODULE_DESCRIPTION("STMicroelectronics pressures spi driver");
H A Dms5611_spi.c14 #include <linux/spi/spi.h>
83 static int ms5611_spi_probe(struct spi_device *spi) ms5611_spi_probe() argument
89 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); ms5611_spi_probe()
93 spi->mode = SPI_MODE_0; ms5611_spi_probe()
94 spi->max_speed_hz = 20000000; ms5611_spi_probe()
95 spi->bits_per_word = 8; ms5611_spi_probe()
96 ret = spi_setup(spi); ms5611_spi_probe()
104 st->client = spi; ms5611_spi_probe()
106 return ms5611_probe(indio_dev, &spi->dev, ms5611_spi_probe()
107 spi_get_device_id(spi)->driver_data); ms5611_spi_probe()
115 MODULE_DEVICE_TABLE(spi, ms5611_id);
127 MODULE_DESCRIPTION("MS5611 spi driver");
/linux-4.4.14/drivers/video/backlight/
H A Dili922x.c24 #include <linux/spi/spi.h>
141 struct spi_device *spi; member in struct:ili922x
148 * @spi: spi device
151 static int ili922x_read_status(struct spi_device *spi, u16 *rs) ili922x_read_status() argument
164 CHECK_FREQ_REG(spi, &xfer); ili922x_read_status()
178 ret = spi_sync(spi, &msg); ili922x_read_status()
180 dev_dbg(&spi->dev, "Error sending SPI message 0x%x", ret); ili922x_read_status()
190 * @spi: spi device
194 static int ili922x_read(struct spi_device *spi, u8 reg, u16 *rx) ili922x_read() argument
208 CHECK_FREQ_REG(spi, &xfer_regindex); ili922x_read()
229 CHECK_FREQ_REG(spi, &xfer_regvalue); ili922x_read()
232 ret = spi_sync(spi, &msg); ili922x_read()
234 dev_dbg(&spi->dev, "Error sending SPI message 0x%x", ret); ili922x_read()
244 * @spi: struct spi_device *
248 static int ili922x_write(struct spi_device *spi, u8 reg, u16 value) ili922x_write() argument
263 CHECK_FREQ_REG(spi, &xfer_regindex); ili922x_write()
273 ret = spi_sync(spi, &msg); ili922x_write()
286 CHECK_FREQ_REG(spi, &xfer_regvalue); ili922x_write()
290 ret = spi_sync(spi, &msg); ili922x_write()
292 dev_err(&spi->dev, "Error sending SPI message 0x%x", ret); ili922x_write()
302 static void ili922x_reg_dump(struct spi_device *spi) ili922x_reg_dump() argument
307 dev_dbg(&spi->dev, "ILI922x configuration registers:\n"); ili922x_reg_dump()
310 ili922x_read(spi, reg, &rx); ili922x_reg_dump()
311 dev_dbg(&spi->dev, "reg @ 0x%02X: 0x%04X\n", reg, rx); ili922x_reg_dump()
315 static inline void ili922x_reg_dump(struct spi_device *spi) {} ili922x_reg_dump() argument
320 * @spi: spi device ili922x_reg_dump()
322 static void set_write_to_gram_reg(struct spi_device *spi) set_write_to_gram_reg() argument
342 spi_sync(spi, &msg); set_write_to_gram_reg()
347 * @spi: spi device
353 static int ili922x_poweron(struct spi_device *spi) ili922x_poweron() argument
358 ret = ili922x_write(spi, REG_POWER_CONTROL_1, 0x0000); ili922x_poweron()
360 ret += ili922x_write(spi, REG_POWER_CONTROL_2, 0x0000); ili922x_poweron()
361 ret += ili922x_write(spi, REG_POWER_CONTROL_3, 0x0000); ili922x_poweron()
363 ret += ili922x_write(spi, REG_POWER_CONTROL_4, 0x0000); ili922x_poweron()
366 ret += ili922x_write(spi, 0x56, 0x080F); ili922x_poweron()
367 ret += ili922x_write(spi, REG_POWER_CONTROL_1, 0x4240); ili922x_poweron()
369 ret += ili922x_write(spi, REG_POWER_CONTROL_2, 0x0000); ili922x_poweron()
370 ret += ili922x_write(spi, REG_POWER_CONTROL_3, 0x0014); ili922x_poweron()
372 ret += ili922x_write(spi, REG_POWER_CONTROL_4, 0x1319); ili922x_poweron()
380 * @spi: spi device
382 static int ili922x_poweroff(struct spi_device *spi) ili922x_poweroff() argument
387 ret = ili922x_write(spi, REG_POWER_CONTROL_1, 0x0000); ili922x_poweroff()
389 ret += ili922x_write(spi, REG_POWER_CONTROL_2, 0x0000); ili922x_poweroff()
390 ret += ili922x_write(spi, REG_POWER_CONTROL_3, 0x0000); ili922x_poweroff()
392 ret += ili922x_write(spi, REG_POWER_CONTROL_4, 0x0000); ili922x_poweroff()
401 * @spi: spi device
403 static void ili922x_display_init(struct spi_device *spi) ili922x_display_init() argument
405 ili922x_write(spi, REG_START_OSCILLATION, 1); ili922x_display_init()
407 ili922x_write(spi, REG_DRIVER_OUTPUT_CONTROL, 0x691B); ili922x_display_init()
408 ili922x_write(spi, REG_LCD_AC_DRIVEING_CONTROL, 0x0700); ili922x_display_init()
409 ili922x_write(spi, REG_ENTRY_MODE, 0x1030); ili922x_display_init()
410 ili922x_write(spi, REG_COMPARE_1, 0x0000); ili922x_display_init()
411 ili922x_write(spi, REG_COMPARE_2, 0x0000); ili922x_display_init()
412 ili922x_write(spi, REG_DISPLAY_CONTROL_1, 0x0037); ili922x_display_init()
413 ili922x_write(spi, REG_DISPLAY_CONTROL_2, 0x0202); ili922x_display_init()
414 ili922x_write(spi, REG_DISPLAY_CONTROL_3, 0x0000); ili922x_display_init()
415 ili922x_write(spi, REG_FRAME_CYCLE_CONTROL, 0x0000); ili922x_display_init()
418 ili922x_write(spi, REG_EXT_INTF_CONTROL, 0x0110); ili922x_display_init()
420 ili922x_poweron(spi); ili922x_display_init()
422 ili922x_write(spi, REG_GAMMA_CONTROL_1, 0x0302); ili922x_display_init()
423 ili922x_write(spi, REG_GAMMA_CONTROL_2, 0x0407); ili922x_display_init()
424 ili922x_write(spi, REG_GAMMA_CONTROL_3, 0x0304); ili922x_display_init()
425 ili922x_write(spi, REG_GAMMA_CONTROL_4, 0x0203); ili922x_display_init()
426 ili922x_write(spi, REG_GAMMA_CONTROL_5, 0x0706); ili922x_display_init()
427 ili922x_write(spi, REG_GAMMA_CONTROL_6, 0x0407); ili922x_display_init()
428 ili922x_write(spi, REG_GAMMA_CONTROL_7, 0x0706); ili922x_display_init()
429 ili922x_write(spi, REG_GAMMA_CONTROL_8, 0x0000); ili922x_display_init()
430 ili922x_write(spi, REG_GAMMA_CONTROL_9, 0x0C06); ili922x_display_init()
431 ili922x_write(spi, REG_GAMMA_CONTROL_10, 0x0F00); ili922x_display_init()
432 ili922x_write(spi, REG_RAM_ADDRESS_SET, 0x0000); ili922x_display_init()
433 ili922x_write(spi, REG_GATE_SCAN_CONTROL, 0x0000); ili922x_display_init()
434 ili922x_write(spi, REG_VERT_SCROLL_CONTROL, 0x0000); ili922x_display_init()
435 ili922x_write(spi, REG_FIRST_SCREEN_DRIVE_POS, 0xDB00); ili922x_display_init()
436 ili922x_write(spi, REG_SECOND_SCREEN_DRIVE_POS, 0xDB00); ili922x_display_init()
437 ili922x_write(spi, REG_RAM_ADDR_POS_H, 0xAF00); ili922x_display_init()
438 ili922x_write(spi, REG_RAM_ADDR_POS_V, 0xDB00); ili922x_display_init()
439 ili922x_reg_dump(spi); ili922x_display_init()
440 set_write_to_gram_reg(spi); ili922x_display_init()
448 ret = ili922x_poweron(lcd->spi); ili922x_lcd_power()
450 ret = ili922x_poweroff(lcd->spi); ili922x_lcd_power()
477 static int ili922x_probe(struct spi_device *spi) ili922x_probe() argument
484 ili = devm_kzalloc(&spi->dev, sizeof(*ili), GFP_KERNEL); ili922x_probe()
488 ili->spi = spi; ili922x_probe()
489 spi_set_drvdata(spi, ili); ili922x_probe()
492 ret = ili922x_read(spi, REG_DRIVER_CODE_READ, &reg); ili922x_probe()
494 dev_err(&spi->dev, ili922x_probe()
500 dev_info(&spi->dev, "ILI%x found, SPI freq %d, mode %d\n", ili922x_probe()
501 reg, spi->max_speed_hz, spi->mode); ili922x_probe()
503 ret = ili922x_read_status(spi, &reg); ili922x_probe()
505 dev_err(&spi->dev, "reading RS failed...\n"); ili922x_probe()
509 dev_dbg(&spi->dev, "status: 0x%x\n", reg); ili922x_probe()
511 ili922x_display_init(spi); ili922x_probe()
515 lcd = devm_lcd_device_register(&spi->dev, "ili922xlcd", &spi->dev, ili, ili922x_probe()
518 dev_err(&spi->dev, "cannot register LCD\n"); ili922x_probe()
523 spi_set_drvdata(spi, ili); ili922x_probe()
530 static int ili922x_remove(struct spi_device *spi) ili922x_remove() argument
532 ili922x_poweroff(spi); ili922x_remove()
H A Dl4f00242t03.c25 #include <linux/spi/spi.h>
26 #include <linux/spi/l4f00242t03.h>
29 struct spi_device *spi; member in struct:l4f00242t03_priv
49 static void l4f00242t03_lcd_init(struct spi_device *spi) l4f00242t03_lcd_init() argument
51 struct l4f00242t03_pdata *pdata = dev_get_platdata(&spi->dev); l4f00242t03_lcd_init()
52 struct l4f00242t03_priv *priv = spi_get_drvdata(spi); l4f00242t03_lcd_init()
56 dev_dbg(&spi->dev, "initializing LCD\n"); l4f00242t03_lcd_init()
60 dev_err(&spi->dev, "failed to set the IO regulator voltage.\n"); l4f00242t03_lcd_init()
65 dev_err(&spi->dev, "failed to enable the IO regulator.\n"); l4f00242t03_lcd_init()
71 dev_err(&spi->dev, "failed to set the core regulator voltage.\n"); l4f00242t03_lcd_init()
77 dev_err(&spi->dev, "failed to enable the core regulator.\n"); l4f00242t03_lcd_init()
86 spi_write(spi, (const u8 *)cmd, ARRAY_SIZE(cmd) * sizeof(u16)); l4f00242t03_lcd_init()
89 static void l4f00242t03_lcd_powerdown(struct spi_device *spi) l4f00242t03_lcd_powerdown() argument
91 struct l4f00242t03_pdata *pdata = dev_get_platdata(&spi->dev); l4f00242t03_lcd_powerdown()
92 struct l4f00242t03_priv *priv = spi_get_drvdata(spi); l4f00242t03_lcd_powerdown()
94 dev_dbg(&spi->dev, "Powering down LCD\n"); l4f00242t03_lcd_powerdown()
112 struct spi_device *spi = priv->spi; l4f00242t03_lcd_power_set() local
124 dev_dbg(&spi->dev, "Resuming LCD\n"); l4f00242t03_lcd_power_set()
126 spi_write(spi, (const u8 *)&slpout, sizeof(u16)); l4f00242t03_lcd_power_set()
128 spi_write(spi, (const u8 *)&dison, sizeof(u16)); l4f00242t03_lcd_power_set()
131 l4f00242t03_lcd_init(spi); l4f00242t03_lcd_power_set()
138 dev_dbg(&spi->dev, "Standby the LCD\n"); l4f00242t03_lcd_power_set()
140 spi_write(spi, (const u8 *)&disoff, sizeof(u16)); l4f00242t03_lcd_power_set()
142 spi_write(spi, (const u8 *)&slpin, sizeof(u16)); l4f00242t03_lcd_power_set()
147 l4f00242t03_lcd_init(spi); l4f00242t03_lcd_power_set()
155 spi_write(spi, (const u8 *)&disoff, sizeof(u16)); l4f00242t03_lcd_power_set()
157 l4f00242t03_lcd_powerdown(spi); l4f00242t03_lcd_power_set()
171 static int l4f00242t03_probe(struct spi_device *spi) l4f00242t03_probe() argument
174 struct l4f00242t03_pdata *pdata = dev_get_platdata(&spi->dev); l4f00242t03_probe()
178 dev_err(&spi->dev, "Uninitialized platform data.\n"); l4f00242t03_probe()
182 priv = devm_kzalloc(&spi->dev, sizeof(struct l4f00242t03_priv), l4f00242t03_probe()
187 spi_set_drvdata(spi, priv); l4f00242t03_probe()
188 spi->bits_per_word = 9; l4f00242t03_probe()
189 spi_setup(spi); l4f00242t03_probe()
191 priv->spi = spi; l4f00242t03_probe()
193 ret = devm_gpio_request_one(&spi->dev, pdata->reset_gpio, l4f00242t03_probe()
196 dev_err(&spi->dev, l4f00242t03_probe()
201 ret = devm_gpio_request_one(&spi->dev, pdata->data_enable_gpio, l4f00242t03_probe()
204 dev_err(&spi->dev, l4f00242t03_probe()
209 priv->io_reg = devm_regulator_get(&spi->dev, "vdd"); l4f00242t03_probe()
211 dev_err(&spi->dev, "%s: Unable to get the IO regulator\n", l4f00242t03_probe()
216 priv->core_reg = devm_regulator_get(&spi->dev, "vcore"); l4f00242t03_probe()
218 dev_err(&spi->dev, "%s: Unable to get the core regulator\n", l4f00242t03_probe()
223 priv->ld = devm_lcd_device_register(&spi->dev, "l4f00242t03", &spi->dev, l4f00242t03_probe()
229 l4f00242t03_lcd_init(spi); l4f00242t03_probe()
233 dev_info(&spi->dev, "Epson l4f00242t03 lcd probed.\n"); l4f00242t03_probe()
238 static int l4f00242t03_remove(struct spi_device *spi) l4f00242t03_remove() argument
240 struct l4f00242t03_priv *priv = spi_get_drvdata(spi); l4f00242t03_remove()
246 static void l4f00242t03_shutdown(struct spi_device *spi) l4f00242t03_shutdown() argument
248 struct l4f00242t03_priv *priv = spi_get_drvdata(spi); l4f00242t03_shutdown()
H A Dtosa_lcd.c16 #include <linux/spi/spi.h>
38 struct spi_device *spi; member in struct:tosa_lcd_data
46 static int tosa_tg_send(struct spi_device *spi, int adrs, uint8_t data) tosa_tg_send() argument
60 return spi_sync(spi, &msg); tosa_tg_send()
63 int tosa_bl_enable(struct spi_device *spi, int enable) tosa_bl_enable() argument
66 return tosa_tg_send(spi, TG_GPODR2, enable ? 0x01 : 0x00); tosa_bl_enable()
78 tosa_tg_send(data->spi, TG_TPOSCTL, 0x00); tosa_lcd_tg_init()
80 tosa_tg_send(data->spi, TG_GPOSR, 0x02); tosa_lcd_tg_init()
85 struct spi_device *spi = data->spi; tosa_lcd_tg_on() local
91 tosa_tg_send(spi, TG_PNLCTL, value); tosa_lcd_tg_on()
94 tosa_tg_send(spi, TG_PINICTL, 0x4); tosa_lcd_tg_on()
98 tosa_tg_send(spi, TG_PINICTL, 0x0); tosa_lcd_tg_on()
109 .platform_data = data->spi, tosa_lcd_tg_on()
117 struct spi_device *spi = data->spi; tosa_lcd_tg_off() local
120 tosa_tg_send(spi, TG_PINICTL, 0x4); tosa_lcd_tg_off()
124 tosa_tg_send(spi, TG_PINICTL, 0x6); tosa_lcd_tg_off()
174 static int tosa_lcd_probe(struct spi_device *spi) tosa_lcd_probe() argument
179 data = devm_kzalloc(&spi->dev, sizeof(struct tosa_lcd_data), tosa_lcd_probe()
189 spi->bits_per_word = 8; tosa_lcd_probe()
191 ret = spi_setup(spi); tosa_lcd_probe()
195 data->spi = spi; tosa_lcd_probe()
196 spi_set_drvdata(spi, data); tosa_lcd_probe()
198 ret = devm_gpio_request_one(&spi->dev, TOSA_GPIO_TG_ON, tosa_lcd_probe()
209 data->lcd = devm_lcd_device_register(&spi->dev, "tosa-lcd", &spi->dev, tosa_lcd_probe()
225 static int tosa_lcd_remove(struct spi_device *spi) tosa_lcd_remove() argument
227 struct tosa_lcd_data *data = spi_get_drvdata(spi); tosa_lcd_remove()
277 MODULE_ALIAS("spi:tosa-lcd");
H A Dlms283gf05.c18 #include <linux/spi/spi.h>
19 #include <linux/spi/lms283gf05.h>
23 struct spi_device *spi; member in struct:lms283gf05_state
106 static void lms283gf05_toggle(struct spi_device *spi, lms283gf05_toggle() argument
116 spi_write(spi, buf, 3); lms283gf05_toggle()
121 spi_write(spi, buf, 3); lms283gf05_toggle()
130 struct spi_device *spi = st->spi; lms283gf05_power_set() local
131 struct lms283gf05_pdata *pdata = dev_get_platdata(&spi->dev); lms283gf05_power_set()
137 lms283gf05_toggle(spi, disp_initseq, ARRAY_SIZE(disp_initseq)); lms283gf05_power_set()
139 lms283gf05_toggle(spi, disp_pdwnseq, ARRAY_SIZE(disp_pdwnseq)); lms283gf05_power_set()
153 static int lms283gf05_probe(struct spi_device *spi) lms283gf05_probe() argument
156 struct lms283gf05_pdata *pdata = dev_get_platdata(&spi->dev); lms283gf05_probe()
161 ret = devm_gpio_request_one(&spi->dev, pdata->reset_gpio, lms283gf05_probe()
169 st = devm_kzalloc(&spi->dev, sizeof(struct lms283gf05_state), lms283gf05_probe()
174 ld = devm_lcd_device_register(&spi->dev, "lms283gf05", &spi->dev, st, lms283gf05_probe()
179 st->spi = spi; lms283gf05_probe()
182 spi_set_drvdata(spi, st); lms283gf05_probe()
187 lms283gf05_toggle(spi, disp_initseq, ARRAY_SIZE(disp_initseq)); lms283gf05_probe()
H A Dili9320.c22 #include <linux/spi/spi.h>
33 struct ili9320_spi *spi = &ili->access.spi; ili9320_write_spi() local
34 unsigned char *addr = spi->buffer_addr; ili9320_write_spi()
35 unsigned char *data = spi->buffer_data; ili9320_write_spi()
37 /* spi message consits of: ili9320_write_spi()
41 addr[0] = spi->id | ILI9320_SPI_INDEX | ILI9320_SPI_WRITE; ili9320_write_spi()
47 data[0] = spi->id | ILI9320_SPI_DATA | ILI9320_SPI_WRITE; ili9320_write_spi()
51 return spi_sync(spi->dev, &spi->message); ili9320_write_spi()
175 struct ili9320_spi *spi = &ili->access.spi; ili9320_setup_spi() local
178 spi->dev = dev; ili9320_setup_spi()
185 spi->xfer[0].tx_buf = spi->buffer_addr; ili9320_setup_spi()
186 spi->xfer[1].tx_buf = spi->buffer_data; ili9320_setup_spi()
187 spi->xfer[0].len = 3; ili9320_setup_spi()
188 spi->xfer[1].len = 3; ili9320_setup_spi()
189 spi->xfer[0].bits_per_word = 8; ili9320_setup_spi()
190 spi->xfer[1].bits_per_word = 8; ili9320_setup_spi()
191 spi->xfer[0].cs_change = 1; ili9320_setup_spi()
193 spi_message_init(&spi->message); ili9320_setup_spi()
194 spi_message_add_tail(&spi->xfer[0], &spi->message); ili9320_setup_spi()
195 spi_message_add_tail(&spi->xfer[1], &spi->message); ili9320_setup_spi()
198 int ili9320_probe_spi(struct spi_device *spi, ili9320_probe_spi() argument
201 struct ili9320_platdata *cfg = dev_get_platdata(&spi->dev); ili9320_probe_spi()
202 struct device *dev = &spi->dev; ili9320_probe_spi()
221 ili = devm_kzalloc(&spi->dev, sizeof(struct ili9320), GFP_KERNEL); ili9320_probe_spi()
225 ili->access.spi.id = ILI9320_SPI_IDCODE | ILI9320_SPI_ID(1); ili9320_probe_spi()
232 spi_set_drvdata(spi, ili); ili9320_probe_spi()
234 ili9320_setup_spi(ili, spi); ili9320_probe_spi()
236 lcd = devm_lcd_device_register(&spi->dev, "ili9320", dev, ili, ili9320_probe_spi()
H A Dams369fg06.c21 #include <linux/spi/spi.h>
39 struct spi_device *spi; member in struct:ams369fg06
178 return spi_sync(lcd->spi, &msg); ams369fg06_spi_write_byte()
444 static int ams369fg06_probe(struct spi_device *spi) ams369fg06_probe() argument
452 lcd = devm_kzalloc(&spi->dev, sizeof(struct ams369fg06), GFP_KERNEL); ams369fg06_probe()
457 spi->bits_per_word = 16; ams369fg06_probe()
459 ret = spi_setup(spi); ams369fg06_probe()
461 dev_err(&spi->dev, "spi setup failed.\n"); ams369fg06_probe()
465 lcd->spi = spi; ams369fg06_probe()
466 lcd->dev = &spi->dev; ams369fg06_probe()
468 lcd->lcd_pd = dev_get_platdata(&spi->dev); ams369fg06_probe()
470 dev_err(&spi->dev, "platform data is NULL\n"); ams369fg06_probe()
474 ld = devm_lcd_device_register(&spi->dev, "ams369fg06", &spi->dev, lcd, ams369fg06_probe()
485 bd = devm_backlight_device_register(&spi->dev, "ams369fg06-bl", ams369fg06_probe()
486 &spi->dev, lcd, ams369fg06_probe()
507 spi_set_drvdata(spi, lcd); ams369fg06_probe()
509 dev_info(&spi->dev, "ams369fg06 panel driver has been probed.\n"); ams369fg06_probe()
514 static int ams369fg06_remove(struct spi_device *spi) ams369fg06_remove() argument
516 struct ams369fg06 *lcd = spi_get_drvdata(spi); ams369fg06_remove()
549 static void ams369fg06_shutdown(struct spi_device *spi) ams369fg06_shutdown() argument
551 struct ams369fg06 *lcd = spi_get_drvdata(spi); ams369fg06_shutdown()
H A Dlms501kf03.c19 #include <linux/spi/spi.h>
27 struct spi_device *spi; member in struct:lms501kf03
131 return spi_sync(lcd->spi, &msg); lms501kf03_spi_write_byte()
325 static int lms501kf03_probe(struct spi_device *spi) lms501kf03_probe() argument
331 lcd = devm_kzalloc(&spi->dev, sizeof(struct lms501kf03), GFP_KERNEL); lms501kf03_probe()
336 spi->bits_per_word = 9; lms501kf03_probe()
338 ret = spi_setup(spi); lms501kf03_probe()
340 dev_err(&spi->dev, "spi setup failed.\n"); lms501kf03_probe()
344 lcd->spi = spi; lms501kf03_probe()
345 lcd->dev = &spi->dev; lms501kf03_probe()
347 lcd->lcd_pd = dev_get_platdata(&spi->dev); lms501kf03_probe()
349 dev_err(&spi->dev, "platform data is NULL\n"); lms501kf03_probe()
353 ld = devm_lcd_device_register(&spi->dev, "lms501kf03", &spi->dev, lcd, lms501kf03_probe()
373 spi_set_drvdata(spi, lcd); lms501kf03_probe()
375 dev_info(&spi->dev, "lms501kf03 panel driver has been probed.\n"); lms501kf03_probe()
380 static int lms501kf03_remove(struct spi_device *spi) lms501kf03_remove() argument
382 struct lms501kf03 *lcd = spi_get_drvdata(spi); lms501kf03_remove()
415 static void lms501kf03_shutdown(struct spi_device *spi) lms501kf03_shutdown() argument
417 struct lms501kf03 *lcd = spi_get_drvdata(spi); lms501kf03_shutdown()
H A Ds6e63m0.c23 #include <linux/spi/spi.h>
39 struct spi_device *spi; member in struct:s6e63m0
372 return spi_sync(lcd->spi, &msg); s6e63m0_spi_write_byte()
708 static int s6e63m0_probe(struct spi_device *spi) s6e63m0_probe() argument
716 lcd = devm_kzalloc(&spi->dev, sizeof(struct s6e63m0), GFP_KERNEL); s6e63m0_probe()
721 spi->bits_per_word = 9; s6e63m0_probe()
723 ret = spi_setup(spi); s6e63m0_probe()
725 dev_err(&spi->dev, "spi setup failed.\n"); s6e63m0_probe()
729 lcd->spi = spi; s6e63m0_probe()
730 lcd->dev = &spi->dev; s6e63m0_probe()
732 lcd->lcd_pd = dev_get_platdata(&spi->dev); s6e63m0_probe()
734 dev_err(&spi->dev, "platform data is NULL.\n"); s6e63m0_probe()
738 ld = devm_lcd_device_register(&spi->dev, "s6e63m0", &spi->dev, lcd, s6e63m0_probe()
749 bd = devm_backlight_device_register(&spi->dev, "s6e63m0bl-bl", s6e63m0_probe()
750 &spi->dev, lcd, &s6e63m0_backlight_ops, s6e63m0_probe()
765 ret = device_create_file(&(spi->dev), &dev_attr_gamma_mode); s6e63m0_probe()
767 dev_err(&(spi->dev), "failed to add sysfs entries\n"); s6e63m0_probe()
769 ret = device_create_file(&(spi->dev), &dev_attr_gamma_table); s6e63m0_probe()
771 dev_err(&(spi->dev), "failed to add sysfs entries\n"); s6e63m0_probe()
790 spi_set_drvdata(spi, lcd); s6e63m0_probe()
792 dev_info(&spi->dev, "s6e63m0 panel driver has been probed.\n"); s6e63m0_probe()
797 static int s6e63m0_remove(struct spi_device *spi) s6e63m0_remove() argument
799 struct s6e63m0 *lcd = spi_get_drvdata(spi); s6e63m0_remove()
802 device_remove_file(&spi->dev, &dev_attr_gamma_table); s6e63m0_remove()
803 device_remove_file(&spi->dev, &dev_attr_gamma_mode); s6e63m0_remove()
835 static void s6e63m0_shutdown(struct spi_device *spi) s6e63m0_shutdown() argument
837 struct s6e63m0 *lcd = spi_get_drvdata(spi); s6e63m0_shutdown()
H A Dltv350qv.c17 #include <linux/spi/spi.h>
24 struct spi_device *spi; member in struct:ltv350qv
67 return spi_sync(lcd->spi, &msg); ltv350qv_write_reg()
229 static int ltv350qv_probe(struct spi_device *spi) ltv350qv_probe() argument
235 lcd = devm_kzalloc(&spi->dev, sizeof(struct ltv350qv), GFP_KERNEL); ltv350qv_probe()
239 lcd->spi = spi; ltv350qv_probe()
241 lcd->buffer = devm_kzalloc(&spi->dev, 8, GFP_KERNEL); ltv350qv_probe()
245 ld = devm_lcd_device_register(&spi->dev, "ltv350qv", &spi->dev, lcd, ltv350qv_probe()
256 spi_set_drvdata(spi, lcd); ltv350qv_probe()
261 static int ltv350qv_remove(struct spi_device *spi) ltv350qv_remove() argument
263 struct ltv350qv *lcd = spi_get_drvdata(spi); ltv350qv_remove()
288 static void ltv350qv_shutdown(struct spi_device *spi) ltv350qv_shutdown() argument
290 struct ltv350qv *lcd = spi_get_drvdata(spi); ltv350qv_shutdown()
311 MODULE_ALIAS("spi:ltv350qv");
/linux-4.4.14/drivers/video/fbdev/omap2/displays-new/
H A Dpanel-lgphilips-lb035q02.c15 #include <linux/spi/spi.h>
47 struct spi_device *spi; member in struct:panel_drv_data
61 static int lb035q02_write_reg(struct spi_device *spi, u8 reg, u16 val) lb035q02_write_reg() argument
89 return spi_sync(spi, &msg); lb035q02_write_reg()
92 static void init_lb035q02_panel(struct spi_device *spi) init_lb035q02_panel() argument
95 lb035q02_write_reg(spi, 0x01, 0x6300); init_lb035q02_panel()
96 lb035q02_write_reg(spi, 0x02, 0x0200); init_lb035q02_panel()
97 lb035q02_write_reg(spi, 0x03, 0x0177); init_lb035q02_panel()
98 lb035q02_write_reg(spi, 0x04, 0x04c7); init_lb035q02_panel()
99 lb035q02_write_reg(spi, 0x05, 0xffc0); init_lb035q02_panel()
100 lb035q02_write_reg(spi, 0x06, 0xe806); init_lb035q02_panel()
101 lb035q02_write_reg(spi, 0x0a, 0x4008); init_lb035q02_panel()
102 lb035q02_write_reg(spi, 0x0b, 0x0000); init_lb035q02_panel()
103 lb035q02_write_reg(spi, 0x0d, 0x0030); init_lb035q02_panel()
104 lb035q02_write_reg(spi, 0x0e, 0x2800); init_lb035q02_panel()
105 lb035q02_write_reg(spi, 0x0f, 0x0000); init_lb035q02_panel()
106 lb035q02_write_reg(spi, 0x16, 0x9f80); init_lb035q02_panel()
107 lb035q02_write_reg(spi, 0x17, 0x0a0f); init_lb035q02_panel()
108 lb035q02_write_reg(spi, 0x1e, 0x00c1); init_lb035q02_panel()
109 lb035q02_write_reg(spi, 0x30, 0x0300); init_lb035q02_panel()
110 lb035q02_write_reg(spi, 0x31, 0x0007); init_lb035q02_panel()
111 lb035q02_write_reg(spi, 0x32, 0x0000); init_lb035q02_panel()
112 lb035q02_write_reg(spi, 0x33, 0x0000); init_lb035q02_panel()
113 lb035q02_write_reg(spi, 0x34, 0x0707); init_lb035q02_panel()
114 lb035q02_write_reg(spi, 0x35, 0x0004); init_lb035q02_panel()
115 lb035q02_write_reg(spi, 0x36, 0x0302); init_lb035q02_panel()
116 lb035q02_write_reg(spi, 0x37, 0x0202); init_lb035q02_panel()
117 lb035q02_write_reg(spi, 0x3a, 0x0a0d); init_lb035q02_panel()
118 lb035q02_write_reg(spi, 0x3b, 0x0806); init_lb035q02_panel()
134 init_lb035q02_panel(ddata->spi); lb035q02_connect()
243 static int lb035q02_probe_pdata(struct spi_device *spi) lb035q02_probe_pdata() argument
246 struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); lb035q02_probe_pdata()
250 pdata = dev_get_platdata(&spi->dev); lb035q02_probe_pdata()
254 dev_err(&spi->dev, "failed to find video source '%s'\n", lb035q02_probe_pdata()
266 r = devm_gpio_request_one(&spi->dev, pdata->enable_gpio, lb035q02_probe_pdata()
281 static int lb035q02_probe_of(struct spi_device *spi) lb035q02_probe_of() argument
283 struct device_node *node = spi->dev.of_node; lb035q02_probe_of()
284 struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); lb035q02_probe_of()
288 gpio = devm_gpiod_get(&spi->dev, "enable", GPIOD_OUT_LOW); lb035q02_probe_of()
290 dev_err(&spi->dev, "failed to parse enable gpio\n"); lb035q02_probe_of()
300 dev_err(&spi->dev, "failed to find video source\n"); lb035q02_probe_of()
309 static int lb035q02_panel_spi_probe(struct spi_device *spi) lb035q02_panel_spi_probe() argument
315 ddata = devm_kzalloc(&spi->dev, sizeof(*ddata), GFP_KERNEL); lb035q02_panel_spi_probe()
319 dev_set_drvdata(&spi->dev, ddata); lb035q02_panel_spi_probe()
321 ddata->spi = spi; lb035q02_panel_spi_probe()
323 if (dev_get_platdata(&spi->dev)) { lb035q02_panel_spi_probe()
324 r = lb035q02_probe_pdata(spi); lb035q02_panel_spi_probe()
327 } else if (spi->dev.of_node) { lb035q02_panel_spi_probe()
328 r = lb035q02_probe_of(spi); lb035q02_panel_spi_probe()
336 r = devm_gpio_request_one(&spi->dev, ddata->backlight_gpio, lb035q02_panel_spi_probe()
345 dssdev->dev = &spi->dev; lb035q02_panel_spi_probe()
354 dev_err(&spi->dev, "Failed to register panel\n"); lb035q02_panel_spi_probe()
366 static int lb035q02_panel_spi_remove(struct spi_device *spi) lb035q02_panel_spi_remove() argument
368 struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); lb035q02_panel_spi_remove()
401 MODULE_ALIAS("spi:lgphilips,lb035q02");
H A Dpanel-nec-nl8048hl11.c16 #include <linux/spi/spi.h>
35 struct spi_device *spi; member in struct:panel_drv_data
90 static int nec_8048_spi_send(struct spi_device *spi, unsigned char reg_addr, nec_8048_spi_send() argument
100 ret = spi_write(spi, (unsigned char *)&data, 4); nec_8048_spi_send()
107 static int init_nec_8048_wvga_lcd(struct spi_device *spi) init_nec_8048_wvga_lcd() argument
111 /* nec_8048_spi_send(spi, REG, VAL) */ init_nec_8048_wvga_lcd()
113 nec_8048_spi_send(spi, nec_8048_init_seq[i].addr, init_nec_8048_wvga_lcd()
116 nec_8048_spi_send(spi, nec_8048_init_seq[i].addr, init_nec_8048_wvga_lcd()
236 static int nec_8048_probe_pdata(struct spi_device *spi) nec_8048_probe_pdata() argument
239 struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); nec_8048_probe_pdata()
242 pdata = dev_get_platdata(&spi->dev); nec_8048_probe_pdata()
249 dev_err(&spi->dev, "failed to find video source '%s'\n", nec_8048_probe_pdata()
263 static int nec_8048_probe_of(struct spi_device *spi) nec_8048_probe_of() argument
265 struct device_node *node = spi->dev.of_node; nec_8048_probe_of()
266 struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); nec_8048_probe_of()
272 dev_err(&spi->dev, "failed to parse enable gpio\n"); nec_8048_probe_of()
282 dev_err(&spi->dev, "failed to find video source\n"); nec_8048_probe_of()
291 static int nec_8048_probe(struct spi_device *spi) nec_8048_probe() argument
297 dev_dbg(&spi->dev, "%s\n", __func__); nec_8048_probe()
299 spi->mode = SPI_MODE_0; nec_8048_probe()
300 spi->bits_per_word = 32; nec_8048_probe()
302 r = spi_setup(spi); nec_8048_probe()
304 dev_err(&spi->dev, "spi_setup failed: %d\n", r); nec_8048_probe()
308 init_nec_8048_wvga_lcd(spi); nec_8048_probe()
310 ddata = devm_kzalloc(&spi->dev, sizeof(*ddata), GFP_KERNEL); nec_8048_probe()
314 dev_set_drvdata(&spi->dev, ddata); nec_8048_probe()
316 ddata->spi = spi; nec_8048_probe()
318 if (dev_get_platdata(&spi->dev)) { nec_8048_probe()
319 r = nec_8048_probe_pdata(spi); nec_8048_probe()
322 } else if (spi->dev.of_node) { nec_8048_probe()
323 r = nec_8048_probe_of(spi); nec_8048_probe()
331 r = devm_gpio_request_one(&spi->dev, ddata->qvga_gpio, nec_8048_probe()
338 r = devm_gpio_request_one(&spi->dev, ddata->res_gpio, nec_8048_probe()
347 dssdev->dev = &spi->dev; nec_8048_probe()
355 dev_err(&spi->dev, "Failed to register panel\n"); nec_8048_probe()
367 static int nec_8048_remove(struct spi_device *spi) nec_8048_remove() argument
369 struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); nec_8048_remove()
373 dev_dbg(&ddata->spi->dev, "%s\n", __func__); nec_8048_remove()
388 struct spi_device *spi = to_spi_device(dev); nec_8048_suspend() local
390 nec_8048_spi_send(spi, 2, 0x01); nec_8048_suspend()
398 struct spi_device *spi = to_spi_device(dev); nec_8048_resume() local
401 spi_setup(spi); nec_8048_resume()
402 nec_8048_spi_send(spi, 2, 0x00); nec_8048_resume()
403 init_nec_8048_wvga_lcd(spi); nec_8048_resume()
434 MODULE_ALIAS("spi:nec,nl8048hl11");
H A Dpanel-tpo-td043mtea1.c15 #include <linux/spi/spi.h>
64 struct spi_device *spi; member in struct:panel_drv_data
99 static int tpo_td043_write(struct spi_device *spi, u8 addr, u8 data) tpo_td043_write() argument
116 r = spi_sync(spi, &m); tpo_td043_write()
118 dev_warn(&spi->dev, "failed to write to LCD reg (%d)\n", r); tpo_td043_write()
122 static void tpo_td043_write_gamma(struct spi_device *spi, u16 gamma[12]) tpo_td043_write_gamma() argument
129 tpo_td043_write(spi, 0x11, val); tpo_td043_write_gamma()
133 tpo_td043_write(spi, 0x12, val); tpo_td043_write_gamma()
137 tpo_td043_write(spi, 0x13, val); tpo_td043_write_gamma()
141 tpo_td043_write(spi, 0x14 + i, gamma[i] & 0xff); tpo_td043_write_gamma()
144 static int tpo_td043_write_mirror(struct spi_device *spi, bool h, bool v) tpo_td043_write_mirror() argument
153 return tpo_td043_write(spi, 4, reg4); tpo_td043_write_mirror()
161 return tpo_td043_write_mirror(ddata->spi, ddata->hmirror, tpo_td043_set_hmirror()
193 ret = tpo_td043_write_mirror(ddata->spi, ddata->hmirror, val); tpo_td043_vmirror_store()
224 tpo_td043_write(ddata->spi, 2, val); tpo_td043_mode_store()
267 tpo_td043_write_gamma(ddata->spi, ddata->gamma); tpo_td043_gamma_store()
307 tpo_td043_write(ddata->spi, 2, tpo_td043_power_on()
309 tpo_td043_write(ddata->spi, 3, TPO_R03_VAL_NORMAL); tpo_td043_power_on()
310 tpo_td043_write(ddata->spi, 0x20, 0xf0); tpo_td043_power_on()
311 tpo_td043_write(ddata->spi, 0x21, 0xf0); tpo_td043_power_on()
312 tpo_td043_write_mirror(ddata->spi, ddata->hmirror, tpo_td043_power_on()
314 tpo_td043_write_gamma(ddata->spi, ddata->gamma); tpo_td043_power_on()
325 tpo_td043_write(ddata->spi, 3, tpo_td043_power_off()
334 tpo_td043_write(ddata->spi, 3, TPO_R03_VAL_STANDBY); tpo_td043_power_off()
468 static int tpo_td043_probe_pdata(struct spi_device *spi) tpo_td043_probe_pdata() argument
471 struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); tpo_td043_probe_pdata()
474 pdata = dev_get_platdata(&spi->dev); tpo_td043_probe_pdata()
480 dev_err(&spi->dev, "failed to find video source '%s'\n", tpo_td043_probe_pdata()
494 static int tpo_td043_probe_of(struct spi_device *spi) tpo_td043_probe_of() argument
496 struct device_node *node = spi->dev.of_node; tpo_td043_probe_of()
497 struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); tpo_td043_probe_of()
503 dev_err(&spi->dev, "failed to parse enable gpio\n"); tpo_td043_probe_of()
510 dev_err(&spi->dev, "failed to find video source\n"); tpo_td043_probe_of()
519 static int tpo_td043_probe(struct spi_device *spi) tpo_td043_probe() argument
525 dev_dbg(&spi->dev, "%s\n", __func__); tpo_td043_probe()
527 spi->bits_per_word = 16; tpo_td043_probe()
528 spi->mode = SPI_MODE_0; tpo_td043_probe()
530 r = spi_setup(spi); tpo_td043_probe()
532 dev_err(&spi->dev, "spi_setup failed: %d\n", r); tpo_td043_probe()
536 ddata = devm_kzalloc(&spi->dev, sizeof(*ddata), GFP_KERNEL); tpo_td043_probe()
540 dev_set_drvdata(&spi->dev, ddata); tpo_td043_probe()
542 ddata->spi = spi; tpo_td043_probe()
544 if (dev_get_platdata(&spi->dev)) { tpo_td043_probe()
545 r = tpo_td043_probe_pdata(spi); tpo_td043_probe()
548 } else if (spi->dev.of_node) { tpo_td043_probe()
549 r = tpo_td043_probe_of(spi); tpo_td043_probe()
559 ddata->vcc_reg = devm_regulator_get(&spi->dev, "vcc"); tpo_td043_probe()
561 dev_err(&spi->dev, "failed to get LCD VCC regulator\n"); tpo_td043_probe()
567 r = devm_gpio_request_one(&spi->dev, tpo_td043_probe()
571 dev_err(&spi->dev, "couldn't request reset GPIO\n"); tpo_td043_probe()
576 r = sysfs_create_group(&spi->dev.kobj, &tpo_td043_attr_group); tpo_td043_probe()
578 dev_err(&spi->dev, "failed to create sysfs files\n"); tpo_td043_probe()
585 dssdev->dev = &spi->dev; tpo_td043_probe()
593 dev_err(&spi->dev, "Failed to register panel\n"); tpo_td043_probe()
600 sysfs_remove_group(&spi->dev.kobj, &tpo_td043_attr_group); tpo_td043_probe()
608 static int tpo_td043_remove(struct spi_device *spi) tpo_td043_remove() argument
610 struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); tpo_td043_remove()
614 dev_dbg(&ddata->spi->dev, "%s\n", __func__); tpo_td043_remove()
623 sysfs_remove_group(&spi->dev.kobj, &tpo_td043_attr_group); tpo_td043_remove()
683 MODULE_ALIAS("spi:tpo,td043mtea1");
H A Dpanel-tpo-td028ttec1.c29 #include <linux/spi/spi.h>
368 static int td028ttec1_panel_probe_pdata(struct spi_device *spi) td028ttec1_panel_probe_pdata() argument
371 struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); td028ttec1_panel_probe_pdata()
374 pdata = dev_get_platdata(&spi->dev); td028ttec1_panel_probe_pdata()
378 dev_err(&spi->dev, "failed to find video source '%s'\n", td028ttec1_panel_probe_pdata()
393 static int td028ttec1_probe_of(struct spi_device *spi) td028ttec1_probe_of() argument
395 struct device_node *node = spi->dev.of_node; td028ttec1_probe_of()
396 struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); td028ttec1_probe_of()
401 dev_err(&spi->dev, "failed to find video source\n"); td028ttec1_probe_of()
410 static int td028ttec1_panel_probe(struct spi_device *spi) td028ttec1_panel_probe() argument
416 dev_dbg(&spi->dev, "%s\n", __func__); td028ttec1_panel_probe()
418 spi->bits_per_word = 9; td028ttec1_panel_probe()
419 spi->mode = SPI_MODE_3; td028ttec1_panel_probe()
421 r = spi_setup(spi); td028ttec1_panel_probe()
423 dev_err(&spi->dev, "spi_setup failed: %d\n", r); td028ttec1_panel_probe()
427 ddata = devm_kzalloc(&spi->dev, sizeof(*ddata), GFP_KERNEL); td028ttec1_panel_probe()
431 dev_set_drvdata(&spi->dev, ddata); td028ttec1_panel_probe()
433 ddata->spi_dev = spi; td028ttec1_panel_probe()
435 if (dev_get_platdata(&spi->dev)) { td028ttec1_panel_probe()
436 r = td028ttec1_panel_probe_pdata(spi); td028ttec1_panel_probe()
439 } else if (spi->dev.of_node) { td028ttec1_panel_probe()
440 r = td028ttec1_probe_of(spi); td028ttec1_panel_probe()
450 dssdev->dev = &spi->dev; td028ttec1_panel_probe()
459 dev_err(&spi->dev, "Failed to register panel\n"); td028ttec1_panel_probe()
470 static int td028ttec1_panel_remove(struct spi_device *spi) td028ttec1_panel_remove() argument
472 struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); td028ttec1_panel_remove()
508 MODULE_ALIAS("spi:toppoly,td028ttec1");
H A Dpanel-sony-acx565akm.c27 #include <linux/spi/spi.h>
89 struct spi_device *spi; member in struct:panel_drv_data
123 BUG_ON(ddata->spi == NULL); acx565akm_transfer()
161 r = spi_sync(ddata->spi, &m); acx565akm_transfer()
163 dev_dbg(&ddata->spi->dev, "spi_sync %d\n", r); acx565akm_transfer()
232 dev_dbg(&ddata->spi->dev, panel_enabled()
241 dev_dbg(&ddata->spi->dev, "MIPI display ID: %02x%02x%02x\n", panel_detect()
267 dev_err(&ddata->spi->dev, "invalid display ID\n"); panel_detect()
273 dev_info(&ddata->spi->dev, "omapfb: %s rev %02x LCD detected\n", panel_detect()
353 dev_dbg(&ddata->spi->dev, "%s\n", __func__); acx565akm_bl_update_status()
549 dev_dbg(&ddata->spi->dev, "%s\n", __func__); acx565akm_panel_power_on()
569 dev_dbg(&ddata->spi->dev, "panel already enabled\n"); acx565akm_panel_power_on()
707 static int acx565akm_probe_pdata(struct spi_device *spi) acx565akm_probe_pdata() argument
710 struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); acx565akm_probe_pdata()
713 pdata = dev_get_platdata(&spi->dev); acx565akm_probe_pdata()
719 dev_err(&spi->dev, "failed to find video source '%s'\n", acx565akm_probe_pdata()
733 static int acx565akm_probe_of(struct spi_device *spi) acx565akm_probe_of() argument
735 struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); acx565akm_probe_of()
736 struct device_node *np = spi->dev.of_node; acx565akm_probe_of()
742 dev_err(&spi->dev, "failed to find video source\n"); acx565akm_probe_of()
749 static int acx565akm_probe(struct spi_device *spi) acx565akm_probe() argument
758 dev_dbg(&spi->dev, "%s\n", __func__); acx565akm_probe()
760 spi->mode = SPI_MODE_3; acx565akm_probe()
762 ddata = devm_kzalloc(&spi->dev, sizeof(*ddata), GFP_KERNEL); acx565akm_probe()
766 dev_set_drvdata(&spi->dev, ddata); acx565akm_probe()
768 ddata->spi = spi; acx565akm_probe()
772 if (dev_get_platdata(&spi->dev)) { acx565akm_probe()
773 r = acx565akm_probe_pdata(spi); acx565akm_probe()
776 } else if (spi->dev.of_node) { acx565akm_probe()
777 r = acx565akm_probe_of(spi); acx565akm_probe()
781 dev_err(&spi->dev, "platform data missing!\n"); acx565akm_probe()
786 r = devm_gpio_request_one(&spi->dev, ddata->reset_gpio, acx565akm_probe()
809 dev_err(&spi->dev, "%s panel detect error\n", __func__); acx565akm_probe()
818 bldev = backlight_device_register("acx565akm", &ddata->spi->dev, acx565akm_probe()
851 dssdev->dev = &spi->dev; acx565akm_probe()
859 dev_err(&spi->dev, "Failed to register panel\n"); acx565akm_probe()
876 static int acx565akm_remove(struct spi_device *spi) acx565akm_remove() argument
878 struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); acx565akm_remove()
882 dev_dbg(&ddata->spi->dev, "%s\n", __func__); acx565akm_remove()
/linux-4.4.14/drivers/misc/
H A Dlattice-ecp3-config.c15 #include <linux/spi/spi.h>
71 struct spi_device *spi = (struct spi_device *)context; firmware_load() local
72 struct fpga_data *data = spi_get_drvdata(spi); firmware_load()
83 dev_err(&spi->dev, "Cannot load firmware, aborting\n"); firmware_load()
88 dev_err(&spi->dev, "Error: Firmware size is 0!\n"); firmware_load()
99 ret = spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); firmware_load()
101 dev_dbg(&spi->dev, "FPGA JTAG ID=%08x\n", jedec_id); firmware_load()
108 dev_err(&spi->dev, firmware_load()
114 dev_info(&spi->dev, "FPGA %s detected\n", ecp3_dev[i].name); firmware_load()
117 ret = spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); firmware_load()
119 dev_dbg(&spi->dev, "FPGA Status=%08x\n", status); firmware_load()
123 dev_err(&spi->dev, "Error: Can't allocate memory!\n"); firmware_load()
137 ret = spi_write(spi, txbuf, 4); firmware_load()
140 ret = spi_write(spi, txbuf, 4); firmware_load()
143 ret = spi_write(spi, txbuf, 4); firmware_load()
150 ret = spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); firmware_load()
159 dev_err(&spi->dev, firmware_load()
166 dev_info(&spi->dev, "Configuring the FPGA...\n"); firmware_load()
167 ret = spi_write(spi, buffer, fw->size + 8); firmware_load()
170 ret = spi_write(spi, txbuf, 4); firmware_load()
173 ret = spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); firmware_load()
175 dev_dbg(&spi->dev, "FPGA Status=%08x\n", status); firmware_load()
179 dev_info(&spi->dev, "FPGA successfully configured!\n"); firmware_load()
181 dev_info(&spi->dev, "FPGA not configured (DONE not set)\n"); firmware_load()
193 static int lattice_ecp3_probe(struct spi_device *spi) lattice_ecp3_probe() argument
198 data = devm_kzalloc(&spi->dev, sizeof(*data), GFP_KERNEL); lattice_ecp3_probe()
200 dev_err(&spi->dev, "Memory allocation for fpga_data failed\n"); lattice_ecp3_probe()
203 spi_set_drvdata(spi, data); lattice_ecp3_probe()
207 FIRMWARE_NAME, &spi->dev, lattice_ecp3_probe()
208 GFP_KERNEL, spi, firmware_load); lattice_ecp3_probe()
210 dev_err(&spi->dev, "Firmware loading failed with %d!\n", err); lattice_ecp3_probe()
214 dev_info(&spi->dev, "FPGA bitstream configuration driver registered\n"); lattice_ecp3_probe()
219 static int lattice_ecp3_remove(struct spi_device *spi) lattice_ecp3_remove() argument
221 struct fpga_data *data = spi_get_drvdata(spi); lattice_ecp3_remove()
233 MODULE_DEVICE_TABLE(spi, lattice_ecp3_id);
H A Dti_dac7512.c23 #include <linux/spi/spi.h>
30 struct spi_device *spi = to_spi_device(dev); dac7512_store_val() local
41 spi_write(spi, tmp, sizeof(tmp)); dac7512_store_val()
56 static int dac7512_probe(struct spi_device *spi) dac7512_probe() argument
60 spi->bits_per_word = 8; dac7512_probe()
61 spi->mode = SPI_MODE_0; dac7512_probe()
62 ret = spi_setup(spi); dac7512_probe()
66 return sysfs_create_group(&spi->dev.kobj, &dac7512_attr_group); dac7512_probe()
69 static int dac7512_remove(struct spi_device *spi) dac7512_remove() argument
71 sysfs_remove_group(&spi->dev.kobj, &dac7512_attr_group); dac7512_remove()
79 MODULE_DEVICE_TABLE(spi, dac7512_id_table);
H A Dad525x_dpot-spi.c9 #include <linux/spi/spi.h>
82 static int ad_dpot_spi_probe(struct spi_device *spi) ad_dpot_spi_probe() argument
85 .client = spi, ad_dpot_spi_probe()
89 return ad_dpot_probe(&spi->dev, &bdata, ad_dpot_spi_probe()
90 spi_get_device_id(spi)->driver_data, ad_dpot_spi_probe()
91 spi_get_device_id(spi)->name); ad_dpot_spi_probe()
94 static int ad_dpot_spi_remove(struct spi_device *spi) ad_dpot_spi_remove() argument
96 return ad_dpot_remove(&spi->dev); ad_dpot_spi_remove()
130 MODULE_DEVICE_TABLE(spi, ad_dpot_spi_id);
146 MODULE_ALIAS("spi:ad_dpot");
/linux-4.4.14/drivers/staging/iio/adc/
H A Dad7606_spi.c10 #include <linux/spi/spi.h>
22 struct spi_device *spi = to_spi_device(dev); ad7606_spi_read_block() local
26 ret = spi_read(spi, buf, count * 2); ad7606_spi_read_block()
28 dev_err(&spi->dev, "SPI read error\n"); ad7606_spi_read_block()
42 static int ad7606_spi_probe(struct spi_device *spi) ad7606_spi_probe() argument
46 indio_dev = ad7606_probe(&spi->dev, spi->irq, NULL, ad7606_spi_probe()
47 spi_get_device_id(spi)->driver_data, ad7606_spi_probe()
53 spi_set_drvdata(spi, indio_dev); ad7606_spi_probe()
58 static int ad7606_spi_remove(struct spi_device *spi) ad7606_spi_remove() argument
60 struct iio_dev *indio_dev = dev_get_drvdata(&spi->dev); ad7606_spi_remove()
62 return ad7606_remove(indio_dev, spi->irq); ad7606_spi_remove()
101 MODULE_DEVICE_TABLE(spi, ad7606_id);
H A Dad7780.c14 #include <linux/spi/spi.h>
164 static int ad7780_probe(struct spi_device *spi) ad7780_probe() argument
166 struct ad7780_platform_data *pdata = spi->dev.platform_data; ad7780_probe()
171 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); ad7780_probe()
178 ad_sd_init(&st->sd, indio_dev, spi, &ad7780_sigma_delta_info); ad7780_probe()
180 st->reg = devm_regulator_get(&spi->dev, "vcc"); ad7780_probe()
190 &ad7780_chip_info_tbl[spi_get_device_id(spi)->driver_data]; ad7780_probe()
197 dev_warn(&spi->dev, "reference voltage unspecified\n"); ad7780_probe()
199 spi_set_drvdata(spi, indio_dev); ad7780_probe()
201 indio_dev->dev.parent = &spi->dev; ad7780_probe()
202 indio_dev->name = spi_get_device_id(spi)->name; ad7780_probe()
209 ret = devm_gpio_request_one(&spi->dev, ad7780_probe()
214 dev_err(&spi->dev, "failed to request GPIO PDRST\n"); ad7780_probe()
241 static int ad7780_remove(struct spi_device *spi) ad7780_remove() argument
243 struct iio_dev *indio_dev = spi_get_drvdata(spi); ad7780_remove()
262 MODULE_DEVICE_TABLE(spi, ad7780_id);
/linux-4.4.14/drivers/hwmon/
H A Dadt7310.c12 #include <linux/spi/spi.h>
44 struct spi_device *spi = to_spi_device(dev); adt7310_spi_read_word() local
46 return spi_w8r16be(spi, AD7310_COMMAND(reg) | ADT7310_CMD_READ); adt7310_spi_read_word()
51 struct spi_device *spi = to_spi_device(dev); adt7310_spi_write_word() local
57 return spi_write(spi, buf, sizeof(buf)); adt7310_spi_write_word()
62 struct spi_device *spi = to_spi_device(dev); adt7310_spi_read_byte() local
64 return spi_w8r8(spi, AD7310_COMMAND(reg) | ADT7310_CMD_READ); adt7310_spi_read_byte()
70 struct spi_device *spi = to_spi_device(dev); adt7310_spi_write_byte() local
76 return spi_write(spi, buf, sizeof(buf)); adt7310_spi_write_byte()
86 static int adt7310_spi_probe(struct spi_device *spi) adt7310_spi_probe() argument
88 return adt7x10_probe(&spi->dev, spi_get_device_id(spi)->name, spi->irq, adt7310_spi_probe()
92 static int adt7310_spi_remove(struct spi_device *spi) adt7310_spi_remove() argument
94 return adt7x10_remove(&spi->dev, spi->irq); adt7310_spi_remove()
102 MODULE_DEVICE_TABLE(spi, adt7310_id);
H A Dads7871.c65 #include <linux/spi/spi.h>
79 static int ads7871_read_reg8(struct spi_device *spi, int reg) ads7871_read_reg8() argument
83 ret = spi_w8r8(spi, reg); ads7871_read_reg8()
87 static int ads7871_read_reg16(struct spi_device *spi, int reg) ads7871_read_reg16() argument
91 ret = spi_w8r16(spi, reg); ads7871_read_reg16()
95 static int ads7871_write_reg8(struct spi_device *spi, int reg, u8 val) ads7871_write_reg8() argument
98 return spi_write(spi, tmp, sizeof(tmp)); ads7871_write_reg8()
104 struct spi_device *spi = to_spi_device(dev); show_voltage() local
116 ads7871_write_reg8(spi, REG_GAIN_MUX, show_voltage()
119 ret = ads7871_read_reg8(spi, REG_GAIN_MUX); show_voltage()
127 ret = ads7871_read_reg8(spi, REG_GAIN_MUX); show_voltage()
133 val = ads7871_read_reg16(spi, REG_LS_BYTE); show_voltage()
176 static int ads7871_probe(struct spi_device *spi) ads7871_probe() argument
182 dev_dbg(&spi->dev, "probe\n"); ads7871_probe()
185 spi->mode = (SPI_MODE_0); ads7871_probe()
186 spi->bits_per_word = 8; ads7871_probe()
187 spi_setup(spi); ads7871_probe()
189 ads7871_write_reg8(spi, REG_SER_CONTROL, 0); ads7871_probe()
190 ads7871_write_reg8(spi, REG_AD_CONTROL, 0); ads7871_probe()
193 ads7871_write_reg8(spi, REG_OSC_CONTROL, val); ads7871_probe()
194 ret = ads7871_read_reg8(spi, REG_OSC_CONTROL); ads7871_probe()
196 dev_dbg(&spi->dev, "REG_OSC_CONTROL write:%x, read:%x\n", val, ret); ads7871_probe()
204 pdata = devm_kzalloc(&spi->dev, sizeof(struct ads7871_data), ads7871_probe()
209 err = sysfs_create_group(&spi->dev.kobj, &ads7871_group); ads7871_probe()
213 spi_set_drvdata(spi, pdata); ads7871_probe()
215 pdata->hwmon_dev = hwmon_device_register(&spi->dev); ads7871_probe()
224 sysfs_remove_group(&spi->dev.kobj, &ads7871_group); ads7871_probe()
228 static int ads7871_remove(struct spi_device *spi) ads7871_remove() argument
230 struct ads7871_data *pdata = spi_get_drvdata(spi); ads7871_remove()
233 sysfs_remove_group(&spi->dev.kobj, &ads7871_group); ads7871_remove()
H A Dmax1111.c22 #include <linux/spi/spi.h>
40 struct spi_device *spi; member in struct:max1111_data
65 err = spi_sync(data->spi, &data->msg); max1111_read()
88 if (!the_max1111 || !the_max1111->spi) max1111_read_channel()
91 return max1111_read(&the_max1111->spi->dev, channel); max1111_read_channel()
185 static int max1111_probe(struct spi_device *spi) max1111_probe() argument
187 enum chips chip = spi_get_device_id(spi)->driver_data; max1111_probe()
191 spi->bits_per_word = 8; max1111_probe()
192 spi->mode = SPI_MODE_0; max1111_probe()
193 err = spi_setup(spi); max1111_probe()
197 data = devm_kzalloc(&spi->dev, sizeof(struct max1111_data), GFP_KERNEL); max1111_probe()
225 data->spi = spi; max1111_probe()
226 spi_set_drvdata(spi, data); max1111_probe()
228 err = sysfs_create_group(&spi->dev.kobj, &max1111_attr_group); max1111_probe()
230 dev_err(&spi->dev, "failed to create attribute group\n"); max1111_probe()
234 err = sysfs_create_group(&spi->dev.kobj, &max1110_attr_group); max1111_probe()
236 dev_err(&spi->dev, max1111_probe()
242 data->hwmon_dev = hwmon_device_register(&spi->dev); max1111_probe()
244 dev_err(&spi->dev, "failed to create hwmon device\n"); max1111_probe()
255 sysfs_remove_group(&spi->dev.kobj, &max1110_attr_group); max1111_probe()
256 sysfs_remove_group(&spi->dev.kobj, &max1111_attr_group); max1111_probe()
260 static int max1111_remove(struct spi_device *spi) max1111_remove() argument
262 struct max1111_data *data = spi_get_drvdata(spi); max1111_remove()
268 sysfs_remove_group(&spi->dev.kobj, &max1110_attr_group); max1111_remove()
269 sysfs_remove_group(&spi->dev.kobj, &max1111_attr_group); max1111_remove()
281 MODULE_DEVICE_TABLE(spi, max1111_ids);
H A Dlm70.c38 #include <linux/spi/spi.h>
51 struct spi_device *spi; member in struct:lm70
61 struct spi_device *spi = p_lm70->spi; lm70_sense_temp() local
73 status = spi_write_then_read(spi, NULL, 0, &rxbuf[0], 2); lm70_sense_temp()
157 static int lm70_probe(struct spi_device *spi) lm70_probe() argument
164 match = of_match_device(lm70_of_ids, &spi->dev); lm70_probe()
168 chip = spi_get_device_id(spi)->driver_data; lm70_probe()
171 if (spi->mode & (SPI_CPOL | SPI_CPHA)) lm70_probe()
176 p_lm70 = devm_kzalloc(&spi->dev, sizeof(*p_lm70), GFP_KERNEL); lm70_probe()
182 p_lm70->spi = spi; lm70_probe()
184 hwmon_dev = devm_hwmon_device_register_with_groups(&spi->dev, lm70_probe()
185 spi->modalias, lm70_probe()
197 MODULE_DEVICE_TABLE(spi, lm70_ids);
H A Dadcxx.c48 #include <linux/spi/spi.h>
63 struct spi_device *spi = to_spi_device(dev); adcxx_read() local
65 struct adcxx *adc = spi_get_drvdata(spi); adcxx_read()
75 status = spi_read(spi, rx_buf, sizeof(rx_buf)); adcxx_read()
78 status = spi_write_then_read(spi, tx_buf, sizeof(tx_buf), adcxx_read()
107 struct spi_device *spi = to_spi_device(dev); adcxx_show_max() local
108 struct adcxx *adc = spi_get_drvdata(spi); adcxx_show_max()
124 struct spi_device *spi = to_spi_device(dev); adcxx_set_max() local
125 struct adcxx *adc = spi_get_drvdata(spi); adcxx_set_max()
164 static int adcxx_probe(struct spi_device *spi) adcxx_probe() argument
166 int channels = spi_get_device_id(spi)->driver_data; adcxx_probe()
171 adc = devm_kzalloc(&spi->dev, sizeof(*adc), GFP_KERNEL); adcxx_probe()
182 spi_set_drvdata(spi, adc); adcxx_probe()
185 status = device_create_file(&spi->dev, &ad_input[i].dev_attr); adcxx_probe()
187 dev_err(&spi->dev, "device_create_file failed.\n"); adcxx_probe()
192 adc->hwmon_dev = hwmon_device_register(&spi->dev); adcxx_probe()
194 dev_err(&spi->dev, "hwmon_device_register failed.\n"); adcxx_probe()
204 device_remove_file(&spi->dev, &ad_input[i].dev_attr); adcxx_probe()
210 static int adcxx_remove(struct spi_device *spi) adcxx_remove() argument
212 struct adcxx *adc = spi_get_drvdata(spi); adcxx_remove()
218 device_remove_file(&spi->dev, &ad_input[i].dev_attr); adcxx_remove()
232 MODULE_DEVICE_TABLE(spi, adcxx_ids);
/linux-4.4.14/drivers/rtc/
H A Drtc-m41t94.c15 #include <linux/spi/spi.h>
34 struct spi_device *spi = to_spi_device(dev); m41t94_set_time() local
56 return spi_write(spi, buf, 8); m41t94_set_time()
61 struct spi_device *spi = to_spi_device(dev); m41t94_read_time() local
66 ret = spi_w8r8(spi, M41T94_REG_HT); m41t94_read_time()
72 spi_write(spi, buf, 2); m41t94_read_time()
76 ret = spi_w8r8(spi, M41T94_REG_SECONDS); m41t94_read_time()
82 spi_write(spi, buf, 2); m41t94_read_time()
85 tm->tm_sec = bcd2bin(spi_w8r8(spi, M41T94_REG_SECONDS)); m41t94_read_time()
86 tm->tm_min = bcd2bin(spi_w8r8(spi, M41T94_REG_MINUTES)); m41t94_read_time()
87 hour = spi_w8r8(spi, M41T94_REG_HOURS); m41t94_read_time()
89 tm->tm_wday = bcd2bin(spi_w8r8(spi, M41T94_REG_WDAY)) - 1; m41t94_read_time()
90 tm->tm_mday = bcd2bin(spi_w8r8(spi, M41T94_REG_DAY)); m41t94_read_time()
91 tm->tm_mon = bcd2bin(spi_w8r8(spi, M41T94_REG_MONTH)) - 1; m41t94_read_time()
92 tm->tm_year = bcd2bin(spi_w8r8(spi, M41T94_REG_YEAR)); m41t94_read_time()
113 static int m41t94_probe(struct spi_device *spi) m41t94_probe() argument
118 spi->bits_per_word = 8; m41t94_probe()
119 spi_setup(spi); m41t94_probe()
121 res = spi_w8r8(spi, M41T94_REG_SECONDS); m41t94_probe()
123 dev_err(&spi->dev, "not found.\n"); m41t94_probe()
127 rtc = devm_rtc_device_register(&spi->dev, m41t94_driver.driver.name, m41t94_probe()
132 spi_set_drvdata(spi, rtc); m41t94_probe()
149 MODULE_ALIAS("spi:rtc-m41t94");
H A Drtc-m41t93.c17 #include <linux/spi/spi.h>
37 static inline int m41t93_set_reg(struct spi_device *spi, u8 addr, u8 data) m41t93_set_reg() argument
45 return spi_write(spi, buf, sizeof(buf)); m41t93_set_reg()
50 struct spi_device *spi = to_spi_device(dev); m41t93_set_time() local
62 dev_warn(&spi->dev, "unsupported date (before 2000-01-01).\n"); m41t93_set_time()
66 tmp = spi_w8r8(spi, M41T93_REG_FLAGS); m41t93_set_time()
71 dev_warn(&spi->dev, "OF bit is set, resetting.\n"); m41t93_set_time()
72 m41t93_set_reg(spi, M41T93_REG_FLAGS, tmp & ~M41T93_FLAG_OF); m41t93_set_time()
74 tmp = spi_w8r8(spi, M41T93_REG_FLAGS); m41t93_set_time()
82 dev_warn(&spi->dev, m41t93_set_time()
84 m41t93_set_reg(spi, M41T93_REG_ST_SEC, reset_osc); m41t93_set_time()
86 m41t93_set_reg(spi, M41T93_REG_ST_SEC, reset_osc); m41t93_set_time()
100 return spi_write(spi, buf, sizeof(buf)); m41t93_set_time()
106 struct spi_device *spi = to_spi_device(dev); m41t93_get_time() local
119 tmp = spi_w8r8(spi, M41T93_REG_ALM_HOUR_HT); m41t93_get_time()
124 dev_dbg(&spi->dev, "HT bit is set, reenable clock update.\n"); m41t93_get_time()
125 m41t93_set_reg(spi, M41T93_REG_ALM_HOUR_HT, m41t93_get_time()
129 tmp = spi_w8r8(spi, M41T93_REG_FLAGS); m41t93_get_time()
135 dev_warn(&spi->dev, "OF bit is set, write time to restart.\n"); m41t93_get_time()
139 dev_warn(&spi->dev, "BL bit is set, replace battery.\n"); m41t93_get_time()
142 tmp = spi_write_then_read(spi, &start_addr, 1, buf, sizeof(buf)); m41t93_get_time()
173 static int m41t93_probe(struct spi_device *spi) m41t93_probe() argument
178 spi->bits_per_word = 8; m41t93_probe()
179 spi_setup(spi); m41t93_probe()
181 res = spi_w8r8(spi, M41T93_REG_WDAY); m41t93_probe()
183 dev_err(&spi->dev, "not found 0x%x.\n", res); m41t93_probe()
187 rtc = devm_rtc_device_register(&spi->dev, m41t93_driver.driver.name, m41t93_probe()
192 spi_set_drvdata(spi, rtc); m41t93_probe()
209 MODULE_ALIAS("spi:rtc-m41t93");
H A Drtc-ds1390.c20 #include <linux/spi/spi.h>
59 struct spi_device *spi = to_spi_device(dev); ds1390_set_reg() local
66 spi_write(spi, buf, 2); ds1390_set_reg()
72 struct spi_device *spi = to_spi_device(dev); ds1390_get_reg() local
82 status = spi_write_then_read(spi, chip->txrx_buf, 1, chip->txrx_buf, 1); ds1390_get_reg()
91 static void ds1390_trickle_of_init(struct spi_device *spi) ds1390_trickle_of_init() argument
96 if (of_property_read_u32(spi->dev.of_node, "trickle-resistor-ohms", ds1390_trickle_of_init()
102 if (of_property_read_bool(spi->dev.of_node, "trickle-diode-disable")) ds1390_trickle_of_init()
119 dev_warn(&spi->dev, ds1390_trickle_of_init()
124 ds1390_set_reg(&spi->dev, DS1390_REG_TRICKLE, value); ds1390_trickle_of_init()
132 struct spi_device *spi = to_spi_device(dev); ds1390_read_time() local
140 status = spi_write_then_read(spi, chip->txrx_buf, 1, chip->txrx_buf, 8); ds1390_read_time()
161 struct spi_device *spi = to_spi_device(dev); ds1390_set_time() local
176 return spi_write_then_read(spi, chip->txrx_buf, 8, NULL, 0); ds1390_set_time()
184 static int ds1390_probe(struct spi_device *spi) ds1390_probe() argument
190 spi->mode = SPI_MODE_3; ds1390_probe()
191 spi->bits_per_word = 8; ds1390_probe()
192 spi_setup(spi); ds1390_probe()
194 chip = devm_kzalloc(&spi->dev, sizeof(*chip), GFP_KERNEL); ds1390_probe()
198 spi_set_drvdata(spi, chip); ds1390_probe()
200 res = ds1390_get_reg(&spi->dev, DS1390_REG_SECONDS, &tmp); ds1390_probe()
202 dev_err(&spi->dev, "unable to read device\n"); ds1390_probe()
206 if (spi->dev.of_node) ds1390_probe()
207 ds1390_trickle_of_init(spi); ds1390_probe()
209 chip->rtc = devm_rtc_device_register(&spi->dev, "ds1390", ds1390_probe()
212 dev_err(&spi->dev, "unable to register device\n"); ds1390_probe()
231 MODULE_ALIAS("spi:rtc-ds1390");
H A Drtc-ds1347.c19 #include <linux/spi/spi.h>
38 struct spi_device *spi = to_spi_device(dev); ds1347_read_reg() local
42 return spi_write_then_read(spi, data, 1, data, 1); ds1347_read_reg()
48 struct spi_device *spi = to_spi_device(dev); ds1347_write_reg() local
54 return spi_write_then_read(spi, buf, 2, NULL, 0); ds1347_write_reg()
59 struct spi_device *spi = to_spi_device(dev); ds1347_read_time() local
65 err = spi_write_then_read(spi, buf, 1, buf, 8); ds1347_read_time()
82 struct spi_device *spi = to_spi_device(dev); ds1347_set_time() local
101 return spi_write_then_read(spi, buf, 9, NULL, 0); ds1347_set_time()
109 static int ds1347_probe(struct spi_device *spi) ds1347_probe() argument
115 /* spi setup with ds1347 in mode 3 and bits per word as 8 */ ds1347_probe()
116 spi->mode = SPI_MODE_3; ds1347_probe()
117 spi->bits_per_word = 8; ds1347_probe()
118 spi_setup(spi); ds1347_probe()
121 res = ds1347_read_reg(&spi->dev, DS1347_SECONDS_REG, &data); ds1347_probe()
126 ds1347_read_reg(&spi->dev, DS1347_CONTROL_REG, &data); ds1347_probe()
128 ds1347_write_reg(&spi->dev, DS1347_CONTROL_REG, data); ds1347_probe()
132 ds1347_read_reg(&spi->dev, DS1347_STATUS_REG, &data); ds1347_probe()
134 ds1347_write_reg(&spi->dev, DS1347_STATUS_REG, data); ds1347_probe()
137 ds1347_read_reg(&spi->dev, DS1347_CONTROL_REG, &data); ds1347_probe()
138 dev_info(&spi->dev, "DS1347 RTC CTRL Reg = 0x%02x\n", data); ds1347_probe()
140 ds1347_read_reg(&spi->dev, DS1347_STATUS_REG, &data); ds1347_probe()
141 dev_info(&spi->dev, "DS1347 RTC Status Reg = 0x%02x\n", data); ds1347_probe()
143 rtc = devm_rtc_device_register(&spi->dev, "ds1347", ds1347_probe()
149 spi_set_drvdata(spi, rtc); ds1347_probe()
H A Drtc-max6902.c10 * Driver for MAX6902 spi RTC
19 #include <linux/spi/spi.h>
35 struct spi_device *spi = to_spi_device(dev); max6902_set_reg() local
42 return spi_write_then_read(spi, buf, 2, NULL, 0); max6902_set_reg()
48 struct spi_device *spi = to_spi_device(dev); max6902_get_reg() local
53 return spi_write_then_read(spi, data, 1, data, 1); max6902_get_reg()
59 struct spi_device *spi = to_spi_device(dev); max6902_read_time() local
64 err = spi_write_then_read(spi, buf, 1, buf, 8); max6902_read_time()
123 static int max6902_probe(struct spi_device *spi) max6902_probe() argument
129 spi->mode = SPI_MODE_3; max6902_probe()
130 spi->bits_per_word = 8; max6902_probe()
131 spi_setup(spi); max6902_probe()
133 res = max6902_get_reg(&spi->dev, MAX6902_REG_SECONDS, &tmp); max6902_probe()
137 rtc = devm_rtc_device_register(&spi->dev, "max6902", max6902_probe()
142 spi_set_drvdata(spi, rtc); max6902_probe()
155 MODULE_DESCRIPTION("max6902 spi RTC driver");
158 MODULE_ALIAS("spi:rtc-max6902");
H A Drtc-ds3234.c19 #include <linux/spi/spi.h>
37 struct spi_device *spi = to_spi_device(dev); ds3234_set_reg() local
44 return spi_write_then_read(spi, buf, 2, NULL, 0); ds3234_set_reg()
50 struct spi_device *spi = to_spi_device(dev); ds3234_get_reg() local
54 return spi_write_then_read(spi, data, 1, data, 1); ds3234_get_reg()
61 struct spi_device *spi = to_spi_device(dev); ds3234_read_time() local
65 err = spi_write_then_read(spi, buf, 1, buf, 8); ds3234_read_time()
108 static int ds3234_probe(struct spi_device *spi) ds3234_probe() argument
114 spi->mode = SPI_MODE_3; ds3234_probe()
115 spi->bits_per_word = 8; ds3234_probe()
116 spi_setup(spi); ds3234_probe()
118 res = ds3234_get_reg(&spi->dev, DS3234_REG_SECONDS, &tmp); ds3234_probe()
136 ds3234_get_reg(&spi->dev, DS3234_REG_CONTROL, &tmp); ds3234_probe()
137 ds3234_set_reg(&spi->dev, DS3234_REG_CONTROL, tmp & 0x1c); ds3234_probe()
139 ds3234_get_reg(&spi->dev, DS3234_REG_CONT_STAT, &tmp); ds3234_probe()
140 ds3234_set_reg(&spi->dev, DS3234_REG_CONT_STAT, tmp & 0x88); ds3234_probe()
143 ds3234_get_reg(&spi->dev, DS3234_REG_CONTROL, &tmp); ds3234_probe()
144 dev_info(&spi->dev, "Control Reg: 0x%02x\n", tmp); ds3234_probe()
146 ds3234_get_reg(&spi->dev, DS3234_REG_CONT_STAT, &tmp); ds3234_probe()
147 dev_info(&spi->dev, "Ctrl/Stat Reg: 0x%02x\n", tmp); ds3234_probe()
149 rtc = devm_rtc_device_register(&spi->dev, "ds3234", ds3234_probe()
154 spi_set_drvdata(spi, rtc); ds3234_probe()
171 MODULE_ALIAS("spi:ds3234");
H A Drtc-pcf2123.c45 #include <linux/spi/spi.h>
90 struct spi_device *spi = to_spi_device(dev); pcf2123_show() local
103 ret = spi_write_then_read(spi, txbuf, 1, rxbuf, 1); pcf2123_show()
112 struct spi_device *spi = to_spi_device(dev); pcf2123_store() local
132 ret = spi_write(spi, txbuf, sizeof(txbuf)); pcf2123_store()
141 struct spi_device *spi = to_spi_device(dev); pcf2123_rtc_read_time() local
146 ret = spi_write_then_read(spi, txbuf, sizeof(txbuf), pcf2123_rtc_read_time()
173 struct spi_device *spi = to_spi_device(dev); pcf2123_rtc_set_time() local
186 ret = spi_write(spi, txbuf, 2); pcf2123_rtc_set_time()
201 ret = spi_write(spi, txbuf, sizeof(txbuf)); pcf2123_rtc_set_time()
209 ret = spi_write(spi, txbuf, 2); pcf2123_rtc_set_time()
222 static int pcf2123_probe(struct spi_device *spi) pcf2123_probe() argument
229 pdata = devm_kzalloc(&spi->dev, sizeof(struct pcf2123_plat_data), pcf2123_probe()
233 spi->dev.platform_data = pdata; pcf2123_probe()
238 dev_dbg(&spi->dev, "resetting RTC (0x%02X 0x%02X)\n", pcf2123_probe()
240 ret = spi_write(spi, txbuf, 2 * sizeof(u8)); pcf2123_probe()
248 dev_dbg(&spi->dev, "stopping RTC (0x%02X 0x%02X)\n", pcf2123_probe()
250 ret = spi_write(spi, txbuf, 2 * sizeof(u8)); pcf2123_probe()
257 dev_dbg(&spi->dev, "checking for presence of RTC (0x%02X)\n", pcf2123_probe()
259 ret = spi_write_then_read(spi, txbuf, 1 * sizeof(u8), pcf2123_probe()
261 dev_dbg(&spi->dev, "received data from RTC (0x%02X 0x%02X)\n", pcf2123_probe()
268 dev_err(&spi->dev, "chip not found\n"); pcf2123_probe()
273 dev_info(&spi->dev, "chip found, driver version " DRV_VERSION "\n"); pcf2123_probe()
274 dev_info(&spi->dev, "spiclk %u KHz.\n", pcf2123_probe()
275 (spi->max_speed_hz + 500) / 1000); pcf2123_probe()
280 ret = spi_write(spi, txbuf, sizeof(txbuf)); pcf2123_probe()
286 rtc = devm_rtc_device_register(&spi->dev, pcf2123_driver.driver.name, pcf2123_probe()
290 dev_err(&spi->dev, "failed to register.\n"); pcf2123_probe()
304 ret = device_create_file(&spi->dev, &pdata->regs[i].attr); pcf2123_probe()
306 dev_err(&spi->dev, "Unable to create sysfs %s\n", pcf2123_probe()
316 device_remove_file(&spi->dev, &pdata->regs[i].attr); pcf2123_probe()
319 spi->dev.platform_data = NULL; pcf2123_probe()
323 static int pcf2123_remove(struct spi_device *spi) pcf2123_remove() argument
325 struct pcf2123_plat_data *pdata = dev_get_platdata(&spi->dev); pcf2123_remove()
331 device_remove_file(&spi->dev, pcf2123_remove()
H A Drtc-r9701.c22 #include <linux/spi/spi.h>
45 struct spi_device *spi = to_spi_device(dev); write_reg() local
51 return spi_write(spi, buf, ARRAY_SIZE(buf)); write_reg()
56 struct spi_device *spi = to_spi_device(dev); read_regs() local
64 ret = spi_write_then_read(spi, txbuf, 1, rxbuf, 1); read_regs()
122 static int r9701_probe(struct spi_device *spi) r9701_probe() argument
130 res = read_regs(&spi->dev, &tmp, 1); r9701_probe()
132 dev_err(&spi->dev, "cannot read RTC register\n"); r9701_probe()
141 if (r9701_get_datetime(&spi->dev, &dt)) { r9701_probe()
142 dev_info(&spi->dev, "trying to repair invalid date/time\n"); r9701_probe()
150 if (r9701_set_datetime(&spi->dev, &dt) || r9701_probe()
151 r9701_get_datetime(&spi->dev, &dt)) { r9701_probe()
152 dev_err(&spi->dev, "cannot repair RTC register\n"); r9701_probe()
157 rtc = devm_rtc_device_register(&spi->dev, "r9701", r9701_probe()
162 spi_set_drvdata(spi, rtc); r9701_probe()
167 static int r9701_remove(struct spi_device *spi) r9701_remove() argument
182 MODULE_DESCRIPTION("r9701 spi RTC driver");
185 MODULE_ALIAS("spi:rtc-r9701");
H A Drtc-ds1305.c18 #include <linux/spi/spi.h>
19 #include <linux/spi/ds1305.h>
80 /* trickle bits are defined in <linux/spi/ds1305.h> */
89 struct spi_device *spi; member in struct:ds1305
161 err = spi_write_then_read(ds1305->spi, buf, sizeof(buf), NULL, 0); ds1305_alarm_irq_enable()
184 status = spi_write_then_read(ds1305->spi, &addr, sizeof(addr), ds1305_get_time()
240 return spi_write_then_read(ds1305->spi, buf, sizeof(buf), ds1305_set_time()
278 struct spi_device *spi = ds1305->spi; ds1305_get_alarm() local
289 status = spi_write_then_read(spi, &addr, sizeof(addr), ds1305_get_alarm()
299 status = spi_write_then_read(spi, &addr, sizeof(addr), ds1305_get_alarm()
337 struct spi_device *spi = ds1305->spi; ds1305_set_alarm() local
368 status = spi_write_then_read(ds1305->spi, buf, 2, NULL, 0); ds1305_set_alarm()
384 status = spi_write_then_read(spi, buf, sizeof(buf), NULL, 0); ds1305_set_alarm()
394 status = spi_write_then_read(ds1305->spi, buf, 2, NULL, 0); ds1305_set_alarm()
459 struct spi_device *spi = ds1305->spi; ds1305_work() local
477 status = spi_write_then_read(spi, buf, sizeof(buf), ds1305_work()
480 dev_dbg(&spi->dev, "clear irq --> %d\n", status); ds1305_work()
485 enable_irq(spi->irq); ds1305_work()
533 struct spi_device *spi; ds1305_nvram_read() local
539 spi = container_of(kobj, struct spi_device, dev.kobj); ds1305_nvram_read()
544 status = spi_sync(spi, &m); ds1305_nvram_read()
546 dev_err(&spi->dev, "nvram %s error %d\n", "read", status); ds1305_nvram_read()
555 struct spi_device *spi; ds1305_nvram_write() local
561 spi = container_of(kobj, struct spi_device, dev.kobj); ds1305_nvram_write()
566 status = spi_sync(spi, &m); ds1305_nvram_write()
568 dev_err(&spi->dev, "nvram %s error %d\n", "write", status); ds1305_nvram_write()
586 static int ds1305_probe(struct spi_device *spi) ds1305_probe() argument
591 struct ds1305_platform_data *pdata = dev_get_platdata(&spi->dev); ds1305_probe()
598 if ((spi->bits_per_word && spi->bits_per_word != 8) ds1305_probe()
599 || (spi->max_speed_hz > 2000000) ds1305_probe()
600 || !(spi->mode & SPI_CPHA)) ds1305_probe()
604 ds1305 = devm_kzalloc(&spi->dev, sizeof(*ds1305), GFP_KERNEL); ds1305_probe()
607 ds1305->spi = spi; ds1305_probe()
608 spi_set_drvdata(spi, ds1305); ds1305_probe()
612 status = spi_write_then_read(spi, &addr, sizeof(addr), ds1305_probe()
615 dev_dbg(&spi->dev, "can't %s, %d\n", ds1305_probe()
620 dev_dbg(&spi->dev, "ctrl %s: %3ph\n", "read", ds1305->ctrl); ds1305_probe()
628 dev_dbg(&spi->dev, "RTC chip is not present\n"); ds1305_probe()
632 dev_dbg(&spi->dev, "chip may not be present\n"); ds1305_probe()
644 status = spi_write_then_read(spi, buf, sizeof(buf), NULL, 0); ds1305_probe()
646 dev_dbg(&spi->dev, "clear WP --> %d\n", status); ds1305_probe()
657 dev_warn(&spi->dev, "SET TIME!\n"); ds1305_probe()
698 status = spi_write_then_read(spi, buf, sizeof(buf), NULL, 0); ds1305_probe()
700 dev_dbg(&spi->dev, "can't %s, %d\n", ds1305_probe()
705 dev_dbg(&spi->dev, "ctrl %s: %3ph\n", "write", ds1305->ctrl); ds1305_probe()
710 status = spi_write_then_read(spi, &addr, sizeof(addr), ds1305_probe()
713 dev_dbg(&spi->dev, "read HOUR --> %d\n", status); ds1305_probe()
719 dev_dbg(&spi->dev, "AM/PM\n"); ds1305_probe()
722 ds1305->rtc = devm_rtc_device_register(&spi->dev, "ds1305", ds1305_probe()
726 dev_dbg(&spi->dev, "register rtc --> %d\n", status); ds1305_probe()
736 if (spi->irq) { ds1305_probe()
738 status = devm_request_irq(&spi->dev, spi->irq, ds1305_irq, ds1305_probe()
741 dev_err(&spi->dev, "request_irq %d --> %d\n", ds1305_probe()
742 spi->irq, status); ds1305_probe()
744 device_set_wakeup_capable(&spi->dev, 1); ds1305_probe()
749 status = sysfs_create_bin_file(&spi->dev.kobj, &nvram); ds1305_probe()
751 dev_err(&spi->dev, "register nvram --> %d\n", status); ds1305_probe()
757 static int ds1305_remove(struct spi_device *spi) ds1305_remove() argument
759 struct ds1305 *ds1305 = spi_get_drvdata(spi); ds1305_remove()
761 sysfs_remove_bin_file(&spi->dev.kobj, &nvram); ds1305_remove()
764 if (spi->irq) { ds1305_remove()
766 devm_free_irq(&spi->dev, spi->irq, ds1305); ds1305_remove()
784 MODULE_ALIAS("spi:rtc-ds1305");
H A Drtc-mcp795.c21 #include <linux/spi/spi.h>
44 struct spi_device *spi = to_spi_device(dev); mcp795_rtcc_read() local
50 ret = spi_write_then_read(spi, tx, sizeof(tx), buf, count); mcp795_rtcc_read()
61 struct spi_device *spi = to_spi_device(dev); mcp795_rtcc_write() local
69 ret = spi_write(spi, tx, 2 + count); mcp795_rtcc_write()
158 static int mcp795_probe(struct spi_device *spi) mcp795_probe() argument
163 spi->mode = SPI_MODE_0; mcp795_probe()
164 spi->bits_per_word = 8; mcp795_probe()
165 ret = spi_setup(spi); mcp795_probe()
167 dev_err(&spi->dev, "Unable to setup SPI\n"); mcp795_probe()
172 mcp795_rtcc_set_bits(&spi->dev, 0x01, MCP795_ST_BIT, MCP795_ST_BIT); mcp795_probe()
174 mcp795_rtcc_set_bits(&spi->dev, 0x03, MCP795_24_BIT, 0); mcp795_probe()
176 rtc = devm_rtc_device_register(&spi->dev, "rtc-mcp795", mcp795_probe()
181 spi_set_drvdata(spi, rtc); mcp795_probe()
198 MODULE_ALIAS("spi:mcp795");
H A Drtc-rs5c348.c25 #include <linux/spi/spi.h>
66 struct spi_device *spi = to_spi_device(dev); rs5c348_rtc_set_time() local
67 struct rs5c348_plat_data *pdata = dev_get_platdata(&spi->dev); rs5c348_rtc_set_time()
94 ret = spi_write_then_read(spi, txbuf, sizeof(txbuf), NULL, 0); rs5c348_rtc_set_time()
102 struct spi_device *spi = to_spi_device(dev); rs5c348_rtc_read_time() local
103 struct rs5c348_plat_data *pdata = dev_get_platdata(&spi->dev); rs5c348_rtc_read_time()
115 ret = spi_write_then_read(spi, txbuf, sizeof(txbuf), rs5c348_rtc_read_time()
141 dev_err(&spi->dev, "retrieved date/time is not valid.\n"); rs5c348_rtc_read_time()
155 static int rs5c348_probe(struct spi_device *spi) rs5c348_probe() argument
161 pdata = devm_kzalloc(&spi->dev, sizeof(struct rs5c348_plat_data), rs5c348_probe()
165 spi->dev.platform_data = pdata; rs5c348_probe()
168 ret = spi_w8r8(spi, RS5C348_CMD_R(RS5C348_REG_SECS)); rs5c348_probe()
170 dev_err(&spi->dev, "not found.\n"); rs5c348_probe()
174 dev_info(&spi->dev, "chip found, driver version " DRV_VERSION "\n"); rs5c348_probe()
175 dev_info(&spi->dev, "spiclk %u KHz.\n", rs5c348_probe()
176 (spi->max_speed_hz + 500) / 1000); rs5c348_probe()
179 ret = spi_w8r8(spi, RS5C348_CMD_R(RS5C348_REG_CTL2)); rs5c348_probe()
186 dev_warn(&spi->dev, "voltage-low detected.\n"); rs5c348_probe()
188 dev_warn(&spi->dev, "oscillator-stop detected.\n"); rs5c348_probe()
190 ret = rs5c348_rtc_set_time(&spi->dev, &tm); rs5c348_probe()
195 ret = spi_write_then_read(spi, buf, sizeof(buf), NULL, 0); rs5c348_probe()
200 ret = spi_w8r8(spi, RS5C348_CMD_R(RS5C348_REG_CTL1)); rs5c348_probe()
206 rtc = devm_rtc_device_register(&spi->dev, rs5c348_driver.driver.name, rs5c348_probe()
234 MODULE_ALIAS("spi:rtc-rs5c348");
H A Drtc-ds1343.c19 #include <linux/spi/spi.h>
80 MODULE_DEVICE_TABLE(spi, ds1343_id);
83 struct spi_device *spi; member in struct:ds1343_priv
170 dev_err(&priv->spi->dev, "Error in nvram write %d", ret); ds1343_nvram_write()
189 dev_err(&priv->spi->dev, "Error in nvram read %d\n", ret); ds1343_nvram_read()
606 static int ds1343_probe(struct spi_device *spi) ds1343_probe() argument
618 priv = devm_kzalloc(&spi->dev, sizeof(struct ds1343_priv), GFP_KERNEL); ds1343_probe()
622 priv->spi = spi; ds1343_probe()
625 /* RTC DS1347 works in spi mode 3 and ds1343_probe()
628 spi->mode = SPI_MODE_3 | SPI_CS_HIGH; ds1343_probe()
629 spi->bits_per_word = 8; ds1343_probe()
630 res = spi_setup(spi); ds1343_probe()
634 spi_set_drvdata(spi, priv); ds1343_probe()
636 priv->map = devm_regmap_init_spi(spi, &config); ds1343_probe()
639 dev_err(&spi->dev, "spi regmap init failed for rtc ds1343\n"); ds1343_probe()
656 priv->rtc = devm_rtc_device_register(&spi->dev, "ds1343", ds1343_probe()
659 dev_err(&spi->dev, "unable to register rtc ds1343\n"); ds1343_probe()
663 priv->irq = spi->irq; ds1343_probe()
666 res = devm_request_threaded_irq(&spi->dev, spi->irq, NULL, ds1343_probe()
671 dev_err(&spi->dev, ds1343_probe()
674 device_init_wakeup(&spi->dev, true); ds1343_probe()
675 dev_pm_set_wake_irq(&spi->dev, spi->irq); ds1343_probe()
679 res = ds1343_sysfs_register(&spi->dev); ds1343_probe()
681 dev_err(&spi->dev, ds1343_probe()
687 static int ds1343_remove(struct spi_device *spi) ds1343_remove() argument
689 struct ds1343_priv *priv = spi_get_drvdata(spi); ds1343_remove()
691 if (spi->irq) { ds1343_remove()
696 dev_pm_clear_wake_irq(&spi->dev); ds1343_remove()
697 device_init_wakeup(&spi->dev, false); ds1343_remove()
698 devm_free_irq(&spi->dev, spi->irq, priv); ds1343_remove()
701 spi_set_drvdata(spi, NULL); ds1343_remove()
703 ds1343_sysfs_unregister(&spi->dev); ds1343_remove()
712 struct spi_device *spi = to_spi_device(dev); ds1343_suspend() local
714 if (spi->irq >= 0 && device_may_wakeup(dev)) ds1343_suspend()
715 enable_irq_wake(spi->irq); ds1343_suspend()
722 struct spi_device *spi = to_spi_device(dev); ds1343_resume() local
724 if (spi->irq >= 0 && device_may_wakeup(dev)) ds1343_resume()
725 disable_irq_wake(spi->irq); ds1343_resume()
H A Drtc-rx4581.c15 * Driver for MAX6902 spi RTC
39 #include <linux/spi/spi.h>
77 struct spi_device *spi = to_spi_device(dev); rx4581_set_reg() local
84 return spi_write_then_read(spi, buf, 2, NULL, 0); rx4581_set_reg()
90 struct spi_device *spi = to_spi_device(dev); rx4581_get_reg() local
95 return spi_write_then_read(spi, data, 1, data, 1); rx4581_get_reg()
104 struct spi_device *spi = to_spi_device(dev); rx4581_get_datetime() local
134 err = spi_write_then_read(spi, date, 1, date, 7); rx4581_get_datetime()
184 struct spi_device *spi = to_spi_device(dev); rx4581_set_datetime() local
224 err = spi_write_then_read(spi, buf, 8, NULL, 0); rx4581_set_datetime()
266 static int rx4581_probe(struct spi_device *spi) rx4581_probe() argument
272 res = rx4581_get_reg(&spi->dev, RX4581_REG_SC, &tmp); rx4581_probe()
276 rtc = devm_rtc_device_register(&spi->dev, "rx4581", rx4581_probe()
281 spi_set_drvdata(spi, rtc); rx4581_probe()
289 MODULE_DEVICE_TABLE(spi, rx4581_id);
301 MODULE_DESCRIPTION("rx4581 spi RTC driver");
304 MODULE_ALIAS("spi:rtc-rx4581");
/linux-4.4.14/drivers/mfd/
H A Dstmpe-spi.c2 * ST Microelectronics MFD: stmpe's spi client specific driver
10 #include <linux/spi/spi.h>
22 struct spi_device *spi = stmpe->client; spi_reg_read() local
23 int status = spi_w8r16(spi, reg | READ_CMD); spi_reg_read()
30 struct spi_device *spi = stmpe->client; spi_reg_write() local
33 return spi_write(spi, (const u8 *)&cmd, 2); spi_reg_write()
66 struct spi_device *spi = stmpe->client; spi_init() local
68 spi->bits_per_word = 8; spi_init()
72 spi_reg_write(stmpe, STMPE811_REG_SPI_CFG, spi->mode); spi_init()
74 if (spi_setup(spi) < 0) spi_init()
75 dev_dbg(&spi->dev, "spi_setup failed\n"); spi_init()
87 stmpe_spi_probe(struct spi_device *spi) stmpe_spi_probe() argument
89 const struct spi_device_id *id = spi_get_device_id(spi); stmpe_spi_probe()
92 if (spi->max_speed_hz > 1000000) { stmpe_spi_probe()
93 dev_dbg(&spi->dev, "f(sample) %d KHz?\n", stmpe_spi_probe()
94 (spi->max_speed_hz/1000)); stmpe_spi_probe()
98 spi_ci.irq = spi->irq; stmpe_spi_probe()
99 spi_ci.client = spi; stmpe_spi_probe()
100 spi_ci.dev = &spi->dev; stmpe_spi_probe()
105 static int stmpe_spi_remove(struct spi_device *spi) stmpe_spi_remove() argument
107 struct stmpe *stmpe = spi_get_drvdata(spi); stmpe_spi_remove()
132 MODULE_DEVICE_TABLE(spi, stmpe_id);
136 .name = "stmpe-spi",
H A Darizona-spi.c2 * arizona-spi.c -- Arizona SPI bus interface
19 #include <linux/spi/spi.h>
26 static int arizona_spi_probe(struct spi_device *spi) arizona_spi_probe() argument
28 const struct spi_device_id *id = spi_get_device_id(spi); arizona_spi_probe()
34 if (spi->dev.of_node) arizona_spi_probe()
35 type = arizona_of_get_type(&spi->dev); arizona_spi_probe()
50 dev_err(&spi->dev, "Unknown device type %ld\n", type); arizona_spi_probe()
55 dev_err(&spi->dev, arizona_spi_probe()
60 arizona = devm_kzalloc(&spi->dev, sizeof(*arizona), GFP_KERNEL); arizona_spi_probe()
64 arizona->regmap = devm_regmap_init_spi(spi, regmap_config); arizona_spi_probe()
67 dev_err(&spi->dev, "Failed to allocate register map: %d\n", arizona_spi_probe()
73 arizona->dev = &spi->dev; arizona_spi_probe()
74 arizona->irq = spi->irq; arizona_spi_probe()
79 static int arizona_spi_remove(struct spi_device *spi) arizona_spi_remove() argument
81 struct arizona *arizona = spi_get_drvdata(spi); arizona_spi_remove()
94 MODULE_DEVICE_TABLE(spi, arizona_spi_ids);
H A Dda9052-spi.c19 #include <linux/spi/spi.h>
24 static int da9052_spi_probe(struct spi_device *spi) da9052_spi_probe() argument
28 const struct spi_device_id *id = spi_get_device_id(spi); da9052_spi_probe()
31 da9052 = devm_kzalloc(&spi->dev, sizeof(struct da9052), GFP_KERNEL); da9052_spi_probe()
35 spi->mode = SPI_MODE_0; da9052_spi_probe()
36 spi->bits_per_word = 8; da9052_spi_probe()
37 spi_setup(spi); da9052_spi_probe()
39 da9052->dev = &spi->dev; da9052_spi_probe()
40 da9052->chip_irq = spi->irq; da9052_spi_probe()
42 spi_set_drvdata(spi, da9052); da9052_spi_probe()
51 da9052->regmap = devm_regmap_init_spi(spi, &config); da9052_spi_probe()
54 dev_err(&spi->dev, "Failed to allocate register map: %d\n", da9052_spi_probe()
62 static int da9052_spi_remove(struct spi_device *spi) da9052_spi_remove() argument
64 struct da9052 *da9052 = spi_get_drvdata(spi); da9052_spi_remove()
H A Dwm831x-spi.c2 * wm831x-spi.c -- SPI access for Wolfson WM831x PMICs
18 #include <linux/spi/spi.h>
24 static int wm831x_spi_probe(struct spi_device *spi) wm831x_spi_probe() argument
26 const struct spi_device_id *id = spi_get_device_id(spi); wm831x_spi_probe()
33 wm831x = devm_kzalloc(&spi->dev, sizeof(struct wm831x), GFP_KERNEL); wm831x_spi_probe()
37 spi->mode = SPI_MODE_0; wm831x_spi_probe()
39 spi_set_drvdata(spi, wm831x); wm831x_spi_probe()
40 wm831x->dev = &spi->dev; wm831x_spi_probe()
42 wm831x->regmap = devm_regmap_init_spi(spi, &wm831x_regmap_config); wm831x_spi_probe()
50 return wm831x_device_init(wm831x, type, spi->irq); wm831x_spi_probe()
53 static int wm831x_spi_remove(struct spi_device *spi) wm831x_spi_remove() argument
55 struct wm831x *wm831x = spi_get_drvdata(spi); wm831x_spi_remove()
94 MODULE_DEVICE_TABLE(spi, wm831x_spi_ids);
H A Dmc13xxx-spi.c23 #include <linux/spi/spi.h>
41 MODULE_DEVICE_TABLE(spi, mc13xxx_device_id);
70 struct spi_device *spi = to_spi_device(dev); mc13xxx_spi_read() local
85 ret = spi_sync(spi, &m); mc13xxx_spi_read()
95 struct spi_device *spi = to_spi_device(dev); mc13xxx_spi_write() local
101 /* include errata fix for spi audio problems */ mc13xxx_spi_write()
103 spi_write(spi, data, count); mc13xxx_spi_write()
105 return spi_write(spi, data, count); mc13xxx_spi_write()
109 * We cannot use regmap-spi generic bus implementation here.
128 static int mc13xxx_spi_probe(struct spi_device *spi) mc13xxx_spi_probe() argument
133 mc13xxx = devm_kzalloc(&spi->dev, sizeof(*mc13xxx), GFP_KERNEL); mc13xxx_spi_probe()
137 dev_set_drvdata(&spi->dev, mc13xxx); mc13xxx_spi_probe()
139 spi->mode = SPI_MODE_0 | SPI_CS_HIGH; mc13xxx_spi_probe()
141 mc13xxx->irq = spi->irq; mc13xxx_spi_probe()
143 spi->max_speed_hz = spi->max_speed_hz ? : 26000000; mc13xxx_spi_probe()
144 ret = spi_setup(spi); mc13xxx_spi_probe()
148 mc13xxx->regmap = devm_regmap_init(&spi->dev, &regmap_mc13xxx_bus, mc13xxx_spi_probe()
149 &spi->dev, mc13xxx_spi_probe()
153 dev_err(&spi->dev, "Failed to initialize regmap: %d\n", ret); mc13xxx_spi_probe()
157 if (spi->dev.of_node) { mc13xxx_spi_probe()
159 of_match_device(mc13xxx_dt_ids, &spi->dev); mc13xxx_spi_probe()
163 const struct spi_device_id *id_entry = spi_get_device_id(spi); mc13xxx_spi_probe()
168 return mc13xxx_common_init(&spi->dev); mc13xxx_spi_probe()
171 static int mc13xxx_spi_remove(struct spi_device *spi) mc13xxx_spi_remove() argument
173 return mc13xxx_common_exit(&spi->dev); mc13xxx_spi_remove()
H A Dtps65912-spi.c2 * tps65912-spi.c -- SPI access for TI TPS65912x PMIC
21 #include <linux/spi/spi.h>
28 struct spi_device *spi = tps65912->control_data; tps65912_spi_write() local
47 ret = spi_sync(spi, &msg); tps65912_spi_write()
54 struct spi_device *spi = tps65912->control_data; tps65912_spi_read() local
74 if (spi == NULL) tps65912_spi_read()
77 ret = spi_sync(spi, &msg); tps65912_spi_read()
83 static int tps65912_spi_probe(struct spi_device *spi) tps65912_spi_probe() argument
87 tps65912 = devm_kzalloc(&spi->dev, tps65912_spi_probe()
92 tps65912->dev = &spi->dev; tps65912_spi_probe()
93 tps65912->control_data = spi; tps65912_spi_probe()
97 spi_set_drvdata(spi, tps65912); tps65912_spi_probe()
102 static int tps65912_spi_remove(struct spi_device *spi) tps65912_spi_remove() argument
104 struct tps65912 *tps65912 = spi_get_drvdata(spi); tps65912_spi_remove()
H A Dezx-pcap.c19 #include <linux/spi/spi.h>
38 struct spi_device *spi; member in struct:pcap_chip
73 status = spi_sync(pcap->spi, &m); ezx_pcap_putget()
180 struct pcap_platform_data *pdata = dev_get_platdata(&pcap->spi->dev); pcap_isr_work()
383 pdev->dev.parent = &pcap->spi->dev; pcap_add_subdev()
393 static int ezx_pcap_remove(struct spi_device *spi) ezx_pcap_remove() argument
395 struct pcap_chip *pcap = spi_get_drvdata(spi); ezx_pcap_remove()
399 device_for_each_child(&spi->dev, NULL, pcap_remove_subdev); ezx_pcap_remove()
416 static int ezx_pcap_probe(struct spi_device *spi) ezx_pcap_probe() argument
418 struct pcap_platform_data *pdata = dev_get_platdata(&spi->dev); ezx_pcap_probe()
427 pcap = devm_kzalloc(&spi->dev, sizeof(*pcap), GFP_KERNEL); ezx_pcap_probe()
437 spi_set_drvdata(spi, pcap); ezx_pcap_probe()
439 /* setup spi */ ezx_pcap_probe()
440 spi->bits_per_word = 32; ezx_pcap_probe()
441 spi->mode = SPI_MODE_0 | (pdata->config & PCAP_CS_AH ? SPI_CS_HIGH : 0); ezx_pcap_probe()
442 ret = spi_setup(spi); ezx_pcap_probe()
446 pcap->spi = spi; ezx_pcap_probe()
453 dev_err(&spi->dev, "can't create pcap thread\n"); ezx_pcap_probe()
474 irq_set_irq_type(spi->irq, IRQ_TYPE_EDGE_RISING); ezx_pcap_probe()
475 irq_set_chained_handler_and_data(spi->irq, pcap_irq_handler, pcap); ezx_pcap_probe()
476 irq_set_irq_wake(spi->irq, 1); ezx_pcap_probe()
482 ret = devm_request_irq(&spi->dev, adc_irq, pcap_adc_irq, 0, "ADC", ezx_pcap_probe()
501 device_for_each_child(&spi->dev, NULL, pcap_remove_subdev); ezx_pcap_probe()
535 MODULE_ALIAS("spi:ezx-pcap");
/linux-4.4.14/drivers/misc/lis3lv02d/
H A Dlis3lv02d_spi.c17 #include <linux/spi/spi.h>
30 struct spi_device *spi = lis3->bus_priv; lis3_spi_read() local
31 int ret = spi_w8r8(spi, reg | LIS3_SPI_READ); lis3_spi_read()
42 struct spi_device *spi = lis3->bus_priv; lis3_spi_write() local
43 return spi_write(spi, tmp, sizeof(tmp)); lis3_spi_write()
65 { .compatible = "st,lis302dl-spi" },
71 static int lis302dl_spi_probe(struct spi_device *spi) lis302dl_spi_probe() argument
75 spi->bits_per_word = 8; lis302dl_spi_probe()
76 spi->mode = SPI_MODE_0; lis302dl_spi_probe()
77 ret = spi_setup(spi); lis302dl_spi_probe()
81 lis3_dev.bus_priv = spi; lis302dl_spi_probe()
85 lis3_dev.irq = spi->irq; lis302dl_spi_probe()
87 lis3_dev.pdata = spi->dev.platform_data; lis302dl_spi_probe()
90 if (of_match_device(lis302dl_spi_dt_ids, &spi->dev)) { lis302dl_spi_probe()
91 lis3_dev.of_node = spi->dev.of_node; lis302dl_spi_probe()
97 spi_set_drvdata(spi, &lis3_dev); lis302dl_spi_probe()
102 static int lis302dl_spi_remove(struct spi_device *spi) lis302dl_spi_remove() argument
104 struct lis3lv02d *lis3 = spi_get_drvdata(spi); lis302dl_spi_remove()
114 struct spi_device *spi = to_spi_device(dev); lis3lv02d_spi_suspend() local
115 struct lis3lv02d *lis3 = spi_get_drvdata(spi); lis3lv02d_spi_suspend()
125 struct spi_device *spi = to_spi_device(dev); lis3lv02d_spi_resume() local
126 struct lis3lv02d *lis3 = spi_get_drvdata(spi); lis3lv02d_spi_resume()
153 MODULE_ALIAS("spi:" DRV_NAME);
/linux-4.4.14/drivers/gpio/
H A Dgpio-max7301.c18 #include <linux/spi/spi.h>
19 #include <linux/spi/max7301.h>
25 struct spi_device *spi = to_spi_device(dev); max7301_spi_write() local
28 return spi_write(spi, (const u8 *)&word, sizeof(word)); max7301_spi_write()
37 struct spi_device *spi = to_spi_device(dev); max7301_spi_read() local
40 ret = spi_write(spi, (const u8 *)&word, sizeof(word)); max7301_spi_read()
47 ret = spi_read(spi, (u8 *)&word, sizeof(word)); max7301_spi_read()
53 static int max7301_probe(struct spi_device *spi) max7301_probe() argument
59 spi->bits_per_word = 16; max7301_probe()
60 ret = spi_setup(spi); max7301_probe()
64 ts = devm_kzalloc(&spi->dev, sizeof(struct max7301), GFP_KERNEL); max7301_probe()
70 ts->dev = &spi->dev; max7301_probe()
76 static int max7301_remove(struct spi_device *spi) max7301_remove() argument
78 return __max730x_remove(&spi->dev); max7301_remove()
85 MODULE_DEVICE_TABLE(spi, max7301_id);
100 /* register after spi postcore initcall and before
H A Dgpio-mc33880.c25 #include <linux/spi/spi.h>
26 #include <linux/spi/mc33880.h>
52 struct spi_device *spi; member in struct:mc33880
57 return spi_write(mc->spi, &mc->port_config, sizeof(mc->port_config)); mc33880_write_config()
83 static int mc33880_probe(struct spi_device *spi) mc33880_probe() argument
89 pdata = dev_get_platdata(&spi->dev); mc33880_probe()
91 dev_dbg(&spi->dev, "incorrect or missing platform data\n"); mc33880_probe()
98 spi->bits_per_word = 8; mc33880_probe()
100 ret = spi_setup(spi); mc33880_probe()
104 mc = devm_kzalloc(&spi->dev, sizeof(struct mc33880), GFP_KERNEL); mc33880_probe()
110 spi_set_drvdata(spi, mc); mc33880_probe()
112 mc->spi = spi; mc33880_probe()
119 mc->chip.dev = &spi->dev; mc33880_probe()
133 dev_err(&spi->dev, "Failed writing to " DRIVER_NAME ": %d\n", mc33880_probe()
149 static int mc33880_remove(struct spi_device *spi) mc33880_remove() argument
153 mc = spi_get_drvdata(spi); mc33880_remove()
175 /* register after spi postcore initcall and before
H A Dgpio-74x164.c14 #include <linux/spi/spi.h>
36 struct spi_device *spi = to_spi_device(chip->gpio_chip.dev); __gen_74x164_write_config() local
62 ret = spi_sync(spi, &message); __gen_74x164_write_config()
107 static int gen_74x164_probe(struct spi_device *spi) gen_74x164_probe() argument
115 spi->bits_per_word = 8; gen_74x164_probe()
117 ret = spi_setup(spi); gen_74x164_probe()
121 chip = devm_kzalloc(&spi->dev, sizeof(*chip), GFP_KERNEL); gen_74x164_probe()
125 spi_set_drvdata(spi, chip); gen_74x164_probe()
127 chip->gpio_chip.label = spi->modalias; gen_74x164_probe()
133 if (of_property_read_u32(spi->dev.of_node, "registers-number", gen_74x164_probe()
135 dev_err(&spi->dev, gen_74x164_probe()
141 chip->buffer = devm_kzalloc(&spi->dev, chip->registers, GFP_KERNEL); gen_74x164_probe()
146 chip->gpio_chip.dev = &spi->dev; gen_74x164_probe()
153 dev_err(&spi->dev, "Failed writing: %d\n", ret); gen_74x164_probe()
167 static int gen_74x164_remove(struct spi_device *spi) gen_74x164_remove() argument
169 struct gen_74x164_chip *chip = spi_get_drvdata(spi); gen_74x164_remove()
/linux-4.4.14/drivers/staging/iio/magnetometer/
H A Dhmc5843_spi.c13 #include <linux/spi/spi.h>
59 static int hmc5843_spi_probe(struct spi_device *spi) hmc5843_spi_probe() argument
62 const struct spi_device_id *id = spi_get_device_id(spi); hmc5843_spi_probe()
64 spi->mode = SPI_MODE_3; hmc5843_spi_probe()
65 spi->max_speed_hz = 8000000; hmc5843_spi_probe()
66 spi->bits_per_word = 8; hmc5843_spi_probe()
67 ret = spi_setup(spi); hmc5843_spi_probe()
71 return hmc5843_common_probe(&spi->dev, hmc5843_spi_probe()
72 devm_regmap_init_spi(spi, &hmc5843_spi_regmap_config), hmc5843_spi_probe()
76 static int hmc5843_spi_remove(struct spi_device *spi) hmc5843_spi_remove() argument
78 return hmc5843_common_remove(&spi->dev); hmc5843_spi_remove()
85 MODULE_DEVICE_TABLE(spi, hmc5843_id);
/linux-4.4.14/include/linux/can/platform/
H A Dmcp251x.h10 #include <linux/spi/spi.h>
/linux-4.4.14/drivers/staging/rts5208/
H A DMakefile6 rtsx_card.o general.o sd.o xd.o ms.o spi.o trace.o
/linux-4.4.14/net/ipv6/
H A Dxfrm6_tunnel.c44 u32 spi; member in struct:xfrm6_tunnel_net
54 * xfrm_tunnel_spi things are for allocating unique id ("spi")
61 u32 spi; member in struct:xfrm6_tunnel_spi
82 static inline unsigned int xfrm6_tunnel_spi_hash_byspi(u32 spi) xfrm6_tunnel_spi_hash_byspi() argument
84 return spi % XFRM6_TUNNEL_SPI_BYSPI_HSIZE; xfrm6_tunnel_spi_hash_byspi()
105 u32 spi; xfrm6_tunnel_spi_lookup() local
109 spi = x6spi ? x6spi->spi : 0; xfrm6_tunnel_spi_lookup()
111 return htonl(spi); xfrm6_tunnel_spi_lookup()
115 static int __xfrm6_tunnel_spi_check(struct net *net, u32 spi) __xfrm6_tunnel_spi_check() argument
119 int index = xfrm6_tunnel_spi_hash_byspi(spi); __xfrm6_tunnel_spi_check()
124 if (x6spi->spi == spi) __xfrm6_tunnel_spi_check()
133 u32 spi; __xfrm6_tunnel_alloc_spi() local
137 if (xfrm6_tn->spi < XFRM6_TUNNEL_SPI_MIN || __xfrm6_tunnel_alloc_spi()
138 xfrm6_tn->spi >= XFRM6_TUNNEL_SPI_MAX) __xfrm6_tunnel_alloc_spi()
139 xfrm6_tn->spi = XFRM6_TUNNEL_SPI_MIN; __xfrm6_tunnel_alloc_spi()
141 xfrm6_tn->spi++; __xfrm6_tunnel_alloc_spi()
143 for (spi = xfrm6_tn->spi; spi <= XFRM6_TUNNEL_SPI_MAX; spi++) { __xfrm6_tunnel_alloc_spi()
144 index = __xfrm6_tunnel_spi_check(net, spi); __xfrm6_tunnel_alloc_spi()
148 for (spi = XFRM6_TUNNEL_SPI_MIN; spi < xfrm6_tn->spi; spi++) { __xfrm6_tunnel_alloc_spi()
149 index = __xfrm6_tunnel_spi_check(net, spi); __xfrm6_tunnel_alloc_spi()
153 spi = 0; __xfrm6_tunnel_alloc_spi()
156 xfrm6_tn->spi = spi; __xfrm6_tunnel_alloc_spi()
162 x6spi->spi = spi; __xfrm6_tunnel_alloc_spi()
170 return spi; __xfrm6_tunnel_alloc_spi()
176 u32 spi; xfrm6_tunnel_alloc_spi() local
182 spi = x6spi->spi; xfrm6_tunnel_alloc_spi()
184 spi = __xfrm6_tunnel_alloc_spi(net, saddr); xfrm6_tunnel_alloc_spi()
187 return htonl(spi); xfrm6_tunnel_alloc_spi()
236 __be32 spi; xfrm6_tunnel_rcv() local
238 spi = xfrm6_tunnel_spi_lookup(net, (const xfrm_address_t *)&iph->saddr); xfrm6_tunnel_rcv()
239 return xfrm6_rcv_spi(skb, IPPROTO_IPV6, spi); xfrm6_tunnel_rcv()
334 xfrm6_tn->spi = 0; xfrm6_tunnel_net_init()
/linux-4.4.14/drivers/leds/
H A Dleds-dac124s085.c18 #include <linux/spi/spi.h>
22 struct spi_device *spi; member in struct:dac124s085_led
50 spi_write(led->spi, (const u8 *)&word, sizeof(word)); dac124s085_led_work()
66 static int dac124s085_probe(struct spi_device *spi) dac124s085_probe() argument
72 dac = devm_kzalloc(&spi->dev, sizeof(*dac), GFP_KERNEL); dac124s085_probe()
76 spi->bits_per_word = 16; dac124s085_probe()
82 led->spi = spi; dac124s085_probe()
91 ret = led_classdev_register(&spi->dev, &led->ldev); dac124s085_probe()
96 spi_set_drvdata(spi, dac); dac124s085_probe()
107 static int dac124s085_remove(struct spi_device *spi) dac124s085_remove() argument
109 struct dac124s085 *dac = spi_get_drvdata(spi); dac124s085_remove()
133 MODULE_ALIAS("spi:dac124s085");
/linux-4.4.14/include/linux/spi/
H A Dspi_bitbang.h10 u8 flags; /* extra spi->mode support */
17 int (*setup_transfer)(struct spi_device *spi,
20 void (*chipselect)(struct spi_device *spi, int is_on);
27 int (*txrx_bufs)(struct spi_device *spi, struct spi_transfer *t);
30 u32 (*txrx_word[4])(struct spi_device *spi,
38 extern int spi_bitbang_setup(struct spi_device *spi);
39 extern void spi_bitbang_cleanup(struct spi_device *spi);
40 extern int spi_bitbang_setup_transfer(struct spi_device *spi,
44 extern int spi_bitbang_start(struct spi_bitbang *spi);
45 extern void spi_bitbang_stop(struct spi_bitbang *spi);
H A Dmmc_spi.h4 #include <linux/spi/spi.h>
18 * REVISIT This is not a spi-specific notion. Any card slot should be
53 extern struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi);
54 extern void mmc_spi_put_pdata(struct spi_device *spi);
57 mmc_spi_get_pdata(struct spi_device *spi) mmc_spi_get_pdata() argument
59 return spi->dev.platform_data; mmc_spi_get_pdata()
61 static inline void mmc_spi_put_pdata(struct spi_device *spi) {} argument
H A Ds3c24xx.h22 void (*gpio_setup)(struct s3c2410_spi_info *spi, int enable);
23 void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol);
/linux-4.4.14/drivers/video/fbdev/mmp/panel/
H A Dtpo_tj032md01bw.c3 * active panel using spi interface to do init
33 #include <linux/spi/spi.h>
85 struct spi_device *spi; member in struct:tpohvga_plat_data
96 ret = spi_write(plat->spi, init, sizeof(init)); tpohvga_onoff()
100 ret = spi_write(plat->spi, poweroff, sizeof(poweroff)); tpohvga_onoff()
139 static int tpohvga_probe(struct spi_device *spi) tpohvga_probe() argument
146 mi = spi->dev.platform_data; tpohvga_probe()
148 dev_err(&spi->dev, "%s: no platform data defined\n", __func__); tpohvga_probe()
152 /* setup spi related info */ tpohvga_probe()
153 spi->bits_per_word = 16; tpohvga_probe()
154 ret = spi_setup(spi); tpohvga_probe()
156 dev_err(&spi->dev, "spi setup failed %d", ret); tpohvga_probe()
164 plat_data->spi = spi; tpohvga_probe()
168 panel_tpohvga.dev = &spi->dev; tpohvga_probe()
/linux-4.4.14/drivers/iio/adc/
H A Dti-adc128s052.c15 #include <linux/spi/spi.h>
26 struct spi_device *spi; member in struct:adc128
43 ret = spi_write(adc->spi, &adc->buffer, 2); adc128_adc_conversion()
49 ret = spi_read(adc->spi, &adc->buffer, 2); adc128_adc_conversion()
127 static int adc128_probe(struct spi_device *spi) adc128_probe() argument
131 int config = spi_get_device_id(spi)->driver_data; adc128_probe()
134 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*adc)); adc128_probe()
139 adc->spi = spi; adc128_probe()
141 spi_set_drvdata(spi, indio_dev); adc128_probe()
143 indio_dev->dev.parent = &spi->dev; adc128_probe()
144 indio_dev->name = spi_get_device_id(spi)->name; adc128_probe()
151 adc->reg = devm_regulator_get(&spi->dev, "vref"); adc128_probe()
166 static int adc128_remove(struct spi_device *spi) adc128_remove() argument
168 struct iio_dev *indio_dev = spi_get_drvdata(spi); adc128_remove()
189 MODULE_DEVICE_TABLE(spi, adc128_id);
H A Dmax1027.c20 #include <linux/spi/spi.h>
77 MODULE_DEVICE_TABLE(spi, max1027_id);
210 struct spi_device *spi; member in struct:max1027_state
232 ret = spi_write(st->spi, &st->reg, 1); max1027_read_single_value()
242 ret = spi_write(st->spi, &st->reg, 1); max1027_read_single_value()
257 ret = spi_read(st->spi, st->buffer, (chan->type == IIO_TEMP) ? 4 : 2); max1027_read_single_value()
317 return spi_write(st->spi, val, 1); max1027_debugfs_reg_access()
341 ret = spi_write(st->spi, &st->reg, 1); max1027_set_trigger_state()
348 ret = spi_write(st->spi, &st->reg, 1); max1027_set_trigger_state()
355 ret = spi_write(st->spi, &st->reg, 1); max1027_set_trigger_state()
383 spi_read(st->spi, st->buffer, indio_dev->masklength * 2); max1027_trigger_handler()
405 static int max1027_probe(struct spi_device *spi) max1027_probe() argument
411 pr_debug("%s: probe(spi = 0x%p)\n", __func__, spi); max1027_probe()
413 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); max1027_probe()
419 spi_set_drvdata(spi, indio_dev); max1027_probe()
422 st->spi = spi; max1027_probe()
423 st->info = &max1027_chip_info_tbl[spi_get_device_id(spi)->driver_data]; max1027_probe()
427 indio_dev->name = spi_get_device_id(spi)->name; max1027_probe()
428 indio_dev->dev.parent = &spi->dev; max1027_probe()
450 st->trig = devm_iio_trigger_alloc(&spi->dev, "%s-trigger", max1027_probe()
459 st->trig->dev.parent = &spi->dev; max1027_probe()
463 ret = devm_request_threaded_irq(&spi->dev, spi->irq, max1027_probe()
467 spi->dev.driver->name, st->trig); max1027_probe()
475 ret = spi_write(st->spi, &st->reg, 1); max1027_probe()
496 static int max1027_remove(struct spi_device *spi) max1027_remove() argument
498 struct iio_dev *indio_dev = spi_get_drvdata(spi); max1027_remove()
500 pr_debug("%s: remove(spi = 0x%p)\n", __func__, spi); max1027_remove()
H A Dad_sigma_delta.c14 #include <linux/spi/spi.h>
94 ret = spi_sync_locked(sigma_delta->spi, &m); ad_sd_write_reg()
96 ret = spi_sync(sigma_delta->spi, &m); ad_sd_write_reg()
129 ret = spi_sync_locked(sigma_delta->spi, &m); ad_sd_read_reg_raw()
131 ret = spi_sync(sigma_delta->spi, &m); ad_sd_read_reg_raw()
189 spi_bus_lock(sigma_delta->spi->master); ad_sd_calibrate()
198 enable_irq(sigma_delta->spi->irq); ad_sd_calibrate()
202 disable_irq_nosync(sigma_delta->spi->irq); ad_sd_calibrate()
209 spi_bus_unlock(sigma_delta->spi->master); ad_sd_calibrate()
260 spi_bus_lock(sigma_delta->spi->master); ad_sigma_delta_single_conversion()
267 enable_irq(sigma_delta->spi->irq); ad_sigma_delta_single_conversion()
272 spi_bus_unlock(sigma_delta->spi->master); ad_sigma_delta_single_conversion()
285 disable_irq_nosync(sigma_delta->spi->irq); ad_sigma_delta_single_conversion()
324 spi_bus_lock(sigma_delta->spi->master); ad_sd_buffer_postenable()
331 enable_irq(sigma_delta->spi->irq); ad_sd_buffer_postenable()
336 spi_bus_unlock(sigma_delta->spi->master); ad_sd_buffer_postenable()
350 disable_irq_nosync(sigma_delta->spi->irq); ad_sd_buffer_postdisable()
357 return spi_bus_unlock(sigma_delta->spi->master); ad_sd_buffer_postdisable()
394 enable_irq(sigma_delta->spi->irq); ad_sd_trigger_handler()
455 ret = request_irq(sigma_delta->spi->irq, ad_sd_probe_trigger()
465 disable_irq_nosync(sigma_delta->spi->irq); ad_sd_probe_trigger()
467 sigma_delta->trig->dev.parent = &sigma_delta->spi->dev; ad_sd_probe_trigger()
480 free_irq(sigma_delta->spi->irq, sigma_delta); ad_sd_probe_trigger()
492 free_irq(sigma_delta->spi->irq, sigma_delta); ad_sd_remove_trigger()
534 * @spi: The SPI device for the ad_sigma_delta device
541 struct spi_device *spi, const struct ad_sigma_delta_info *info) ad_sd_init()
543 sigma_delta->spi = spi; ad_sd_init()
540 ad_sd_init(struct ad_sigma_delta *sigma_delta, struct iio_dev *indio_dev, struct spi_device *spi, const struct ad_sigma_delta_info *info) ad_sd_init() argument
H A Dad7298.c13 #include <linux/spi/spi.h>
43 struct spi_device *spi; member in struct:ad7298_state
103 * ad7298_update_scan_mode() setup the spi transfer buffer for the new scan mask
124 /* build spi ring message */ ad7298_update_scan_mode()
161 b_sent = spi_sync(st->spi, &st->ring_msg); ad7298_trigger_handler()
180 ret = spi_sync(st->spi, &st->scan_single_msg); ad7298_scan_direct()
195 ret = spi_write(st->spi, (u8 *)&buf, 2); ad7298_scan_temp()
201 ret = spi_write(st->spi, (u8 *)&buf, 2); ad7298_scan_temp()
207 ret = spi_read(st->spi, (u8 *)&buf, 2); ad7298_scan_temp()
286 static int ad7298_probe(struct spi_device *spi) ad7298_probe() argument
288 struct ad7298_platform_data *pdata = spi->dev.platform_data; ad7298_probe()
293 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); ad7298_probe()
303 st->reg = devm_regulator_get(&spi->dev, "vref"); ad7298_probe()
312 spi_set_drvdata(spi, indio_dev); ad7298_probe()
314 st->spi = spi; ad7298_probe()
316 indio_dev->name = spi_get_device_id(spi)->name; ad7298_probe()
317 indio_dev->dev.parent = &spi->dev; ad7298_probe()
359 static int ad7298_remove(struct spi_device *spi) ad7298_remove() argument
361 struct iio_dev *indio_dev = spi_get_drvdata(spi); ad7298_remove()
376 MODULE_DEVICE_TABLE(spi, ad7298_id);
H A Dad7887.c13 #include <linux/spi/spi.h>
55 struct spi_device *spi; member in struct:ad7887_state
89 spi_sync(st->spi, st->ring_msg); ad7887_ring_preenable()
104 return spi_sync(st->spi, &st->msg[AD7887_CH0]); ad7887_ring_postdisable()
120 b_sent = spi_sync(st->spi, st->ring_msg); ad7887_trigger_handler()
141 int ret = spi_sync(st->spi, &st->msg[ch]); ad7887_scan_direct()
236 static int ad7887_probe(struct spi_device *spi) ad7887_probe() argument
238 struct ad7887_platform_data *pdata = spi->dev.platform_data; ad7887_probe()
244 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); ad7887_probe()
251 st->reg = devm_regulator_get(&spi->dev, "vref"); ad7887_probe()
261 &ad7887_chip_info_tbl[spi_get_device_id(spi)->driver_data]; ad7887_probe()
263 spi_set_drvdata(spi, indio_dev); ad7887_probe()
264 st->spi = spi; ad7887_probe()
266 /* Estabilish that the iio_dev is a child of the spi device */ ad7887_probe()
267 indio_dev->dev.parent = &spi->dev; ad7887_probe()
268 indio_dev->name = spi_get_device_id(spi)->name; ad7887_probe()
337 static int ad7887_remove(struct spi_device *spi) ad7887_remove() argument
339 struct iio_dev *indio_dev = spi_get_drvdata(spi); ad7887_remove()
354 MODULE_DEVICE_TABLE(spi, ad7887_id);
H A Dad7476.c13 #include <linux/spi/spi.h>
34 struct spi_device *spi; member in struct:ad7476_state
68 b_sent = spi_sync(st->spi, &st->msg); ad7476_trigger_handler()
83 spi_read(st->spi, st->data, 1); ad7091_reset()
90 ret = spi_sync(st->spi, &st->msg); ad7476_scan_direct()
203 static int ad7476_probe(struct spi_device *spi) ad7476_probe() argument
209 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); ad7476_probe()
215 &ad7476_chip_info_tbl[spi_get_device_id(spi)->driver_data]; ad7476_probe()
217 st->reg = devm_regulator_get(&spi->dev, "vcc"); ad7476_probe()
225 spi_set_drvdata(spi, indio_dev); ad7476_probe()
227 st->spi = spi; ad7476_probe()
229 /* Establish that the iio_dev is a child of the spi device */ ad7476_probe()
230 indio_dev->dev.parent = &spi->dev; ad7476_probe()
231 indio_dev->name = spi_get_device_id(spi)->name; ad7476_probe()
265 static int ad7476_remove(struct spi_device *spi) ad7476_remove() argument
267 struct iio_dev *indio_dev = spi_get_drvdata(spi); ad7476_remove()
300 MODULE_DEVICE_TABLE(spi, ad7476_id);
H A Dad7923.c14 #include <linux/spi/spi.h>
55 struct spi_device *spi; member in struct:ad7923_state
130 * ad7923_update_scan_mode() setup the spi transfer buffer for the new scan mask
146 /* build spi ring message */
179 b_sent = spi_sync(st->spi, &st->ring_msg); ad7923_trigger_handler()
202 ret = spi_sync(st->spi, &st->scan_single_msg); ad7923_scan_direct()
269 static int ad7923_probe(struct spi_device *spi) ad7923_probe() argument
276 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); ad7923_probe()
282 spi_set_drvdata(spi, indio_dev); ad7923_probe()
284 st->spi = spi; ad7923_probe()
288 info = &ad7923_chip_info[spi_get_device_id(spi)->driver_data]; ad7923_probe()
290 indio_dev->name = spi_get_device_id(spi)->name; ad7923_probe()
291 indio_dev->dev.parent = &spi->dev; ad7923_probe()
309 st->reg = devm_regulator_get(&spi->dev, "refin"); ad7923_probe()
336 static int ad7923_remove(struct spi_device *spi) ad7923_remove() argument
338 struct iio_dev *indio_dev = spi_get_drvdata(spi); ad7923_remove()
355 MODULE_DEVICE_TABLE(spi, ad7923_id);
H A Dmcp320x.c37 #include <linux/spi/spi.h>
61 struct spi_device *spi; member in struct:mcp320x
109 ret = spi_sync(adc->spi, &adc->msg); mcp320x_adc_conversion()
113 ret = spi_read(adc->spi, &adc->rx_buf, sizeof(adc->rx_buf)); mcp320x_adc_conversion()
148 device_index = spi_get_device_id(adc->spi)->driver_data; mcp320x_read_raw()
289 static int mcp320x_probe(struct spi_device *spi) mcp320x_probe() argument
296 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*adc)); mcp320x_probe()
301 adc->spi = spi; mcp320x_probe()
303 indio_dev->dev.parent = &spi->dev; mcp320x_probe()
304 indio_dev->name = spi_get_device_id(spi)->name; mcp320x_probe()
308 chip_info = &mcp320x_chip_infos[spi_get_device_id(spi)->driver_data]; mcp320x_probe()
322 adc->reg = devm_regulator_get(&spi->dev, "vref"); mcp320x_probe()
344 static int mcp320x_remove(struct spi_device *spi) mcp320x_remove() argument
346 struct iio_dev *indio_dev = spi_get_drvdata(spi); mcp320x_remove()
402 MODULE_DEVICE_TABLE(spi, mcp320x_id);
H A Dad7791.c15 #include <linux/spi/spi.h>
354 static int ad7791_probe(struct spi_device *spi) ad7791_probe() argument
356 struct ad7791_platform_data *pdata = spi->dev.platform_data; ad7791_probe()
361 if (!spi->irq) { ad7791_probe()
362 dev_err(&spi->dev, "Missing IRQ.\n"); ad7791_probe()
366 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); ad7791_probe()
372 st->reg = devm_regulator_get(&spi->dev, "refin"); ad7791_probe()
380 st->info = &ad7791_chip_infos[spi_get_device_id(spi)->driver_data]; ad7791_probe()
381 ad_sd_init(&st->sd, indio_dev, spi, &ad7791_sigma_delta_info); ad7791_probe()
383 spi_set_drvdata(spi, indio_dev); ad7791_probe()
385 indio_dev->dev.parent = &spi->dev; ad7791_probe()
386 indio_dev->name = spi_get_device_id(spi)->name; ad7791_probe()
417 static int ad7791_remove(struct spi_device *spi) ad7791_remove() argument
419 struct iio_dev *indio_dev = spi_get_drvdata(spi); ad7791_remove()
438 MODULE_DEVICE_TABLE(spi, ad7791_spi_ids);
/linux-4.4.14/drivers/mtd/devices/
H A Dm25p80.c26 #include <linux/spi/spi.h>
27 #include <linux/spi/flash.h>
28 #include <linux/mtd/spi-nor.h>
32 struct spi_device *spi; member in struct:m25p
40 struct spi_device *spi = flash->spi; m25p80_read_reg() local
43 ret = spi_write_then_read(spi, &code, 1, val, len); m25p80_read_reg()
45 dev_err(&spi->dev, "error %d reading %x\n", ret, code); m25p80_read_reg()
67 struct spi_device *spi = flash->spi; m25p80_write_reg() local
73 return spi_write(spi, flash->command, len + 1); m25p80_write_reg()
80 struct spi_device *spi = flash->spi; m25p80_write() local
101 spi_sync(spi, &m); m25p80_write()
126 struct spi_device *spi = flash->spi; m25p80_read() local
149 spi_sync(spi, &m); m25p80_read()
166 spi_write(flash->spi, flash->command, m25p_cmdsz(nor)); m25p80_erase()
176 static int m25p_probe(struct spi_device *spi) m25p_probe() argument
186 data = dev_get_platdata(&spi->dev); m25p_probe()
188 flash = devm_kzalloc(&spi->dev, sizeof(*flash), GFP_KERNEL); m25p_probe()
201 nor->dev = &spi->dev; m25p_probe()
202 nor->flash_node = spi->dev.of_node; m25p_probe()
205 spi_set_drvdata(spi, flash); m25p_probe()
206 flash->spi = spi; m25p_probe()
208 if (spi->mode & SPI_RX_QUAD) m25p_probe()
210 else if (spi->mode & SPI_RX_DUAL) m25p_probe()
224 flash_name = spi->modalias; m25p_probe()
230 ppdata.of_node = spi->dev.of_node; m25p_probe()
238 static int m25p_remove(struct spi_device *spi) m25p_remove() argument
240 struct m25p *flash = spi_get_drvdata(spi); m25p_remove()
252 * encourage new users to add support to the spi-nor library, and simply bind
253 * against a generic string here (e.g., "jedec,spi-nor").
255 * Many flash names are kept here in this list (as well as in spi-nor.c) to
289 MODULE_DEVICE_TABLE(spi, m25p_ids);
296 { .compatible = "jedec,spi-nor" },
H A Dmtd_dataflash.c22 #include <linux/spi/spi.h>
23 #include <linux/spi/flash.h>
94 struct spi_device *spi; member in struct:dataflash
113 static inline int dataflash_status(struct spi_device *spi) dataflash_status() argument
118 return spi_w8r8(spi, OP_READ_STATUS); dataflash_status()
125 static int dataflash_waitready(struct spi_device *spi) dataflash_waitready() argument
130 status = dataflash_status(spi); dataflash_waitready()
133 dev_name(&spi->dev), status); dataflash_waitready()
152 struct spi_device *spi = priv->spi; dataflash_erase() local
160 dev_name(&spi->dev), (long long)instr->addr, dataflash_erase()
199 status = spi_sync(spi, &msg); dataflash_erase()
200 (void) dataflash_waitready(spi); dataflash_erase()
204 dev_name(&spi->dev), pageaddr, status); dataflash_erase()
245 pr_debug("%s: read 0x%x..0x%x\n", dev_name(&priv->spi->dev), dataflash_read()
279 status = spi_sync(priv->spi, &msg); dataflash_read()
287 dev_name(&priv->spi->dev), dataflash_read()
304 struct spi_device *spi = priv->spi; dataflash_write() local
314 dev_name(&spi->dev), (unsigned)to, (unsigned)(to + len)); dataflash_write()
362 status = spi_sync(spi, &msg); dataflash_write()
365 dev_name(&spi->dev), addr, status); dataflash_write()
367 (void) dataflash_waitready(priv->spi); dataflash_write()
383 status = spi_sync(spi, &msg); dataflash_write()
387 dev_name(&spi->dev), addr, writelen, status); dataflash_write()
389 (void) dataflash_waitready(priv->spi); dataflash_write()
404 status = spi_sync(spi, &msg); dataflash_write()
407 dev_name(&spi->dev), addr, status); dataflash_write()
409 status = dataflash_waitready(priv->spi); dataflash_write()
414 dev_name(&spi->dev), pageaddr, status); dataflash_write()
457 static ssize_t otp_read(struct spi_device *spi, unsigned base, otp_read() argument
490 dataflash_waitready(spi); otp_read()
492 status = spi_sync(spi, &m); otp_read()
510 status = otp_read(priv->spi, 64, buf, from, len); dataflash_read_fact_otp()
527 status = otp_read(priv->spi, 0, buf, from, len); dataflash_read_user_otp()
579 dataflash_waitready(priv->spi); dataflash_write_user_otp()
580 status = spi_sync(priv->spi, &m); dataflash_write_user_otp()
622 static int add_dataflash_otp(struct spi_device *spi, char *name, int nr_pages, add_dataflash_otp() argument
628 struct flash_platform_data *pdata = dev_get_platdata(&spi->dev); add_dataflash_otp()
637 priv->spi = spi; add_dataflash_otp()
642 sprintf(priv->name, "spi%d.%d-%s", add_dataflash_otp()
643 spi->master->bus_num, spi->chip_select, add_dataflash_otp()
658 device->dev.parent = &spi->dev; add_dataflash_otp()
663 dev_info(&spi->dev, "%s (%lld KBytes) pagesize %d bytes%s\n", add_dataflash_otp()
666 spi_set_drvdata(spi, priv); add_dataflash_otp()
668 ppdata.of_node = spi->dev.of_node; add_dataflash_otp()
680 static inline int add_dataflash(struct spi_device *spi, char *name, add_dataflash() argument
683 return add_dataflash_otp(spi, name, nr_pages, pagesize, add_dataflash()
740 static struct flash_info *jedec_probe(struct spi_device *spi) jedec_probe() argument
757 tmp = spi_write_then_read(spi, &code, 1, id, 3); jedec_probe()
760 dev_name(&spi->dev), tmp); jedec_probe()
777 dev_name(&spi->dev), jedec_probe()
782 status = dataflash_status(spi); jedec_probe()
785 dev_name(&spi->dev), status); jedec_probe()
805 dev_warn(&spi->dev, "JEDEC id %06x not handled\n", jedec); jedec_probe()
823 static int dataflash_probe(struct spi_device *spi) dataflash_probe() argument
835 info = jedec_probe(spi); dataflash_probe()
839 return add_dataflash_otp(spi, info->name, info->nr_pages, dataflash_probe()
847 status = dataflash_status(spi); dataflash_probe()
850 dev_name(&spi->dev), status); dataflash_probe()
857 * board setup should have set spi->max_speed_max to dataflash_probe()
862 status = add_dataflash(spi, "AT45DB011B", 512, 264, 9); dataflash_probe()
865 status = add_dataflash(spi, "AT45DB021B", 1024, 264, 9); dataflash_probe()
868 status = add_dataflash(spi, "AT45DB041x", 2048, 264, 9); dataflash_probe()
871 status = add_dataflash(spi, "AT45DB081B", 4096, 264, 9); dataflash_probe()
874 status = add_dataflash(spi, "AT45DB161x", 4096, 528, 10); dataflash_probe()
877 status = add_dataflash(spi, "AT45DB321x", 8192, 528, 10); dataflash_probe()
881 status = add_dataflash(spi, "AT45DB642x", 8192, 1056, 11); dataflash_probe()
885 dev_info(&spi->dev, "unsupported device (%x)\n", dataflash_probe()
891 pr_debug("%s: add_dataflash --> %d\n", dev_name(&spi->dev), dataflash_probe()
897 static int dataflash_remove(struct spi_device *spi) dataflash_remove() argument
899 struct dataflash *flash = spi_get_drvdata(spi); dataflash_remove()
902 pr_debug("%s: remove\n", dev_name(&spi->dev)); dataflash_remove()
927 MODULE_ALIAS("spi:mtd_dataflash");
H A Dsst25l.c28 #include <linux/spi/spi.h>
29 #include <linux/spi/flash.h>
51 struct spi_device *spi; member in struct:sst25l_flash
87 err = spi_sync(flash->spi, &m); sst25l_status()
101 err = spi_write(flash->spi, command, 1); sst25l_write_enable()
106 err = spi_write(flash->spi, command, 1); sst25l_write_enable()
112 err = spi_write(flash->spi, command, 2); sst25l_write_enable()
159 err = spi_write(flash->spi, command, 4); sst25l_erase_sector()
199 dev_err(&flash->spi->dev, "Erase failed\n"); sst25l_erase()
247 spi_sync(flash->spi, &message); sst25l_read()
283 ret = spi_write(flash->spi, command, 5); sst25l_write()
299 ret = spi_write(flash->spi, command, 2); sst25l_write()
315 static struct flash_info *sst25l_match_device(struct spi_device *spi) sst25l_match_device() argument
337 err = spi_sync(spi, &m); sst25l_match_device()
339 dev_err(&spi->dev, "error reading device id\n"); sst25l_match_device()
350 dev_err(&spi->dev, "unknown id %.4x\n", id); sst25l_match_device()
355 static int sst25l_probe(struct spi_device *spi) sst25l_probe() argument
362 flash_info = sst25l_match_device(spi); sst25l_probe()
366 flash = devm_kzalloc(&spi->dev, sizeof(*flash), GFP_KERNEL); sst25l_probe()
370 flash->spi = spi; sst25l_probe()
372 spi_set_drvdata(spi, flash); sst25l_probe()
374 data = dev_get_platdata(&spi->dev); sst25l_probe()
378 flash->mtd.dev.parent = &spi->dev; sst25l_probe()
389 dev_info(&spi->dev, "%s (%lld KiB)\n", flash_info->name, sst25l_probe()
409 static int sst25l_remove(struct spi_device *spi) sst25l_remove() argument
411 struct sst25l_flash *flash = spi_get_drvdata(spi); sst25l_remove()
/linux-4.4.14/drivers/net/can/spi/
H A Dmcp251x.c76 #include <linux/spi/spi.h>
246 struct spi_device *spi; member in struct:mcp251x_priv
276 static inline int mcp251x_is_##_model(struct spi_device *spi) \
278 struct mcp251x_priv *priv = spi_get_drvdata(spi); \
312 static int mcp251x_spi_trans(struct spi_device *spi, int len) mcp251x_spi_trans() argument
314 struct mcp251x_priv *priv = spi_get_drvdata(spi); mcp251x_spi_trans()
334 ret = spi_sync(spi, &m); mcp251x_spi_trans()
336 dev_err(&spi->dev, "spi transfer failed: ret = %d\n", ret); mcp251x_spi_trans()
340 static u8 mcp251x_read_reg(struct spi_device *spi, uint8_t reg) mcp251x_read_reg() argument
342 struct mcp251x_priv *priv = spi_get_drvdata(spi); mcp251x_read_reg()
348 mcp251x_spi_trans(spi, 3); mcp251x_read_reg()
354 static void mcp251x_read_2regs(struct spi_device *spi, uint8_t reg, mcp251x_read_2regs() argument
357 struct mcp251x_priv *priv = spi_get_drvdata(spi); mcp251x_read_2regs()
362 mcp251x_spi_trans(spi, 4); mcp251x_read_2regs()
368 static void mcp251x_write_reg(struct spi_device *spi, u8 reg, uint8_t val) mcp251x_write_reg() argument
370 struct mcp251x_priv *priv = spi_get_drvdata(spi); mcp251x_write_reg()
376 mcp251x_spi_trans(spi, 3); mcp251x_write_reg()
379 static void mcp251x_write_bits(struct spi_device *spi, u8 reg, mcp251x_write_bits() argument
382 struct mcp251x_priv *priv = spi_get_drvdata(spi); mcp251x_write_bits()
389 mcp251x_spi_trans(spi, 4); mcp251x_write_bits()
392 static void mcp251x_hw_tx_frame(struct spi_device *spi, u8 *buf, mcp251x_hw_tx_frame() argument
395 struct mcp251x_priv *priv = spi_get_drvdata(spi); mcp251x_hw_tx_frame()
397 if (mcp251x_is_2510(spi)) { mcp251x_hw_tx_frame()
401 mcp251x_write_reg(spi, TXBCTRL(tx_buf_idx) + i, mcp251x_hw_tx_frame()
405 mcp251x_spi_trans(spi, TXBDAT_OFF + len); mcp251x_hw_tx_frame()
409 static void mcp251x_hw_tx(struct spi_device *spi, struct can_frame *frame, mcp251x_hw_tx() argument
412 struct mcp251x_priv *priv = spi_get_drvdata(spi); mcp251x_hw_tx()
433 mcp251x_hw_tx_frame(spi, buf, frame->can_dlc, tx_buf_idx); mcp251x_hw_tx()
437 mcp251x_spi_trans(priv->spi, 1); mcp251x_hw_tx()
440 static void mcp251x_hw_rx_frame(struct spi_device *spi, u8 *buf, mcp251x_hw_rx_frame() argument
443 struct mcp251x_priv *priv = spi_get_drvdata(spi); mcp251x_hw_rx_frame()
445 if (mcp251x_is_2510(spi)) { mcp251x_hw_rx_frame()
449 buf[i] = mcp251x_read_reg(spi, RXBCTRL(buf_idx) + i); mcp251x_hw_rx_frame()
453 buf[i] = mcp251x_read_reg(spi, RXBCTRL(buf_idx) + i); mcp251x_hw_rx_frame()
456 mcp251x_spi_trans(spi, SPI_TRANSFER_BUF_LEN); mcp251x_hw_rx_frame()
461 static void mcp251x_hw_rx(struct spi_device *spi, int buf_idx) mcp251x_hw_rx() argument
463 struct mcp251x_priv *priv = spi_get_drvdata(spi); mcp251x_hw_rx()
470 dev_err(&spi->dev, "cannot allocate RX skb\n"); mcp251x_hw_rx()
475 mcp251x_hw_rx_frame(spi, buf, buf_idx); mcp251x_hw_rx()
510 static void mcp251x_hw_sleep(struct spi_device *spi) mcp251x_hw_sleep() argument
512 mcp251x_write_reg(spi, CANCTRL, CANCTRL_REQOP_SLEEP); mcp251x_hw_sleep()
519 struct spi_device *spi = priv->spi; mcp251x_hard_start_xmit() local
522 dev_warn(&spi->dev, "hard_xmit called while tx busy\n"); mcp251x_hard_start_xmit()
557 static int mcp251x_set_normal_mode(struct spi_device *spi) mcp251x_set_normal_mode() argument
559 struct mcp251x_priv *priv = spi_get_drvdata(spi); mcp251x_set_normal_mode()
563 mcp251x_write_reg(spi, CANINTE, mcp251x_set_normal_mode()
569 mcp251x_write_reg(spi, CANCTRL, CANCTRL_REQOP_LOOPBACK); mcp251x_set_normal_mode()
572 mcp251x_write_reg(spi, CANCTRL, CANCTRL_REQOP_LISTEN_ONLY); mcp251x_set_normal_mode()
575 mcp251x_write_reg(spi, CANCTRL, CANCTRL_REQOP_NORMAL); mcp251x_set_normal_mode()
579 while (mcp251x_read_reg(spi, CANSTAT) & CANCTRL_REQOP_MASK) { mcp251x_set_normal_mode()
582 dev_err(&spi->dev, "MCP251x didn't" mcp251x_set_normal_mode()
596 struct spi_device *spi = priv->spi; mcp251x_do_set_bittiming() local
598 mcp251x_write_reg(spi, CNF1, ((bt->sjw - 1) << CNF1_SJW_SHIFT) | mcp251x_do_set_bittiming()
600 mcp251x_write_reg(spi, CNF2, CNF2_BTLMODE | mcp251x_do_set_bittiming()
605 mcp251x_write_bits(spi, CNF3, CNF3_PHSEG2_MASK, mcp251x_do_set_bittiming()
607 dev_dbg(&spi->dev, "CNF: 0x%02x 0x%02x 0x%02x\n", mcp251x_do_set_bittiming()
608 mcp251x_read_reg(spi, CNF1), mcp251x_do_set_bittiming()
609 mcp251x_read_reg(spi, CNF2), mcp251x_do_set_bittiming()
610 mcp251x_read_reg(spi, CNF3)); mcp251x_do_set_bittiming()
616 struct spi_device *spi) mcp251x_setup()
620 mcp251x_write_reg(spi, RXBCTRL(0), mcp251x_setup()
622 mcp251x_write_reg(spi, RXBCTRL(1), mcp251x_setup()
627 static int mcp251x_hw_reset(struct spi_device *spi) mcp251x_hw_reset() argument
629 struct mcp251x_priv *priv = spi_get_drvdata(spi); mcp251x_hw_reset()
637 ret = mcp251x_spi_trans(spi, 1); mcp251x_hw_reset()
644 reg = mcp251x_read_reg(spi, CANSTAT); mcp251x_hw_reset()
651 static int mcp251x_hw_probe(struct spi_device *spi) mcp251x_hw_probe() argument
656 ret = mcp251x_hw_reset(spi); mcp251x_hw_probe()
660 ctrl = mcp251x_read_reg(spi, CANCTRL); mcp251x_hw_probe()
662 dev_dbg(&spi->dev, "CANCTRL 0x%02x\n", ctrl); mcp251x_hw_probe()
685 struct spi_device *spi = priv->spi; mcp251x_open_clean() local
687 free_irq(spi->irq, priv); mcp251x_open_clean()
688 mcp251x_hw_sleep(spi); mcp251x_open_clean()
696 struct spi_device *spi = priv->spi; mcp251x_stop() local
701 free_irq(spi->irq, priv); mcp251x_stop()
708 mcp251x_write_reg(spi, CANINTE, 0x00); mcp251x_stop()
709 mcp251x_write_reg(spi, CANINTF, 0x00); mcp251x_stop()
711 mcp251x_write_reg(spi, TXBCTRL(0), 0); mcp251x_stop()
714 mcp251x_hw_sleep(spi); mcp251x_stop()
746 struct spi_device *spi = priv->spi; mcp251x_tx_work_handler() local
759 mcp251x_hw_tx(spi, frame, 0); mcp251x_tx_work_handler()
772 struct spi_device *spi = priv->spi; mcp251x_restart_work_handler() local
777 mcp251x_hw_reset(spi); mcp251x_restart_work_handler()
778 mcp251x_setup(net, priv, spi); mcp251x_restart_work_handler()
780 mcp251x_set_normal_mode(spi); mcp251x_restart_work_handler()
784 mcp251x_set_normal_mode(spi); mcp251x_restart_work_handler()
787 mcp251x_hw_sleep(spi); mcp251x_restart_work_handler()
795 mcp251x_write_reg(spi, TXBCTRL(0), 0); mcp251x_restart_work_handler()
806 struct spi_device *spi = priv->spi; mcp251x_can_ist() local
816 mcp251x_read_2regs(spi, CANINTF, &intf, &eflag); mcp251x_can_ist()
823 mcp251x_hw_rx(spi, 0); mcp251x_can_ist()
828 if (mcp251x_is_2510(spi)) mcp251x_can_ist()
829 mcp251x_write_bits(spi, CANINTF, CANINTF_RX0IF, 0x00); mcp251x_can_ist()
834 mcp251x_hw_rx(spi, 1); mcp251x_can_ist()
836 if (mcp251x_is_2510(spi)) mcp251x_can_ist()
844 mcp251x_write_bits(spi, CANINTF, clear_intf, 0x00); mcp251x_can_ist()
847 mcp251x_write_bits(spi, EFLG, eflag, 0x00); mcp251x_can_ist()
911 mcp251x_hw_sleep(spi); mcp251x_can_ist()
938 struct spi_device *spi = priv->spi; mcp251x_open() local
944 dev_err(&spi->dev, "unable to set initial baudrate!\n"); mcp251x_open()
955 ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist, mcp251x_open()
958 dev_err(&spi->dev, "failed to acquire irq %d\n", spi->irq); mcp251x_open()
968 ret = mcp251x_hw_reset(spi); mcp251x_open()
973 ret = mcp251x_setup(net, priv, spi); mcp251x_open()
978 ret = mcp251x_set_normal_mode(spi); mcp251x_open()
1024 MODULE_DEVICE_TABLE(spi, mcp251x_id_table);
1026 static int mcp251x_can_probe(struct spi_device *spi) mcp251x_can_probe() argument
1029 &spi->dev); mcp251x_can_probe()
1030 struct mcp251x_platform_data *pdata = dev_get_platdata(&spi->dev); mcp251x_can_probe()
1036 clk = devm_clk_get(&spi->dev, NULL); mcp251x_can_probe()
1073 priv->model = spi_get_device_id(spi)->driver_data; mcp251x_can_probe()
1077 spi_set_drvdata(spi, priv); mcp251x_can_probe()
1080 spi->bits_per_word = 8; mcp251x_can_probe()
1081 if (mcp251x_is_2510(spi)) mcp251x_can_probe()
1082 spi->max_speed_hz = spi->max_speed_hz ? : 5 * 1000 * 1000; mcp251x_can_probe()
1084 spi->max_speed_hz = spi->max_speed_hz ? : 10 * 1000 * 1000; mcp251x_can_probe()
1085 ret = spi_setup(spi); mcp251x_can_probe()
1089 priv->power = devm_regulator_get_optional(&spi->dev, "vdd"); mcp251x_can_probe()
1090 priv->transceiver = devm_regulator_get_optional(&spi->dev, "xceiver"); mcp251x_can_probe()
1101 priv->spi = spi; mcp251x_can_probe()
1106 spi->dev.coherent_dma_mask = ~0; mcp251x_can_probe()
1112 priv->spi_tx_buf = dmam_alloc_coherent(&spi->dev, mcp251x_can_probe()
1129 priv->spi_tx_buf = devm_kzalloc(&spi->dev, SPI_TRANSFER_BUF_LEN, mcp251x_can_probe()
1135 priv->spi_rx_buf = devm_kzalloc(&spi->dev, SPI_TRANSFER_BUF_LEN, mcp251x_can_probe()
1143 SET_NETDEV_DEV(net, &spi->dev); mcp251x_can_probe()
1146 ret = mcp251x_hw_probe(spi); mcp251x_can_probe()
1150 mcp251x_hw_sleep(spi); mcp251x_can_probe()
1173 static int mcp251x_can_remove(struct spi_device *spi) mcp251x_can_remove() argument
1175 struct mcp251x_priv *priv = spi_get_drvdata(spi); mcp251x_can_remove()
1192 struct spi_device *spi = to_spi_device(dev); mcp251x_can_suspend() local
1193 struct mcp251x_priv *priv = spi_get_drvdata(spi); mcp251x_can_suspend()
1197 disable_irq(spi->irq); mcp251x_can_suspend()
1205 mcp251x_hw_sleep(spi); mcp251x_can_suspend()
1222 struct spi_device *spi = to_spi_device(dev); mcp251x_can_resume() local
1223 struct mcp251x_priv *priv = spi_get_drvdata(spi); mcp251x_can_resume()
1236 enable_irq(spi->irq); mcp251x_can_resume()
615 mcp251x_setup(struct net_device *net, struct mcp251x_priv *priv, struct spi_device *spi) mcp251x_setup() argument
/linux-4.4.14/arch/arm/mach-u300/
H A Ddummyspichip.c16 #include <linux/spi/spi.h>
35 /* When we cat /sys/bus/spi/devices/spi0.0/looptest this will be triggered */ dummy_looptest()
39 struct spi_device *spi = to_spi_device(dev); dummy_looptest() local
40 struct dummy *p_dummy = dev_get_drvdata(&spi->dev); dummy_looptest()
74 spi->bits_per_word = 8; dummy_looptest()
76 spi->master->setup(spi); dummy_looptest()
81 status = spi_w8r8(spi, 0xAA); dummy_looptest()
90 status = spi_write_then_read(spi, &txbuf[0], 8, &rxbuf[0], 8); dummy_looptest()
99 status = spi_write_then_read(spi, &txbuf[0], 14, &rxbuf[0], 14); dummy_looptest()
108 status = spi_write(spi, &txbuf[0], 8); dummy_looptest()
114 status = spi_read(spi, &rxbuf[0], 8); dummy_looptest()
123 status = spi_write(spi, &txbuf[0], 14); dummy_looptest()
129 status = spi_read(spi, &rxbuf[0], 14); dummy_looptest()
139 status = spi_write(spi, &bigtxbuf_virtual[0], DMA_TEST_SIZE); dummy_looptest()
145 status = spi_read(spi, &bigrxbuf_virtual[0], DMA_TEST_SIZE); dummy_looptest()
157 spi->bits_per_word = 16; dummy_looptest()
159 spi->master->setup(spi); dummy_looptest()
163 status = spi_w8r8(spi, 0xAA); dummy_looptest()
175 status = spi_write_then_read(spi, &txbuf[0], 8, &rxbuf[0], 8); dummy_looptest()
184 status = spi_write_then_read(spi, &txbuf[0], 14, &rxbuf[0], 14); dummy_looptest()
194 status = spi_write(spi, &bigtxbuf_virtual[0], DMA_TEST_SIZE); dummy_looptest()
201 status = spi_read(spi, &bigrxbuf_virtual[0], DMA_TEST_SIZE); dummy_looptest()
218 static int pl022_dummy_probe(struct spi_device *spi) pl022_dummy_probe() argument
223 dev_info(&spi->dev, "probing dummy SPI device\n"); pl022_dummy_probe()
229 dev_set_drvdata(&spi->dev, p_dummy); pl022_dummy_probe()
233 status = device_create_file(&spi->dev, &dev_attr_looptest); pl022_dummy_probe()
235 dev_dbg(&spi->dev, "device_create_file looptest failure.\n"); pl022_dummy_probe()
242 dev_set_drvdata(&spi->dev, NULL); pl022_dummy_probe()
247 static int pl022_dummy_remove(struct spi_device *spi) pl022_dummy_remove() argument
249 struct dummy *p_dummy = dev_get_drvdata(&spi->dev); pl022_dummy_remove()
251 dev_info(&spi->dev, "removing dummy SPI device\n"); pl022_dummy_remove()
252 device_remove_file(&spi->dev, &dev_attr_looptest); pl022_dummy_remove()
253 dev_set_drvdata(&spi->dev, NULL); pl022_dummy_remove()
266 .name = "spi-dummy",
/linux-4.4.14/drivers/staging/iio/resolver/
H A Dad2s90.c14 #include <linux/spi/spi.h>
61 static int ad2s90_probe(struct spi_device *spi) ad2s90_probe() argument
67 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); ad2s90_probe()
71 spi_set_drvdata(spi, indio_dev); ad2s90_probe()
74 st->sdev = spi; ad2s90_probe()
75 indio_dev->dev.parent = &spi->dev; ad2s90_probe()
80 indio_dev->name = spi_get_device_id(spi)->name; ad2s90_probe()
87 spi->max_speed_hz = 830000; ad2s90_probe()
88 spi->mode = SPI_MODE_3; ad2s90_probe()
89 spi_setup(spi); ad2s90_probe()
98 MODULE_DEVICE_TABLE(spi, ad2s90_id);
H A Dad2s1200.c15 #include <linux/spi/spi.h>
104 static int ad2s1200_probe(struct spi_device *spi) ad2s1200_probe() argument
109 unsigned short *pins = spi->dev.platform_data; ad2s1200_probe()
112 ret = devm_gpio_request_one(&spi->dev, pins[pn], GPIOF_DIR_OUT, ad2s1200_probe()
115 dev_err(&spi->dev, "request gpio pin %d failed\n", ad2s1200_probe()
120 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); ad2s1200_probe()
123 spi_set_drvdata(spi, indio_dev); ad2s1200_probe()
126 st->sdev = spi; ad2s1200_probe()
130 indio_dev->dev.parent = &spi->dev; ad2s1200_probe()
135 indio_dev->name = spi_get_device_id(spi)->name; ad2s1200_probe()
137 ret = devm_iio_device_register(&spi->dev, indio_dev); ad2s1200_probe()
141 spi->max_speed_hz = AD2S1200_HZ; ad2s1200_probe()
142 spi->mode = SPI_MODE_3; ad2s1200_probe()
143 spi_setup(spi); ad2s1200_probe()
153 MODULE_DEVICE_TABLE(spi, ad2s1200_id);
/linux-4.4.14/drivers/base/regmap/
H A Dregmap-spi.c14 #include <linux/spi/spi.h>
35 struct spi_device *spi = to_spi_device(dev); regmap_spi_write() local
37 return spi_write(spi, data, count); regmap_spi_write()
45 struct spi_device *spi = to_spi_device(dev); regmap_spi_gather_write() local
54 return spi_sync(spi, &m); regmap_spi_gather_write()
66 struct spi_device *spi = to_spi_device(dev); regmap_spi_async_write() local
81 return spi_async(spi, &async->m); regmap_spi_async_write()
100 struct spi_device *spi = to_spi_device(dev); regmap_spi_read() local
102 return spi_write_then_read(spi, reg, reg_size, val, val_size); regmap_spi_read()
116 struct regmap *__regmap_init_spi(struct spi_device *spi, __regmap_init_spi() argument
121 return __regmap_init(&spi->dev, &regmap_spi, &spi->dev, config, __regmap_init_spi()
126 struct regmap *__devm_regmap_init_spi(struct spi_device *spi, __devm_regmap_init_spi() argument
131 return __devm_regmap_init(&spi->dev, &regmap_spi, &spi->dev, config, __devm_regmap_init_spi()
/linux-4.4.14/drivers/char/tpm/st33zp24/
H A DMakefile11 tpm_st33zp24_spi-objs = spi.o
/linux-4.4.14/arch/sh/include/asm/
H A Dspi.h10 void (*chip_select)(struct sh_spi_info *spi, int cs, int state);
/linux-4.4.14/Documentation/
H A DMakefile3 networking pcmcia prctl ptp spi timers vDSO video4linux \
/linux-4.4.14/net/nfc/nci/
H A DMakefile9 nci_spi-y += spi.o
/linux-4.4.14/drivers/video/fbdev/mmp/hw/
H A Dmmp_spi.c3 * using the spi in LCD controler for commands send
28 #include <linux/spi/spi.h>
43 static inline int lcd_spi_write(struct spi_device *spi, u32 data) lcd_spi_write() argument
48 *(void **)spi_master_get_devdata(spi->master); lcd_spi_write()
53 switch (spi->bits_per_word) { lcd_spi_write()
64 dev_err(&spi->dev, "Wrong spi bit length\n"); lcd_spi_write()
79 dev_err(&spi->dev, "spi cmd send time out\n"); lcd_spi_write()
94 static int lcd_spi_setup(struct spi_device *spi) lcd_spi_setup() argument
97 *(void **)spi_master_get_devdata(spi->master); lcd_spi_setup()
101 CFG_TXBITS(spi->bits_per_word) | lcd_spi_setup()
107 * After set mode it need a time to pull up the spi singals, lcd_spi_setup()
108 * or it would cause the wrong waveform when send spi command, lcd_spi_setup()
120 static int lcd_spi_one_transfer(struct spi_device *spi, struct spi_message *m) lcd_spi_one_transfer() argument
126 switch (spi->bits_per_word) { lcd_spi_one_transfer()
129 lcd_spi_write(spi, ((u8 *)t->tx_buf)[i]); lcd_spi_one_transfer()
133 lcd_spi_write(spi, ((u16 *)t->tx_buf)[i]); lcd_spi_one_transfer()
137 lcd_spi_write(spi, ((u32 *)t->tx_buf)[i]); lcd_spi_one_transfer()
140 dev_err(&spi->dev, "Wrong spi bit length\n"); lcd_spi_one_transfer()
164 /* set bus num to 5 to avoid conflict with other spi hosts */ lcd_spi_register()
/linux-4.4.14/drivers/nfc/nfcmrvl/
H A Dspi.c28 #include <linux/spi/spi.h>
36 struct spi_device *spi; member in struct:nfcmrvl_spi_drv_data
60 nfc_err(&drv_data->spi->dev, "failed to read spi packet"); nfcmrvl_spi_int_irq_thread_fn()
65 nfc_err(&drv_data->spi->dev, "corrupted RX packet"); nfcmrvl_spi_int_irq_thread_fn()
143 static int nfcmrvl_spi_probe(struct spi_device *spi) nfcmrvl_spi_probe() argument
150 drv_data = devm_kzalloc(&spi->dev, sizeof(*drv_data), GFP_KERNEL); nfcmrvl_spi_probe()
154 drv_data->spi = spi; nfcmrvl_spi_probe()
156 spi_set_drvdata(spi, drv_data); nfcmrvl_spi_probe()
158 pdata = spi->dev.platform_data; nfcmrvl_spi_probe()
160 if (!pdata && spi->dev.of_node) nfcmrvl_spi_probe()
161 if (nfcmrvl_spi_parse_dt(spi->dev.of_node, &config) == 0) nfcmrvl_spi_probe()
167 ret = devm_request_threaded_irq(&drv_data->spi->dev, pdata->irq, nfcmrvl_spi_probe()
172 nfc_err(&drv_data->spi->dev, "Unable to register IRQ handler"); nfcmrvl_spi_probe()
178 &drv_data->spi->dev, nfcmrvl_spi_probe()
185 drv_data->nci_spi = nci_spi_allocate_spi(drv_data->spi, 0, 10, nfcmrvl_spi_probe()
193 static int nfcmrvl_spi_remove(struct spi_device *spi) nfcmrvl_spi_remove() argument
195 struct nfcmrvl_spi_drv_data *drv_data = spi_get_drvdata(spi); nfcmrvl_spi_remove()
202 { .compatible = "marvell,nfc-spi", },
211 MODULE_DEVICE_TABLE(spi, nfcmrvl_spi_id_table);
/linux-4.4.14/drivers/media/tuners/
H A Dmsi001.c40 struct spi_device *spi; member in struct:msi001_dev
62 return spi_write(dev->spi, &data, 3); msi001_wreg()
68 struct spi_device *spi = dev->spi; msi001_set_gain() local
72 dev_dbg(&spi->dev, "lna=%d mixer=%d if=%d\n", msi001_set_gain()
88 dev_dbg(&spi->dev, "failed %d\n", ret); msi001_set_gain()
94 struct spi_device *spi = dev->spi; msi001_set_tuner() local
152 dev_dbg(&spi->dev, "f_rf=%d f_if=%d\n", f_rf, f_if); msi001_set_tuner()
200 dev_dbg(&spi->dev, "bandwidth selected=%d\n", bandwidth_lut[i].freq); msi001_set_tuner()
239 dev_dbg(&spi->dev, msi001_set_tuner()
290 dev_dbg(&spi->dev, "failed %d\n", ret); msi001_set_tuner()
297 struct spi_device *spi = dev->spi; msi001_s_power() local
300 dev_dbg(&spi->dev, "on=%d\n", on); msi001_s_power()
317 struct spi_device *spi = dev->spi; msi001_g_tuner() local
319 dev_dbg(&spi->dev, "index=%d\n", v->index); msi001_g_tuner()
333 struct spi_device *spi = dev->spi; msi001_s_tuner() local
335 dev_dbg(&spi->dev, "index=%d\n", v->index); msi001_s_tuner()
342 struct spi_device *spi = dev->spi; msi001_g_frequency() local
344 dev_dbg(&spi->dev, "tuner=%d\n", f->tuner); msi001_g_frequency()
353 struct spi_device *spi = dev->spi; msi001_s_frequency() local
356 dev_dbg(&spi->dev, "tuner=%d type=%d frequency=%u\n", msi001_s_frequency()
373 struct spi_device *spi = dev->spi; msi001_enum_freq_bands() local
375 dev_dbg(&spi->dev, "tuner=%d type=%d index=%d\n", msi001_enum_freq_bands()
404 struct spi_device *spi = dev->spi; msi001_s_ctrl() local
408 dev_dbg(&spi->dev, "id=%d name=%s val=%d min=%lld max=%lld step=%lld\n", msi001_s_ctrl()
433 dev_dbg(&spi->dev, "unknown control %d\n", ctrl->id); msi001_s_ctrl()
444 static int msi001_probe(struct spi_device *spi) msi001_probe() argument
449 dev_dbg(&spi->dev, "\n"); msi001_probe()
457 dev->spi = spi; msi001_probe()
459 v4l2_spi_subdev_init(&dev->sd, spi, &msi001_ops); msi001_probe()
476 dev_err(&spi->dev, "Could not initialize controls\n"); msi001_probe()
490 static int msi001_remove(struct spi_device *spi) msi001_remove() argument
492 struct v4l2_subdev *sd = spi_get_drvdata(spi); msi001_remove()
495 dev_dbg(&spi->dev, "\n"); msi001_remove()
511 MODULE_DEVICE_TABLE(spi, msi001_id_table);
/linux-4.4.14/include/trace/events/
H A Dspi.h2 #define TRACE_SYSTEM spi
24 TP_printk("spi%d", (int)__entry->bus_num)
57 __entry->bus_num = msg->spi->master->bus_num;
58 __entry->chip_select = msg->spi->chip_select;
62 TP_printk("spi%d.%d %p", (int)__entry->bus_num,
98 __entry->bus_num = msg->spi->master->bus_num;
99 __entry->chip_select = msg->spi->chip_select;
105 TP_printk("spi%d.%d %p len=%u/%u", (int)__entry->bus_num,
125 __entry->bus_num = msg->spi->master->bus_num;
126 __entry->chip_select = msg->spi->chip_select;
131 TP_printk("spi%d.%d %p len=%d", (int)__entry->bus_num,
/linux-4.4.14/arch/mips/txx9/generic/
H A Dspi_eeprom.c16 #include <linux/spi/spi.h>
17 #include <linux/spi/eeprom.h>
18 #include <asm/txx9/spi.h>
44 /* simple temporary spi driver to provide early access to seeprom. */
54 static int __init early_seeprom_probe(struct spi_device *spi) early_seeprom_probe() argument
62 dev_info(&spi->dev, "spiclk %u KHz.\n", early_seeprom_probe()
63 (spi->max_speed_hz + 500) / 1000); early_seeprom_probe()
64 if (read_param->busid != spi->master->bus_num || early_seeprom_probe()
65 read_param->chipid != spi->chip_select) early_seeprom_probe()
72 stat = spi_write_then_read(spi, cmd, sizeof(cmd), buf, c); early_seeprom_probe()
/linux-4.4.14/drivers/staging/wilc1000/
H A Dlinux_wlan_spi.h4 #include <linux/spi/spi.h>
H A Dwilc_spi.c215 PRINT_ER("[wilc spi]: Failed cmd write, bus error...\n"); spi_cmd()
241 PRINT_ER("[wilc spi]: Failed cmd response read, bus error...\n"); spi_cmd_rsp()
247 PRINT_ER("[wilc spi]: Failed cmd response, cmd (%02x), resp (%02x)\n", cmd, rsp); spi_cmd_rsp()
256 PRINT_ER("[wilc spi]: Failed cmd state read, bus error...\n"); spi_cmd_rsp()
262 PRINT_ER("[wilc spi]: Failed cmd state response state (%02x)\n", rsp); spi_cmd_rsp()
401 PRINT_ER("[wilc spi]: spi buffer size too small (%d) (%zu)\n", spi_cmd_complete()
406 /* zero spi write buffers. */ spi_cmd_complete()
413 PRINT_ER("[wilc spi]: Failed cmd write, bus error...\n"); spi_cmd_complete()
433 PRINT_ER("[wilc spi]: Failed cmd response, cmd (%02x)" spi_cmd_complete()
444 PRINT_ER("[wilc spi]: Failed cmd state response " spi_cmd_complete()
472 PRINT_ER("[wilc spi]: Error, data read " spi_cmd_complete()
488 PRINT_ER("[wilc spi]: buffer overrun when reading data.\n"); spi_cmd_complete()
501 PRINT_ER("[wilc spi]: buffer overrun when reading crc.\n"); spi_cmd_complete()
528 PRINT_ER("[wilc spi]: Failed data block read, bus error...\n"); spi_cmd_complete()
538 PRINT_ER("[wilc spi]: Failed data block crc read, bus error...\n"); spi_cmd_complete()
569 PRINT_ER("[wilc spi]: Failed data response read, bus error...\n"); spi_cmd_complete()
585 PRINT_ER("[wilc spi]: Failed data block read, bus error...\n"); spi_cmd_complete()
595 PRINT_ER("[wilc spi]: Failed data block crc read, bus error...\n"); spi_cmd_complete()
633 PRINT_ER("[wilc spi]: Failed data response read, bus error...\n"); spi_data_read()
645 PRINT_ER("[wilc spi]: Failed data response read...(%02x)\n", rsp); spi_data_read()
654 PRINT_ER("[wilc spi]: Failed data block read, bus error...\n"); spi_data_read()
664 PRINT_ER("[wilc spi]: Failed data block crc read, bus error...\n"); spi_data_read()
713 PRINT_ER("[wilc spi]: Failed data block cmd write, bus error...\n"); spi_data_write()
722 PRINT_ER("[wilc spi]: Failed data block write, bus error...\n"); spi_data_write()
732 PRINT_ER("[wilc spi]: Failed data block crc write, bus error...\n"); spi_data_write()
764 PRINT_ER("[wilc spi]: Failed internal write cmd...\n"); spi_internal_write()
776 PRINT_ER("[wilc spi]: Failed internal read cmd...\n"); spi_internal_read()
810 PRINT_ER("[wilc spi]: Failed cmd, write reg (%08x)...\n", addr); spi_write_reg()
829 PRINT_ER("[wilc spi]: Failed cmd, write block (%08x)...\n", addr); spi_write()
838 PRINT_ER("[wilc spi]: Failed block data write...\n"); spi_write()
859 PRINT_ER("[wilc spi]: Failed cmd, read reg (%08x)...\n", addr); spi_read_reg()
880 PRINT_ER("[wilc spi]: Failed cmd, read block (%08x)...\n", addr); spi_read()
898 PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_HOST_RX_CTRL_0); spi_clear_int()
924 PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_PIN_MUX_0); spi_sync()
930 PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_PIN_MUX_0); spi_sync()
939 PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_INTR_ENABLE); spi_sync()
945 PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_INTR_ENABLE); spi_sync()
962 PRINT_ER("[wilc spi]: Fail cmd read chip id...\n"); spi_init()
974 PRINT_ER("[wilc spi]: Failed io init bus...\n"); spi_init()
980 g_spi.spi_tx = inp->io_func.u.spi.spi_tx; spi_init()
981 g_spi.spi_rx = inp->io_func.u.spi.spi_rx; spi_init()
982 g_spi.spi_trx = inp->io_func.u.spi.spi_trx; spi_init()
983 g_spi.spi_max_speed = inp->io_func.u.spi.spi_max_speed; spi_init()
996 PRINT_ER("[wilc spi]: Failed internal read protocol with CRC on, retyring with CRC off...\n"); spi_init()
999 PRINT_ER("[wilc spi]: Failed internal read protocol...\n"); spi_init()
1008 PRINT_ER("[wilc spi %d]: Failed internal write protocol reg...\n", __LINE__); spi_init()
1019 PRINT_ER("[wilc spi]: Fail cmd read chip id...\n"); spi_init()
1022 /* PRINT_ER("[wilc spi]: chipid (%08x)\n", chipid); */ spi_init()
1053 PRINT_ER("[wilc spi]: Failed read WILC_VMM_TO_HOST_SIZE ...\n"); spi_read_size()
1080 PRINT_ER("[wilc spi]: Failed read WILC_VMM_TO_HOST_SIZE ...\n"); spi_read_int()
1108 PRINT_ER("[wilc spi]: Unexpected interrupt (2): j=%d, tmp=%x, mask=%x\n", j, tmp, unkmown_mask); spi_read_int()
1147 PRINT_ER("[wilc spi]: Failed spi_write_reg, set reg %x ...\n", 0x10c8 + i * 4); spi_clear_int_ext()
1152 PRINT_ER("[wilc spi]: Unexpected interrupt cleared %d...\n", i); spi_clear_int_ext()
1170 PRINT_ER("[wilc spi]: fail write reg vmm_tbl_ctl...\n"); spi_clear_int_ext()
1180 PRINT_ER("[wilc spi]: fail write reg vmm_core_ctl...\n"); spi_clear_int_ext()
1196 PRINT_ER("[wilc spi]: Too many interupts (%d)...\n", nint); spi_sync_ext()
1207 PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_PIN_MUX_0); spi_sync_ext()
1213 PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_PIN_MUX_0); spi_sync_ext()
1222 PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_INTR_ENABLE); spi_sync_ext()
1231 PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_INTR_ENABLE); spi_sync_ext()
1237 PRINT_ER("[wilc spi]: Failed read reg (%08x)...\n", WILC_INTR2_ENABLE); spi_sync_ext()
1247 PRINT_ER("[wilc spi]: Failed write reg (%08x)...\n", WILC_INTR2_ENABLE); spi_sync_ext()
1256 * Global spi HIF function table
/linux-4.4.14/arch/mips/include/asm/mach-au1x00/
H A Dau1550_spi.h11 void (*activate_cs)(struct au1550_spi_info *spi, int cs, int polarity);
12 void (*deactivate_cs)(struct au1550_spi_info *spi, int cs, int polarity);
/linux-4.4.14/drivers/misc/eeprom/
H A Deeprom_93xx46.c17 #include <linux/spi/spi.h>
29 struct spi_device *spi; member in struct:eeprom_93xx46_dev
61 dev_dbg(&edev->spi->dev, "read cmd 0x%x, %d Hz\n", eeprom_93xx46_bin_read()
62 cmd_addr, edev->spi->max_speed_hz); eeprom_93xx46_bin_read()
82 ret = spi_sync(edev->spi, &m); eeprom_93xx46_bin_read()
86 dev_err(&edev->spi->dev, "read %zu bytes at %d: err. %d\n", eeprom_93xx46_bin_read()
113 dev_dbg(&edev->spi->dev, "ew cmd 0x%04x\n", cmd_addr); eeprom_93xx46_ew()
128 ret = spi_sync(edev->spi, &m); eeprom_93xx46_ew()
132 dev_err(&edev->spi->dev, "erase/write %sable error %d\n", eeprom_93xx46_ew()
163 dev_dbg(&edev->spi->dev, "write cmd 0x%x\n", cmd_addr); eeprom_93xx46_write_word()
178 ret = spi_sync(edev->spi, &m); eeprom_93xx46_write_word()
215 dev_err(&edev->spi->dev, "write failed at %d: %d\n", eeprom_93xx46_bin_write()
261 ret = spi_sync(edev->spi, &m); eeprom_93xx46_eral()
263 dev_err(&edev->spi->dev, "erase error %d\n", ret); eeprom_93xx46_eral()
297 static int eeprom_93xx46_probe(struct spi_device *spi) eeprom_93xx46_probe() argument
303 pd = spi->dev.platform_data; eeprom_93xx46_probe()
305 dev_err(&spi->dev, "missing platform data\n"); eeprom_93xx46_probe()
318 dev_err(&spi->dev, "unspecified address type\n"); eeprom_93xx46_probe()
325 edev->spi = spi_dev_get(spi); eeprom_93xx46_probe()
338 err = sysfs_create_bin_file(&spi->dev.kobj, &edev->bin); eeprom_93xx46_probe()
342 dev_info(&spi->dev, "%d-bit eeprom %s\n", eeprom_93xx46_probe()
347 if (device_create_file(&spi->dev, &dev_attr_erase)) eeprom_93xx46_probe()
348 dev_err(&spi->dev, "can't create erase interface\n"); eeprom_93xx46_probe()
351 spi_set_drvdata(spi, edev); eeprom_93xx46_probe()
358 static int eeprom_93xx46_remove(struct spi_device *spi) eeprom_93xx46_remove() argument
360 struct eeprom_93xx46_dev *edev = spi_get_drvdata(spi); eeprom_93xx46_remove()
363 device_remove_file(&spi->dev, &dev_attr_erase); eeprom_93xx46_remove()
365 sysfs_remove_bin_file(&spi->dev.kobj, &edev->bin); eeprom_93xx46_remove()
383 MODULE_ALIAS("spi:93xx46");
H A Dat25.c19 #include <linux/spi/spi.h>
20 #include <linux/spi/eeprom.h>
31 struct spi_device *spi; member in struct:at25_data
125 status = spi_sync(at25->spi, &m); at25_ee_read()
126 dev_dbg(&at25->spi->dev, at25_ee_read()
186 status = spi_write(at25->spi, cp, 1); at25_ee_write()
188 dev_dbg(&at25->spi->dev, "WREN --> %d\n", at25_ee_write()
215 status = spi_write(at25->spi, bounce, at25_ee_write()
217 dev_dbg(&at25->spi->dev, at25_ee_write()
232 sr = spi_w8r8(at25->spi, AT25_RDSR); at25_ee_write()
234 dev_dbg(&at25->spi->dev, at25_ee_write()
245 dev_err(&at25->spi->dev, at25_ee_write()
357 static int at25_probe(struct spi_device *spi) at25_probe() argument
366 if (!spi->dev.platform_data) { at25_probe()
367 err = at25_fw_to_chip(&spi->dev, &chip); at25_probe()
371 chip = *(struct spi_eeprom *)spi->dev.platform_data; at25_probe()
381 dev_dbg(&spi->dev, "unsupported address type\n"); at25_probe()
389 sr = spi_w8r8(spi, AT25_RDSR); at25_probe()
391 dev_dbg(&spi->dev, "rdsr --> %d (%02x)\n", sr, sr); at25_probe()
395 at25 = devm_kzalloc(&spi->dev, sizeof(struct at25_data), GFP_KERNEL); at25_probe()
401 at25->spi = spi_dev_get(spi); at25_probe()
402 spi_set_drvdata(spi, at25); at25_probe()
427 err = sysfs_create_bin_file(&spi->dev.kobj, &at25->bin); at25_probe()
434 dev_info(&spi->dev, "%Zd %s %s eeprom%s, pagesize %u\n", at25_probe()
445 static int at25_remove(struct spi_device *spi) at25_remove() argument
449 at25 = spi_get_drvdata(spi); at25_remove()
450 sysfs_remove_bin_file(&spi->dev.kobj, &at25->bin); at25_remove()
476 MODULE_ALIAS("spi:at25");
/linux-4.4.14/drivers/iio/imu/
H A Dadis16400_buffer.c4 #include <linux/spi/spi.h>
67 u32 old_speed_hz = st->adis.spi->max_speed_hz; adis16400_trigger_handler()
75 st->adis.spi->max_speed_hz > ADIS16400_SPI_BURST) { adis16400_trigger_handler()
76 st->adis.spi->max_speed_hz = ADIS16400_SPI_BURST; adis16400_trigger_handler()
77 spi_setup(st->adis.spi); adis16400_trigger_handler()
80 ret = spi_sync(adis->spi, &adis->msg); adis16400_trigger_handler()
82 dev_err(&adis->spi->dev, "Failed to read data: %d\n", ret); adis16400_trigger_handler()
85 st->adis.spi->max_speed_hz = old_speed_hz; adis16400_trigger_handler()
86 spi_setup(st->adis.spi); adis16400_trigger_handler()
H A Dadis_trigger.c12 #include <linux/spi/spi.h>
50 ret = request_irq(adis->spi->irq, adis_probe_trigger()
58 adis->trig->dev.parent = &adis->spi->dev; adis_probe_trigger()
70 free_irq(adis->spi->irq, adis->trig); adis_probe_trigger()
86 free_irq(adis->spi->irq, adis->trig); adis_remove_trigger()
/linux-4.4.14/drivers/iio/dac/
H A Dmcp4922.c23 #include <linux/spi/spi.h>
38 struct spi_device *spi; member in struct:mcp4922_state
66 return spi_write(state->spi, state->mosi, 2); mcp4922_spi_write()
125 static int mcp4922_probe(struct spi_device *spi) mcp4922_probe() argument
132 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*state)); mcp4922_probe()
137 state->spi = spi; mcp4922_probe()
138 state->vref_reg = devm_regulator_get(&spi->dev, "vref"); mcp4922_probe()
140 dev_err(&spi->dev, "Vref regulator not specified\n"); mcp4922_probe()
146 dev_err(&spi->dev, "Failed to enable vref regulator: %d\n", mcp4922_probe()
153 dev_err(&spi->dev, "Failed to read vref regulator: %d\n", mcp4922_probe()
159 spi_set_drvdata(spi, indio_dev); mcp4922_probe()
160 id = spi_get_device_id(spi); mcp4922_probe()
161 indio_dev->dev.parent = &spi->dev; mcp4922_probe()
170 dev_err(&spi->dev, "Failed to register iio device: %d\n", mcp4922_probe()
183 static int mcp4922_remove(struct spi_device *spi) mcp4922_remove() argument
185 struct iio_dev *indio_dev = spi_get_drvdata(spi); mcp4922_remove()
201 MODULE_DEVICE_TABLE(spi, mcp4922_id);
H A Dad5504.c13 #include <linux/spi/spi.h>
44 * @spi: spi_device
52 struct spi_device *spi; member in struct:ad5504_state
75 return spi_write(st->spi, &st->data[0], 2); ad5504_spi_write()
88 ret = spi_sync_transfer(st->spi, &t, 1); ad5504_spi_read()
274 static int ad5504_probe(struct spi_device *spi) ad5504_probe() argument
276 struct ad5504_platform_data *pdata = spi->dev.platform_data; ad5504_probe()
282 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); ad5504_probe()
285 reg = devm_regulator_get(&spi->dev, "vcc"); ad5504_probe()
298 spi_set_drvdata(spi, indio_dev); ad5504_probe()
305 dev_warn(&spi->dev, "reference voltage unspecified\n"); ad5504_probe()
308 st->spi = spi; ad5504_probe()
309 indio_dev->dev.parent = &spi->dev; ad5504_probe()
310 indio_dev->name = spi_get_device_id(st->spi)->name; ad5504_probe()
312 if (spi_get_device_id(st->spi)->driver_data == ID_AD5501) ad5504_probe()
319 if (spi->irq) { ad5504_probe()
320 ret = devm_request_threaded_irq(&spi->dev, spi->irq, ad5504_probe()
324 spi_get_device_id(st->spi)->name, ad5504_probe()
343 static int ad5504_remove(struct spi_device *spi) ad5504_remove() argument
345 struct iio_dev *indio_dev = spi_get_drvdata(spi); ad5504_remove()
361 MODULE_DEVICE_TABLE(spi, ad5504_id);
H A Dad5764.c14 #include <linux/spi/spi.h>
47 * @spi: spi_device
50 * @data: spi transfer buffers
54 struct spi_device *spi; member in struct:ad5764_state
133 ret = spi_write(st->spi, &st->data[0].d8[1], 3); ad5764_write()
159 ret = spi_sync_transfer(st->spi, t, ARRAY_SIZE(t)); ad5764_read()
274 static int ad5764_probe(struct spi_device *spi) ad5764_probe() argument
276 enum ad5764_type type = spi_get_device_id(spi)->driver_data; ad5764_probe()
281 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); ad5764_probe()
283 dev_err(&spi->dev, "Failed to allocate iio device\n"); ad5764_probe()
288 spi_set_drvdata(spi, indio_dev); ad5764_probe()
290 st->spi = spi; ad5764_probe()
293 indio_dev->dev.parent = &spi->dev; ad5764_probe()
294 indio_dev->name = spi_get_device_id(spi)->name; ad5764_probe()
304 ret = devm_regulator_bulk_get(&st->spi->dev, ad5764_probe()
307 dev_err(&spi->dev, "Failed to request vref regulators: %d\n", ad5764_probe()
315 dev_err(&spi->dev, "Failed to enable vref regulators: %d\n", ad5764_probe()
323 dev_err(&spi->dev, "Failed to register iio device: %d\n", ret); ad5764_probe()
335 static int ad5764_remove(struct spi_device *spi) ad5764_remove() argument
337 struct iio_dev *indio_dev = spi_get_drvdata(spi); ad5764_remove()
355 MODULE_DEVICE_TABLE(spi, ad5764_ids);
H A Dad7303.c12 #include <linux/spi/spi.h>
31 * @spi: the device for this driver instance
34 * @data: spi transfer buffer
38 struct spi_device *spi; member in struct:ad7303_state
59 return spi_write(st->spi, &st->data, sizeof(st->data)); ad7303_write()
199 static int ad7303_probe(struct spi_device *spi) ad7303_probe() argument
201 const struct spi_device_id *id = spi_get_device_id(spi); ad7303_probe()
207 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); ad7303_probe()
212 spi_set_drvdata(spi, indio_dev); ad7303_probe()
214 st->spi = spi; ad7303_probe()
216 st->vdd_reg = devm_regulator_get(&spi->dev, "Vdd"); ad7303_probe()
224 if (spi->dev.of_node) { ad7303_probe()
225 ext_ref = of_property_read_bool(spi->dev.of_node, ad7303_probe()
228 struct ad7303_platform_data *pdata = spi->dev.platform_data; ad7303_probe()
236 st->vref_reg = devm_regulator_get(&spi->dev, "REF"); ad7303_probe()
249 indio_dev->dev.parent = &spi->dev; ad7303_probe()
270 static int ad7303_remove(struct spi_device *spi) ad7303_remove() argument
272 struct iio_dev *indio_dev = spi_get_drvdata(spi); ad7303_remove()
294 MODULE_DEVICE_TABLE(spi, ad7303_spi_ids);
H A Dad5449.c15 #include <linux/spi/spi.h>
54 * @spi: the SPI device for this driver instance
59 * @data: spi transfer buffers
62 struct spi_device *spi; member in struct:ad5449
93 ret = spi_write(st->spi, st->data, 2); ad5449_write()
120 ret = spi_sync_transfer(st->spi, t, ARRAY_SIZE(t)); ad5449_read()
269 static int ad5449_spi_probe(struct spi_device *spi) ad5449_spi_probe() argument
271 struct ad5449_platform_data *pdata = spi->dev.platform_data; ad5449_spi_probe()
272 const struct spi_device_id *id = spi_get_device_id(spi); ad5449_spi_probe()
278 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); ad5449_spi_probe()
283 spi_set_drvdata(spi, indio_dev); ad5449_spi_probe()
286 st->spi = spi; ad5449_spi_probe()
291 ret = devm_regulator_bulk_get(&spi->dev, st->chip_info->num_channels, ad5449_spi_probe()
300 indio_dev->dev.parent = &spi->dev; ad5449_spi_probe()
332 static int ad5449_spi_remove(struct spi_device *spi) ad5449_spi_remove() argument
334 struct iio_dev *indio_dev = spi_get_drvdata(spi); ad5449_spi_remove()
354 MODULE_DEVICE_TABLE(spi, ad5449_spi_ids);
H A Dad5686.c14 #include <linux/spi/spi.h>
59 * @spi: spi_device
65 * @data: spi transfer buffers
69 struct spi_device *spi; member in struct:ad5686_state
104 return spi_write(st->spi, &st->data[0].d8[1], 3); ad5686_spi_write()
126 ret = spi_sync_transfer(st->spi, t, ARRAY_SIZE(t)); ad5686_spi_read()
312 static int ad5686_probe(struct spi_device *spi) ad5686_probe() argument
318 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); ad5686_probe()
323 spi_set_drvdata(spi, indio_dev); ad5686_probe()
325 st->reg = devm_regulator_get_optional(&spi->dev, "vcc"); ad5686_probe()
339 &ad5686_chip_info_tbl[spi_get_device_id(spi)->driver_data]; ad5686_probe()
346 st->spi = spi; ad5686_probe()
351 indio_dev->dev.parent = &spi->dev; ad5686_probe()
352 indio_dev->name = spi_get_device_id(spi)->name; ad5686_probe()
375 static int ad5686_remove(struct spi_device *spi) ad5686_remove() argument
377 struct iio_dev *indio_dev = spi_get_drvdata(spi); ad5686_remove()
393 MODULE_DEVICE_TABLE(spi, ad5686_id);
H A Dad5360.c14 #include <linux/spi/spi.h>
67 * @spi: spi_device
71 * @data: spi transfer buffers
75 struct spi_device *spi; member in struct:ad5360_state
202 return spi_write(st->spi, &st->data[0].d8[1], 3); ad5360_write_unlocked()
240 ret = spi_sync_transfer(st->spi, t, ARRAY_SIZE(t)); ad5360_read()
458 static int ad5360_probe(struct spi_device *spi) ad5360_probe() argument
460 enum ad5360_type type = spi_get_device_id(spi)->driver_data; ad5360_probe()
466 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); ad5360_probe()
468 dev_err(&spi->dev, "Failed to allocate iio device\n"); ad5360_probe()
473 spi_set_drvdata(spi, indio_dev); ad5360_probe()
476 st->spi = spi; ad5360_probe()
478 indio_dev->dev.parent = &spi->dev; ad5360_probe()
479 indio_dev->name = spi_get_device_id(spi)->name; ad5360_probe()
486 dev_err(&spi->dev, "Failed to allocate channel spec: %d\n", ret); ad5360_probe()
493 ret = devm_regulator_bulk_get(&st->spi->dev, st->chip_info->num_vrefs, ad5360_probe()
496 dev_err(&spi->dev, "Failed to request vref regulators: %d\n", ret); ad5360_probe()
502 dev_err(&spi->dev, "Failed to enable vref regulators: %d\n", ret); ad5360_probe()
508 dev_err(&spi->dev, "Failed to register iio device: %d\n", ret); ad5360_probe()
522 static int ad5360_remove(struct spi_device *spi) ad5360_remove() argument
524 struct iio_dev *indio_dev = spi_get_drvdata(spi); ad5360_remove()
547 MODULE_DEVICE_TABLE(spi, ad5360_ids);
H A Dad5624r_spi.c2 * AD5624R, AD5644R, AD5664R Digital to analog convertors spi driver
13 #include <linux/spi/spi.h>
24 static int ad5624r_spi_write(struct spi_device *spi, ad5624r_spi_write() argument
43 return spi_write(spi, msg, 3); ad5624r_spi_write()
224 static int ad5624r_probe(struct spi_device *spi) ad5624r_probe() argument
230 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); ad5624r_probe()
234 st->reg = devm_regulator_get(&spi->dev, "vcc"); ad5624r_probe()
247 spi_set_drvdata(spi, indio_dev); ad5624r_probe()
249 &ad5624r_chip_info_tbl[spi_get_device_id(spi)->driver_data]; ad5624r_probe()
256 st->us = spi; ad5624r_probe()
258 indio_dev->dev.parent = &spi->dev; ad5624r_probe()
259 indio_dev->name = spi_get_device_id(spi)->name; ad5624r_probe()
265 ret = ad5624r_spi_write(spi, AD5624R_CMD_INTERNAL_REFER_SETUP, 0, ad5624r_probe()
283 static int ad5624r_remove(struct spi_device *spi) ad5624r_remove() argument
285 struct iio_dev *indio_dev = spi_get_drvdata(spi); ad5624r_remove()
304 MODULE_DEVICE_TABLE(spi, ad5624r_id);
317 MODULE_DESCRIPTION("Analog Devices AD5624/44/64R DAC spi driver");
H A Dad5791.c14 #include <linux/spi/spi.h>
74 * @spi: spi_device
84 struct spi_device *spi; member in struct:ad5791_state
117 return spi_write(st->spi, &st->data[0].d8[1], 3); ad5791_spi_write()
141 ret = spi_sync_transfer(st->spi, xfers, ARRAY_SIZE(xfers)); ad5791_spi_read()
346 static int ad5791_probe(struct spi_device *spi) ad5791_probe() argument
348 struct ad5791_platform_data *pdata = spi->dev.platform_data; ad5791_probe()
353 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); ad5791_probe()
357 st->reg_vdd = devm_regulator_get(&spi->dev, "vdd"); ad5791_probe()
370 st->reg_vss = devm_regulator_get(&spi->dev, "vss"); ad5791_probe()
384 st->spi = spi; ad5791_probe()
393 dev_warn(&spi->dev, "reference voltage unspecified\n"); ad5791_probe()
400 st->chip_info = &ad5791_chip_info_tbl[spi_get_device_id(spi) ad5791_probe()
413 spi_set_drvdata(spi, indio_dev); ad5791_probe()
414 indio_dev->dev.parent = &spi->dev; ad5791_probe()
418 = &ad5791_channels[spi_get_device_id(spi)->driver_data]; ad5791_probe()
420 indio_dev->name = spi_get_device_id(st->spi)->name; ad5791_probe()
436 static int ad5791_remove(struct spi_device *spi) ad5791_remove() argument
438 struct iio_dev *indio_dev = spi_get_drvdata(spi); ad5791_remove()
459 MODULE_DEVICE_TABLE(spi, ad5791_id);
/linux-4.4.14/drivers/iio/common/ssp_sensors/
H A Dssp_dev.c88 dev_err(&data->spi->dev, ssp_sync_available_sensors()
98 dev_err(&data->spi->dev, ssp_sync_available_sensors()
104 dev_info(&data->spi->dev, "current shutdown = %d, old = %d\n", enable, ssp_enable_mcu()
109 enable_irq(data->spi->irq); ssp_enable_mcu()
110 enable_irq_wake(data->spi->irq); ssp_enable_mcu()
113 disable_irq(data->spi->irq); ssp_enable_mcu()
114 disable_irq_wake(data->spi->irq); ssp_enable_mcu()
116 dev_warn(&data->spi->dev, "current shutdown = %d, old = %d\n", ssp_enable_mcu()
133 dev_warn(&data->spi->dev, ssp_check_fwbl()
142 dev_err(&data->spi->dev, "SSP_INVALID_REVISION\n"); ssp_check_fwbl()
146 dev_info(&data->spi->dev, ssp_check_fwbl()
169 dev_err(&data->spi->dev, "%s - Sensor state: 0x%x, RC: %u, CC: %u\n", ssp_wdt_work_func()
247 dev_err(&data->spi->dev, "Enabling sensor failed\n"); ssp_enable_sensor()
260 dev_err(&data->spi->dev, ssp_enable_sensor()
303 dev_err(&data->spi->dev, "Changing sensor delay failed\n"); ssp_change_delay()
334 dev_err(&data->spi->dev, "Remove sensor fail\n"); ssp_disable_sensor()
371 dev_err(&data->spi->dev, "%s - MCU %s ret = %d\n", __func__, ssp_initialize_mcu()
377 dev_info(&data->spi->dev, "MCU device ID = %d\n", ret); ssp_initialize_mcu()
385 dev_err(&data->spi->dev, ssp_initialize_mcu()
392 dev_err(&data->spi->dev, ssp_initialize_mcu()
398 dev_info(&data->spi->dev, "MCU Firm Rev : New = %8u\n", ssp_initialize_mcu()
413 dev_info(&data->spi->dev, "refreshing\n"); ssp_refresh_task()
524 static int ssp_probe(struct spi_device *spi) ssp_probe() argument
529 data = ssp_parse_dt(&spi->dev); ssp_probe()
531 dev_err(&spi->dev, "Failed to find platform data\n"); ssp_probe()
535 ret = mfd_add_devices(&spi->dev, -1, sensorhub_sensor_devs, ssp_probe()
538 dev_err(&spi->dev, "mfd add devices fail\n"); ssp_probe()
542 spi->mode = SPI_MODE_1; ssp_probe()
543 ret = spi_setup(spi); ssp_probe()
545 dev_err(&spi->dev, "Failed to setup spi\n"); ssp_probe()
550 data->spi = spi; ssp_probe()
551 spi_set_drvdata(spi, data); ssp_probe()
576 ret = request_threaded_irq(data->spi->irq, NULL, ssp_probe()
581 dev_err(&spi->dev, "Irq request fail\n"); ssp_probe()
589 enable_irq_wake(data->spi->irq); ssp_probe()
595 dev_err(&spi->dev, "Initialize_mcu failed\n"); ssp_probe()
599 dev_err(&spi->dev, "Firmware version not supported\n"); ssp_probe()
607 free_irq(data->spi->irq, data); ssp_probe()
612 dev_err(&spi->dev, "Probe failed!\n"); ssp_probe()
617 static int ssp_remove(struct spi_device *spi) ssp_remove() argument
619 struct ssp_data *data = spi_get_drvdata(spi); ssp_remove()
622 dev_err(&data->spi->dev, ssp_remove()
630 free_irq(data->spi->irq, data); ssp_remove()
638 mfd_remove_devices(&spi->dev); ssp_remove()
656 dev_err(&data->spi->dev, ssp_suspend()
664 disable_irq(data->spi->irq); ssp_suspend()
674 enable_irq(data->spi->irq); ssp_resume()
681 dev_err(&data->spi->dev, ssp_resume()
/linux-4.4.14/drivers/net/phy/
H A Dspi_ks8995.c6 * This file was based on: drivers/spi/at25.c
22 #include <linux/spi/spi.h>
97 struct spi_device *spi; member in struct:ks8995_switch
138 err = spi_sync(ks->spi, &m); ks8995_read()
169 err = spi_sync(ks->spi, &m); ks8995_write()
248 static int ks8995_probe(struct spi_device *spi) ks8995_probe() argument
256 pdata = spi->dev.platform_data; ks8995_probe()
258 ks = devm_kzalloc(&spi->dev, sizeof(*ks), GFP_KERNEL); ks8995_probe()
264 ks->spi = spi_dev_get(spi); ks8995_probe()
265 spi_set_drvdata(spi, ks); ks8995_probe()
267 spi->mode = SPI_MODE_0; ks8995_probe()
268 spi->bits_per_word = 8; ks8995_probe()
269 err = spi_setup(spi); ks8995_probe()
271 dev_err(&spi->dev, "spi_setup failed, err=%d\n", err); ks8995_probe()
277 dev_err(&spi->dev, "unable to read id registers, err=%d\n", ks8995_probe()
286 dev_err(&spi->dev, "unknown family id:%02x\n", ids[0]); ks8995_probe()
297 dev_err(&spi->dev, ks8995_probe()
303 dev_err(&spi->dev, "unknown chip:%02x,0\n", ids[1]); ks8995_probe()
313 err = sysfs_create_bin_file(&spi->dev.kobj, &ks->regs_attr); ks8995_probe()
315 dev_err(&spi->dev, "unable to create sysfs file, err=%d\n", ks8995_probe()
321 dev_info(&spi->dev, ks8995_probe()
325 dev_info(&spi->dev, "KSZ8864 device found, Revision:%x\n", ks8995_probe()
332 static int ks8995_remove(struct spi_device *spi) ks8995_remove() argument
334 struct ks8995_switch *ks = spi_get_drvdata(spi); ks8995_remove()
336 sysfs_remove_bin_file(&spi->dev.kobj, &ks->regs_attr); ks8995_remove()
345 .name = "spi-ks8995",
/linux-4.4.14/include/linux/platform_data/
H A Dspi-ep93xx.h24 int (*setup)(struct spi_device *spi);
25 void (*cleanup)(struct spi_device *spi);
26 void (*cs_control)(struct spi_device *spi, int value);
/linux-4.4.14/drivers/staging/iio/meter/
H A DMakefile15 obj-$(CONFIG_ADE7854_SPI) += ade7854-spi.o
H A Dade7854-spi.c11 #include <linux/spi/spi.h>
37 ret = spi_sync_transfer(st->spi, &xfer, 1); ade7854_spi_write_reg_8()
63 ret = spi_sync_transfer(st->spi, &xfer, 1); ade7854_spi_write_reg_16()
90 ret = spi_sync_transfer(st->spi, &xfer, 1); ade7854_spi_write_reg_24()
118 ret = spi_sync_transfer(st->spi, &xfer, 1); ade7854_spi_write_reg_32()
149 ret = spi_sync_transfer(st->spi, xfers, ARRAY_SIZE(xfers)); ade7854_spi_read_reg_8()
151 dev_err(&st->spi->dev, "problem when reading 8 bit register 0x%02X", ade7854_spi_read_reg_8()
186 ret = spi_sync_transfer(st->spi, xfers, ARRAY_SIZE(xfers)); ade7854_spi_read_reg_16()
188 dev_err(&st->spi->dev, "problem when reading 16 bit register 0x%02X", ade7854_spi_read_reg_16()
224 ret = spi_sync_transfer(st->spi, xfers, ARRAY_SIZE(xfers)); ade7854_spi_read_reg_24()
226 dev_err(&st->spi->dev, "problem when reading 24 bit register 0x%02X", ade7854_spi_read_reg_24()
262 ret = spi_sync_transfer(st->spi, xfers, ARRAY_SIZE(xfers)); ade7854_spi_read_reg_32()
264 dev_err(&st->spi->dev, "problem when reading 32 bit register 0x%02X", ade7854_spi_read_reg_32()
275 static int ade7854_spi_probe(struct spi_device *spi) ade7854_spi_probe() argument
280 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); ade7854_spi_probe()
284 spi_set_drvdata(spi, indio_dev); ade7854_spi_probe()
293 st->irq = spi->irq; ade7854_spi_probe()
294 st->spi = spi; ade7854_spi_probe()
296 return ade7854_probe(indio_dev, &spi->dev); ade7854_spi_probe()
299 static int ade7854_spi_remove(struct spi_device *spi) ade7854_spi_remove() argument
301 ade7854_remove(spi_get_drvdata(spi)); ade7854_spi_remove()
312 MODULE_DEVICE_TABLE(spi, ade7854_id);
/linux-4.4.14/drivers/net/wireless/ti/wl1251/
H A DMakefile3 wl1251_spi-objs += spi.o
H A Dspi.c28 #include <linux/spi/spi.h>
37 #include "spi.h"
65 wl1251_error("could not allocate cmd for spi reset"); wl1251_spi_reset()
80 wl1251_dump(DEBUG_SPI, "spi reset -> ", cmd, WSPI_INIT_CMD_LEN); wl1251_spi_reset()
92 wl1251_error("could not allocate cmd for spi init"); wl1251_spi_wake()
132 wl1251_dump(DEBUG_SPI, "spi init -> ", cmd, WSPI_INIT_CMD_LEN); wl1251_spi_wake()
241 static int wl1251_spi_probe(struct spi_device *spi) wl1251_spi_probe() argument
243 struct wl1251_platform_data *pdata = dev_get_platdata(&spi->dev); wl1251_spi_probe()
244 struct device_node *np = spi->dev.of_node; wl1251_spi_probe()
260 SET_IEEE80211_DEV(hw, &spi->dev); wl1251_spi_probe()
261 spi_set_drvdata(spi, wl); wl1251_spi_probe()
262 wl->if_priv = spi; wl1251_spi_probe()
268 spi->bits_per_word = 32; wl1251_spi_probe()
270 ret = spi_setup(spi); wl1251_spi_probe()
290 ret = devm_gpio_request_one(&spi->dev, wl->power_gpio, wl1251_spi_probe()
302 wl->irq = spi->irq; wl1251_spi_probe()
310 ret = devm_request_irq(&spi->dev, wl->irq, wl1251_irq, 0, wl1251_spi_probe()
319 wl->vio = devm_regulator_get(&spi->dev, "vio"); wl1251_spi_probe()
344 static int wl1251_spi_remove(struct spi_device *spi) wl1251_spi_remove() argument
346 struct wl1251 *wl = spi_get_drvdata(spi); wl1251_spi_remove()
367 MODULE_ALIAS("spi:wl1251");
/linux-4.4.14/drivers/net/wireless/ti/wlcore/
H A DMakefile4 wlcore_spi-objs = spi.o
/linux-4.4.14/drivers/nfc/st-nci/
H A DMakefile11 st-nci_spi-objs = spi.o
/linux-4.4.14/drivers/staging/iio/frequency/
H A Dad9832.h60 * @spi: spi_device
66 * @xfer: default spi transfer
67 * @msg: default spi message
68 * @freq_xfer: tuning word spi transfer
69 * @freq_msg: tuning word spi message
70 * @phase_xfer: tuning word spi transfer
71 * @phase_msg: tuning word spi message
72 * @data: spi transmit buffer
73 * @phase_data: tuning word spi transmit buffer
74 * @freq_data: tuning word spi transmit buffer
78 struct spi_device *spi; member in struct:ad9832_state
H A Dad9834.h41 * @spi: spi_device
45 * @xfer: default spi transfer
46 * @msg: default spi message
47 * @freq_xfer: tuning word spi transfer
48 * @freq_msg: tuning word spi message
49 * @data: spi transmit buffer
50 * @freq_data: tuning word spi transmit buffer
54 struct spi_device *spi; member in struct:ad9834_state
H A Dad9832.c13 #include <linux/spi/spi.h>
56 return spi_sync(st->spi, &st->freq_msg); ad9832_write_frequency()
72 return spi_sync(st->spi, &st->phase_msg); ad9832_write_phase()
107 ret = spi_sync(st->spi, &st->msg); ad9832_write()
120 ret = spi_sync(st->spi, &st->msg); ad9832_write()
133 ret = spi_sync(st->spi, &st->msg); ad9832_write()
144 ret = spi_sync(st->spi, &st->msg); ad9832_write()
202 static int ad9832_probe(struct spi_device *spi) ad9832_probe() argument
204 struct ad9832_platform_data *pdata = spi->dev.platform_data; ad9832_probe()
211 dev_dbg(&spi->dev, "no platform data?\n"); ad9832_probe()
215 reg = devm_regulator_get(&spi->dev, "vcc"); ad9832_probe()
222 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); ad9832_probe()
227 spi_set_drvdata(spi, indio_dev); ad9832_probe()
231 st->spi = spi; ad9832_probe()
233 indio_dev->dev.parent = &spi->dev; ad9832_probe()
234 indio_dev->name = spi_get_device_id(spi)->name; ad9832_probe()
277 ret = spi_sync(st->spi, &st->msg); ad9832_probe()
279 dev_err(&spi->dev, "device init failed\n"); ad9832_probe()
320 static int ad9832_remove(struct spi_device *spi) ad9832_remove() argument
322 struct iio_dev *indio_dev = spi_get_drvdata(spi); ad9832_remove()
337 MODULE_DEVICE_TABLE(spi, ad9832_id);
H A Dad9834.c16 #include <linux/spi/spi.h>
52 return spi_sync(st->spi, &st->freq_msg); ad9834_write_frequency()
62 return spi_sync(st->spi, &st->msg); ad9834_write_phase()
102 ret = spi_sync(st->spi, &st->msg); ad9834_write()
110 ret = spi_sync(st->spi, &st->msg); ad9834_write()
124 ret = spi_sync(st->spi, &st->msg); ad9834_write()
133 ret = spi_sync(st->spi, &st->msg); ad9834_write()
196 ret = spi_sync(st->spi, &st->msg); ad9834_store_wavetype()
319 static int ad9834_probe(struct spi_device *spi) ad9834_probe() argument
321 struct ad9834_platform_data *pdata = spi->dev.platform_data; ad9834_probe()
328 dev_dbg(&spi->dev, "no platform data?\n"); ad9834_probe()
332 reg = devm_regulator_get(&spi->dev, "vcc"); ad9834_probe()
339 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); ad9834_probe()
344 spi_set_drvdata(spi, indio_dev); ad9834_probe()
347 st->spi = spi; ad9834_probe()
348 st->devid = spi_get_device_id(spi)->driver_data; ad9834_probe()
350 indio_dev->dev.parent = &spi->dev; ad9834_probe()
351 indio_dev->name = spi_get_device_id(spi)->name; ad9834_probe()
390 ret = spi_sync(st->spi, &st->msg); ad9834_probe()
392 dev_err(&spi->dev, "device init failed\n"); ad9834_probe()
425 static int ad9834_remove(struct spi_device *spi) ad9834_remove() argument
427 struct iio_dev *indio_dev = spi_get_drvdata(spi); ad9834_remove()
444 MODULE_DEVICE_TABLE(spi, ad9834_id);
/linux-4.4.14/arch/mips/ath79/
H A Ddev-spi.h15 #include <linux/spi/spi.h>
H A Ddev-spi.c14 #include "dev-spi.h"
25 .name = "ath79-spi",
/linux-4.4.14/drivers/iio/amplifiers/
H A Dad8366.c13 #include <linux/spi/spi.h>
23 struct spi_device *spi; member in struct:ad8366_state
45 ret = spi_write(st->spi, st->data, ARRAY_SIZE(st->data)); ad8366_write()
136 static int ad8366_probe(struct spi_device *spi) ad8366_probe() argument
142 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); ad8366_probe()
148 st->reg = devm_regulator_get(&spi->dev, "vcc"); ad8366_probe()
155 spi_set_drvdata(spi, indio_dev); ad8366_probe()
156 st->spi = spi; ad8366_probe()
158 indio_dev->dev.parent = &spi->dev; ad8366_probe()
159 indio_dev->name = spi_get_device_id(spi)->name; ad8366_probe()
180 static int ad8366_remove(struct spi_device *spi) ad8366_remove() argument
182 struct iio_dev *indio_dev = spi_get_drvdata(spi); ad8366_remove()
198 MODULE_DEVICE_TABLE(spi, ad8366_id);
/linux-4.4.14/drivers/iio/proximity/
H A Das3935.c27 #include <linux/spi/spi.h>
61 struct spi_device *spi; member in struct:as3935_state
92 ret = spi_w8r8(st->spi, cmd); as3935_read()
109 return spi_write(st->spi, buf, 2); as3935_write()
238 dev_warn(&st->spi->dev, "noise level is too high"); as3935_event_work()
322 static int as3935_probe(struct spi_device *spi) as3935_probe() argument
327 struct device_node *np = spi->dev.of_node; as3935_probe()
331 if (!spi->irq) { as3935_probe()
332 dev_err(&spi->dev, "unable to get event interrupt\n"); as3935_probe()
336 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); as3935_probe()
341 st->spi = spi; as3935_probe()
344 spi_set_drvdata(spi, indio_dev); as3935_probe()
352 dev_warn(&spi->dev, as3935_probe()
358 dev_err(&spi->dev, as3935_probe()
364 indio_dev->dev.parent = &spi->dev; as3935_probe()
365 indio_dev->name = spi_get_device_id(spi)->name; as3935_probe()
371 trig = devm_iio_trigger_alloc(&spi->dev, "%s-dev%d", as3935_probe()
384 dev_err(&spi->dev, "failed to register trigger\n"); as3935_probe()
392 dev_err(&spi->dev, "cannot setup iio trigger\n"); as3935_probe()
398 ret = devm_request_irq(&spi->dev, spi->irq, as3935_probe()
401 dev_name(&spi->dev), as3935_probe()
405 dev_err(&spi->dev, "unable to request irq\n"); as3935_probe()
411 dev_err(&spi->dev, "unable to register device\n"); as3935_probe()
425 static int as3935_remove(struct spi_device *spi) as3935_remove() argument
427 struct iio_dev *indio_dev = spi_get_drvdata(spi); as3935_remove()
447 MODULE_DEVICE_TABLE(spi, as3935_id);
464 MODULE_ALIAS("spi:as3935");
/linux-4.4.14/drivers/net/wireless/p54/
H A Dp54spi.c29 #include <linux/spi/spi.h>
79 spi_sync(priv->spi, &m); p54spi_spi_read()
113 spi_sync(priv->spi, &m); p54spi_spi_write()
151 dev_err(&priv->spi->dev, "spi_write_dma not allowed " p54spi_spi_write_dma()
171 ret = request_firmware(&priv->firmware, "3826.arm", &priv->spi->dev); p54spi_request_firmware()
174 dev_err(&priv->spi->dev, "request_firmware() failed: %d", ret); p54spi_request_firmware()
196 ret = request_firmware_direct(&eeprom, "3826.eeprom", &priv->spi->dev); p54spi_request_eeprom()
199 dev_info(&priv->spi->dev, "loading default eeprom...\n"); p54spi_request_eeprom()
203 dev_err(&priv->spi->dev, "Failed to request user eeprom\n"); p54spi_request_eeprom()
206 dev_info(&priv->spi->dev, "loading user eeprom...\n"); p54spi_request_eeprom()
306 dev_err(&priv->spi->dev, "INT_READY timeout\n"); p54spi_wakeup()
358 dev_err(&priv->spi->dev, "rx request of zero bytes\n"); p54spi_rx()
370 dev_err(&priv->spi->dev, "could not alloc skb"); p54spi_rx()
397 struct spi_device *spi = config; p54spi_interrupt() local
398 struct p54s_priv *priv = spi_get_drvdata(spi); p54spi_interrupt()
419 dev_err(&priv->spi->dev, "WR_READY timeout\n"); p54spi_tx_frame()
557 dev_err(&priv->spi->dev, "firmware boot failed"); p54spi_op_start()
597 static int p54spi_probe(struct spi_device *spi) p54spi_probe() argument
605 dev_err(&spi->dev, "could not alloc ieee80211_hw"); p54spi_probe()
611 spi_set_drvdata(spi, priv); p54spi_probe()
612 priv->spi = spi; p54spi_probe()
614 spi->bits_per_word = 16; p54spi_probe()
615 spi->max_speed_hz = 24000000; p54spi_probe()
617 ret = spi_setup(spi); p54spi_probe()
619 dev_err(&priv->spi->dev, "spi_setup failed"); p54spi_probe()
625 dev_err(&priv->spi->dev, "power GPIO request failed: %d", ret); p54spi_probe()
631 dev_err(&priv->spi->dev, "irq GPIO request failed: %d", ret); p54spi_probe()
640 priv->spi); p54spi_probe()
642 dev_err(&priv->spi->dev, "request_irq() failed"); p54spi_probe()
655 SET_IEEE80211_DEV(hw, &spi->dev); p54spi_probe()
668 ret = p54_register_common(hw, &priv->spi->dev); p54spi_probe()
675 free_irq(gpio_to_irq(p54spi_gpio_irq), spi); p54spi_probe() local
685 static int p54spi_remove(struct spi_device *spi) p54spi_remove() argument
687 struct p54s_priv *priv = spi_get_drvdata(spi); p54spi_remove()
691 free_irq(gpio_to_irq(p54spi_gpio_irq), spi); p54spi_remove() local
718 MODULE_ALIAS("spi:cx3110x");
719 MODULE_ALIAS("spi:p54spi");
720 MODULE_ALIAS("spi:stlc45xx");
/linux-4.4.14/net/ipv6/netfilter/
H A Dip6t_ah.c26 /* Returns 1 if the spi is matched by the range, 0 otherwise */
28 spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, bool invert) spi_match() argument
33 invert ? '!' : ' ', min, spi, max); spi_match()
34 r = (spi >= min && spi <= max) ^ invert; spi_match()
65 pr_debug("SPI %u %08X\n", ntohl(ah->spi), ntohl(ah->spi)); ah_mt6()
67 pr_debug("IPv6 AH spi %02X ", ah_mt6()
69 ntohl(ah->spi), ah_mt6()
82 ntohl(ah->spi), ah_mt6()
/linux-4.4.14/drivers/iio/common/st_sensors/
H A Dst_sensors_spi.c2 * STMicroelectronics sensors spi library driver
107 struct spi_device *spi, struct st_sensor_data *sdata) st_sensors_spi_configure()
109 spi_set_drvdata(spi, indio_dev); st_sensors_spi_configure()
111 indio_dev->dev.parent = &spi->dev; st_sensors_spi_configure()
112 indio_dev->name = spi->modalias; st_sensors_spi_configure()
114 sdata->dev = &spi->dev; st_sensors_spi_configure()
121 MODULE_DESCRIPTION("STMicroelectronics ST-sensors spi driver");
106 st_sensors_spi_configure(struct iio_dev *indio_dev, struct spi_device *spi, struct st_sensor_data *sdata) st_sensors_spi_configure() argument
/linux-4.4.14/drivers/staging/iio/gyro/
H A Dadis16060_core.c14 #include <linux/spi/spi.h>
153 static int adis16060_r_probe(struct spi_device *spi) adis16060_r_probe() argument
160 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); adis16060_r_probe()
164 spi_set_drvdata(spi, indio_dev); adis16060_r_probe()
166 st->us_r = spi; adis16060_r_probe()
169 indio_dev->name = spi->dev.driver->name; adis16060_r_probe()
170 indio_dev->dev.parent = &spi->dev; adis16060_r_probe()
176 ret = devm_iio_device_register(&spi->dev, indio_dev); adis16060_r_probe()
184 static int adis16060_w_probe(struct spi_device *spi) adis16060_w_probe() argument
195 spi_set_drvdata(spi, indio_dev); adis16060_w_probe()
196 st->us_w = spi; adis16060_w_probe()
203 static int adis16060_w_remove(struct spi_device *spi) adis16060_w_remove() argument
/linux-4.4.14/drivers/net/ieee802154/
H A Dcc2520.c17 #include <linux/spi/spi.h>
18 #include <linux/spi/cc2520.h>
194 struct spi_device *spi; /* SPI device structure */ member in struct:cc2520_private
224 dev_vdbg(&priv->spi->dev, cc2520_cmd_strobe()
228 ret = spi_sync(priv->spi, &msg); cc2520_cmd_strobe()
231 dev_vdbg(&priv->spi->dev, cc2520_cmd_strobe()
254 dev_vdbg(&priv->spi->dev, cc2520_get_status()
257 ret = spi_sync(priv->spi, &msg); cc2520_get_status()
260 dev_vdbg(&priv->spi->dev, cc2520_get_status()
291 status = spi_sync(priv->spi, &msg); cc2520_write_register()
325 status = spi_sync(priv->spi, &msg); cc2520_write_ram()
326 dev_dbg(&priv->spi->dev, "spi status = %d\n", status); cc2520_write_ram()
358 status = spi_sync(priv->spi, &msg); cc2520_read_register()
359 dev_dbg(&priv->spi->dev, cc2520_read_register()
360 "spi status = %d\n", status); cc2520_read_register()
402 dev_vdbg(&priv->spi->dev, cc2520_write_txfifo()
405 status = spi_sync(priv->spi, &msg); cc2520_write_txfifo()
406 dev_vdbg(&priv->spi->dev, "status = %d\n", status); cc2520_write_txfifo()
409 dev_vdbg(&priv->spi->dev, "status = %d\n", status); cc2520_write_txfifo()
410 dev_vdbg(&priv->spi->dev, "buf[0] = %02x\n", priv->buf[0]); cc2520_write_txfifo()
439 dev_vdbg(&priv->spi->dev, "read rxfifo buf[0] = %02x\n", priv->buf[0]); cc2520_read_rxfifo()
440 dev_vdbg(&priv->spi->dev, "buf[1] = %02x\n", priv->buf[1]); cc2520_read_rxfifo()
442 status = spi_sync(priv->spi, &msg); cc2520_read_rxfifo()
443 dev_vdbg(&priv->spi->dev, "status = %d\n", status); cc2520_read_rxfifo()
446 dev_vdbg(&priv->spi->dev, "status = %d\n", status); cc2520_read_rxfifo()
447 dev_vdbg(&priv->spi->dev, cc2520_read_rxfifo()
449 dev_vdbg(&priv->spi->dev, "length buf[1] = %02x\n", priv->buf[1]); cc2520_read_rxfifo()
487 dev_err(&priv->spi->dev, "cc2520 tx underflow exception\n"); cc2520_tx()
531 dev_dbg(&priv->spi->dev, "frame reception failed\n"); cc2520_rx()
540 dev_vdbg(&priv->spi->dev, "RXFIFO: %x %x\n", len, lqi); cc2520_rx()
576 dev_dbg(&priv->spi->dev, "trying to set channel\n"); cc2520_set_channel()
598 dev_vdbg(&priv->spi->dev, cc2520_filter()
605 dev_vdbg(&priv->spi->dev, cc2520_filter()
615 dev_vdbg(&priv->spi->dev, cc2520_filter()
622 dev_vdbg(&priv->spi->dev, cc2520_filter()
746 priv->hw->parent = &priv->spi->dev; cc2520_register()
768 dev_vdbg(&priv->spi->dev, "registered cc2520\n"); cc2520_register()
786 dev_dbg(&priv->spi->dev, "fifop interrupt received\n"); cc2520_fifop_irqwork()
791 dev_dbg(&priv->spi->dev, "rxfifo overflow\n"); cc2520_fifop_irqwork()
815 dev_dbg(&priv->spi->dev, "SFD for TX\n"); cc2520_sfd_isr()
819 dev_dbg(&priv->spi->dev, "SFD for RX\n"); cc2520_sfd_isr()
825 static int cc2520_get_platform_data(struct spi_device *spi, cc2520_get_platform_data() argument
828 struct device_node *np = spi->dev.of_node; cc2520_get_platform_data()
829 struct cc2520_private *priv = spi_get_drvdata(spi); cc2520_get_platform_data()
832 struct cc2520_platform_data *spi_pdata = spi->dev.platform_data; cc2520_get_platform_data()
864 ret = cc2520_get_platform_data(priv->spi, &pdata); cc2520_hw_init()
881 dev_err(&priv->spi->dev, "oscillator start failed!\n"); cc2520_hw_init()
887 dev_vdbg(&priv->spi->dev, "oscillator brought up\n"); cc2520_hw_init()
980 static int cc2520_probe(struct spi_device *spi) cc2520_probe() argument
986 priv = devm_kzalloc(&spi->dev, sizeof(*priv), GFP_KERNEL); cc2520_probe()
990 spi_set_drvdata(spi, priv); cc2520_probe()
992 ret = cc2520_get_platform_data(spi, &pdata); cc2520_probe()
994 dev_err(&spi->dev, "no platform data\n"); cc2520_probe()
998 priv->spi = spi; cc2520_probe()
1000 priv->buf = devm_kzalloc(&spi->dev, cc2520_probe()
1015 dev_err(&spi->dev, "fifo gpio is not valid\n"); cc2520_probe()
1020 ret = devm_gpio_request_one(&spi->dev, pdata.fifo, cc2520_probe()
1026 dev_err(&spi->dev, "cca gpio is not valid\n"); cc2520_probe()
1031 ret = devm_gpio_request_one(&spi->dev, pdata.cca, cc2520_probe()
1037 dev_err(&spi->dev, "fifop gpio is not valid\n"); cc2520_probe()
1042 ret = devm_gpio_request_one(&spi->dev, pdata.fifop, cc2520_probe()
1048 dev_err(&spi->dev, "sfd gpio is not valid\n"); cc2520_probe()
1053 ret = devm_gpio_request_one(&spi->dev, pdata.sfd, cc2520_probe()
1059 dev_err(&spi->dev, "reset gpio is not valid\n"); cc2520_probe()
1064 ret = devm_gpio_request_one(&spi->dev, pdata.reset, cc2520_probe()
1070 dev_err(&spi->dev, "vreg gpio is not valid\n"); cc2520_probe()
1075 ret = devm_gpio_request_one(&spi->dev, pdata.vreg, cc2520_probe()
1091 ret = devm_request_irq(&spi->dev, cc2520_probe()
1095 dev_name(&spi->dev), cc2520_probe()
1098 dev_err(&spi->dev, "could not get fifop irq\n"); cc2520_probe()
1103 ret = devm_request_irq(&spi->dev, cc2520_probe()
1107 dev_name(&spi->dev), cc2520_probe()
1110 dev_err(&spi->dev, "could not get sfd irq\n"); cc2520_probe()
1126 static int cc2520_remove(struct spi_device *spi) cc2520_remove() argument
1128 struct cc2520_private *priv = spi_get_drvdata(spi); cc2520_remove()
1143 MODULE_DEVICE_TABLE(spi, cc2520_ids);
/linux-4.4.14/arch/arm/mach-omap2/
H A Dboard-rx51-video.c15 #include <linux/spi/spi.h>
21 #include <linux/platform_data/spi-omap2-mcspi.h>
/linux-4.4.14/net/ipv4/netfilter/
H A Dipt_ah.c21 /* Returns 1 if the spi is matched by the range, 0 otherwise */
23 spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, bool invert) spi_match() argument
27 invert ? '!' : ' ', min, spi, max); spi_match()
28 r = (spi >= min && spi <= max) ^ invert; spi_match()
54 ntohl(ah->spi), ah_mt()
/linux-4.4.14/net/netfilter/
H A Dxt_esp.c27 /* Returns 1 if the spi is matched by the range, 0 otherwise */
29 spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, bool invert) spi_match() argument
33 invert ? '!' : ' ', min, spi, max); spi_match()
34 r = (spi >= min && spi <= max) ^ invert; spi_match()
59 return spi_match(espinfo->spis[0], espinfo->spis[1], ntohl(eh->spi), esp_mt()
/linux-4.4.14/include/uapi/linux/netfilter/
H A Dxt_policy.h25 spi:1, member in struct:xt_policy_spec
54 __be32 spi; member in struct:xt_policy_elem
/linux-4.4.14/drivers/staging/fbtft/
H A Dfbtft_device.c21 #include <linux/spi/spi.h>
116 struct spi_board_info *spi; member in struct:fbtft_device_display
252 .spi = &(struct spi_board_info) {
272 .spi = &(struct spi_board_info) {
295 .spi = &(struct spi_board_info) {
314 .spi = &(struct spi_board_info) {
334 .spi = &(struct spi_board_info) {
354 .spi = &(struct spi_board_info) {
371 .spi = &(struct spi_board_info) {
410 .spi = &(struct spi_board_info) {
428 .spi = &(struct spi_board_info) {
449 .spi = &(struct spi_board_info) {
470 .spi = &(struct spi_board_info) {
486 .spi = &(struct spi_board_info) {
501 .spi = &(struct spi_board_info) {
542 .spi = &(struct spi_board_info) {
561 .spi = &(struct spi_board_info) {
580 .spi = &(struct spi_board_info) {
600 .spi = &(struct spi_board_info) {
623 .spi = &(struct spi_board_info) {
695 .spi = &(struct spi_board_info) {
714 .spi = &(struct spi_board_info) {
735 .spi = &(struct spi_board_info) {
754 .spi = &(struct spi_board_info) {
767 .spi = &(struct spi_board_info) {
785 .spi = &(struct spi_board_info) {
803 .spi = &(struct spi_board_info) {
821 .spi = &(struct spi_board_info) {
842 .spi = &(struct spi_board_info) {
862 .spi = &(struct spi_board_info) {
888 .spi = &(struct spi_board_info) {
908 .spi = &(struct spi_board_info) {
928 .spi = &(struct spi_board_info) {
1008 .spi = &(struct spi_board_info) {
1027 .spi = &(struct spi_board_info) {
1041 .spi = &(struct spi_board_info) {
1058 .spi = &(struct spi_board_info) {
1078 .spi = &(struct spi_board_info) {
1098 .spi = &(struct spi_board_info) {
1118 .spi = &(struct spi_board_info) {
1138 .spi = &(struct spi_board_info) {
1155 .spi = &(struct spi_board_info) {
1176 .spi = &(struct spi_board_info) {
1195 .spi = &(struct spi_board_info) {
1290 struct spi_device *spi = container_of(dev, struct spi_device, dev); spi_device_found() local
1292 dev_info(dev, "%s %s %dkHz %d bits mode=0x%02X\n", spi->modalias, spi_device_found()
1293 dev_name(dev), spi->max_speed_hz / 1000, spi->bits_per_word, spi_device_found()
1294 spi->mode); spi_device_found()
1339 static int fbtft_device_spi_device_register(struct spi_board_info *spi) fbtft_device_spi_device_register() argument
1343 master = spi_busnum_to_master(spi->bus_num); fbtft_device_spi_device_register()
1346 spi->bus_num); fbtft_device_spi_device_register()
1350 fbtft_device_spi_delete(master, spi->chip_select); fbtft_device_spi_device_register()
1351 spi_device = spi_new_device(master, spi); fbtft_device_spi_device_register()
1360 static int fbtft_device_spi_device_register(struct spi_board_info *spi) fbtft_device_spi_device_register() argument
1362 return spi_register_board_info(spi, 1); fbtft_device_spi_device_register()
1368 struct spi_board_info *spi = NULL; fbtft_device_init() local
1457 displays[i].spi = NULL; fbtft_device_init()
1459 strncpy(displays[i].spi->modalias, name, SPI_NAME_SIZE); fbtft_device_init()
1466 if (displays[i].spi) { fbtft_device_init()
1467 spi = displays[i].spi; fbtft_device_init()
1468 spi->chip_select = cs; fbtft_device_init()
1469 spi->bus_num = busnum; fbtft_device_init()
1471 spi->max_speed_hz = speed; fbtft_device_init()
1473 spi->mode = mode; fbtft_device_init()
1474 pdata = (void *)spi->platform_data; fbtft_device_init()
1508 if (displays[i].spi) { fbtft_device_init()
1509 ret = fbtft_device_spi_device_register(spi); fbtft_device_init()
/linux-4.4.14/drivers/tty/serial/
H A Dmax3100.c49 #include <linux/spi/spi.h>
99 struct spi_device *spi; member in struct:max3100_port
210 status = spi_sync(s->spi, &message); max3100_sr()
212 dev_warn(&s->spi->dev, "error while calling spi_sync\n"); max3100_sr()
217 dev_dbg(&s->spi->dev, "%04x - %04x\n", tx, *rx); max3100_sr()
227 dev_dbg(&s->spi->dev, "%s\n", __func__); max3100_handlerx()
269 dev_dbg(&s->spi->dev, "%s\n", __func__); max3100_work()
334 dev_dbg(&s->spi->dev, "%s\n", __func__); max3100_irq()
348 dev_dbg(&s->spi->dev, "%s\n", __func__); max3100_enable_ms()
357 dev_dbg(&s->spi->dev, "%s\n", __func__); max3100_start_tx()
368 dev_dbg(&s->spi->dev, "%s\n", __func__); max3100_stop_rx()
384 dev_dbg(&s->spi->dev, "%s\n", __func__); max3100_tx_empty()
397 dev_dbg(&s->spi->dev, "%s\n", __func__); max3100_get_mctrl()
412 dev_dbg(&s->spi->dev, "%s\n", __func__); max3100_set_mctrl()
436 dev_dbg(&s->spi->dev, "%s\n", __func__); max3100_set_termios()
556 dev_dbg(&s->spi->dev, "%s\n", __func__); max3100_shutdown()
592 dev_dbg(&s->spi->dev, "%s\n", __func__); max3100_startup()
608 dev_warn(&s->spi->dev, "cannot create workqueue\n"); max3100_startup()
615 dev_warn(&s->spi->dev, "cannot allocate irq %d\n", s->irq); max3100_startup()
646 dev_dbg(&s->spi->dev, "%s\n", __func__); max3100_type()
657 dev_dbg(&s->spi->dev, "%s\n", __func__); max3100_release_port()
666 dev_dbg(&s->spi->dev, "%s\n", __func__); max3100_config_port()
680 dev_dbg(&s->spi->dev, "%s\n", __func__); max3100_verify_port()
693 dev_dbg(&s->spi->dev, "%s\n", __func__); max3100_stop_tx()
702 dev_dbg(&s->spi->dev, "%s\n", __func__); max3100_request_port()
712 dev_dbg(&s->spi->dev, "%s\n", __func__); max3100_break_ctl()
744 static int max3100_probe(struct spi_device *spi) max3100_probe() argument
766 dev_warn(&spi->dev, "too many MAX3100 chips\n"); max3100_probe()
773 dev_warn(&spi->dev, max3100_probe()
778 max3100s[i]->spi = spi; max3100_probe()
779 max3100s[i]->irq = spi->irq; max3100_probe()
781 spi_set_drvdata(spi, max3100s[i]); max3100_probe()
782 pdata = dev_get_platdata(&spi->dev); max3100_probe()
794 dev_dbg(&spi->dev, "%s: adding port %d\n", __func__, i); max3100_probe()
802 max3100s[i]->port.dev = &spi->dev; max3100_probe()
805 dev_warn(&spi->dev, max3100_probe()
820 static int max3100_remove(struct spi_device *spi) max3100_remove() argument
822 struct max3100_port *s = spi_get_drvdata(spi); max3100_remove()
830 dev_dbg(&spi->dev, "%s: removing port %d\n", __func__, i); max3100_remove()
858 dev_dbg(&s->spi->dev, "%s\n", __func__); max3100_suspend()
881 dev_dbg(&s->spi->dev, "%s\n", __func__); max3100_resume()
918 MODULE_ALIAS("spi:max3100");
/linux-4.4.14/drivers/staging/iio/accel/
H A Dadis16201_core.c13 #include <linux/spi/spi.h>
179 static int adis16201_probe(struct spi_device *spi) adis16201_probe() argument
186 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); adis16201_probe()
192 spi_set_drvdata(spi, indio_dev); adis16201_probe()
194 indio_dev->name = spi->dev.driver->name; adis16201_probe()
195 indio_dev->dev.parent = &spi->dev; adis16201_probe()
202 ret = adis_init(st, indio_dev, spi, &adis16201_data); adis16201_probe()
224 static int adis16201_remove(struct spi_device *spi) adis16201_remove() argument
226 struct iio_dev *indio_dev = spi_get_drvdata(spi); adis16201_remove()
247 MODULE_ALIAS("spi:adis16201");
H A Dadis16203_core.c13 #include <linux/spi/spi.h>
147 static int adis16203_probe(struct spi_device *spi) adis16203_probe() argument
154 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); adis16203_probe()
159 spi_set_drvdata(spi, indio_dev); adis16203_probe()
161 indio_dev->name = spi->dev.driver->name; adis16203_probe()
162 indio_dev->dev.parent = &spi->dev; adis16203_probe()
168 ret = adis_init(st, indio_dev, spi, &adis16203_data); adis16203_probe()
192 static int adis16203_remove(struct spi_device *spi) adis16203_remove() argument
194 struct iio_dev *indio_dev = spi_get_drvdata(spi); adis16203_remove()
215 MODULE_ALIAS("spi:adis16203");
H A Dadis16204_core.c15 #include <linux/spi/spi.h>
186 static int adis16204_probe(struct spi_device *spi) adis16204_probe() argument
193 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); adis16204_probe()
198 spi_set_drvdata(spi, indio_dev); adis16204_probe()
200 indio_dev->name = spi->dev.driver->name; adis16204_probe()
201 indio_dev->dev.parent = &spi->dev; adis16204_probe()
207 ret = adis_init(st, indio_dev, spi, &adis16204_data); adis16204_probe()
230 static int adis16204_remove(struct spi_device *spi) adis16204_remove() argument
232 struct iio_dev *indio_dev = spi_get_drvdata(spi); adis16204_remove()
253 MODULE_ALIAS("spi:adis16204");
H A Dadis16209_core.c13 #include <linux/spi/spi.h>
181 static int adis16209_probe(struct spi_device *spi) adis16209_probe() argument
188 indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); adis16209_probe()
193 spi_set_drvdata(spi, indio_dev); adis16209_probe()
195 indio_dev->name = spi->dev.driver->name; adis16209_probe()
196 indio_dev->dev.parent = &spi->dev; adis16209_probe()
202 ret = adis_init(st, indio_dev, spi, &adis16209_data); adis16209_probe()
224 static int adis16209_remove(struct spi_device *spi) adis16209_remove() argument
226 struct iio_dev *indio_dev = spi_get_drvdata(spi); adis16209_remove()
247 MODULE_ALIAS("spi:adis16209");
/linux-4.4.14/arch/arm/mach-ep93xx/
H A Dvision_ep9307.c27 #include <linux/spi/spi.h>
28 #include <linux/spi/flash.h>
29 #include <linux/spi/mmc_spi.h>
36 #include <linux/platform_data/spi-ep93xx.h>
178 static int vision_cs4271_hw_setup(struct spi_device *spi) vision_cs4271_hw_setup() argument
181 GPIOF_OUT_INIT_HIGH, spi->modalias); vision_cs4271_hw_setup()
184 static void vision_cs4271_hw_cleanup(struct spi_device *spi) vision_cs4271_hw_cleanup() argument
189 static void vision_cs4271_hw_cs_control(struct spi_device *spi, int value) vision_cs4271_hw_cs_control() argument
227 static int vision_spi_flash_hw_setup(struct spi_device *spi) vision_spi_flash_hw_setup() argument
230 spi->modalias); vision_spi_flash_hw_setup()
233 static void vision_spi_flash_hw_cleanup(struct spi_device *spi) vision_spi_flash_hw_cleanup() argument
238 static void vision_spi_flash_hw_cs_control(struct spi_device *spi, int value) vision_spi_flash_hw_cs_control() argument
267 static int vision_spi_mmc_hw_setup(struct spi_device *spi) vision_spi_mmc_hw_setup() argument
270 spi->modalias); vision_spi_mmc_hw_setup()
273 static void vision_spi_mmc_hw_cleanup(struct spi_device *spi) vision_spi_mmc_hw_cleanup() argument
278 static void vision_spi_mmc_hw_cs_control(struct spi_device *spi, int value) vision_spi_mmc_hw_cs_control() argument
/linux-4.4.14/drivers/mmc/host/
H A Dmmc_spi.c41 #include <linux/spi/spi.h>
42 #include <linux/spi/mmc_spi.h>
127 struct spi_device *spi; member in struct:mmc_spi_host
167 return spi_setup(host->spi); mmc_cs_off()
187 status = spi_sync_locked(host->spi, &host->readback); mmc_spi_readbytes()
417 dev_dbg(&host->spi->dev, "bad response type %04x\n", mmc_spi_response_get()
425 dev_dbg(&host->spi->dev, "%s: resp %04x %08x\n", mmc_spi_response_get()
523 dev_dbg(&host->spi->dev, " mmc_spi: CMD%d, resp %s\n", mmc_spi_command_send()
543 status = spi_sync_locked(host->spi, &host->m); mmc_spi_command_send()
550 dev_dbg(&host->spi->dev, " ... write returned %d\n", status); mmc_spi_command_send()
674 struct spi_device *spi = host->spi; mmc_spi_writeblock() local
687 status = spi_sync_locked(spi, &host->m); mmc_spi_writeblock()
690 dev_dbg(&spi->dev, "write error (%d)\n", status); mmc_spi_writeblock()
741 dev_dbg(&spi->dev, "write error %02x (%d)\n", mmc_spi_writeblock()
781 struct spi_device *spi = host->spi; mmc_spi_readblock() local
798 dev_dbg(&spi->dev, "read error %02x (%d)\n", status, status); mmc_spi_readblock()
821 status = spi_sync_locked(spi, &host->m); mmc_spi_readblock()
858 dev_dbg(&spi->dev, "read - crc error: crc_val=0x%04x, " mmc_spi_readblock()
881 struct spi_device *spi = host->spi; mmc_spi_data_do() local
901 clock_rate = spi->max_speed_hz; mmc_spi_data_do()
945 dev_dbg(&host->spi->dev, mmc_spi_data_do()
975 dev_dbg(&spi->dev, "%s status %d\n", mmc_spi_data_do()
994 dev_dbg(&spi->dev, " mmc_spi: STOP_TRAN\n"); mmc_spi_data_do()
1017 tmp = spi_sync_locked(spi, &host->m); mmc_spi_data_do()
1065 dev_dbg(&host->spi->dev, "bogus command\n"); mmc_spi_request()
1072 dev_dbg(&host->spi->dev, "bogus STOP command\n"); mmc_spi_request()
1086 spi_bus_lock(host->spi->master); mmc_spi_request()
1118 spi_bus_unlock(host->spi->master); mmc_spi_request()
1153 host->spi->mode |= SPI_CS_HIGH; mmc_spi_initsequence()
1154 if (spi_setup(host->spi) != 0) { mmc_spi_initsequence()
1156 dev_warn(&host->spi->dev, mmc_spi_initsequence()
1158 host->spi->mode &= ~SPI_CS_HIGH; mmc_spi_initsequence()
1162 host->spi->mode &= ~SPI_CS_HIGH; mmc_spi_initsequence()
1163 if (spi_setup(host->spi) != 0) { mmc_spi_initsequence()
1165 dev_err(&host->spi->dev, mmc_spi_initsequence()
1190 dev_dbg(&host->spi->dev, "mmc_spi: power %s (%d)%s\n", mmc_spi_set_ios()
1202 host->pdata->setpower(&host->spi->dev, mmc_spi_set_ios()
1226 host->spi->mode &= ~(SPI_CPOL|SPI_CPHA); mmc_spi_set_ios()
1227 mres = spi_setup(host->spi); mmc_spi_set_ios()
1229 dev_dbg(&host->spi->dev, mmc_spi_set_ios()
1232 if (spi_write(host->spi, &nullbyte, 1) < 0) mmc_spi_set_ios()
1233 dev_dbg(&host->spi->dev, mmc_spi_set_ios()
1234 "put spi signals to low failed\n"); mmc_spi_set_ios()
1237 * Now clock should be low due to spi mode 0; mmc_spi_set_ios()
1247 host->spi->mode |= (SPI_CPOL|SPI_CPHA); mmc_spi_set_ios()
1248 mres = spi_setup(host->spi); mmc_spi_set_ios()
1250 dev_dbg(&host->spi->dev, mmc_spi_set_ios()
1259 if (host->spi->max_speed_hz != ios->clock && ios->clock != 0) { mmc_spi_set_ios()
1262 host->spi->max_speed_hz = ios->clock; mmc_spi_set_ios()
1263 status = spi_setup(host->spi); mmc_spi_set_ios()
1264 dev_dbg(&host->spi->dev, mmc_spi_set_ios()
1266 host->spi->max_speed_hz, status); mmc_spi_set_ios()
1294 static int mmc_spi_probe(struct spi_device *spi) mmc_spi_probe() argument
1305 if (spi->master->flags & SPI_MASTER_HALF_DUPLEX) mmc_spi_probe()
1314 if (spi->mode != SPI_MODE_3) mmc_spi_probe()
1315 spi->mode = SPI_MODE_0; mmc_spi_probe()
1316 spi->bits_per_word = 8; mmc_spi_probe()
1318 status = spi_setup(spi); mmc_spi_probe()
1320 dev_dbg(&spi->dev, "needs SPI mode %02x, %d KHz; %d\n", mmc_spi_probe()
1321 spi->mode, spi->max_speed_hz / 1000, mmc_spi_probe()
1338 mmc = mmc_alloc_host(sizeof(*host), &spi->dev); mmc_spi_probe()
1359 mmc->f_max = spi->max_speed_hz; mmc_spi_probe()
1363 host->spi = spi; mmc_spi_probe()
1370 host->pdata = mmc_spi_get_pdata(spi); mmc_spi_probe()
1374 dev_warn(&spi->dev, "ASSUMING 3.2-3.4 V slot power\n"); mmc_spi_probe()
1383 dev_set_drvdata(&spi->dev, mmc); mmc_spi_probe()
1390 if (spi->master->dev.parent->dma_mask) { mmc_spi_probe()
1391 struct device *dev = spi->master->dev.parent; mmc_spi_probe()
1419 status = host->pdata->init(&spi->dev, mmc_spi_detect_irq, mmc); mmc_spi_probe()
1455 dev_info(&spi->dev, "SD/MMC host %s%s%s%s%s\n", mmc_spi_probe()
1475 mmc_spi_put_pdata(spi); mmc_spi_probe()
1476 dev_set_drvdata(&spi->dev, NULL); mmc_spi_probe()
1484 static int mmc_spi_remove(struct spi_device *spi) mmc_spi_remove() argument
1486 struct mmc_host *mmc = dev_get_drvdata(&spi->dev); mmc_spi_remove()
1494 host->pdata->exit(&spi->dev, mmc); mmc_spi_remove()
1508 spi->max_speed_hz = mmc->f_max; mmc_spi_remove()
1510 mmc_spi_put_pdata(spi); mmc_spi_remove()
1511 dev_set_drvdata(&spi->dev, NULL); mmc_spi_remove()
1517 { .compatible = "mmc-spi-slot", },
1537 MODULE_ALIAS("spi:mmc_spi");

Completed in 3619 milliseconds

1234