aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/cyttsp4_core.h
blob: 088ed9d5f92204c3cd1b7f13bc2167f49c8d58d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*
 * Header file for:
 * Cypress TrueTouch(TM) Standard Product (TTSP) touchscreen drivers.
 * For use with Cypress Gen4 and Solo parts.
 * Supported parts include:
 * CY8CTMA884/616
 * CY8CTMA4XX
 *
 * Copyright (C) 2009-2012 Cypress Semiconductor, Inc.
 * Copyright (C) 2011 Motorola Mobility, Inc.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * version 2, and only version 2, as published by the
 * Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 * Contact Cypress Semiconductor at www.cypress.com <kev@cypress.com>
 *
 */

#ifndef __CYTTSP4_CORE_H__
#define __CYTTSP4_CORE_H__

#define CY_NUM_RETRY                10 /* max retries for rd/wr ops */

#define CY_I2C_NAME                 "cyttsp4-i2c"
#define CY_SPI_NAME                 "cyttsp4-spi"
#define CY_DRIVER_VERSION           "Rev4-2M-28"
#define CY_DRIVER_DATE              "2012-03-09"

/*
 * use the following define if the device is a TMA400 family part
 */
#define CY_USE_TMA400

/*
 * use the following define if the device is a TMA400 family part
 * and can report size and orientation signals
 * (touch major, touch minor, and orientation)
 */
#define CY_USE_TMA400_SP2

/*
 * use the following define if the device is a TMA884/616 family part
#define CY_USE_TMA884
 */

/*
 * use the following define to allow auto load of firmware at startup
#define CY_AUTO_LOAD_FW
 */

/* use the following define to allow auto load of Touch Params at startup
#define CY_AUTO_LOAD_TOUCH_PARAMS
 */

/* use the following define to allow auto load of Design Data at startup
#define CY_AUTO_LOAD_DDATA
 */

/*
 * use the following define to allow auto load of Manufacturing Data at startup
#define CY_AUTO_LOAD_MDATA
 */

/*
 * use the following define to allow autoload firmware for any version diffs;
 * otherwise only autoload if load version is greater than device image version
#define CY_ANY_DIFF_NEW_VER
 */

/* use the following define to include loader application
#define CY_USE_FORCE_LOAD
 */

/*
 * use the following define to enable register peak/poke capability
#define CY_USE_REG_ACCESS
 */

/* use the following define to enable special debug tools for test only
#define CY_USE_DEBUG_TOOLS
 */

/*
 * use the following define to use level interrupt method (else falling edge)
 * this method should only be used if the host processor misses edge interrupts
#define CY_USE_LEVEL_IRQ
 */

/*
 * use the following define to enable driver watchdog timer
#define CY_USE_WATCHDOG
 */
#define CY_USE_WATCHDOG

/* system includes are here in order to allow DEBUG option */
/*
 * enable this define to enable debug prints
#define DEBUG = y
 */

/*
 * enable this define to enable verbose debug prints
#define VERBOSE_DEBUG
 */

#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/input.h>

#ifdef CONFIG_HAS_EARLYSUSPEND
#include <linux/earlysuspend.h>
#endif
#define CY_MAX_PRBUF_SIZE           PIPE_BUF

struct cyttsp4_bus_ops {
	int (*write)(void *handle, u16 subaddr, size_t length,
		const void *values, int i2c_addr, bool use_subaddr);
	int (*read)(void *handle, u16 subaddr, size_t length,
		void *values, int i2c_addr, bool use_subaddr);
	struct device *dev;
#ifdef CONFIG_TOUCHSCREEN_DEBUG
	u8 tsdebug;
#endif
};

void *cyttsp4_core_init(struct cyttsp4_bus_ops *bus_ops,
	struct device *dev, int irq, char *name);

void cyttsp4_core_release(void *handle);

#if !defined(CONFIG_HAS_EARLYSUSPEND)
#if defined(CONFIG_PM_SLEEP)
extern const struct dev_pm_ops cyttsp4_pm_ops;
#elif defined(CONFIG_PM)
int cyttsp4_resume(void *handle);
int cyttsp4_suspend(void *handle);
#endif
#endif

#endif /* __CYTTSP4_CORE_H__ */