1 /* drivers/input/touchscreen/gt818_ts.h
3 * Copyright (C) 2011 Rockcip, Inc.
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * Author: hhb@rock-chips.com
18 #ifndef _LINUX_GOODIX_TOUCH_H
19 #define _LINUX_GOODIX_TOUCH_H
21 #include <linux/earlysuspend.h>
22 #include <linux/hrtimer.h>
23 #include <linux/i2c.h>
24 #include <linux/input.h>
27 //*************************TouchScreen Work Part*****************************
28 #define GOODIX_I2C_NAME "gt818_ts"
31 #define GUITAR_UPDATE_STATE 0x02
32 #define GT818_I2C_SCL 400*1000
34 //define resolution of the touchscreen
35 #define TOUCH_MAX_HEIGHT 7168
36 #define TOUCH_MAX_WIDTH 5120
38 //define resolution of the LCD
39 #define SCREEN_MAX_HEIGHT 800
40 #define SCREEN_MAX_WIDTH 480
44 #define SHUTDOWN_PORT pdata->gpio_reset //SHUTDOWN¹Ü½ÅºÅ
45 #define INT_PORT pdata->gpio_pendown
48 #define TS_INT gpio_to_irq(INT_PORT) //Interrupt Number
53 #define HAVE_TOUCH_KEY
58 //set GT801 PLUS trigger mode,Ö»ÄÜÉèÖÃ0»ò1
60 #define POLL_TIME 10 //actual query spacing interval:POLL_TIME+6
62 #define GOODIX_MULTI_TOUCH
63 #ifdef GOODIX_MULTI_TOUCH
64 #define MAX_FINGER_NUM 2
66 #define MAX_FINGER_NUM 1
69 #define swap(x, y) do { typeof(x) z = x; x = y; y = z; } while (0)
71 #define READ_TOUCH_ADDR_H 0x07
72 #define READ_TOUCH_ADDR_L 0x12
73 #define READ_KEY_ADDR_H 0x07
74 #define READ_KEY_ADDR_L 0x21
75 #define READ_COOR_ADDR_H 0x07
76 #define READ_COOR_ADDR_L 0x22
77 #define READ_ID_ADDR_H 0x00
78 #define READ_ID_ADDR_L 0xff
81 #define IOMUX_NAME_SIZE 48
82 struct gt818_platform_data {
85 bool swap_xy; /* swap x and y axes */
89 int gpio_reset_active_low;
90 int gpio_pendown; /* the GPIO used to decide the pendown */
92 char pendown_iomux_name[IOMUX_NAME_SIZE];
93 char resetpin_iomux_name[IOMUX_NAME_SIZE];
94 int pendown_iomux_mode;
95 int resetpin_iomux_mode;
97 int (*get_pendown_state)(void);
101 struct gt818_ts_data {
106 struct i2c_client *client;
107 struct input_dev *input_dev;
108 int use_reset; //use RESET flag
109 int use_irq; //use EINT flag
110 int read_mode; //read moudle mode,20110221 by andrew
111 struct hrtimer timer;
112 struct work_struct work;
116 struct early_suspend early_suspend;
117 int (*power)(struct gt818_ts_data * ts, int on);
122 #endif /* _LINUX_GOODIX_TOUCH_H */