tpd.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. #ifndef __TPD_H
  2. #define __TPD_H
  3. #include <linux/init.h>
  4. #include <linux/module.h>
  5. #include <linux/kernel.h>
  6. #include <linux/input.h>
  7. #include <linux/interrupt.h>
  8. #include <linux/time.h>
  9. #include <linux/types.h>
  10. #include <linux/seq_file.h>
  11. #include <linux/list.h>
  12. #include <linux/proc_fs.h>
  13. #include <linux/slab.h>
  14. #include <linux/io.h>
  15. #include <linux/platform_device.h>
  16. #include <generated/autoconf.h>
  17. #include <linux/kobject.h>
  18. #include <linux/regulator/consumer.h>
  19. /*debug macros */
  20. /*#define TPD_DEBUG */
  21. #define TPD_DEBUG_CODE
  22. /* #define TPD_DEBUG_TRACK */
  23. #define TPD_DMESG(a, arg...) pr_debug(TPD_DEVICE ": " a, ##arg)
  24. #if defined(TPD_DEBUG)
  25. #undef TPD_DEBUG
  26. #define TPD_DEBUG(a, arg...) pr_debug(TPD_DEVICE ": " a, ##arg)
  27. #else
  28. #define TPD_DEBUG(arg...)
  29. #endif
  30. /* register, address, configurations */
  31. #define TPD_DEVICE "mtk-tpd"
  32. #define TPD_X 0
  33. #define TPD_Y 1
  34. #define TPD_Z1 2
  35. #define TPD_Z2 3
  36. #define TP_DELAY (2*HZ/100)
  37. #define TP_DRV_MAX_COUNT (20)
  38. #define TPD_WARP_CNT (4)
  39. #define TPD_VIRTUAL_KEY_MAX (10)
  40. /* various mode */
  41. #define TPD_MODE_NORMAL 0
  42. #define TPD_MODE_KEYPAD 1
  43. #define TPD_MODE_SW 2
  44. #define TPD_MODE_FAV_SW 3
  45. #define TPD_MODE_FAV_HW 4
  46. #define TPD_MODE_RAW_DATA 5
  47. #undef TPD_RES_X
  48. #undef TPD_RES_Y
  49. extern unsigned long TPD_RES_X;
  50. extern unsigned long TPD_RES_Y;
  51. extern int tpd_load_status; /* 0: failed, 1: success */
  52. extern int tpd_mode;
  53. extern int tpd_mode_axis;
  54. extern int tpd_mode_min;
  55. extern int tpd_mode_max;
  56. extern int tpd_mode_keypad_tolerance;
  57. extern int tpd_em_debounce_time;
  58. extern int tpd_em_debounce_time0;
  59. extern int tpd_em_debounce_time1;
  60. extern int tpd_em_asamp;
  61. extern int tpd_em_auto_time_interval;
  62. extern int tpd_em_sample_cnt;
  63. extern int tpd_calmat[];
  64. extern int tpd_def_calmat[];
  65. extern int tpd_calmat[];
  66. extern int tpd_def_calmat[];
  67. extern int TPD_DO_WARP;
  68. extern int tpd_wb_start[];
  69. extern int tpd_wb_end[];
  70. extern int tpd_v_magnify_x;
  71. extern int tpd_v_magnify_y;
  72. extern unsigned int DISP_GetScreenHeight(void);
  73. extern unsigned int DISP_GetScreenWidth(void);
  74. #if defined(CONFIG_MTK_S3320) || defined(CONFIG_MTK_S3320_47) || defined(CONFIG_MTK_S3320_50)
  75. extern void synaptics_init_sysfs(void);
  76. #endif /* CONFIG_MTK_S3320 */
  77. extern void tpd_button_init(void);
  78. struct tpd_device {
  79. struct device *tpd_dev;
  80. struct regulator *reg;
  81. struct regulator *io_reg;
  82. struct input_dev *dev;
  83. struct input_dev *kpd;
  84. struct timer_list timer;
  85. struct tasklet_struct tasklet;
  86. int btn_state;
  87. };
  88. struct tpd_key_dim_local {
  89. int key_x;
  90. int key_y;
  91. int key_width;
  92. int key_height;
  93. };
  94. struct tpd_filter_t {
  95. int enable; /*0: disable, 1: enable*/
  96. int pixel_density; /*XXX pixel/cm*/
  97. int W_W[3][4];/*filter custom setting prameters*/
  98. unsigned int VECLOCITY_THRESHOLD[3];/*filter speed custom settings*/
  99. };
  100. struct tpd_dts_info {
  101. int tpd_resolution[2];
  102. int tpd_convert_ratio[2];
  103. int touch_max_num;
  104. int use_tpd_button;
  105. int tpd_key_num;
  106. int tpd_key_local[4];
  107. struct tpd_key_dim_local tpd_key_dim_local[4];
  108. struct tpd_filter_t touch_filter;
  109. };
  110. extern struct tpd_dts_info tpd_dts_data;
  111. struct tpd_attrs {
  112. struct device_attribute **attr;
  113. int num;
  114. };
  115. struct tpd_driver_t {
  116. char *tpd_device_name;
  117. int (*tpd_local_init)(void);
  118. void (*suspend)(struct device *h);
  119. void (*resume)(struct device *h);
  120. int tpd_have_button;
  121. struct tpd_attrs attrs;
  122. };
  123. #if 1 /* #ifdef TPD_HAVE_BUTTON */
  124. void tpd_button(unsigned int x, unsigned int y, unsigned int down);
  125. void tpd_button_init(void);
  126. ssize_t tpd_virtual_key(char *buf);
  127. /* #ifndef TPD_BUTTON_HEIGHT */
  128. /* #define TPD_BUTTON_HEIGHT TPD_RES_Y */
  129. /* #endif */
  130. #endif
  131. extern int tpd_driver_add(struct tpd_driver_t *tpd_drv);
  132. extern int tpd_driver_remove(struct tpd_driver_t *tpd_drv);
  133. void tpd_button_setting(int keycnt, void *keys, void *keys_dim);
  134. extern int tpd_em_spl_num;
  135. extern int tpd_em_pressure_threshold;
  136. extern struct tpd_device *tpd;
  137. extern void tpd_get_dts_info(void);
  138. #define GTP_RST_PORT 0
  139. #define GTP_INT_PORT 1
  140. extern void tpd_gpio_as_int(int pin);
  141. extern void tpd_gpio_output(int pin, int level);
  142. extern struct of_device_id touch_of_match[];
  143. #ifdef TPD_DEBUG_CODE
  144. #include "tpd_debug.h"
  145. #endif
  146. #ifdef TPD_DEBUG_TRACK
  147. int DAL_Clean(void);
  148. int DAL_Printf(const char *fmt, ...);
  149. int LCD_LayerEnable(int id, BOOL enable);
  150. #endif
  151. #ifdef TPD_HAVE_CALIBRATION
  152. #include "tpd_calibrate.h"
  153. #endif
  154. #include "tpd_default.h"
  155. /* switch touch panel into different mode */
  156. void _tpd_switch_single_mode(void);
  157. void _tpd_switch_multiple_mode(void);
  158. void _tpd_switch_sleep_mode(void);
  159. void _tpd_switch_normal_mode(void);
  160. #endif