ftsIO.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * FTS Capacitive touch screen controller (FingerTipS)
  4. *
  5. * Copyright (C) 2016-2019, STMicroelectronics Limited.
  6. * Authors: AMG(Analog Mems Group) <[email protected]>
  7. *
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License version 2 as published by
  11. * the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful, but WITHOUT
  14. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  15. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  16. * more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along with
  19. * this program. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. /**
  22. *
  23. **************************************************************************
  24. ** STMicroelectronics **
  25. **************************************************************************
  26. ** [email protected] **
  27. **************************************************************************
  28. * *
  29. * I2C/SPI Communication **
  30. * *
  31. **************************************************************************
  32. **************************************************************************
  33. */
  34. #ifndef __FTS_IO_H
  35. #define __FTS_IO_H
  36. #include <linux/i2c.h>
  37. #include <linux/i2c-dev.h>
  38. #include "ftsSoftware.h"
  39. #include "ftsCrossCompile.h"
  40. #define I2C_RETRY 3 //number of retry
  41. #define I2C_WAIT_BEFORE_RETRY 2 //ms
  42. int openChannel(struct i2c_client *clt);
  43. struct device *getDev(void);
  44. struct i2c_client *getClient(void);
  45. int fts_readCmd(u8 *cmd, int cmdLenght, u8 *outBuf, int byteToRead);
  46. int fts_writeCmd(u8 *cmd, int cmdLenght);
  47. int fts_writeFwCmd(u8 *cmd, int cmdLenght);
  48. int writeReadCmd(u8 *writeCmd, int writeCmdLenght, u8 *readCmd,
  49. int readCmdLenght, u8 *outBuf, int byteToRead);
  50. int readCmdU16(u8 cmd, u16 address, u8 *outBuf, int byteToRead,
  51. int hasDummyByte);
  52. int writeCmdU16(u8 WriteCmd, u16 address, u8 *dataToWrite, int byteToWrite);
  53. int writeCmdU32(u8 writeCmd1, u8 writeCmd2, u32 address, u8 *dataToWrite,
  54. int byteToWrite);
  55. int writeReadCmdU32(u8 wCmd, u8 rCmd, u32 address, u8 *outBuf, int byteToRead,
  56. int hasDummyByte);
  57. #endif