summaryrefslogtreecommitdiff
path: root/fst2/fts.h
blob: 93ab75a2d8052baf4992edf38caffb2e9c423ff6 (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
/*
  *
  **************************************************************************
  **                        STMicroelectronics				  **
  **************************************************************************
  *                                                                        *
  * FTS Capacitive touch screen controller (FingerTipS)		           *
  *                                                                        *
  **************************************************************************
  **************************************************************************
  *
  */

/*!
  * \file fts.h
  * \brief Contains all the definitions and structs used generally by the driver
  */

#ifndef _LINUX_FTS_I2C_H_
#define _LINUX_FTS_I2C_H_

#include <linux/device.h>
#include "fts_lib/fts_io.h"

#define FTS_TS_DRV_NAME		"fts"
#define FTS_TS_DRV_VERSION	"6.0.3"
#define FTS_TS_DRV_VER		0x06000003

#define MAX_FIFO_EVENT	100

/* **** PANEL SPECIFICATION **** */
#define X_AXIS_MAX	1440	/* /< Max X coordinate of the display */
#define X_AXIS_MIN	0	/* /< min X coordinate of the display */
#define Y_AXIS_MAX	2959	/* /< Max Y coordinate of the display */
#define Y_AXIS_MIN	0	/* /< min Y coordinate of the display */

#define PRESSURE_MIN	0	/* /< min value of pressure reported */
#define PRESSURE_MAX	127	/* /< Max value of pressure reported */

#define DISTANCE_MIN	0	/* /< min distance between the tool and the
				 * display */
#define DISTANCE_MAX	127	/* /< Max distance between the tool and the
				 * display */

#define TOUCH_ID_MAX	10	/* /< Max number of simoultaneous touches
				 * reported */

#define AREA_MIN	PRESSURE_MIN	/* /< min value of Major/minor axis
					 * reported */
#define AREA_MAX	PRESSURE_MAX	/* /< Man value of Major/minor axis
					 * reported */
/* **** END **** */



#define DEBUG

/* Touch Types */
#define TOUCH_TYPE_FINGER_HOVER		0x00
#define TOUCH_TYPE_FINGER			0x01	/* /< Finger touch */
#define TOUCH_TYPE_GLOVE			0x02	/* /< Glove touch */
#define TOUCH_TYPE_LARGE			0x03

/*
  * Forward declaration
  */
struct fts_ts_info;

/*
  * Dispatch event handler
  */
typedef void (*event_dispatch_handler_t)
	(struct fts_ts_info *info, unsigned char *data);

/**
  * Struct which contains information about the HW platform and set up
  */
struct fts_hw_platform_data {
	int (*power)(bool on);
	int irq_gpio;	/* /< number of the gpio associated to the interrupt pin
			 * */
	int reset_gpio;	/* /< number of the gpio associated to the reset pin */
	const char *vdd_reg_name;	/* /< name of the VDD regulator */
	const char *avdd_reg_name;	/* /< name of the AVDD regulator */
};
/**
  * Struct contains FTS capacitive touch screen device information
  */
struct fts_ts_info {
	struct device            *dev;	/* /< Pointer to the structure device */
#ifdef I2C_INTERFACE
	struct i2c_client        *client;	/* /< I2C client structure */
#else
	struct spi_device        *client;	/* /< SPI client structure */
#endif
	struct fts_hw_platform_data *board;	/* /< HW info retrieved from
						 * device tree */
	struct regulator *vdd_reg;	/* /< DVDD power regulator */
	struct regulator *avdd_reg;	/* /< AVDD power regulator */
	struct input_dev *input_dev; /* /< Input device structure */
	struct mutex input_report_mutex;/* /< mutex for handling the report
						 * of the pressure of keys */
	struct work_struct work;	/* /< Event work thread */
	struct work_struct suspend_work;	/* /< Suspend work thread */
	struct work_struct resume_work;	/* /< Resume work thread */
	struct workqueue_struct *event_wq;	/* /< Workqueue used for event
						 * handler, suspend and resume
						 * work threads */
	event_dispatch_handler_t *event_dispatch_table;
	int resume_bit;	/* /< Indicate if screen off/on */
	unsigned int mode;	/* /< Device operating mode (bitmask: msb
				 * indicate if active or lpm) */
	struct notifier_block notifier;	/* /< Used for be notified from a
					 * suspend/resume event */
	struct wakeup_source wakesrc;	/* Wake Lock struct */
	unsigned long touch_id;	/* /< Bitmask for touch id (mapped to input
				 * slots) */
	bool sensor_sleep;	/* /< if true suspend was called while if false
				 * resume was called */
#ifndef FW_UPDATE_ON_PROBE
	struct delayed_work fwu_work;	/* /< Delayed work thread for fw update
					 * process */
	struct workqueue_struct  *fwu_workqueue;/* /< Fw update work
							 * queue */
#endif
};

extern int fts_proc_init(void);
extern int fts_proc_remove(void);
int fts_enable_interrupt(void);
int fts_disable_interrupt(void);

#endif