aboutsummaryrefslogtreecommitdiff
path: root/drivers/input/touchscreen/mediatek/tpd_debug.h
blob: 4907a0399dac9a86db3ca167551f4c98df307460 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#ifndef TPD_DEBUG_H
#define TPD_DEBUG_H
#ifdef TPD_DEBUG_CODE
#include<linux/i2c.h>

void tpd_debug_no_response(struct i2c_client *);
extern int tpd_debug_nr;

#define TPD_DEBUG_CHECK_NO_RESPONSE \
    if (tpd_debug_nr) { \
        wait_event_interruptible_timeout(waiter, tpd_flag != 0, HZ/10); \
        if (tpd_flag == 0) { \
	    tpd_debug_no_response(i2c_client); \
	    continue; \
	} \
    } else


void tpd_debug_set_time(void);
extern int tpd_debug_time;
extern long tpd_last_2_int_time[2];
extern long tpd_last_down_time;
extern int tpd_start_profiling;
extern int tpd_down_status;

#define TPD_DEBUG_PRINT_INT                                                 \
    do {                                                                    \
	if (tpd_debug_time) {                                                \
	    printk("tp_int\n");                                             \
	}                                                                   \
    } while (0)

#define TPD_DEBUG_PRINT_UP                                                  \
    do {                                                                    \
        if (pending == 0 && tpd_debug_time) {                                  \
            tpd_down_status = 0;                                              \
	    printk("up on %ld ms (+%ld ms)\n",                              \
	       (tpd_last_2_int_time[1] - tpd_last_down_time) / 1000,        \
	       (tpd_last_2_int_time[1] - tpd_last_2_int_time[0]) / 1000);   \
	}                                                                   \
    } while (0)

#define TPD_DEBUG_PRINT_DOWN                                                    \
    do {                                                                        \
	if (tpd_debug_time) {                                                    \
            if (tpd_down_status == 0) printk("down on 0 ms\n");                    \
	    else printk("move on %ld ms (+%ld ms)\n",                           \
		    (tpd_last_2_int_time[1] - tpd_last_down_time) / 1000,       \
		    (tpd_last_2_int_time[1] - tpd_last_2_int_time[0]) / 1000);  \
            tpd_down_status = 1;                                                  \
	}                                                                       \
    } while (0)

#define TPD_DEBUG_SET_TIME   do { tpd_debug_set_time(); } while (0);

extern int tpd_em_log;
extern int tpd_em_log_to_fs;
extern int tpd_type_cap;

void tpd_em_log_output(int raw_x, int raw_y, int cal_x, int cal_y, int p, int down);
void tpd_em_log_store(int raw_x, int raw_y, int cal_x, int cal_y, int p, int down);
void tpd_em_log_release(void);

#define TPD_TYPE_RAW_DATA   2
#define TPD_TYPE_INT_DOWN   3
#define TPD_TYPE_INT_UP     4
#define TPD_TYPE_TIMER      5
#define TPD_TYPE_REJECT1		6
#define TPD_TYPE_REJECT2		7
#define TPD_TYPE_FIST_LATENCY		8

#define TPD_EM_PRINT(raw_x, raw_y, cal_x, cal_y, p, down)                           \
    do {                                                                            \
	if (tpd_em_log) {                                                           \
	    if (!tpd_em_log_to_fs) {                                                \
		tpd_em_log_output(raw_x, raw_y, cal_x, cal_y, p, down);             \
	    } else {                                                                \
		tpd_em_log_store(raw_x, raw_y, cal_x, cal_y, p, down);              \
		tpd_em_log_output(raw_x, raw_y, cal_x, cal_y, p, down);                \
	    }                                                                       \
	    if (down == 1)                                                          \
		tpd_down_status = 1;                                                \
	    else if (down == 0)                                                     \
		tpd_down_status = 0;                                                \
	}                                                                           \
	else {                                                                      \
	    if (tpd_em_log_to_fs) {                                                 \
		tpd_em_log_release();                                               \
	    }                                                                       \
	}                                                                           \
    } while (0)

#ifdef TPD_DEBUG_TRACK
extern void *dal_fb_addr;
extern int tpd_debug_track;
void tpd_up_debug_track(int x, int y);
void tpd_down_debug_track(int x, int y);
#define TPD_UP_DEBUG_TRACK(x, y) do { if (tpd_debug_track) tpd_up_debug_track(x, y); } while(0)
#define TPD_DOWN_DEBUG_TRACK(x, y) do { if (tpd_debug_track) tpd_down_debug_track(x, y); } while(0)

#endif				/* TPD_DEBUG_TRACK */
#endif				/* TPD_DEBUG_CODE */

/* Macros that will be embedded in code */

#ifndef TPD_DEBUG_CHECK_NO_RESPONSE
#define TPD_DEBUG_CHECK_NO_RESPONSE
#endif

#ifndef TPD_DEBUG_SET_TIME
#define TPD_DEBUG_SET_TIME
#endif

#ifndef TPD_DEBUG_PRINT_UP
#define TPD_DEBUG_PRINT_UP
#endif

#ifndef TPD_DEBUG_PRINT_DOWN
#define TPD_DEBUG_PRINT_DOWN
#endif

#ifndef TPD_UP_DEBUG_TRACK
#define TPD_UP_DEBUG_TRACK(x, y)
#endif

#ifndef TPD_DOWN_DEBUG_TRACK
#define TPD_DOWN_DEBUG_TRACK(x, y)
#endif


#endif				/* TPD_DEBUG_H */