aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/s5pc210_ts.h
blob: fc5cecb54ee525d656093d46a0c8a6f55d3df56f (plain)
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
/* driver/input/touchscreen/s5pc210_ts.h
 *
 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
 *	http://www.samsung.com
 *
 * S5PC210 10.1" Touchscreen driver information
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
*/

#ifndef	_S5PV310_TS_H_
#define	_S5PV310_TS_H_

#ifdef CONFIG_HAS_EARLYSUSPEND
#include <linux/earlysuspend.h>
#endif

#include <mach/board_rev.h>

#define S5PV310_TS_DEVICE_NAME	"s5pc210_ts"

#define	TOUCH_PRESS             1
#define	TOUCH_RELEASE           0

/* Touch Configuration */

/* Touch Interrupt define */
#ifdef CONFIG_MACH_SMDK4X12

#define TS_ATTB			samsung_board_rev_is_0_0() ? EXYNOS4_GPX1(6) : EXYNOS4212_GPM3(4)
#define S5PV310_TS_IRQ		gpio_to_irq(TS_ATTB)

/* Touch should be reset before using. In order to reset it, the reset pin
   should be set OUTPUT HIGH. The Reset pin is EXYNOS4_GPX1(5) (XEINT 13).
   However, the SMDK4X12 uses this pin for resetting both LCD and touchscreen.
   Therefore, it assumes that LCD driver will reset them by this pin. */

#elif defined (CONFIG_MACH_SMDKV310)

#define S5PV310_TS_IRQ		gpio_to_irq(EXYNOS4_GPX3(5))
#define TS_ATTB			(EXYNOS4_GPX3(5))

#else
#error Unsupported board!
#endif

#define	TS_ABS_MIN_X            0
#define	TS_ABS_MIN_Y            0
#define	TS_ABS_MAX_X		1366
#define	TS_ABS_MAX_Y		768

#define	TS_X_THRESHOLD		1
#define	TS_Y_THRESHOLD		1


/* touch register */
#define	MODULE_CALIBRATION	0x37
#define	MODULE_POWERMODE	0x14
#define	MODULE_INTMODE		0x15
#define	MODULE_INTWIDTH		0x16

#define	PERIOD_10MS		(HZ/100) /* 10ms */
#define	PERIOD_20MS		(HZ/50)	 /* 20ms */
#define	PERIOD_50MS		(HZ/20)	 /* 50ms */

#define	TOUCH_STATE_BOOT	0
#define	TOUCH_STATE_RESUME	1

/* Touch hold event */
#define	SW_TOUCH_HOLD		0x09

#if defined(CONFIG_TOUCHSCREEN_EXYNOS4)
/* multi-touch data process struct */
struct touch_process_data_t {
	unsigned char finger_cnt;
	unsigned int x1;
	unsigned int y1;
	unsigned int x2;
	unsigned int y2;
};
#endif

struct s5pv310_ts_t {
	struct input_dev *driver;

	/* seqlock_t */
	seqlock_t		lock;
	unsigned int		seq;

	/* timer */
	struct  timer_list	penup_timer;

	/* data store */
	unsigned int		status;
	unsigned int		x;
	unsigned int		y;
	unsigned char		rd[10];

	/* sysfs used */
	unsigned char		hold_status;
	unsigned char		sampling_rate;

	/* x data threshold (0-10) : default 3 */
	unsigned char		threshold_x;
	/* y data threshold (0-10) : default 3 */
	unsigned char		threshold_y;
	/* touch sensitivity (0-255) : default 0x14 */
	unsigned char		sensitivity;

#if defined CONFIG_TOUCHSCREEN_EXYNOS4
#ifdef CONFIG_HAS_EARLYSUSPEND
	struct	early_suspend		power;
#endif
#endif
};

extern struct s5pv310_ts_t s5pv310_ts;
#endif