rmi_spi 53 drivers/input/rmi4/rmi_spi.c static int rmi_spi_manage_pools(struct rmi_spi_xport *rmi_spi, int len) rmi_spi 55 drivers/input/rmi4/rmi_spi.c struct spi_device *spi = rmi_spi->spi; rmi_spi 56 drivers/input/rmi4/rmi_spi.c int buf_size = rmi_spi->xfer_buf_size rmi_spi 57 drivers/input/rmi4/rmi_spi.c ? rmi_spi->xfer_buf_size : RMI_SPI_DEFAULT_XFER_BUF_SIZE; rmi_spi 68 drivers/input/rmi4/rmi_spi.c tmp = rmi_spi->rx_buf; rmi_spi 74 drivers/input/rmi4/rmi_spi.c rmi_spi->rx_buf = buf; rmi_spi 75 drivers/input/rmi4/rmi_spi.c rmi_spi->tx_buf = &rmi_spi->rx_buf[buf_size]; rmi_spi 76 drivers/input/rmi4/rmi_spi.c rmi_spi->xfer_buf_size = buf_size; rmi_spi 81 drivers/input/rmi4/rmi_spi.c if (rmi_spi->xport.pdata.spi_data.read_delay_us) rmi_spi 82 drivers/input/rmi4/rmi_spi.c rmi_spi->rx_xfer_count = buf_size; rmi_spi 84 drivers/input/rmi4/rmi_spi.c rmi_spi->rx_xfer_count = 1; rmi_spi 86 drivers/input/rmi4/rmi_spi.c if (rmi_spi->xport.pdata.spi_data.write_delay_us) rmi_spi 87 drivers/input/rmi4/rmi_spi.c rmi_spi->tx_xfer_count = buf_size; rmi_spi 89 drivers/input/rmi4/rmi_spi.c rmi_spi->tx_xfer_count = 1; rmi_spi 95 drivers/input/rmi4/rmi_spi.c tmp = rmi_spi->rx_xfers; rmi_spi 97 drivers/input/rmi4/rmi_spi.c rmi_spi->rx_xfer_count + rmi_spi->tx_xfer_count, rmi_spi 103 drivers/input/rmi4/rmi_spi.c rmi_spi->rx_xfers = xfer_buf; rmi_spi 104 drivers/input/rmi4/rmi_spi.c rmi_spi->tx_xfers = &xfer_buf[rmi_spi->rx_xfer_count]; rmi_spi 112 drivers/input/rmi4/rmi_spi.c static int rmi_spi_xfer(struct rmi_spi_xport *rmi_spi, rmi_spi 116 drivers/input/rmi4/rmi_spi.c struct spi_device *spi = rmi_spi->spi; rmi_spi 118 drivers/input/rmi4/rmi_spi.c &rmi_spi->xport.pdata.spi_data; rmi_spi 148 drivers/input/rmi4/rmi_spi.c if (rmi_spi->xfer_buf_size < len) { rmi_spi 149 drivers/input/rmi4/rmi_spi.c ret = rmi_spi_manage_pools(rmi_spi, len); rmi_spi 163 drivers/input/rmi4/rmi_spi.c rmi_spi->tx_buf[0] = (addr >> 8); rmi_spi 164 drivers/input/rmi4/rmi_spi.c rmi_spi->tx_buf[1] = addr & 0xFF; rmi_spi 167 drivers/input/rmi4/rmi_spi.c rmi_spi->tx_buf[0] = (addr >> 8) | 0x80; rmi_spi 168 drivers/input/rmi4/rmi_spi.c rmi_spi->tx_buf[1] = addr & 0xFF; rmi_spi 175 drivers/input/rmi4/rmi_spi.c rmi_spi->tx_buf[0] = 0x40; rmi_spi 176 drivers/input/rmi4/rmi_spi.c rmi_spi->tx_buf[1] = (addr >> 8) & 0xFF; rmi_spi 177 drivers/input/rmi4/rmi_spi.c rmi_spi->tx_buf[2] = addr & 0xFF; rmi_spi 178 drivers/input/rmi4/rmi_spi.c rmi_spi->tx_buf[3] = tx_len; rmi_spi 183 drivers/input/rmi4/rmi_spi.c memcpy(&rmi_spi->tx_buf[cmd_len], tx_buf, tx_len); rmi_spi 185 drivers/input/rmi4/rmi_spi.c if (rmi_spi->tx_xfer_count > 1) { rmi_spi 187 drivers/input/rmi4/rmi_spi.c xfer = &rmi_spi->tx_xfers[i]; rmi_spi 189 drivers/input/rmi4/rmi_spi.c xfer->tx_buf = &rmi_spi->tx_buf[i]; rmi_spi 195 drivers/input/rmi4/rmi_spi.c xfer = rmi_spi->tx_xfers; rmi_spi 197 drivers/input/rmi4/rmi_spi.c xfer->tx_buf = rmi_spi->tx_buf; rmi_spi 204 drivers/input/rmi4/rmi_spi.c total_tx_len, total_tx_len, rmi_spi->tx_buf); rmi_spi 207 drivers/input/rmi4/rmi_spi.c if (rmi_spi->rx_xfer_count > 1) { rmi_spi 209 drivers/input/rmi4/rmi_spi.c xfer = &rmi_spi->rx_xfers[i]; rmi_spi 211 drivers/input/rmi4/rmi_spi.c xfer->rx_buf = &rmi_spi->rx_buf[i]; rmi_spi 217 drivers/input/rmi4/rmi_spi.c xfer = rmi_spi->rx_xfers; rmi_spi 219 drivers/input/rmi4/rmi_spi.c xfer->rx_buf = rmi_spi->rx_buf; rmi_spi 232 drivers/input/rmi4/rmi_spi.c memcpy(rx_buf, rmi_spi->rx_buf, rx_len); rmi_spi 254 drivers/input/rmi4/rmi_spi.c static int rmi_set_page(struct rmi_spi_xport *rmi_spi, u8 page) rmi_spi 262 drivers/input/rmi4/rmi_spi.c ret = rmi_spi_xfer(rmi_spi, &cmd, &page, 1, NULL, 0); rmi_spi 265 drivers/input/rmi4/rmi_spi.c rmi_spi->page = page; rmi_spi 273 drivers/input/rmi4/rmi_spi.c struct rmi_spi_xport *rmi_spi = rmi_spi 278 drivers/input/rmi4/rmi_spi.c mutex_lock(&rmi_spi->page_mutex); rmi_spi 280 drivers/input/rmi4/rmi_spi.c if (RMI_SPI_PAGE(addr) != rmi_spi->page) { rmi_spi 281 drivers/input/rmi4/rmi_spi.c ret = rmi_set_page(rmi_spi, RMI_SPI_PAGE(addr)); rmi_spi 289 drivers/input/rmi4/rmi_spi.c ret = rmi_spi_xfer(rmi_spi, &cmd, buf, len, NULL, 0); rmi_spi 292 drivers/input/rmi4/rmi_spi.c mutex_unlock(&rmi_spi->page_mutex); rmi_spi 299 drivers/input/rmi4/rmi_spi.c struct rmi_spi_xport *rmi_spi = rmi_spi 304 drivers/input/rmi4/rmi_spi.c mutex_lock(&rmi_spi->page_mutex); rmi_spi 306 drivers/input/rmi4/rmi_spi.c if (RMI_SPI_PAGE(addr) != rmi_spi->page) { rmi_spi 307 drivers/input/rmi4/rmi_spi.c ret = rmi_set_page(rmi_spi, RMI_SPI_PAGE(addr)); rmi_spi 315 drivers/input/rmi4/rmi_spi.c ret = rmi_spi_xfer(rmi_spi, &cmd, NULL, 0, buf, len); rmi_spi 318 drivers/input/rmi4/rmi_spi.c mutex_unlock(&rmi_spi->page_mutex); rmi_spi 364 drivers/input/rmi4/rmi_spi.c struct rmi_spi_xport *rmi_spi = data; rmi_spi 366 drivers/input/rmi4/rmi_spi.c rmi_unregister_transport_device(&rmi_spi->xport); rmi_spi 371 drivers/input/rmi4/rmi_spi.c struct rmi_spi_xport *rmi_spi; rmi_spi 379 drivers/input/rmi4/rmi_spi.c rmi_spi = devm_kzalloc(&spi->dev, sizeof(struct rmi_spi_xport), rmi_spi 381 drivers/input/rmi4/rmi_spi.c if (!rmi_spi) rmi_spi 384 drivers/input/rmi4/rmi_spi.c pdata = &rmi_spi->xport.pdata; rmi_spi 408 drivers/input/rmi4/rmi_spi.c rmi_spi->spi = spi; rmi_spi 409 drivers/input/rmi4/rmi_spi.c mutex_init(&rmi_spi->page_mutex); rmi_spi 411 drivers/input/rmi4/rmi_spi.c rmi_spi->xport.dev = &spi->dev; rmi_spi 412 drivers/input/rmi4/rmi_spi.c rmi_spi->xport.proto_name = "spi"; rmi_spi 413 drivers/input/rmi4/rmi_spi.c rmi_spi->xport.ops = &rmi_spi_ops; rmi_spi 415 drivers/input/rmi4/rmi_spi.c spi_set_drvdata(spi, rmi_spi); rmi_spi 417 drivers/input/rmi4/rmi_spi.c error = rmi_spi_manage_pools(rmi_spi, RMI_SPI_DEFAULT_XFER_BUF_SIZE); rmi_spi 425 drivers/input/rmi4/rmi_spi.c error = rmi_set_page(rmi_spi, 0); rmi_spi 433 drivers/input/rmi4/rmi_spi.c error = rmi_register_transport_device(&rmi_spi->xport); rmi_spi 441 drivers/input/rmi4/rmi_spi.c rmi_spi); rmi_spi 452 drivers/input/rmi4/rmi_spi.c struct rmi_spi_xport *rmi_spi = spi_get_drvdata(spi); rmi_spi 455 drivers/input/rmi4/rmi_spi.c ret = rmi_driver_suspend(rmi_spi->xport.rmi_dev, true); rmi_spi 465 drivers/input/rmi4/rmi_spi.c struct rmi_spi_xport *rmi_spi = spi_get_drvdata(spi); rmi_spi 468 drivers/input/rmi4/rmi_spi.c ret = rmi_driver_resume(rmi_spi->xport.rmi_dev, true); rmi_spi 480 drivers/input/rmi4/rmi_spi.c struct rmi_spi_xport *rmi_spi = spi_get_drvdata(spi); rmi_spi 483 drivers/input/rmi4/rmi_spi.c ret = rmi_driver_suspend(rmi_spi->xport.rmi_dev, false); rmi_spi 493 drivers/input/rmi4/rmi_spi.c struct rmi_spi_xport *rmi_spi = spi_get_drvdata(spi); rmi_spi 496 drivers/input/rmi4/rmi_spi.c ret = rmi_driver_resume(rmi_spi->xport.rmi_dev, false);