sx9500_reg.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. * Copyright (C) 2013 Samsung Electronics. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * version 2 as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. * General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program; if not, write to the Free Software
  15. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  16. * 02110-1301 USA
  17. */
  18. #ifndef _SX9500_I2C_REG_H_
  19. #define _SX9500_I2C_REG_H_
  20. /*
  21. * I2C Registers
  22. */
  23. #define SX9500_IRQSTAT_REG 0x00
  24. #define SX9500_TCHCMPSTAT_REG 0x01
  25. #define SX9500_IRQ_ENABLE_REG 0x03
  26. #define SX9500_CPS_CTRL0_REG 0x06
  27. #define SX9500_CPS_CTRL1_REG 0x07
  28. #define SX9500_CPS_CTRL2_REG 0x08
  29. #define SX9500_CPS_CTRL3_REG 0x09
  30. #define SX9500_CPS_CTRL4_REG 0x0A
  31. #define SX9500_CPS_CTRL5_REG 0x0B
  32. #define SX9500_CPS_CTRL6_REG 0x0C
  33. #define SX9500_CPS_CTRL7_REG 0x0D
  34. #define SX9500_CPS_CTRL8_REG 0x0E
  35. #define SX9500_SOFTRESET_REG 0x7F
  36. /* Sensor Readback */
  37. #define SX9500_REGSENSORSELECT 0x20
  38. #define SX9500_REGUSEMSB 0x21
  39. #define SX9500_REGUSELSB 0x22
  40. #define SX9500_REGAVGMSB 0x23
  41. #define SX9500_REGAVGLSB 0x24
  42. #define SX9500_REGDIFFMSB 0x25
  43. #define SX9500_REGDIFFLSB 0x26
  44. #define SX9500_REGOFFSETMSB 0x27
  45. #define SX9500_REGOFFSETLSB 0x28
  46. /* IrqStat 0:Inactive 1:Active */
  47. #define SX9500_IRQSTAT_RESET_FLAG 0x80
  48. #define SX9500_IRQSTAT_TOUCH_FLAG 0x40
  49. #define SX9500_IRQSTAT_RELEASE_FLAG 0x20
  50. #define SX9500_IRQSTAT_COMPDONE_FLAG 0x10
  51. #define SX9500_IRQSTAT_CONV_FLAG 0x08
  52. #define SX9500_IRQSTAT_TXENSTAT_FLAG 0x01
  53. /* CpsStat */
  54. #define SX9500_TCHCMPSTAT_TCHSTAT3_FLAG 0x80
  55. #define SX9500_TCHCMPSTAT_TCHSTAT2_FLAG 0x40
  56. #define SX9500_TCHCMPSTAT_TCHSTAT1_FLAG 0x20
  57. #define SX9500_TCHCMPSTAT_TCHSTAT0_FLAG 0x10
  58. /* SoftReset */
  59. #define SX9500_SOFTRESET 0xDE
  60. struct smtc_reg_data {
  61. unsigned char reg;
  62. unsigned char val;
  63. };
  64. static const struct smtc_reg_data setup_reg[] = {
  65. {
  66. .reg = SX9500_IRQ_ENABLE_REG,
  67. .val = 0xF0,
  68. },
  69. {
  70. .reg = SX9500_CPS_CTRL1_REG,
  71. .val = 0x43,
  72. },
  73. {
  74. .reg = SX9500_CPS_CTRL2_REG,
  75. .val = 0x77,
  76. },
  77. {
  78. .reg = SX9500_CPS_CTRL3_REG,
  79. .val = 0x01,
  80. },
  81. {
  82. .reg = SX9500_CPS_CTRL4_REG,
  83. .val = 0x30,
  84. },
  85. {
  86. .reg = SX9500_CPS_CTRL5_REG,
  87. .val = 0x0F,
  88. },
  89. {
  90. .reg = SX9500_CPS_CTRL6_REG,
  91. .val = 0x11,
  92. },
  93. {
  94. .reg = SX9500_CPS_CTRL7_REG,
  95. .val = 0x00,
  96. },
  97. {
  98. .reg = SX9500_CPS_CTRL8_REG,
  99. .val = 0x00,
  100. },
  101. {
  102. .reg = SX9500_CPS_CTRL0_REG,
  103. .val = 0x20,
  104. },
  105. };
  106. enum {
  107. OFF = 0,
  108. ON = 1
  109. };
  110. #endif /* _SX9500_I2C_REG_H_*/