gp2ap030.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * Copyright (c) 2012 SAMSUNG
  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. * as published by the Free Software Foundation; either version 2
  7. * of the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  17. * MA 02110-1301, USA.
  18. */
  19. #ifndef __GP2A_H__
  20. #define __GP2A_H__
  21. #define I2C_M_WR 0 /* for i2c Write */
  22. #define I2c_M_RD 1 /* for i2c Read */
  23. #define I2C_DF_NOTIFY 0x01 /* for i2c */
  24. /* Registers */
  25. #define COMMAND1 0x00
  26. #define COMMAND2 0x01 /* Read&Write */
  27. #define COMMAND3 0x02 /* Read&Write */
  28. #define COMMAND4 0x03 /* Read&Write */
  29. #define INT_LT_LSB 0x04 /* Read&Write */
  30. #define INT_LT_MSB 0x05 /* Read&Write */
  31. #define INT_HT_LSB 0x06 /* Read&Write */
  32. #define INT_HT_MSB 0x07 /* Read&Write */
  33. #define PS_LT_LSB 0x08 /* Read&Write */
  34. #define PS_LT_MSB 0x09 /* Read&Write */
  35. #define PS_HT_LSB 0x0A /* Read&Write */
  36. #define PS_HT_MSB 0x0B /* Read&Write */
  37. #define DATA0_LSB 0x0C /* Read Only */
  38. #define DATA0_MSB 0x0D /* Read Only */
  39. #define DATA1_LSB 0x0E /* Read Only */
  40. #define DATA1_MSB 0x0F /* Read Only */
  41. #define DATA2_LSB 0x10 /* Read Only */
  42. #define DATA2_MSB 0x11 /* Read Only */
  43. #define ADC_BUFFER_NUM 6
  44. #define DEFAULT_LO_THR 0x07 /* sharp recommand Loff */
  45. #define DEFAULT_HI_THR 0x08 /* sharp recommand Lon */
  46. #define OFFSET_ARRAY_LENGTH 10
  47. /* 16 level for premium model*/
  48. enum {
  49. LIGHT_DIM = 0,
  50. LIGHT_LEVEL1,
  51. LIGHT_LEVEL2,
  52. LIGHT_LEVEL3,
  53. LIGHT_LEVEL4,
  54. LIGHT_LEVEL5,
  55. LIGHT_LEVEL6,
  56. LIGHT_LEVEL7,
  57. LIGHT_LEVEL8,
  58. LIGHT_LEVEL9,
  59. LIGHT_LEVEL10,
  60. LIGHT_LEVEL11,
  61. LIGHT_LEVEL12,
  62. LIGHT_LEVEL13,
  63. LIGHT_LEVEL14,
  64. LIGHT_LEVEL15,
  65. LIGHT_LEVEL16,
  66. LIGHT_INIT,
  67. };
  68. enum {
  69. D0_BND = 0,
  70. D0_COND1,
  71. D0_COND1_A,
  72. D0_COND1_B,
  73. D0_COND2,
  74. D0_COND2_A,
  75. D0_COND2_B,
  76. D0_COND3_A,
  77. D0_COND3_B,
  78. };
  79. struct gp2ap020_pdata {
  80. /*void (*power_on) (bool);
  81. void (*led_on) (bool);*/
  82. int p_out; /* proximity-sensor-output gpio (proximity interrupt) */
  83. int irq;
  84. u32 p_out_flags;
  85. u32 vdd_2p85;
  86. /*u32 vdd_en;*/
  87. int version; /* choice chip version 020 or 030 */
  88. u32 version_flags;
  89. const char *prox_cal_path;
  90. int d0_value[9];
  91. u8 thresh[2];
  92. };
  93. #endif