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