9 #include <linux/input.h>
10 #include <linux/module.h>
13 #include <linux/types.h>
16 #define AD714x_SPI_CMD_PREFIX 0xE000
17 #define AD714x_SPI_READ BIT(10)
20 static int ad714x_spi_suspend(
struct device *
dev)
25 static int ad714x_spi_resume(
struct device *
dev)
34 unsigned short reg,
unsigned short *
data,
size_t len)
43 memset(xfer, 0,
sizeof(xfer));
47 xfer[0].tx_buf = &chip->xfer_buf[0];
48 xfer[0].len =
sizeof(chip->xfer_buf[0]);
49 spi_message_add_tail(&xfer[0], &
message);
51 xfer[1].rx_buf = &chip->xfer_buf[1];
52 xfer[1].len =
sizeof(chip->xfer_buf[1]) * len;
53 spi_message_add_tail(&xfer[1], &
message);
57 dev_err(chip->
dev,
"SPI read error: %d\n", error);
61 for (i = 0; i <
len; i++)
67 static int ad714x_spi_write(
struct ad714x_chip *chip,
68 unsigned short reg,
unsigned short data)
76 error = spi_write(spi, (
u8 *)chip->xfer_buf,
77 2 *
sizeof(*chip->xfer_buf));
79 dev_err(chip->
dev,
"SPI write error: %d\n", error);
97 ad714x_spi_read, ad714x_spi_write);
101 spi_set_drvdata(spi, chip);
111 spi_set_drvdata(spi,
NULL);
116 static struct spi_driver ad714x_spi_driver = {
118 .name =
"ad714x_captouch",
120 .pm = &ad714x_spi_pm,
122 .probe = ad714x_spi_probe,