xref: /OK3568_Linux_fs/kernel/drivers/input/touchscreen/gt1x/gt1x.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* drivers/input/touchscreen/gt1x.h
2  *
3  * 2010 - 2013 Goodix Technology.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be a reference
11  * to you, when you are integrating the GOODiX's CTP IC into your system,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * General Public License for more details.
15  *
16  * Version: 1.4
17  * Release Date:  2015/07/10
18  */
19 
20 #ifndef _GOODIX_GT1X_H_
21 #define _GOODIX_GT1X_H_
22 #include "gt1x_generic.h"
23 #include <linux/gpio.h>
24 #ifdef GTP_CONFIG_OF
25 #include <linux/of_gpio.h>
26 #include <linux/regulator/consumer.h>
27 #endif
28 #ifdef CONFIG_FB
29 #include <linux/notifier.h>
30 #include <linux/fb.h>
31 #endif
32 #ifdef CONFIG_HAS_EARLYSUSPEND
33 #include <linux/earlysuspend.h>
34 #endif
35 
36 #define IIC_MAX_TRANSFER_SIZE       250
37 
38 /* Customize your I/O ports & I/O operations */
39 #ifdef GTP_CONFIG_OF
40 extern bool gt1x_gt5688;
41 extern int gt1x_rst_gpio;
42 extern int gt1x_int_gpio;
43 extern struct regulator *gt1x_supply;
44 #define GTP_RST_PORT gt1x_rst_gpio
45 #define GTP_INT_PORT gt1x_int_gpio
46 #else
47 #define GTP_RST_PORT    102
48 #define GTP_INT_PORT    52
49 #endif
50 
51 #define GTP_INT_IRQ     gpio_to_irq(GTP_INT_PORT)
52 /*#define GTP_INT_CFG     S3C_GPIO_SFN(0xF)*/
53 
54 #define GTP_GPIO_AS_INPUT(pin)          do {\
55 	gpio_direction_input(pin);\
56 } while (0)
57 #define GTP_GPIO_AS_INT(pin)            do {\
58 	GTP_GPIO_AS_INPUT(pin);\
59 } while (0)
60 #define GTP_GPIO_GET_VALUE(pin)         gpio_get_value(pin)
61 #define GTP_GPIO_OUTPUT(pin, level)      gpio_direction_output(pin, level)
62 #define GTP_IRQ_TAB                     {IRQ_TYPE_EDGE_RISING, IRQ_TYPE_EDGE_FALLING, IRQ_TYPE_LEVEL_LOW, IRQ_TYPE_LEVEL_HIGH}
63 
64 #endif /* _GOODIX_GT1X_H_ */
65