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>
12 #include <linux/slab.h>
14 #include <mach/mt_gpio.h>
15 #include <mach/mt_reg_base.h>
16 #include <mach/mt_typedefs.h>
18 #include <mach/board.h>
19 #include <mach/irqs.h>
20 #include <mach/eint.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"
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)
36 #define TPD_DEBUG(a,arg...) printk(TPD_DEVICE ": " a,##arg)
38 #define TPD_DEBUG(arg...)
41 /* register, address, configurations */
42 #define TPD_DEVICE "mtk-tpd"
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)
53 #define TPD_MODE_NORMAL 0
54 #define TPD_MODE_KEYPAD 1
56 #define TPD_MODE_FAV_SW 3
57 #define TPD_MODE_FAV_HW 4
58 #define TPD_MODE_RAW_DATA 5
63 extern int tpd_load_status
; //0: failed, 1: sucess
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
[];
85 struct input_dev
*dev
;
86 struct input_dev
*kpd
;
87 struct timer_list timer
;
88 struct tasklet_struct tasklet
;
94 struct device_attribute
**attr
;
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
);
104 struct tpd_attrs attrs
;
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
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);
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
;
131 #ifdef TPD_DEBUG_CODE
132 #include "tpd_debug.h"
135 #ifdef TPD_HAVE_CALIBRATION
136 #include "tpd_calibrate.h"
139 #include "tpd_default.h"
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);