import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / arm / mach-mt8127 / tcl8127_tb_c_l / touchpanel / tpd.h
1 #include <linux/init.h>
2 #include <linux/module.h>
3 #include <linux/kernel.h>
4 #include <linux/input.h>
5 #include <linux/interrupt.h>
6 #include <linux/time.h>
7 #include <linux/types.h>
8 #include <linux/seq_file.h>
9 #include <linux/list.h>
10 #include <linux/proc_fs.h>
11
12 #include <linux/slab.h>
13
14 #include <mach/mt_gpio.h>
15 #include <mach/mt_reg_base.h>
16 #include <mach/mt_typedefs.h>
17
18 #include <mach/board.h>
19 #include <mach/irqs.h>
20 #include <mach/eint.h>
21
22 #include <asm/io.h>
23 #include <linux/platform_device.h>
24 #include <generated/autoconf.h>
25 #include <linux/kobject.h>
26 #include <linux/earlysuspend.h>
27 //#include "tpd_custom.h"
28
29 /* debug macros */
30 ////#define TPD_DEBUG
31 #define TPD_DEBUG_CODE
32 //#define TPD_DEBUG_TRACK
33 #define TPD_DMESG(a,arg...) printk(TPD_DEVICE ": " a,##arg)
34 #if defined(TPD_DEBUG)
35 #undef TPD_DEBUG
36 #define TPD_DEBUG(a,arg...) printk(TPD_DEVICE ": " a,##arg)
37 #else
38 #define TPD_DEBUG(arg...)
39 #endif
40
41 /* register, address, configurations */
42 #define TPD_DEVICE "mtk-tpd"
43 #define TPD_X 0
44 #define TPD_Y 1
45 #define TPD_Z1 2
46 #define TPD_Z2 3
47 #define TP_DELAY (2*HZ/100)
48 #define TP_DRV_MAX_COUNT (20)
49 #define TPD_WARP_CNT (4)
50 #define TPD_VIRTUAL_KEY_MAX (10)
51
52 /* various mode */
53 #define TPD_MODE_NORMAL 0
54 #define TPD_MODE_KEYPAD 1
55 #define TPD_MODE_SW 2
56 #define TPD_MODE_FAV_SW 3
57 #define TPD_MODE_FAV_HW 4
58 #define TPD_MODE_RAW_DATA 5
59 #undef TPD_RES_X
60 #undef TPD_RES_Y
61 extern int TPD_RES_X;
62 extern int TPD_RES_Y;
63 extern int tpd_load_status ; //0: failed, 1: sucess
64 extern int tpd_mode;
65 extern int tpd_mode_axis;
66 extern int tpd_mode_min;
67 extern int tpd_mode_max;
68 extern int tpd_mode_keypad_tolerance;
69 extern int tpd_em_debounce_time;
70 extern int tpd_em_debounce_time0;
71 extern int tpd_em_debounce_time1;
72 extern int tpd_em_asamp;
73 extern int tpd_em_auto_time_interval;
74 extern int tpd_em_sample_cnt;
75 extern int tpd_calmat[];
76 extern int tpd_def_calmat[];
77 extern int tpd_calmat[];
78 extern int tpd_def_calmat[];
79 extern int TPD_DO_WARP;
80 extern int tpd_wb_start[];
81 extern int tpd_wb_end[];
82
83 struct tpd_device
84 {
85 struct input_dev *dev;
86 struct input_dev *kpd;
87 struct timer_list timer;
88 struct tasklet_struct tasklet;
89 int btn_state;
90 };
91
92 struct tpd_attrs
93 {
94 struct device_attribute **attr;
95 int num;
96 };
97 struct tpd_driver_t
98 {
99 char *tpd_device_name;
100 int (*tpd_local_init)(void);
101 void (*suspend)(struct early_suspend *h);
102 void (*resume)(struct early_suspend *h);
103 int tpd_have_button;
104 struct tpd_attrs attrs;
105 };
106
107 #if 1 //#ifdef TPD_HAVE_BUTTON
108 void tpd_button(unsigned int x, unsigned int y, unsigned int down);
109 void tpd_button_init(void);
110 ssize_t tpd_virtual_key(char *buf);
111 //#ifndef TPD_BUTTON_HEIGHT
112 //#define TPD_BUTTON_HEIGHT TPD_RES_Y
113 //#endif
114 #endif
115
116 #if 0
117 void tpd_adc_init(void);
118 void tpd_set_debounce_time(int debounce_time);
119 void tpd_set_spl_number(int spl_num);
120 u16 tpd_read(int position);
121 u16 tpd_read_adc(u16 pos);
122 u16 tpd_read_status(void);
123 #endif
124
125 extern int tpd_driver_add(struct tpd_driver_t *tpd_drv);
126 extern int tpd_driver_remove(struct tpd_driver_t *tpd_drv);
127 void tpd_button_setting(int keycnt, void *keys, void *keys_dim);
128 extern int tpd_em_spl_num;
129 extern int tpd_em_pressure_threshold;
130
131 #ifdef TPD_DEBUG_CODE
132 #include "tpd_debug.h"
133 #endif
134
135 #ifdef TPD_HAVE_CALIBRATION
136 #include "tpd_calibrate.h"
137 #endif
138
139 #include "tpd_default.h"
140
141 /* switch touch panel into different mode */
142 void _tpd_switch_single_mode(void);
143 void _tpd_switch_multiple_mode(void);
144 void _tpd_switch_sleep_mode(void);
145 void _tpd_switch_normal_mode(void);