diff options
Diffstat (limited to 'drivers/input/touchscreen/stm/fts_lib/ftsIO.h')
-rw-r--r-- | drivers/input/touchscreen/stm/fts_lib/ftsIO.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/stm/fts_lib/ftsIO.h b/drivers/input/touchscreen/stm/fts_lib/ftsIO.h new file mode 100644 index 000000000000..f470991b05c2 --- /dev/null +++ b/drivers/input/touchscreen/stm/fts_lib/ftsIO.h @@ -0,0 +1,78 @@ +/* + * + ************************************************************************** + ** STMicroelectronics ** + ************************************************************************** + ** marco.cali@st.com ** + ************************************************************************** + * * + * I2C/SPI Communication * + * * + ************************************************************************** + ************************************************************************** + * + */ +/*! + * \file ftsIO.h + * \brief Contains all the definitions and prototypes used and implemented in + * ftsIO.c + */ + +#ifndef FTS_IO_H +#define FTS_IO_H + +#include "ftsSoftware.h" + +#define I2C_RETRY 3 /* /< number of retry in case of i2c + * failure */ +#define I2C_WAIT_BEFORE_RETRY 2 /* /< wait in ms before retry an i2c + * transaction */ + +#ifdef I2C_INTERFACE +#include <linux/i2c.h> +#include <linux/i2c-dev.h> +struct i2c_client *getClient(void); +#else +#include <linux/spi/spi.h> +struct spi_device *getClient(void); +#endif + + + +int openChannel(void *clt); +struct device *getDev(void); + + + +/*************** NEW I2C API ****************/ +int changeSAD(u8 sad); +int fts_read(u8 *outBuf, int byteToRead); +int fts_read_heap(u8 *outBuf, int byteToRead); +int fts_writeRead(u8 *cmd, int cmdLength, u8 *outBuf, int byteToRead); +int fts_writeRead_heap(u8 *cmd, int cmdLength, u8 *outBuf, int byteToRead); +int fts_write(u8 *cmd, int cmdLength); +int fts_write_heap(u8 *cmd, int cmdLength); +int fts_writeFwCmd(u8 *cmd, int cmdLength); +int fts_writeFwCmd_heap(u8 *cmd, int cmdLength); +int fts_writeThenWriteRead(u8 *writeCmd1, int writeCmdLength, + u8 *readCmd1, int readCmdLength, + u8 *outBuf, int byteToRead); +int fts_writeThenWriteRead_heap(u8 *writeCmd1, int writeCmdLength, + u8 *readCmd1, int readCmdLength, + u8 *outBuf, int byteToRead); + +/* chunked version of fts_write */ +int fts_writeU8UX(u8 cmd, AddrSize addrSize, u64 address, u8 *data, + int dataSize); +/* chunked version of fts_writeRead */ +int fts_writeReadU8UX(u8 cmd, AddrSize addrSize, u64 address, u8 *outBuf, + int byteToRead, int hasDummyByte); +/* chunked, write followed by another write */ +int fts_writeU8UXthenWriteU8UX(u8 cmd1, AddrSize addrSize1, u8 cmd2, + AddrSize addrSize2, u64 address, u8 *data, + int dataSize); +/* chunked, write followed by a writeRead */ +int fts_writeU8UXthenWriteReadU8UX(u8 cmd1, AddrSize addrSize1, u8 cmd2, + AddrSize addrSize2, u64 address, u8 *outBuf, + int count, int hasDummyByte); +#endif |