aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-03-18 00:51:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-18 00:51:52 -0400
commit10fdfee7f7fd8d4a6a8455ac4c9fbbc51d79b9f7 (patch)
treeace3300ec40d2a253c59a70ee37eb76fa53c859f /include/linux
parent0f49fc95b86fc77b867d643e2d38bc9f28035ed4 (diff)
parent4d2508a55990c9b0fc1afb2c2cc5636712fd30f7 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input updates from Dmitry Torokhov: "The most notable item is addition of support for Synaptics RMI4 protocol which is native protocol for all current Synaptics devices (touchscreens, touchpads). In later releases we'll switch devices using HID and PS/2 protocol emulation to RMI4. You will also get: - BYD PS/2 touchpad protocol support for psmouse - MELFAS MIP4 Touchscreen driver - rotary encoder was moved away from legacy platform data and to generic device properties API, devm_* API, and can now handle encoders using more than 2 GPIOs - Cypress touchpad driver was switched to devm_* API and device properties - other assorted driver fixes" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (40 commits) ARM: pxa/raumfeld: use PROPERTY_ENTRY_INTEGER to define props Input: synaptics-rmi4 - using logical instead of bitwise AND Input: powermate - fix oops with malicious USB descriptors Input: snvs_pwrkey - fix returned value check of syscon_regmap_lookup_by_phandle() MAINTAINERS: add devicetree bindings to Input Drivers section Input: synaptics-rmi4 - add device tree support to the SPI transport driver Input: synaptics-rmi4 - add SPI transport driver Input: synaptics-rmi4 - add support for F30 Input: synaptics-rmi4 - add support for F12 Input: synaptics-rmi4 - add device tree support for 2d sensors and F11 Input: synaptics-rmi4 - add support for 2D sensors and F11 Input: synaptics-rmi4 - add device tree support for RMI4 I2C devices Input: synaptics-rmi4 - add I2C transport driver Input: synaptics-rmi4 - add support for Synaptics RMI4 devices Input: ad7879 - add device tree support Input: ad7879 - fix default x/y axis assignment Input: ad7879 - move header to platform_data directory Input: ts4800 - add hardware dependency Input: cyapa - fix for losing events during device power transitions Input: sh_keysc - remove dependency on SUPERH ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/input/cyttsp.h15
-rw-r--r--include/linux/platform_data/ad7879.h (renamed from include/linux/spi/ad7879.h)2
-rw-r--r--include/linux/rmi.h359
-rw-r--r--include/linux/rotary_encoder.h17
4 files changed, 360 insertions, 33 deletions
diff --git a/include/linux/input/cyttsp.h b/include/linux/input/cyttsp.h
index 5af7c66f1fca..586c8c95dcb0 100644
--- a/include/linux/input/cyttsp.h
+++ b/include/linux/input/cyttsp.h
@@ -40,19 +40,4 @@
40/* Active distance in pixels for a gesture to be reported */ 40/* Active distance in pixels for a gesture to be reported */
41#define CY_ACT_DIST_DFLT 0xF8 /* pixels */ 41#define CY_ACT_DIST_DFLT 0xF8 /* pixels */
42 42
43struct cyttsp_platform_data {
44 u32 maxx;
45 u32 maxy;
46 bool use_hndshk;
47 u8 act_dist; /* Active distance */
48 u8 act_intrvl; /* Active refresh interval; ms */
49 u8 tch_tmout; /* Active touch timeout; ms */
50 u8 lp_intrvl; /* Low power refresh interval; ms */
51 int (*init)(void);
52 void (*exit)(void);
53 char *name;
54 s16 irq_gpio;
55 u8 *bl_keys;
56};
57
58#endif /* _CYTTSP_H_ */ 43#endif /* _CYTTSP_H_ */
diff --git a/include/linux/spi/ad7879.h b/include/linux/platform_data/ad7879.h
index 58368be0b4c0..69e2e1fd2bc8 100644
--- a/include/linux/spi/ad7879.h
+++ b/include/linux/platform_data/ad7879.h
@@ -1,4 +1,4 @@
1/* linux/spi/ad7879.h */ 1/* linux/platform_data/ad7879.h */
2 2
3/* Touchscreen characteristics vary between boards and models. The 3/* Touchscreen characteristics vary between boards and models. The
4 * platform_data for the device's "struct device" holds this information. 4 * platform_data for the device's "struct device" holds this information.
diff --git a/include/linux/rmi.h b/include/linux/rmi.h
new file mode 100644
index 000000000000..e0aca1476001
--- /dev/null
+++ b/include/linux/rmi.h
@@ -0,0 +1,359 @@
1/*
2 * Copyright (c) 2011-2016 Synaptics Incorporated
3 * Copyright (c) 2011 Unixphere
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */
9
10#ifndef _RMI_H
11#define _RMI_H
12#include <linux/kernel.h>
13#include <linux/device.h>
14#include <linux/interrupt.h>
15#include <linux/input.h>
16#include <linux/list.h>
17#include <linux/module.h>
18#include <linux/types.h>
19
20#define NAME_BUFFER_SIZE 256
21
22/**
23 * struct rmi_2d_axis_alignment - target axis alignment
24 * @swap_axes: set to TRUE if desired to swap x- and y-axis
25 * @flip_x: set to TRUE if desired to flip direction on x-axis
26 * @flip_y: set to TRUE if desired to flip direction on y-axis
27 * @clip_x_low - reported X coordinates below this setting will be clipped to
28 * the specified value
29 * @clip_x_high - reported X coordinates above this setting will be clipped to
30 * the specified value
31 * @clip_y_low - reported Y coordinates below this setting will be clipped to
32 * the specified value
33 * @clip_y_high - reported Y coordinates above this setting will be clipped to
34 * the specified value
35 * @offset_x - this value will be added to all reported X coordinates
36 * @offset_y - this value will be added to all reported Y coordinates
37 * @rel_report_enabled - if set to true, the relative reporting will be
38 * automatically enabled for this sensor.
39 */
40struct rmi_2d_axis_alignment {
41 bool swap_axes;
42 bool flip_x;
43 bool flip_y;
44 u16 clip_x_low;
45 u16 clip_y_low;
46 u16 clip_x_high;
47 u16 clip_y_high;
48 u16 offset_x;
49 u16 offset_y;
50 u8 delta_x_threshold;
51 u8 delta_y_threshold;
52};
53
54/** This is used to override any hints an F11 2D sensor might have provided
55 * as to what type of sensor it is.
56 *
57 * @rmi_f11_sensor_default - do not override, determine from F11_2D_QUERY14 if
58 * available.
59 * @rmi_f11_sensor_touchscreen - treat the sensor as a touchscreen (direct
60 * pointing).
61 * @rmi_f11_sensor_touchpad - thread the sensor as a touchpad (indirect
62 * pointing).
63 */
64enum rmi_sensor_type {
65 rmi_sensor_default = 0,
66 rmi_sensor_touchscreen,
67 rmi_sensor_touchpad
68};
69
70#define RMI_F11_DISABLE_ABS_REPORT BIT(0)
71
72/**
73 * struct rmi_2d_sensor_data - overrides defaults for a 2D sensor.
74 * @axis_align - provides axis alignment overrides (see above).
75 * @sensor_type - Forces the driver to treat the sensor as an indirect
76 * pointing device (touchpad) rather than a direct pointing device
77 * (touchscreen). This is useful when F11_2D_QUERY14 register is not
78 * available.
79 * @disable_report_mask - Force data to not be reported even if it is supported
80 * by the firware.
81 * @topbuttonpad - Used with the "5 buttons touchpads" found on the Lenovo 40
82 * series
83 * @kernel_tracking - most moderns RMI f11 firmwares implement Multifinger
84 * Type B protocol. However, there are some corner cases where the user
85 * triggers some jumps by tapping with two fingers on the touchpad.
86 * Use this setting and dmax to filter out these jumps.
87 * Also, when using an old sensor using MF Type A behavior, set to true to
88 * report an actual MT protocol B.
89 * @dmax - the maximum distance (in sensor units) the kernel tracking allows two
90 * distincts fingers to be considered the same.
91 */
92struct rmi_2d_sensor_platform_data {
93 struct rmi_2d_axis_alignment axis_align;
94 enum rmi_sensor_type sensor_type;
95 int x_mm;
96 int y_mm;
97 int disable_report_mask;
98 u16 rezero_wait;
99 bool topbuttonpad;
100 bool kernel_tracking;
101 int dmax;
102};
103
104/**
105 * struct rmi_f30_data - overrides defaults for a single F30 GPIOs/LED chip.
106 * @buttonpad - the touchpad is a buttonpad, so enable only the first actual
107 * button that is found.
108 * @trackstick_buttons - Set when the function 30 is handling the physical
109 * buttons of the trackstick (as a PD/2 passthrough device.
110 * @disable - the touchpad incorrectly reports F30 and it should be ignored.
111 * This is a special case which is due to misconfigured firmware.
112 */
113struct rmi_f30_data {
114 bool buttonpad;
115 bool trackstick_buttons;
116 bool disable;
117};
118
119/**
120 * struct rmi_f01_power - override default power management settings.
121 *
122 */
123enum rmi_f01_nosleep {
124 RMI_F01_NOSLEEP_DEFAULT = 0,
125 RMI_F01_NOSLEEP_OFF = 1,
126 RMI_F01_NOSLEEP_ON = 2
127};
128
129/**
130 * struct rmi_f01_power_management -When non-zero, these values will be written
131 * to the touch sensor to override the default firmware settigns. For a
132 * detailed explanation of what each field does, see the corresponding
133 * documention in the RMI4 specification.
134 *
135 * @nosleep - specifies whether the device is permitted to sleep or doze (that
136 * is, enter a temporary low power state) when no fingers are touching the
137 * sensor.
138 * @wakeup_threshold - controls the capacitance threshold at which the touch
139 * sensor will decide to wake up from that low power state.
140 * @doze_holdoff - controls how long the touch sensor waits after the last
141 * finger lifts before entering the doze state, in units of 100ms.
142 * @doze_interval - controls the interval between checks for finger presence
143 * when the touch sensor is in doze mode, in units of 10ms.
144 */
145struct rmi_f01_power_management {
146 enum rmi_f01_nosleep nosleep;
147 u8 wakeup_threshold;
148 u8 doze_holdoff;
149 u8 doze_interval;
150};
151
152/**
153 * struct rmi_device_platform_data_spi - provides parameters used in SPI
154 * communications. All Synaptics SPI products support a standard SPI
155 * interface; some also support what is called SPI V2 mode, depending on
156 * firmware and/or ASIC limitations. In V2 mode, the touch sensor can
157 * support shorter delays during certain operations, and these are specified
158 * separately from the standard mode delays.
159 *
160 * @block_delay - for standard SPI transactions consisting of both a read and
161 * write operation, the delay (in microseconds) between the read and write
162 * operations.
163 * @split_read_block_delay_us - for V2 SPI transactions consisting of both a
164 * read and write operation, the delay (in microseconds) between the read and
165 * write operations.
166 * @read_delay_us - the delay between each byte of a read operation in normal
167 * SPI mode.
168 * @write_delay_us - the delay between each byte of a write operation in normal
169 * SPI mode.
170 * @split_read_byte_delay_us - the delay between each byte of a read operation
171 * in V2 mode.
172 * @pre_delay_us - the delay before the start of a SPI transaction. This is
173 * typically useful in conjunction with custom chip select assertions (see
174 * below).
175 * @post_delay_us - the delay after the completion of an SPI transaction. This
176 * is typically useful in conjunction with custom chip select assertions (see
177 * below).
178 * @cs_assert - For systems where the SPI subsystem does not control the CS/SSB
179 * line, or where such control is broken, you can provide a custom routine to
180 * handle a GPIO as CS/SSB. This routine will be called at the beginning and
181 * end of each SPI transaction. The RMI SPI implementation will wait
182 * pre_delay_us after this routine returns before starting the SPI transfer;
183 * and post_delay_us after completion of the SPI transfer(s) before calling it
184 * with assert==FALSE.
185 */
186struct rmi_device_platform_data_spi {
187 u32 block_delay_us;
188 u32 split_read_block_delay_us;
189 u32 read_delay_us;
190 u32 write_delay_us;
191 u32 split_read_byte_delay_us;
192 u32 pre_delay_us;
193 u32 post_delay_us;
194 u8 bits_per_word;
195 u16 mode;
196
197 void *cs_assert_data;
198 int (*cs_assert)(const void *cs_assert_data, const bool assert);
199};
200
201/**
202 * struct rmi_device_platform_data - system specific configuration info.
203 *
204 * @reset_delay_ms - after issuing a reset command to the touch sensor, the
205 * driver waits a few milliseconds to give the firmware a chance to
206 * to re-initialize. You can override the default wait period here.
207 */
208struct rmi_device_platform_data {
209 int reset_delay_ms;
210
211 struct rmi_device_platform_data_spi spi_data;
212
213 /* function handler pdata */
214 struct rmi_2d_sensor_platform_data *sensor_pdata;
215 struct rmi_f01_power_management power_management;
216 struct rmi_f30_data *f30_data;
217};
218
219/**
220 * struct rmi_function_descriptor - RMI function base addresses
221 *
222 * @query_base_addr: The RMI Query base address
223 * @command_base_addr: The RMI Command base address
224 * @control_base_addr: The RMI Control base address
225 * @data_base_addr: The RMI Data base address
226 * @interrupt_source_count: The number of irqs this RMI function needs
227 * @function_number: The RMI function number
228 *
229 * This struct is used when iterating the Page Description Table. The addresses
230 * are 16-bit values to include the current page address.
231 *
232 */
233struct rmi_function_descriptor {
234 u16 query_base_addr;
235 u16 command_base_addr;
236 u16 control_base_addr;
237 u16 data_base_addr;
238 u8 interrupt_source_count;
239 u8 function_number;
240 u8 function_version;
241};
242
243struct rmi_device;
244
245/**
246 * struct rmi_transport_dev - represent an RMI transport device
247 *
248 * @dev: Pointer to the communication device, e.g. i2c or spi
249 * @rmi_dev: Pointer to the RMI device
250 * @proto_name: name of the transport protocol (SPI, i2c, etc)
251 * @ops: pointer to transport operations implementation
252 *
253 * The RMI transport device implements the glue between different communication
254 * buses such as I2C and SPI.
255 *
256 */
257struct rmi_transport_dev {
258 struct device *dev;
259 struct rmi_device *rmi_dev;
260
261 const char *proto_name;
262 const struct rmi_transport_ops *ops;
263
264 struct rmi_device_platform_data pdata;
265
266 struct input_dev *input;
267
268 void *attn_data;
269 int attn_size;
270};
271
272/**
273 * struct rmi_transport_ops - defines transport protocol operations.
274 *
275 * @write_block: Writing a block of data to the specified address
276 * @read_block: Read a block of data from the specified address.
277 */
278struct rmi_transport_ops {
279 int (*write_block)(struct rmi_transport_dev *xport, u16 addr,
280 const void *buf, size_t len);
281 int (*read_block)(struct rmi_transport_dev *xport, u16 addr,
282 void *buf, size_t len);
283 int (*reset)(struct rmi_transport_dev *xport, u16 reset_addr);
284};
285
286/**
287 * struct rmi_driver - driver for an RMI4 sensor on the RMI bus.
288 *
289 * @driver: Device driver model driver
290 * @reset_handler: Called when a reset is detected.
291 * @clear_irq_bits: Clear the specified bits in the current interrupt mask.
292 * @set_irq_bist: Set the specified bits in the current interrupt mask.
293 * @store_productid: Callback for cache product id from function 01
294 * @data: Private data pointer
295 *
296 */
297struct rmi_driver {
298 struct device_driver driver;
299
300 int (*reset_handler)(struct rmi_device *rmi_dev);
301 int (*clear_irq_bits)(struct rmi_device *rmi_dev, unsigned long *mask);
302 int (*set_irq_bits)(struct rmi_device *rmi_dev, unsigned long *mask);
303 int (*store_productid)(struct rmi_device *rmi_dev);
304 int (*set_input_params)(struct rmi_device *rmi_dev,
305 struct input_dev *input);
306 void *data;
307};
308
309/**
310 * struct rmi_device - represents an RMI4 sensor device on the RMI bus.
311 *
312 * @dev: The device created for the RMI bus
313 * @number: Unique number for the device on the bus.
314 * @driver: Pointer to associated driver
315 * @xport: Pointer to the transport interface
316 *
317 */
318struct rmi_device {
319 struct device dev;
320 int number;
321
322 struct rmi_driver *driver;
323 struct rmi_transport_dev *xport;
324
325};
326
327struct rmi_driver_data {
328 struct list_head function_list;
329
330 struct rmi_device *rmi_dev;
331
332 struct rmi_function *f01_container;
333 bool f01_bootloader_mode;
334
335 u32 attn_count;
336 int num_of_irq_regs;
337 int irq_count;
338 unsigned long *irq_status;
339 unsigned long *fn_irq_bits;
340 unsigned long *current_irq_mask;
341 unsigned long *new_irq_mask;
342 struct mutex irq_mutex;
343 struct input_dev *input;
344
345 u8 pdt_props;
346 u8 bsr;
347
348 bool enabled;
349
350 void *data;
351};
352
353int rmi_register_transport_device(struct rmi_transport_dev *xport);
354void rmi_unregister_transport_device(struct rmi_transport_dev *xport);
355int rmi_process_interrupt_requests(struct rmi_device *rmi_dev);
356
357int rmi_driver_suspend(struct rmi_device *rmi_dev);
358int rmi_driver_resume(struct rmi_device *rmi_dev);
359#endif
diff --git a/include/linux/rotary_encoder.h b/include/linux/rotary_encoder.h
deleted file mode 100644
index fe3dc64e5aeb..000000000000
--- a/include/linux/rotary_encoder.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef __ROTARY_ENCODER_H__
2#define __ROTARY_ENCODER_H__
3
4struct rotary_encoder_platform_data {
5 unsigned int steps;
6 unsigned int axis;
7 unsigned int gpio_a;
8 unsigned int gpio_b;
9 unsigned int inverted_a;
10 unsigned int inverted_b;
11 unsigned int steps_per_period;
12 bool relative_axis;
13 bool rollover;
14 bool wakeup_source;
15};
16
17#endif /* __ROTARY_ENCODER_H__ */