aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/input
diff options
context:
space:
mode:
authorChristopher Kenna <cjk@cs.unc.edu>2012-09-28 13:46:28 -0400
committerChristopher Kenna <cjk@cs.unc.edu>2012-09-28 14:50:15 -0400
commitdaa22703f14c007e93b464c45fa60019a36f546d (patch)
treea1a130b6e128dc9d57c35c026977e1b4953105e1 /include/linux/input
parent5aa287dcf1b5879aa0150b0511833c52885f5b4c (diff)
Apply k4412 kernel from HardKernel for ODROID-X.
Diffstat (limited to 'include/linux/input')
-rw-r--r--include/linux/input/isa1200.h30
-rw-r--r--include/linux/input/odroidq-touch.h247
-rw-r--r--include/linux/input/touch-pdata.h186
3 files changed, 463 insertions, 0 deletions
diff --git a/include/linux/input/isa1200.h b/include/linux/input/isa1200.h
new file mode 100644
index 00000000000..c72f736d4e3
--- /dev/null
+++ b/include/linux/input/isa1200.h
@@ -0,0 +1,30 @@
1/*
2 * ISA1200 Haptic Driver
3 */
4
5#ifndef __LINUX_ISA1200_H
6#define __LINUX_ISA1200_H
7
8#include <linux/compiler.h>
9#include <linux/types.h>
10
11#define ISA1200_POWERDOWN_MODE (0<<3)
12#define ISA1200_PWM_INPUT_MODE (1<<3)
13#define ISA1200_PWM_GEN_MODE (2<<3)
14#define ISA1200_WAVE_GEN_MODE (3<<3)
15
16struct isa1200_platform_data {
17
18 int gpio_hen;
19 int gpio_len;
20 unsigned char mode_sel;
21
22 int pwm_gpio;
23 int pwm_func;
24
25 int pwm_id;
26 unsigned short pwm_periode_ns;
27 unsigned short pwm_duty;
28};
29
30#endif /* __LINUX_ISA1200_H */
diff --git a/include/linux/input/odroidq-touch.h b/include/linux/input/odroidq-touch.h
new file mode 100644
index 00000000000..979f45e5d5f
--- /dev/null
+++ b/include/linux/input/odroidq-touch.h
@@ -0,0 +1,247 @@
1//[*]--------------------------------------------------------------------------------------------------[*]
2//
3//
4//
5// I2C Touchscreen driver (platform data struct)
6// 2012.01.17
7//
8//
9//[*]--------------------------------------------------------------------------------------------------[*]
10#ifndef __ODROIDQ_TOUCH_H__
11#define __ODROIDQ_TOUCH_H__
12
13//[*]--------------------------------------------------------------------------------------------------[*]
14#ifdef CONFIG_HAS_EARLYSUSPEND
15 #include <linux/earlysuspend.h>
16#endif
17
18//[*]--------------------------------------------------------------------------------------------------[*]
19#define IRQ_MODE_EVENT
20
21//[*]--------------------------------------------------------------------------------------------------[*]
22#if defined(CONFIG_ANDROID_PARANOID_NETWORK)
23 #define SOFT_AVR_FILTER_ENABLE
24#endif
25
26#if defined(SOFT_AVR_FILTER_ENABLE)
27 #define SOFT_AVR_COUNT 10
28 #define SOFT_AVR_MOVE_TOL_X 20 // First move tol
29 #define SOFT_AVR_MOVE_TOL_Y 20 // First move tol
30 #define SOFT_AVR_ENABLE_SPEED 5
31#endif
32
33//[*]--------------------------------------------------------------------------------------------------[*]
34#define EVENT_MOVE_TOL 0x01 // 0x53 Register (0x00 ~ 0xFF : 0x10 default)
35#define X_TRACKING 0x80 // 0x54 Register (0x00 ~ 0xFF : 0x80 default)
36#define Y_TRACKING 0x80 // 0x55 Register (0x00 ~ 0xFF : 0x80 default)
37
38#if defined(SOFT_AVR_FILTER_ENABLE)
39 #define MOVE_AVR_FILTER 0x00 // 0x56 Register (0x00 ~ 0x03 : 0x00 default)
40#else
41 //#define MOVE_AVR_FILTER 0x01 // 0x56 Register (0x00 ~ 0x03 : 0x00 default)
42 #define MOVE_AVR_FILTER 0x02 // 0x56 Register (0x00 ~ 0x03 : 0x00 default)
43 //#define MOVE_AVR_FILTER 0x03 // 0x56 Register (0x00 ~ 0x03 : 0x00 default)
44#endif
45
46#define SCAN_MODE 0x01 // 0x26 Register (0x00 ~ ?? : 0x02 default)
47//#define SCAN_MODE 0x0F // 0x26 Register (0x00 ~ ?? : 0x02 default)
48
49//[*]--------------------------------------------------------------------------------------------------[*]
50#define MAX_FINGERS 10
51#define RESOULATION 64
52
53#define DRIVE_LINE_COUNT 23
54#define SENSE_LINE_COUNT 38
55
56//#define DRIVE_DATA_MAX (DRIVE_LINE_COUNT * RESOULATION)
57//#define SENSE_DATA_MAX (SENSE_LINE_COUNT * RESOULATION)
58
59#define DRIVE_DATA_MAX 800
60#define SENSE_DATA_MAX 1280
61
62#define TRANSPOSE_XY 0x04
63#define INVERT_Y 0x01
64#define INVERT_X 0x02
65
66// 0x65 Register (0x00 ~ 0x07 : 0x00 default)
67#define ORIENTATION 0x00
68
69#define TRACKING_ID_MAX 16
70
71#define PRESSURE_MAX 16
72
73//[*]--------------------------------------------------------------------------------------------------[*]
74// Register Define
75//[*]--------------------------------------------------------------------------------------------------[*]
76#define NOP 0x00
77#define DEVICE_ID 0x02
78#define VERSION_ID 0x03
79#define SLEEP_OUT_REG 0x04
80#define SLEEP_IN_REG 0x05
81#define DRIVE_NO_REG 0x06
82#define SENSE_NO_REG 0x07
83
84//[*]--------------------------------------------------------------------------------------------------[*]
85#define DRIVE_LINE0_REG 0x08
86#define DRIVE_LINE1_REG 0x09
87#define DRIVE_LINE2_REG 0x0A
88#define DRIVE_LINE3_REG 0x0B
89#define DRIVE_LINE4_REG 0x0C
90#define DRIVE_LINE5_REG 0x0D
91#define DRIVE_LINE6_REG 0x0E
92#define DRIVE_LINE7_REG 0x0F
93#define DRIVE_LINE8_REG 0x10
94#define DRIVE_LINE9_REG 0x11
95#define DRIVE_LINE10_REG 0x12
96#define DRIVE_LINE11_REG 0x13
97#define DRIVE_LINE12_REG 0x14
98#define DRIVE_LINE13_REG 0x15
99#define DRIVE_LINE14_REG 0x16
100#define DRIVE_LINE15_REG 0x17
101#define DRIVE_LINE16_REG 0x18
102#define DRIVE_LINE17_REG 0x19
103#define DRIVE_LINE18_REG 0x1A
104#define DRIVE_LINE19_REG 0x1B
105#define DRIVE_LINE20_REG 0x1C
106#define DRIVE_LINE21_REG 0x1D
107#define DRIVE_LINE22_REG 0x1E
108
109//[*]--------------------------------------------------------------------------------------------------[*]
110#define WOP_MODE_REG 0x25
111#define ROP_MODE_REG 0x26
112#define DOWN_TIME_REG 0x27
113#define FRAME_ESC_REG 0x28
114#define SCAN_FRAME_REG 0x2A
115
116//[*]--------------------------------------------------------------------------------------------------[*]
117#define MEDIAN_FILTER_SEL_REG 0x2C
118#define INT_GAIN_REG 0x2F
119#define START_INT_REG 0x30
120#define END_INT_REG 0x31
121
122//[*]--------------------------------------------------------------------------------------------------[*]
123#define MIN_AREA_REG 0x33
124#define MIN_LEVEL_REG 0x34
125#define MIN_WEIGHT_REG 0x35
126#define MAX_AREA_REG 0x36
127#define SEG_DEPTH_REG 0x37
128#define CG_METHOD_REG 0x39
129#define HYBRID_SELECT_REG 0x3A
130#define INT_BYPASS_REG 0x3C
131#define FILTER_SEL_REG 0x3D
132#define CALIBRATE_OFF_REG 0x3E
133
134//[*]--------------------------------------------------------------------------------------------------[*]
135#define EVENT_MOVE_TOL_REG 0x53
136#define X_TRACKING_TOL_REG 0x54
137#define Y_TRACKING_TOL_REG 0x55
138#define MOV_AVG_FILTER_REG 0x56
139#define ORIENTATION_REG 0x65
140#define X_SCALING_REG 0x66
141#define Y_SCALING_REG 0x67
142#define X_OFFSET_REG 0x68
143#define Y_OFFSET_REG 0x69
144
145//[*]--------------------------------------------------------------------------------------------------[*]
146#define TOUCH_STATUS 0x79
147
148typedef struct status__t {
149 unsigned short fifo_valid :1;
150 unsigned short fifo_overflow :1;
151 unsigned short large_object :1;
152 unsigned short abnomal_status :1;
153 unsigned short fingers :10;
154 unsigned short reserved :2;
155} __attribute__ ((packed)) status_t;
156
157typedef union status__u {
158 unsigned char byte[sizeof(status_t)];
159 status_t bits;
160} __attribute__ ((packed)) status_u;
161
162//[*]--------------------------------------------------------------------------------------------------[*]
163#define BUTTON_STATUS 0xB9
164
165//[*]--------------------------------------------------------------------------------------------------[*]
166#define EVENT_MASK_REG 0x7A
167#define IRQ_MASK_REG 0x7B
168
169//[*]--------------------------------------------------------------------------------------------------[*]
170#define FINGER00_REG 0x7C
171#define FINGER01_REG 0x7D
172#define FINGER02_REG 0x7E
173#define FINGER03_REG 0x7F
174#define FINGER04_REG 0x80
175#define FINGER05_REG 0x81
176#define FINGER06_REG 0x82
177#define FINGER07_REG 0x83
178#define FINGER08_REG 0x84
179#define FINGER09_REG 0x85
180
181typedef struct finger_data__t {
182 unsigned char speed :4; // LSB
183 unsigned char pressure :4;
184 unsigned char msb_y :4;
185 unsigned char msb_x :4;
186 unsigned char lsb_y :8;
187 unsigned char lsb_x :8; // MSB
188} __attribute__ ((packed)) finger_data_t;
189
190typedef union finger_data__u {
191 unsigned char byte[sizeof(finger_data_t)];
192 finger_data_t bits;
193} __attribute__ ((packed)) finger_data_u;
194
195//[*]--------------------------------------------------------------------------------------------------[*]
196#define EVENT_STACK 0x86
197
198typedef struct event_stack__t {
199 unsigned char speed :4; // LSB
200 unsigned char pressure :4;
201 unsigned char msb_y :4;
202 unsigned char msb_x :4;
203 unsigned char lsb_y :8;
204 unsigned char lsb_x :8;
205 unsigned char event :4;
206 unsigned char number :4; // MSB
207} __attribute__ ((packed)) event_stack_t;
208
209typedef union event_stack__u {
210 unsigned char byte[sizeof(event_stack_t)];
211 event_stack_t bits;
212} __attribute__ ((packed)) event_stack_u;
213
214//[*]--------------------------------------------------------------------------------------------------[*]
215#define EVENT_FIFO_SCLR 0x87
216#define TOUCH_IRQ_MODE 0x89 // 0 -> event, 1 -> frame
217//[*]--------------------------------------------------------------------------------------------------[*]
218#define INIT_RST 0xA2
219#define DRIVE_LEVEL_REG 0xD5
220#define ADC_RANGE_SEL_REG 0xD7
221#define BIAS_RES 0xD8
222#define INTG_CAP_REG 0xDB
223
224//[*]--------------------------------------------------------------------------------------------------[*]
225#define EVENT_UNKNOWN 0x00
226#define EVENT_PRESS 0x03
227#define EVENT_MOVE 0x04
228#define EVENT_RELEASE 0x05
229
230//[*]--------------------------------------------------------------------------------------------------[*]
231//[*]--------------------------------------------------------------------------------------------------[*]
232//
233// ODROID-Q Control Function define
234//
235//[*]--------------------------------------------------------------------------------------------------[*]
236extern int odroidq_calibration (struct touch *ts);
237extern int odroidq_i2c_read (struct i2c_client *client, unsigned char *cmd, unsigned int cmd_len, unsigned char *data, unsigned int len);
238extern void odroidq_work (struct touch *ts);
239extern void odroidq_enable (struct touch *ts);
240extern void odroidq_disable (struct touch *ts);
241extern int odroidq_early_probe (struct touch *ts);
242extern int odroidq_probe (struct touch *ts);
243
244//[*]--------------------------------------------------------------------------------------------------[*]
245#endif /* __ODROIDQ_TOUCH_H__ */
246//[*]--------------------------------------------------------------------------------------------------[*]
247//[*]--------------------------------------------------------------------------------------------------[*]
diff --git a/include/linux/input/touch-pdata.h b/include/linux/input/touch-pdata.h
new file mode 100644
index 00000000000..fed2d3b4e78
--- /dev/null
+++ b/include/linux/input/touch-pdata.h
@@ -0,0 +1,186 @@
1//[*]--------------------------------------------------------------------------------------------------[*]
2//
3//
4//
5// I2C Touchscreen driver (platform data struct)
6// 2012.01.17
7//
8//
9//[*]--------------------------------------------------------------------------------------------------[*]
10#ifndef __TOUCH_PDATA_H__
11#define __TOUCH_PDATA_H__
12
13//[*]--------------------------------------------------------------------------------------------------[*]
14#ifdef CONFIG_HAS_EARLYSUSPEND
15 #include <linux/earlysuspend.h>
16#endif
17
18#include <linux/interrupt.h>
19//[*]--------------------------------------------------------------------------------------------------[*]
20#define I2C_TOUCH_NAME "odroid-ts"
21
22#define I2C_SEND_MAX_SIZE 512 // I2C Send/Receive data max size
23
24//[*]--------------------------------------------------------------------------------------------------[*]
25// Button struct (1 = press, 0 = release)
26//[*]--------------------------------------------------------------------------------------------------[*]
27typedef struct button__t {
28 unsigned char bt0_press :1; // lsb
29 unsigned char bt1_press :1;
30 unsigned char bt2_press :1;
31 unsigned char bt3_press :1;
32 unsigned char bt4_press :1;
33 unsigned char bt5_press :1;
34 unsigned char bt6_press :1;
35 unsigned char bt7_press :1; // msb
36} __attribute__ ((packed)) button_t;
37
38typedef union button__u {
39 unsigned char ubyte;
40 button_t bits;
41} __attribute__ ((packed)) button_u;
42
43//[*]--------------------------------------------------------------------------------------------------[*]
44// Touch Event type define
45//[*]--------------------------------------------------------------------------------------------------[*]
46#define TS_EVENT_UNKNOWN 0x00
47#define TS_EVENT_PRESS 0x01
48#define TS_EVENT_MOVE 0x02
49#define TS_EVENT_RELEASE 0x03
50
51//[*]--------------------------------------------------------------------------------------------------[*]
52typedef struct finger__t {
53 unsigned int status; // true : ts data updated, false : no update data
54 unsigned int event; // ts event type
55 unsigned int id; // ts received id
56 unsigned int x; // ts data x
57 unsigned int y; // ts data y
58 unsigned int area; // ts finger area
59 unsigned int pressure; // ts finger pressure
60} __attribute__ ((packed)) finger_t;
61
62//[*]--------------------------------------------------------------------------------------------------[*]
63struct touch {
64 int irq;
65 struct i2c_client *client;
66 struct touch_pdata *pdata;
67 struct input_dev *input;
68 char phys[32];
69
70 // finger data
71 finger_t *finger;
72
73 // sysfs control flags
74 unsigned char disabled; // interrupt status
75 unsigned char fw_version;
76
77 unsigned char *fw_buf;
78 unsigned int fw_size;
79 int fw_status;
80
81 // irq func used
82 struct workqueue_struct *work_queue;
83 struct work_struct work;
84
85 // noise filter work
86 struct delayed_work filter_dwork;
87
88#if defined(CONFIG_HAS_EARLYSUSPEND)
89 struct early_suspend power;
90#endif
91};
92
93//[*]--------------------------------------------------------------------------------------------------[*]
94struct i2c_client;
95struct input_dev;
96struct device;
97
98//[*]--------------------------------------------------------------------------------------------------[*]
99#define IRQ_MODE_THREAD 0
100#define IRQ_MODE_NORMAL 1
101#define IRQ_MODE_POLLING 2
102
103//[*]--------------------------------------------------------------------------------------------------[*]
104// IRQ type & trigger action
105//[*]--------------------------------------------------------------------------------------------------[*]
106//
107// IRQF_TRIGGER_RISING, IRQF_TRIGGER_FALLING, IRQF_TRIGGER_HIGH, IRQF_TRIGGER_LOW
108// IRQF_DISABLED, IRQF_SHARED, IRQF_IRQPOLL, IRQF_ONESHOT, IRQF_NO_THREAD
109//
110//[*]--------------------------------------------------------------------------------------------------[*]
111struct touch_pdata {
112 char *name; /* input drv name */
113
114 int irq_gpio; /* irq gpio define */
115 int reset_gpio; /* reset gpio define */
116 int reset_level; /* reset level setting (1 = High reset, 0 = Low reset) */
117
118 int irq_mode; /* IRQ_MODE_THREAD, IRQ_MODE_NORMAL, IRQ_MODE_POLLING */
119 int irq_flags; /* irq flags setup : Therad irq mode(IRQF_TRIGGER_HIGH | IRQF_ONESHOT) */
120
121 int abs_max_x, abs_max_y;
122 int abs_min_x, abs_min_y;
123
124 int area_max, area_min;
125 int press_max, press_min;
126 int id_max, id_min;
127
128 int vendor, product, version;
129
130 int max_fingers;
131
132 int *keycode, keycnt;
133
134 //--------------------------------------------
135 // Control function
136 //--------------------------------------------
137 void (*gpio_init) (void); /* gpio early-init function */
138
139 irqreturn_t (*irq_func) (int irq, void *handle);
140 void (*touch_work) (struct touch *ts);
141
142 void (*report) (struct touch *ts);
143 void (*key_report) (struct touch *ts, unsigned char button_data);
144
145 int (*early_probe) (struct touch *ts);
146 int (*probe) (struct touch *ts);
147 void (*enable) (struct touch *ts);
148 void (*disable) (struct touch *ts);
149 int (*input_open) (struct input_dev *input);
150 void (*input_close) (struct input_dev *input);
151
152 void (*event_clear) (struct touch *ts);
153
154#ifdef CONFIG_HAS_EARLYSUSPEND
155 void (*resume) (struct early_suspend *h);
156 void (*suspend) (struct early_suspend *h);
157#endif
158
159 //--------------------------------------------
160 // I2C control function
161 //--------------------------------------------
162 int (*i2c_write) (struct i2c_client *client, unsigned char *cmd, unsigned int cmd_len, unsigned char *data, unsigned int len);
163 int (*i2c_read) (struct i2c_client *client, unsigned char *cmd, unsigned int cmd_len, unsigned char *data, unsigned int len);
164
165 //--------------------------------------------
166 // Firmware update control function
167 //--------------------------------------------
168 char *fw_filename;
169 int fw_filesize;
170
171 int (*i2c_boot_write) (struct i2c_client *client, unsigned char *cmd, unsigned int cmd_len, unsigned char *data, unsigned int len);
172 int (*i2c_boot_read) (struct i2c_client *client, unsigned char *cmd, unsigned int cmd_len, unsigned char *data, unsigned int len);
173 int (*fw_control) (struct touch *ts, unsigned int fw_status);
174 int (*flash_firmware) (struct device *dev, const char *fw_name);
175
176 //--------------------------------------------
177 // Calibration control func
178 //--------------------------------------------
179 int (*calibration) (struct touch *ts);
180};
181
182//[*]--------------------------------------------------------------------------------------------------[*]
183#endif /* __TOUCH_PDATA_H__ */
184//[*]--------------------------------------------------------------------------------------------------[*]
185//[*]--------------------------------------------------------------------------------------------------[*]
186