Merge tag 'ceph-for-4.13-rc8' of git://github.com/ceph/ceph-client
[linux/fpc-iii.git] / drivers / input / touchscreen / cyttsp_core.h
blob7835e2bacf5a241a9e1cffce4bd72dcdf8a69c85
1 /*
2 * Header file for:
3 * Cypress TrueTouch(TM) Standard Product (TTSP) touchscreen drivers.
4 * For use with Cypress Txx3xx parts.
5 * Supported parts include:
6 * CY8CTST341
7 * CY8CTMA340
9 * Copyright (C) 2009, 2010, 2011 Cypress Semiconductor, Inc.
10 * Copyright (C) 2012 Javier Martinez Canillas <javier@dowhile0.org>
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * version 2, and only version 2, as published by the
15 * Free Software Foundation.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 * Contact Cypress Semiconductor at www.cypress.com <kev@cypress.com>
31 #ifndef __CYTTSP_CORE_H__
32 #define __CYTTSP_CORE_H__
34 #include <linux/kernel.h>
35 #include <linux/err.h>
36 #include <linux/module.h>
37 #include <linux/types.h>
38 #include <linux/device.h>
39 #include <linux/input/cyttsp.h>
41 #define CY_NUM_RETRY 16 /* max number of retries for read ops */
43 struct cyttsp_tch {
44 __be16 x, y;
45 u8 z;
46 } __packed;
48 /* TrueTouch Standard Product Gen3 interface definition */
49 struct cyttsp_xydata {
50 u8 hst_mode;
51 u8 tt_mode;
52 u8 tt_stat;
53 struct cyttsp_tch tch1;
54 u8 touch12_id;
55 struct cyttsp_tch tch2;
56 u8 gest_cnt;
57 u8 gest_id;
58 struct cyttsp_tch tch3;
59 u8 touch34_id;
60 struct cyttsp_tch tch4;
61 u8 tt_undef[3];
62 u8 act_dist;
63 u8 tt_reserved;
64 } __packed;
67 /* TTSP System Information interface definition */
68 struct cyttsp_sysinfo_data {
69 u8 hst_mode;
70 u8 mfg_stat;
71 u8 mfg_cmd;
72 u8 cid[3];
73 u8 tt_undef1;
74 u8 uid[8];
75 u8 bl_verh;
76 u8 bl_verl;
77 u8 tts_verh;
78 u8 tts_verl;
79 u8 app_idh;
80 u8 app_idl;
81 u8 app_verh;
82 u8 app_verl;
83 u8 tt_undef[5];
84 u8 scn_typ;
85 u8 act_intrvl;
86 u8 tch_tmout;
87 u8 lp_intrvl;
90 /* TTSP Bootloader Register Map interface definition */
91 #define CY_BL_CHKSUM_OK 0x01
92 struct cyttsp_bootloader_data {
93 u8 bl_file;
94 u8 bl_status;
95 u8 bl_error;
96 u8 blver_hi;
97 u8 blver_lo;
98 u8 bld_blver_hi;
99 u8 bld_blver_lo;
100 u8 ttspver_hi;
101 u8 ttspver_lo;
102 u8 appid_hi;
103 u8 appid_lo;
104 u8 appver_hi;
105 u8 appver_lo;
106 u8 cid_0;
107 u8 cid_1;
108 u8 cid_2;
111 struct cyttsp;
113 struct cyttsp_bus_ops {
114 u16 bustype;
115 int (*write)(struct device *dev, u8 *xfer_buf, u16 addr, u8 length,
116 const void *values);
117 int (*read)(struct device *dev, u8 *xfer_buf, u16 addr, u8 length,
118 void *values);
121 enum cyttsp_state {
122 CY_IDLE_STATE,
123 CY_ACTIVE_STATE,
124 CY_BL_STATE,
127 struct cyttsp {
128 struct device *dev;
129 int irq;
130 struct input_dev *input;
131 char phys[32];
132 const struct cyttsp_bus_ops *bus_ops;
133 struct cyttsp_bootloader_data bl_data;
134 struct cyttsp_sysinfo_data sysinfo_data;
135 struct cyttsp_xydata xy_data;
136 struct completion bl_ready;
137 enum cyttsp_state state;
138 bool suspended;
140 struct gpio_desc *reset_gpio;
141 bool use_hndshk;
142 u8 act_dist;
143 u8 act_intrvl;
144 u8 tch_tmout;
145 u8 lp_intrvl;
146 u8 *bl_keys;
148 u8 xfer_buf[] ____cacheline_aligned;
151 struct cyttsp *cyttsp_probe(const struct cyttsp_bus_ops *bus_ops,
152 struct device *dev, int irq, size_t xfer_buf_size);
154 int cyttsp_i2c_write_block_data(struct device *dev, u8 *xfer_buf, u16 addr,
155 u8 length, const void *values);
156 int cyttsp_i2c_read_block_data(struct device *dev, u8 *xfer_buf, u16 addr,
157 u8 length, void *values);
158 extern const struct dev_pm_ops cyttsp_pm_ops;
160 #endif /* __CYTTSP_CORE_H__ */