GNU Linux-libre 4.14.332-gnu1
[releases.git] / include / linux / platform_data / pixcir_i2c_ts.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _PIXCIR_I2C_TS_H
3 #define _PIXCIR_I2C_TS_H
4
5 /*
6  * Register map
7  */
8 #define PIXCIR_REG_POWER_MODE   51
9 #define PIXCIR_REG_INT_MODE     52
10
11 /*
12  * Power modes:
13  * active: max scan speed
14  * idle: lower scan speed with automatic transition to active on touch
15  * halt: datasheet says sleep but this is more like halt as the chip
16  *       clocks are cut and it can only be brought out of this mode
17  *       using the RESET pin.
18  */
19 enum pixcir_power_mode {
20         PIXCIR_POWER_ACTIVE,
21         PIXCIR_POWER_IDLE,
22         PIXCIR_POWER_HALT,
23 };
24
25 #define PIXCIR_POWER_MODE_MASK  0x03
26 #define PIXCIR_POWER_ALLOW_IDLE (1UL << 2)
27
28 /*
29  * Interrupt modes:
30  * periodical: interrupt is asserted periodicaly
31  * diff coordinates: interrupt is asserted when coordinates change
32  * level on touch: interrupt level asserted during touch
33  * pulse on touch: interrupt pulse asserted druing touch
34  *
35  */
36 enum pixcir_int_mode {
37         PIXCIR_INT_PERIODICAL,
38         PIXCIR_INT_DIFF_COORD,
39         PIXCIR_INT_LEVEL_TOUCH,
40         PIXCIR_INT_PULSE_TOUCH,
41 };
42
43 #define PIXCIR_INT_MODE_MASK    0x03
44 #define PIXCIR_INT_ENABLE       (1UL << 3)
45 #define PIXCIR_INT_POL_HIGH     (1UL << 2)
46
47 /**
48  * struct pixcir_irc_chip_data - chip related data
49  * @max_fingers:        Max number of fingers reported simultaneously by h/w
50  * @has_hw_ids:         Hardware supports finger tracking IDs
51  *
52  */
53 struct pixcir_i2c_chip_data {
54         u8 max_fingers;
55         bool has_hw_ids;
56 };
57
58 struct pixcir_ts_platform_data {
59         int x_max;
60         int y_max;
61         struct pixcir_i2c_chip_data chip;
62 };
63
64 #endif