aboutsummaryrefslogtreecommitdiff
path: root/include/linux/r69001-ts.h
blob: 011e3cb64a874a23673d4970def8adebfdd19b17 (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
121
122
/*
 * R69001 Touchscreen Controller Driver
 * Header file
 *
 * 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.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 */

#ifndef _R69001_TS_H_
#define _R69001_TS_H_

#ifdef CONFIG_R69001_DEBUG_SUPPORT
#include <linux/r69001-ts-debug.h>
#endif

/* Spec */
#define MIN_X                       0
#define MIN_Y                       0
#define MIN_Z                       0
#ifdef CONFIG_R69001_RESOLUTION_WIDTH
#define MAX_X                       CONFIG_R69001_RESOLUTION_WIDTH
#else
#define MAX_X                       720
#endif
#ifdef CONFIG_R69001_RESOLUTION_HEIGHT
#define MAX_Y                       CONFIG_R69001_RESOLUTION_HEIGHT
#else
#define MAX_Y                       1280
#endif
#define MAX_Z                       255
#define MIN_AREA                    0
#define MAX_AREA                    10
#ifdef CONFIG_R69001_MAX_FINGERS
#define MAX_FINGERS                 CONFIG_R69001_MAX_FINGERS
#else
#define MAX_FINGERS                 10
#endif

/* Scan cycle */
#ifdef CONFIG_R69001_SCAN_TIME
#define SCAN_TIME                   CONFIG_R69001_SCAN_TIME
#else
#define SCAN_TIME                   16
#endif

/* Polling interval */
#ifdef CONFIG_R69001_POLLING_TIME
#define POLL_INTERVAL               CONFIG_R69001_POLLING_TIME
#else
#define POLL_INTERVAL               2
#endif
#define POLL_INTERVAL_MAX           1000

/* Number of RX/TX */
#ifdef CONFIG_R69001_NUM_RX
#define NUM_RX                      CONFIG_R69001_NUM_RX
#else
#define NUM_RX                      21
#endif
#ifdef CONFIG_R69001_NUM_TX
#define NUM_TX                      CONFIG_R69001_NUM_TX
#else
#define NUM_TX                      13
#endif

/* Scan Mode */
#define R69001_SCAN_MODE_STOP           0x00
#define R69001_SCAN_MODE_LOW_POWER      0x01
#define R69001_SCAN_MODE_FULL_SCAN      0x02
#define R69001_SCAN_MODE_CALIBRATION    0x03

/* Interrupt/Polling mode */
#define R69001_TS_INTERRUPT_MODE        0
#define R69001_TS_POLLING_MODE          1
#define R69001_TS_POLLING_LOW_EDGE_MODE 2
#define R69001_TS_CALIBRATION_INTERRUPT_MODE 3

struct io_mode {
	u8 scan;
	u8 mode;
	u16 poll_time;
};

struct io_rxtx_num {
	u8 rx;
	u8 tx;
};

struct io_resolution {
	u16 x;
	u16 y;
};

struct r69001_io_data {
	struct io_mode mode;
	struct io_rxtx_num rxtx_num;
	struct io_resolution resolution;
};

struct r69001_platform_data {
	int irq_type;
	int gpio;
};

#define R69001_IO   'R'

/* R69001 ioctl commands */
#define RSP_IOCTL_SET_INT_POLL_MODE _IOW(R69001_IO, 0x01, struct r69001_io_data)
#define RSP_IOCTL_GET_RXTX_NUM      _IOR(R69001_IO, 0x02, struct r69001_io_data)
#define RSP_IOCTL_GET_RESOLUTION    _IOR(R69001_IO, 0x03, struct r69001_io_data)
#define RSP_IOCTL_SET_SCAN_MODE     _IOW(R69001_IO, 0x04, struct r69001_io_data)

#define RSP_IOCTL_SUSPEND           _IOW(R69001_IO, 0x50, struct r69001_io_data)
#define RSP_IOCTL_RESUME            _IOW(R69001_IO, 0x51, struct r69001_io_data)

#endif /* _R69001_TS_H_ */