import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / input / touchscreen / mediatek / cy8ctma / cyttsp4_core.h
1 /* BEGIN PN:DTS2013051703879 ,Added by l00184147, 2013/5/17*/
2 //add Touch driver for G610-T11
3 /* BEGIN PN:DTS2013012601133 ,Modified by l00184147, 2013/1/26*/
4 /* BEGIN PN:DTS2013011401860 ,Modified by l00184147, 2013/1/14*/
5 /* BEGIN PN:SPBB-1218 ,Added by l00184147, 2012/12/20*/
6 /*
7 * cyttsp4_core.h
8 * Cypress TrueTouch(TM) Standard Product V4 Core driver module.
9 * For use with Cypress Txx4xx parts.
10 * Supported parts include:
11 * TMA4XX
12 * TMA1036
13 *
14 * Copyright (C) 2012 Cypress Semiconductor
15 * Copyright (C) 2011 Sony Ericsson Mobile Communications AB.
16 *
17 * Author: Aleksej Makarov <aleksej.makarov@sonyericsson.com>
18 * Modifed by: Cypress Semiconductor to add touch settings
19 *
20 * This program is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU General Public License
22 * version 2, and only version 2, as published by the
23 * Free Software Foundation.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 *
30 * You should have received a copy of the GNU General Public License along
31 * with this program; if not, write to the Free Software Foundation, Inc.,
32 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
33 *
34 * Contact Cypress Semiconductor at www.cypress.com <ttdrivers@cypress.com>
35 *
36 */
37
38 #ifndef _LINUX_CYTTSP4_CORE_H
39 #define _LINUX_CYTTSP4_CORE_H
40
41 #define CYTTSP4_CORE_NAME "cyttsp4_core"
42
43 #define CYTTSP4_STR(x) #x
44 #define CYTTSP4_STRINGIFY(x) CYTTSP4_STR(x)
45
46 #define CY_DRIVER_NAME TTDA
47 #define CY_DRIVER_MAJOR 02
48 #define CY_DRIVER_MINOR 02
49
50 #define CY_DRIVER_REVCTRL 402597 /*00000A */
51
52 #define CY_DRIVER_VERSION \
53 CYTTSP4_STRINGIFY(CY_DRIVER_NAME) \
54 "." CYTTSP4_STRINGIFY(CY_DRIVER_MAJOR) \
55 "." CYTTSP4_STRINGIFY(CY_DRIVER_MINOR) \
56 "." CYTTSP4_STRINGIFY(CY_DRIVER_REVCTRL)
57
58 #define CY_DRIVER_DATE "20121109" /* YYYYMMDD */
59
60 /* x-axis resolution of panel in pixels */
61 #define CY_PCFG_RESOLUTION_X_MASK 0x7F
62
63 /* y-axis resolution of panel in pixels */
64 #define CY_PCFG_RESOLUTION_Y_MASK 0x7F
65
66 /* x-axis, 0:origin is on left side of panel, 1: right */
67 #define CY_PCFG_ORIGIN_X_MASK 0x80
68
69 /* y-axis, 0:origin is on top side of panel, 1: bottom */
70 #define CY_PCFG_ORIGIN_Y_MASK 0x80
71
72 #define CY_TOUCH_SETTINGS_MAX 32
73 #define CY_TOUCH_SETTINGS_PARAM_REGS 6
74
75 struct touch_settings {
76 const uint8_t *data;
77 uint32_t size;
78 const uint8_t *ver;
79 uint32_t vsize;
80 uint8_t tag;
81 } __packed;
82
83 struct cyttsp4_touch_firmware {
84 const uint8_t *img;
85 uint32_t size;
86 const uint8_t *ver;
87 uint8_t vsize;
88 } __packed;
89
90 /* BEGIN PN:SPBB-1254 ,Added by F00184246, 2013/2/18*/
91 struct cyttsp4_sett_param_map {
92 u8 id;
93 struct touch_settings *param;
94 };
95 /* END PN:SPBB-1254 ,Added by F00184246, 2013/2/18*/
96 /* BEGIN PN:SPBB-1254 ,Modified by F00184246, 2013/2/18*/
97 struct cyttsp4_loader_platform_data {
98 struct cyttsp4_touch_firmware *fw;
99 struct touch_settings *param_regs;
100 struct touch_settings *param_size;
101 struct cyttsp4_sett_param_map *param_map;
102 u32 flags;
103 } __packed;
104 /* END PN:SPBB-1254 ,Modified by F00184246, 2013/2/18*/
105
106 struct cyttsp4_core_platform_data {
107 int irq_gpio;
108 int rst_gpio;
109 int level_irq_udelay;
110 unsigned use_configure_sensitivity:1;
111 int (*xres)(struct cyttsp4_core_platform_data *pdata,
112 struct device *dev);
113 int (*init)(struct cyttsp4_core_platform_data *pdata,
114 int on, struct device *dev);
115 int (*power)(struct cyttsp4_core_platform_data *pdata,
116 int on, struct device *dev, atomic_t *ignore_irq);
117 int (*irq_stat)(struct cyttsp4_core_platform_data *pdata,
118 struct device *dev);
119 struct touch_settings *sett[CY_TOUCH_SETTINGS_MAX];
120 struct cyttsp4_loader_platform_data *loader_pdata;
121 };
122
123 #ifdef VERBOSE_DEBUG
124 extern void cyttsp4_pr_buf(struct device *dev, u8 *pr_buf, u8 *dptr, int size,
125 const char *data_name);
126 #else
127 #define cyttsp4_pr_buf(a, b, c, d, e) do { } while (0)
128 #endif
129
130 #endif /* _LINUX_CYTTSP4_CORE_H */
131 /* END PN:SPBB-1218 ,Added by l00184147, 2012/12/20*/
132 /* END PN:DTS2013011401860 ,Modified by l00184147, 2013/1/14*/
133 /* END PN:DTS2013012601133 ,Modified by l00184147, 2013/1/26*/
134 /* END PN:DTS2013051703879 ,Added by l00184147, 2013/5/17*/