/linux/drivers/net/wan/ |
H A D | slic_ds26522.c | 38 static void slic_write(struct spi_device *spi, u16 addr, in slic_write() argument 50 spi_write(spi, &temp[0], SLIC_THREE_LEN); in slic_write() 53 static u8 slic_read(struct spi_device *spi, u16 addr) in slic_read() argument 62 spi_write_then_read(spi, &temp[0], SLIC_TWO_LEN, &data, in slic_read() 69 static bool get_slic_product_code(struct spi_device *spi) in get_slic_product_code() argument 73 device_id = slic_read(spi, DS26522_IDR_ADDR); in get_slic_product_code() 80 static void ds26522_e1_spec_config(struct spi_device *spi) in ds26522_e1_spec_config() argument 83 slic_write(spi, DS26522_RMMR_ADDR, DS26522_RMMR_E1); in ds26522_e1_spec_config() 86 slic_write(spi, DS26522_TMMR_ADDR, DS26522_TMMR_E1); in ds26522_e1_spec_config() 89 slic_write(spi, DS26522_RMMR_ADDR, in ds26522_e1_spec_config() [all …]
|
/linux/drivers/video/backlight/ |
H A D | ili922x.c | 138 struct spi_device *spi; member 148 static int ili922x_read_status(struct spi_device *spi, u16 *rs) in ili922x_read_status() argument 161 CHECK_FREQ_REG(spi, &xfer); in ili922x_read_status() 175 ret = spi_sync(spi, &msg); in ili922x_read_status() 177 dev_dbg(&spi->dev, "Error sending SPI message 0x%x", ret); in ili922x_read_status() 191 static int ili922x_read(struct spi_device *spi, u8 reg, u16 *rx) in ili922x_read() argument 205 CHECK_FREQ_REG(spi, &xfer_regindex); in ili922x_read() 226 CHECK_FREQ_REG(spi, &xfer_regvalue); in ili922x_read() 229 ret = spi_sync(spi, &msg); in ili922x_read() 231 dev_dbg(&spi->dev, "Error sending SPI message 0x%x", ret); in ili922x_read() [all …]
|
H A D | l4f00242t03.c | 24 struct spi_device *spi; member 46 static void l4f00242t03_lcd_init(struct spi_device *spi) in l4f00242t03_lcd_init() argument 48 struct l4f00242t03_priv *priv = spi_get_drvdata(spi); in l4f00242t03_lcd_init() 52 dev_dbg(&spi->dev, "initializing LCD\n"); in l4f00242t03_lcd_init() 56 dev_err(&spi->dev, "failed to set the IO regulator voltage.\n"); in l4f00242t03_lcd_init() 61 dev_err(&spi->dev, "failed to enable the IO regulator.\n"); in l4f00242t03_lcd_init() 67 dev_err(&spi->dev, "failed to set the core regulator voltage.\n"); in l4f00242t03_lcd_init() 73 dev_err(&spi->dev, "failed to enable the core regulator.\n"); in l4f00242t03_lcd_init() 82 spi_write(spi, (const u8 *)cmd, ARRAY_SIZE(cmd) * sizeof(u16)); in l4f00242t03_lcd_init() 85 static void l4f00242t03_lcd_powerdown(struct spi_device *spi) in l4f00242t03_lcd_powerdown() argument [all …]
|
H A D | ili9320.c | 29 struct ili9320_spi *spi = &ili->access.spi; in ili9320_write_spi() local 30 unsigned char *addr = spi->buffer_addr; in ili9320_write_spi() 31 unsigned char *data = spi->buffer_data; in ili9320_write_spi() 37 addr[0] = spi->id | ILI9320_SPI_INDEX | ILI9320_SPI_WRITE; in ili9320_write_spi() 43 data[0] = spi->id | ILI9320_SPI_DATA | ILI9320_SPI_WRITE; in ili9320_write_spi() 47 return spi_sync(spi->dev, &spi->message); in ili9320_write_spi() 171 struct ili9320_spi *spi = &ili->access.spi; in ili9320_setup_spi() local 174 spi->dev = dev; in ili9320_setup_spi() 181 spi->xfer[0].tx_buf = spi->buffer_addr; in ili9320_setup_spi() 182 spi->xfer[1].tx_buf = spi->buffer_data; in ili9320_setup_spi() [all …]
|
/linux/drivers/staging/greybus/ |
H A D | spilib.c | 45 static struct spi_controller *get_controller_from_spi(struct gb_spilib *spi) in get_controller_from_spi() argument 47 return gb_connection_get_data(spi->connection); in get_controller_from_spi() 95 static void clean_xfer_state(struct gb_spilib *spi) in clean_xfer_state() argument 97 spi->first_xfer = NULL; in clean_xfer_state() 98 spi->last_xfer = NULL; in clean_xfer_state() 99 spi->rx_xfer_offset = 0; in clean_xfer_state() 100 spi->tx_xfer_offset = 0; in clean_xfer_state() 101 spi->last_xfer_size = 0; in clean_xfer_state() 102 spi->op_timeout = 0; in clean_xfer_state() 105 static bool is_last_xfer_done(struct gb_spilib *spi) in is_last_xfer_done() argument [all …]
|
/linux/drivers/spi/ |
H A D | spi-mux.c | 39 struct spi_device *spi; member 49 static int spi_mux_select(struct spi_device *spi) in spi_mux_select() argument 51 struct spi_mux_priv *priv = spi_controller_get_devdata(spi->controller); in spi_mux_select() 54 ret = mux_control_select(priv->mux, spi_get_chipselect(spi, 0)); in spi_mux_select() 58 if (priv->current_cs == spi_get_chipselect(spi, 0)) in spi_mux_select() 61 dev_dbg(&priv->spi->dev, "setting up the mux for cs %d\n", in spi_mux_select() 62 spi_get_chipselect(spi, 0)); in spi_mux_select() 65 priv->spi->max_speed_hz = spi->max_speed_hz; in spi_mux_select() 66 priv->spi->mode = spi->mode; in spi_mux_select() 67 priv->spi->bits_per_word = spi->bits_per_word; in spi_mux_select() [all …]
|
H A D | spi-gpio.c | 75 spi_to_spi_gpio(const struct spi_device *spi) in spi_to_spi_gpio() argument 80 bang = spi_controller_get_devdata(spi->controller); in spi_to_spi_gpio() 86 static inline void setsck(const struct spi_device *spi, int is_on) in setsck() argument 88 struct spi_gpio *spi_gpio = spi_to_spi_gpio(spi); in setsck() 93 static inline void setmosi(const struct spi_device *spi, int is_on) in setmosi() argument 95 struct spi_gpio *spi_gpio = spi_to_spi_gpio(spi); in setmosi() 100 static inline int getmiso(const struct spi_device *spi) in getmiso() argument 102 struct spi_gpio *spi_gpio = spi_to_spi_gpio(spi); in getmiso() 104 if (spi->mode & SPI_3WIRE) in getmiso() 134 static u32 spi_gpio_txrx_word_mode0(struct spi_device *spi, in spi_gpio_txrx_word_mode0() argument [all …]
|
H A D | spi-bitbang.c | 51 static unsigned int bitbang_txrx_8(struct spi_device *spi, in bitbang_txrx_8() argument 63 bitbang = spi_controller_get_devdata(spi->controller); in bitbang_txrx_8() 70 word = spi->mode & SPI_MOSI_IDLE_HIGH ? 0xFF : 0; in bitbang_txrx_8() 71 word = txrx_word(spi, ns, word, bits, flags); in bitbang_txrx_8() 77 bitbang->set_mosi_idle(spi); in bitbang_txrx_8() 82 static unsigned int bitbang_txrx_16(struct spi_device *spi, in bitbang_txrx_16() argument 94 bitbang = spi_controller_get_devdata(spi->controller); in bitbang_txrx_16() 101 word = spi->mode & SPI_MOSI_IDLE_HIGH ? 0xFFFF : 0; in bitbang_txrx_16() 102 word = txrx_word(spi, ns, word, bits, flags); in bitbang_txrx_16() 108 bitbang->set_mosi_idle(spi); in bitbang_txrx_16() [all …]
|
H A D | spi.c | 49 struct spi_device *spi = to_spi_device(dev); in spidev_release() local 51 spi_controller_put(spi->controller); in spidev_release() 52 kfree(spi->driver_override); in spidev_release() 53 free_percpu(spi->pcpu_statistics); in spidev_release() 54 kfree(spi); in spidev_release() 60 const struct spi_device *spi = to_spi_device(dev); in modalias_show() local 67 return sysfs_emit(buf, "%s%s\n", SPI_MODULE_PREFIX, spi->modalias); in modalias_show() 75 struct spi_device *spi = to_spi_device(dev); in driver_override_store() local 78 ret = driver_set_override(dev, &spi->driver_override, buf, count); in driver_override_store() 88 const struct spi_device *spi = to_spi_device(dev); in driver_override_show() local [all …]
|
/linux/drivers/misc/ |
H A D | gehc-achc.c | 59 static int ezport_start_programming(struct spi_device *spi, struct gpio_desc *reset) in ezport_start_programming() argument 68 spi_bus_lock(spi->controller); in ezport_start_programming() 73 ret = spi_sync_locked(spi, &msg); in ezport_start_programming() 85 ret = spi_sync_locked(spi, &msg); in ezport_start_programming() 88 spi_bus_unlock(spi->controller); in ezport_start_programming() 92 static void ezport_stop_programming(struct spi_device *spi, struct gpio_desc *reset) in ezport_stop_programming() argument 95 spi_bus_lock(spi->controller); in ezport_stop_programming() 97 spi_bus_unlock(spi->controller); in ezport_stop_programming() 100 static int ezport_get_status_register(struct spi_device *spi) in ezport_get_status_register() argument 104 ret = spi_w8r8(spi, EZPORT_CMD_RDSR); in ezport_get_status_register() [all …]
|
H A D | lattice-ecp3-config.c | 67 struct spi_device *spi = (struct spi_device *)context; in firmware_load() local 68 struct fpga_data *data = spi_get_drvdata(spi); in firmware_load() 78 dev_err(&spi->dev, "Cannot load firmware, aborting\n"); in firmware_load() 83 dev_err(&spi->dev, "Error: Firmware size is 0!\n"); in firmware_load() 94 spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); in firmware_load() 96 dev_dbg(&spi->dev, "FPGA JTAG ID=%08x\n", jedec_id); in firmware_load() 103 dev_err(&spi->dev, in firmware_load() 109 dev_info(&spi->dev, "FPGA %s detected\n", ecp3_dev[i].name); in firmware_load() 112 spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); in firmware_load() 114 dev_dbg(&spi->dev, "FPGA Status=%08x\n", status); in firmware_load() [all …]
|
/linux/drivers/net/can/spi/ |
H A D | mcp251x.c | 230 struct spi_device *spi; member 263 static inline int mcp251x_is_##_model(struct spi_device *spi) \ 265 struct mcp251x_priv *priv = spi_get_drvdata(spi); \ 296 static int mcp251x_spi_trans(struct spi_device *spi, int len) in mcp251x_spi_trans() argument 298 struct mcp251x_priv *priv = spi_get_drvdata(spi); in mcp251x_spi_trans() 311 ret = spi_sync(spi, &m); in mcp251x_spi_trans() 313 dev_err(&spi->dev, "spi transfer failed: ret = %d\n", ret); in mcp251x_spi_trans() 317 static int mcp251x_spi_write(struct spi_device *spi, int len) in mcp251x_spi_write() argument 319 struct mcp251x_priv *priv = spi_get_drvdata(spi); in mcp251x_spi_write() 322 ret = spi_write(spi, priv->spi_tx_buf, len); in mcp251x_spi_write() [all …]
|
H A D | hi311x.c | 147 struct spi_device *spi; member 200 static int hi3110_spi_trans(struct spi_device *spi, int len) in hi3110_spi_trans() argument 202 struct hi3110_priv *priv = spi_get_drvdata(spi); in hi3110_spi_trans() 215 ret = spi_sync(spi, &m); in hi3110_spi_trans() 218 dev_err(&spi->dev, "spi transfer failed: ret = %d\n", ret); in hi3110_spi_trans() 222 static int hi3110_cmd(struct spi_device *spi, u8 command) in hi3110_cmd() argument 224 struct hi3110_priv *priv = spi_get_drvdata(spi); in hi3110_cmd() 227 dev_dbg(&spi->dev, "hi3110_cmd: %02X\n", command); in hi3110_cmd() 229 return hi3110_spi_trans(spi, 1); in hi3110_cmd() 232 static u8 hi3110_read(struct spi_device *spi, u8 command) in hi3110_read() argument [all …]
|
/linux/drivers/media/dvb-frontends/cxd2880/ |
H A D | cxd2880_spi_device.c | 14 static int cxd2880_spi_device_write(struct cxd2880_spi *spi, in cxd2880_spi_device_write() argument 22 if (!spi || !spi->user || !data || size == 0) in cxd2880_spi_device_write() 25 spi_device = spi->user; in cxd2880_spi_device_write() 33 result = spi_sync(spi_device->spi, &msg); in cxd2880_spi_device_write() 41 static int cxd2880_spi_device_write_read(struct cxd2880_spi *spi, in cxd2880_spi_device_write_read() argument 50 if (!spi || !spi->user || !tx_data || in cxd2880_spi_device_write_read() 54 spi_device = spi->user; in cxd2880_spi_device_write_read() 56 result = spi_write_then_read(spi_device->spi, tx_data, in cxd2880_spi_device_write_read() 70 struct spi_device *spi = spi_device->spi; in cxd2880_spi_device_initialize() local 74 spi->mode = SPI_MODE_0; in cxd2880_spi_device_initialize() [all …]
|
/linux/drivers/video/fbdev/omap2/omapfb/displays/ |
H A D | panel-lgphilips-lb035q02.c | 43 struct spi_device *spi; member 54 static int lb035q02_write_reg(struct spi_device *spi, u8 reg, u16 val) in lb035q02_write_reg() argument 82 return spi_sync(spi, &msg); in lb035q02_write_reg() 85 static void init_lb035q02_panel(struct spi_device *spi) in init_lb035q02_panel() argument 88 lb035q02_write_reg(spi, 0x01, 0x6300); in init_lb035q02_panel() 89 lb035q02_write_reg(spi, 0x02, 0x0200); in init_lb035q02_panel() 90 lb035q02_write_reg(spi, 0x03, 0x0177); in init_lb035q02_panel() 91 lb035q02_write_reg(spi, 0x04, 0x04c7); in init_lb035q02_panel() 92 lb035q02_write_reg(spi, 0x05, 0xffc0); in init_lb035q02_panel() 93 lb035q02_write_reg(spi, 0x06, 0xe806); in init_lb035q02_panel() [all …]
|
/linux/drivers/mtd/devices/ |
H A D | mtd_dataflash.c | 93 struct spi_device *spi; member 112 MODULE_DEVICE_TABLE(spi, dataflash_spi_ids); 119 static inline int dataflash_status(struct spi_device *spi) in dataflash_status() argument 124 return spi_w8r8(spi, OP_READ_STATUS); in dataflash_status() 131 static int dataflash_waitready(struct spi_device *spi) in dataflash_waitready() argument 136 status = dataflash_status(spi); in dataflash_waitready() 138 dev_dbg(&spi->dev, "status %d?\n", status); in dataflash_waitready() 157 struct spi_device *spi = priv->spi; in dataflash_erase() local 164 dev_dbg(&spi->dev, "erase addr=0x%llx len 0x%llx\n", in dataflash_erase() 198 dev_dbg(&spi->dev, "ERASE %s: (%x) %x %x %x [%i]\n", in dataflash_erase() [all …]
|
/linux/drivers/iio/chemical/ |
H A D | bme680_spi.c | 15 struct spi_device *spi; member 27 struct spi_device *spi = ctx->spi; in bme680_regmap_spi_select_page() local 40 ret = spi_write_then_read(spi, buf, 1, buf + 1, 1); in bme680_regmap_spi_select_page() 42 dev_err(&spi->dev, "failed to set page %u\n", page); in bme680_regmap_spi_select_page() 52 ret = spi_write(spi, buf, 2); in bme680_regmap_spi_select_page() 54 dev_err(&spi->dev, "failed to set page %u\n", page); in bme680_regmap_spi_select_page() 67 struct spi_device *spi = ctx->spi; in bme680_regmap_spi_write() local 83 return spi_write(spi, buf, 2); in bme680_regmap_spi_write() 90 struct spi_device *spi = ctx->spi; in bme680_regmap_spi_read() local 100 return spi_write_then_read(spi, &addr, 1, val, val_size); in bme680_regmap_spi_read() [all …]
|
/linux/net/ipv6/ |
H A D | xfrm6_tunnel.c | 31 u32 spi; member 48 u32 spi; member 69 static inline unsigned int xfrm6_tunnel_spi_hash_byspi(u32 spi) in xfrm6_tunnel_spi_hash_byspi() argument 71 return spi % XFRM6_TUNNEL_SPI_BYSPI_HSIZE; in xfrm6_tunnel_spi_hash_byspi() 92 u32 spi; in xfrm6_tunnel_spi_lookup() local 96 spi = x6spi ? x6spi->spi : 0; in xfrm6_tunnel_spi_lookup() 98 return htonl(spi); in xfrm6_tunnel_spi_lookup() 102 static int __xfrm6_tunnel_spi_check(struct net *net, u32 spi) in __xfrm6_tunnel_spi_check() argument 106 int index = xfrm6_tunnel_spi_hash_byspi(spi); in __xfrm6_tunnel_spi_check() 111 if (x6spi->spi == spi) in __xfrm6_tunnel_spi_check() [all …]
|
/linux/drivers/net/dsa/b53/ |
H A D | b53_spi.c | 42 static inline int b53_spi_read_reg(struct spi_device *spi, u8 reg, u8 *val, in b53_spi_read_reg() argument 50 return spi_write_then_read(spi, txbuf, 2, val, len); in b53_spi_read_reg() 53 static inline int b53_spi_clear_status(struct spi_device *spi) in b53_spi_clear_status() argument 60 ret = b53_spi_read_reg(spi, B53_SPI_STATUS, &rxbuf, 1); in b53_spi_clear_status() 76 static inline int b53_spi_set_page(struct spi_device *spi, u8 page) in b53_spi_set_page() argument 84 return spi_write(spi, txbuf, sizeof(txbuf)); in b53_spi_set_page() 87 static inline int b53_prepare_reg_access(struct spi_device *spi, u8 page) in b53_prepare_reg_access() argument 89 int ret = b53_spi_clear_status(spi); in b53_prepare_reg_access() 94 return b53_spi_set_page(spi, page); in b53_prepare_reg_access() 97 static int b53_spi_prepare_reg_read(struct spi_device *spi, u8 reg) in b53_spi_prepare_reg_read() argument [all …]
|
/linux/drivers/media/v4l2-core/ |
H A D | v4l2-spi.c | 13 struct spi_device *spi = v4l2_get_subdevdata(sd); in v4l2_spi_subdev_unregister() local 15 if (spi && !spi->dev.of_node && !spi->dev.fwnode) in v4l2_spi_subdev_unregister() 16 spi_unregister_device(spi); in v4l2_spi_subdev_unregister() 19 void v4l2_spi_subdev_init(struct v4l2_subdev *sd, struct spi_device *spi, in v4l2_spi_subdev_init() argument 25 sd->owner = spi->dev.driver->owner; in v4l2_spi_subdev_init() 26 sd->dev = &spi->dev; in v4l2_spi_subdev_init() 28 v4l2_set_subdevdata(sd, spi); in v4l2_spi_subdev_init() 29 spi_set_drvdata(spi, sd); in v4l2_spi_subdev_init() 32 spi->dev.driver->name, dev_name(&spi->dev)); in v4l2_spi_subdev_init() 41 struct spi_device *spi = NULL; in v4l2_spi_new_subdev() local [all …]
|
/linux/include/linux/spi/ |
H A D | spi.h | 256 static inline struct spi_device *spi_dev_get(struct spi_device *spi) in spi_dev_get() argument 258 return (spi && get_device(&spi->dev)) ? spi : NULL; in spi_dev_get() 261 static inline void spi_dev_put(struct spi_device *spi) in spi_dev_put() argument 263 if (spi) in spi_dev_put() 264 put_device(&spi->dev); in spi_dev_put() 268 static inline void *spi_get_ctldata(const struct spi_device *spi) in spi_get_ctldata() argument 270 return spi->controller_state; in spi_get_ctldata() 273 static inline void spi_set_ctldata(struct spi_device *spi, void *state) in spi_set_ctldata() argument 275 spi->controller_state = state; in spi_set_ctldata() 280 static inline void spi_set_drvdata(struct spi_device *spi, void *data) in spi_set_drvdata() argument [all …]
|
/linux/drivers/rtc/ |
H A D | rtc-ds1302.c | 39 struct spi_device *spi = dev_get_drvdata(dev); in ds1302_rtc_set_time() local 49 status = spi_write_then_read(spi, buf, 2, in ds1302_rtc_set_time() 68 return spi_write_then_read(spi, buf, sizeof(buf), in ds1302_rtc_set_time() 74 struct spi_device *spi = dev_get_drvdata(dev); in ds1302_rtc_get_time() local 82 status = spi_write_then_read(spi, &addr, sizeof(addr), in ds1302_rtc_get_time() 104 static int ds1302_probe(struct spi_device *spi) in ds1302_probe() argument 116 if (spi->bits_per_word && (spi->bits_per_word != 8)) { in ds1302_probe() 117 dev_err(&spi->dev, "bad word length\n"); in ds1302_probe() 119 } else if (spi->max_speed_hz > 2000000) { in ds1302_probe() 120 dev_err(&spi->dev, "speed is too high\n"); in ds1302_probe() [all …]
|
H A D | rtc-max6916.c | 34 struct spi_device *spi = to_spi_device(dev); in max6916_read_reg() local 38 return spi_write_then_read(spi, data, 1, data, 1); in max6916_read_reg() 44 struct spi_device *spi = to_spi_device(dev); in max6916_write_reg() local 50 return spi_write_then_read(spi, buf, 2, NULL, 0); in max6916_write_reg() 55 struct spi_device *spi = to_spi_device(dev); in max6916_read_time() local 61 err = spi_write_then_read(spi, buf, 1, buf, 8); in max6916_read_time() 79 struct spi_device *spi = to_spi_device(dev); in max6916_set_time() local 83 dev_err(&spi->dev, "Year must be between 2000 and 2099. It's %d.\n", in max6916_set_time() 99 return spi_write_then_read(spi, buf, 9, NULL, 0); in max6916_set_time() 107 static int max6916_probe(struct spi_device *spi) in max6916_probe() argument [all …]
|
H A D | rtc-ds1305.c | 85 struct spi_device *spi; member 157 err = spi_write_then_read(ds1305->spi, buf, sizeof(buf), NULL, 0); in ds1305_alarm_irq_enable() 180 status = spi_write_then_read(ds1305->spi, &addr, sizeof(addr), in ds1305_get_time() 231 return spi_write_then_read(ds1305->spi, buf, sizeof(buf), in ds1305_set_time() 269 struct spi_device *spi = ds1305->spi; in ds1305_get_alarm() local 280 status = spi_write_then_read(spi, &addr, sizeof(addr), in ds1305_get_alarm() 290 status = spi_write_then_read(spi, &addr, sizeof(addr), in ds1305_get_alarm() 321 struct spi_device *spi = ds1305->spi; in ds1305_set_alarm() local 348 status = spi_write_then_read(ds1305->spi, buf, 2, NULL, 0); in ds1305_set_alarm() 364 status = spi_write_then_read(spi, buf, sizeof(buf), NULL, 0); in ds1305_set_alarm() [all …]
|
/linux/drivers/hwmon/ |
H A D | ads7871.c | 66 struct spi_device *spi; member 69 static int ads7871_read_reg8(struct spi_device *spi, int reg) in ads7871_read_reg8() argument 73 ret = spi_w8r8(spi, reg); in ads7871_read_reg8() 77 static int ads7871_read_reg16(struct spi_device *spi, int reg) in ads7871_read_reg16() argument 81 ret = spi_w8r16(spi, reg); in ads7871_read_reg16() 85 static int ads7871_write_reg8(struct spi_device *spi, int reg, u8 val) in ads7871_write_reg8() argument 88 return spi_write(spi, tmp, sizeof(tmp)); in ads7871_write_reg8() 95 struct spi_device *spi = pdata->spi; in voltage_show() local 107 ads7871_write_reg8(spi, REG_GAIN_MUX, in voltage_show() 110 ret = ads7871_read_reg8(spi, REG_GAIN_MUX); in voltage_show() [all …]
|