aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Duggan <aduggan@synaptics.com>2016-03-10 18:48:32 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2016-03-10 19:04:05 -0500
commitaaa27982b3bcc3cce6a1d835673adccd75903a2e (patch)
tree1940f239eccb6f395ad12ef878fba5291c344ef7
parentff8f83708b3e36c050dc3fd7e2f04ea7f1752599 (diff)
Input: synaptics-rmi4 - add device tree support for 2d sensors and F11
2D sensors have several parameter which can be set in the platform data. This patch adds support for getting those values from devicetree. Signed-off-by: Andrew Duggan <aduggan@synaptics.com> Tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Tested-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--Documentation/devicetree/bindings/input/rmi4/rmi_2d_sensor.txt56
-rw-r--r--Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt2
-rw-r--r--drivers/input/rmi4/rmi_2d_sensor.c108
-rw-r--r--drivers/input/rmi4/rmi_2d_sensor.h3
-rw-r--r--drivers/input/rmi4/rmi_f11.c7
5 files changed, 175 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/input/rmi4/rmi_2d_sensor.txt b/Documentation/devicetree/bindings/input/rmi4/rmi_2d_sensor.txt
new file mode 100644
index 000000000000..f2c30c8b725d
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/rmi4/rmi_2d_sensor.txt
@@ -0,0 +1,56 @@
1Synaptics RMI4 2D Sensor Device Binding
2
3The Synaptics RMI4 core is able to support RMI4 devices using different
4transports and different functions. This file describes the device tree
5bindings for devices which contain 2D sensors using Function 11 or
6Function 12. Complete documentation for transports and other functions
7can be found in:
8Documentation/devicetree/bindings/input/rmi4.
9
10RMI4 Function 11 and Function 12 are for 2D touch position sensing.
11Additional documentation for F11 can be found at:
12http://www.synaptics.com/sites/default/files/511-000136-01-Rev-E-RMI4-Interfacing-Guide.pdf
13
14Optional Touch Properties:
15Description in Documentation/devicetree/bindings/input/touch
16- touchscreen-inverted-x
17- touchscreen-inverted-y
18- touchscreen-swapped-x-y
19- touchscreen-x-mm
20- touchscreen-y-mm
21
22Optional Properties:
23- syna,clip-x-low: Sets a minimum value for X.
24- syna,clip-y-low: Sets a minimum value for Y.
25- syna,clip-x-high: Sets a maximum value for X.
26- syna,clip-y-high: Sets a maximum value for Y.
27- syna,offset-x: Add an offset to X.
28- syna,offset-y: Add an offset to Y.
29- syna,delta-x-threshold: Set the minimum distance on the X axis required
30 to generate an interrupt in reduced reporting
31 mode.
32- syna,delta-y-threshold: Set the minimum distance on the Y axis required
33 to generate an interrupt in reduced reporting
34 mode.
35- syna,sensor-type: Set the sensor type. 1 for touchscreen 2 for touchpad.
36- syna,disable-report-mask: Mask for disabling posiiton reporting. Used to
37 disable reporing absolute position data.
38- syna,rezero-wait-ms: Time in miliseconds to wait after issuing a rezero
39 command.
40
41
42Example of a RMI4 I2C device with F11:
43Example:
44 &i2c1 {
45 rmi4-i2c-dev@2c {
46 compatible = "syna,rmi4-i2c";
47
48 ...
49
50 rmi4-f11@11 {
51 reg = <0x11>;
52 touchscreen-inverted-y;
53 syna,sensor-type = <2>;
54 };
55 };
56 };
diff --git a/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
index ac23caf518ad..bccaa4e73045 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
@@ -18,6 +18,8 @@ Optional properties for Touchscreens:
18 - touchscreen-inverted-y : Y axis is inverted (boolean) 18 - touchscreen-inverted-y : Y axis is inverted (boolean)
19 - touchscreen-swapped-x-y : X and Y axis are swapped (boolean) 19 - touchscreen-swapped-x-y : X and Y axis are swapped (boolean)
20 Swapping is done after inverting the axis 20 Swapping is done after inverting the axis
21 - touchscreen-x-mm : horizontal length in mm of the touchscreen
22 - touchscreen-y-mm : vertical length in mm of the touchscreen
21 23
22Deprecated properties for Touchscreens: 24Deprecated properties for Touchscreens:
23 - x-size : deprecated name for touchscreen-size-x 25 - x-size : deprecated name for touchscreen-size-x
diff --git a/drivers/input/rmi4/rmi_2d_sensor.c b/drivers/input/rmi4/rmi_2d_sensor.c
index 8f48647ca5b0..e97bd7fabccc 100644
--- a/drivers/input/rmi4/rmi_2d_sensor.c
+++ b/drivers/input/rmi4/rmi_2d_sensor.c
@@ -219,3 +219,111 @@ int rmi_2d_sensor_configure_input(struct rmi_function *fn,
219 return 0; 219 return 0;
220} 220}
221EXPORT_SYMBOL_GPL(rmi_2d_sensor_configure_input); 221EXPORT_SYMBOL_GPL(rmi_2d_sensor_configure_input);
222
223#ifdef CONFIG_OF
224int rmi_2d_sensor_of_probe(struct device *dev,
225 struct rmi_2d_sensor_platform_data *pdata)
226{
227 int retval;
228 u32 val;
229
230 pdata->axis_align.swap_axes = of_property_read_bool(dev->of_node,
231 "touchscreen-swapped-x-y");
232
233 pdata->axis_align.flip_x = of_property_read_bool(dev->of_node,
234 "touchscreen-inverted-x");
235
236 pdata->axis_align.flip_y = of_property_read_bool(dev->of_node,
237 "touchscreen-inverted-y");
238
239 retval = rmi_of_property_read_u32(dev, &val, "syna,clip-x-low", 1);
240 if (retval)
241 return retval;
242
243 pdata->axis_align.clip_x_low = val;
244
245 retval = rmi_of_property_read_u32(dev, &val, "syna,clip-y-low", 1);
246 if (retval)
247 return retval;
248
249 pdata->axis_align.clip_y_low = val;
250
251 retval = rmi_of_property_read_u32(dev, &val, "syna,clip-x-high", 1);
252 if (retval)
253 return retval;
254
255 pdata->axis_align.clip_x_high = val;
256
257 retval = rmi_of_property_read_u32(dev, &val, "syna,clip-y-high", 1);
258 if (retval)
259 return retval;
260
261 pdata->axis_align.clip_y_high = val;
262
263 retval = rmi_of_property_read_u32(dev, &val, "syna,offset-x", 1);
264 if (retval)
265 return retval;
266
267 pdata->axis_align.offset_x = val;
268
269 retval = rmi_of_property_read_u32(dev, &val, "syna,offset-y", 1);
270 if (retval)
271 return retval;
272
273 pdata->axis_align.offset_y = val;
274
275 retval = rmi_of_property_read_u32(dev, &val, "syna,delta-x-threshold",
276 1);
277 if (retval)
278 return retval;
279
280 pdata->axis_align.delta_x_threshold = val;
281
282 retval = rmi_of_property_read_u32(dev, &val, "syna,delta-y-threshold",
283 1);
284 if (retval)
285 return retval;
286
287 pdata->axis_align.delta_y_threshold = val;
288
289 retval = rmi_of_property_read_u32(dev, (u32 *)&pdata->sensor_type,
290 "syna,sensor-type", 1);
291 if (retval)
292 return retval;
293
294 retval = rmi_of_property_read_u32(dev, &val, "touchscreen-x-mm", 1);
295 if (retval)
296 return retval;
297
298 pdata->x_mm = val;
299
300 retval = rmi_of_property_read_u32(dev, &val, "touchscreen-y-mm", 1);
301 if (retval)
302 return retval;
303
304 pdata->y_mm = val;
305
306 retval = rmi_of_property_read_u32(dev, &val,
307 "syna,disable-report-mask", 1);
308 if (retval)
309 return retval;
310
311 pdata->disable_report_mask = val;
312
313 retval = rmi_of_property_read_u32(dev, &val, "syna,rezero-wait-ms",
314 1);
315 if (retval)
316 return retval;
317
318 pdata->rezero_wait = val;
319
320 return 0;
321}
322#else
323inline int rmi_2d_sensor_of_probe(struct device *dev,
324 struct rmi_2d_sensor_platform_data *pdata)
325{
326 return -ENODEV;
327}
328#endif
329EXPORT_SYMBOL_GPL(rmi_2d_sensor_of_probe);
diff --git a/drivers/input/rmi4/rmi_2d_sensor.h b/drivers/input/rmi4/rmi_2d_sensor.h
index 6a715d392ec2..77fcdfef003c 100644
--- a/drivers/input/rmi4/rmi_2d_sensor.h
+++ b/drivers/input/rmi4/rmi_2d_sensor.h
@@ -69,6 +69,9 @@ struct rmi_2d_sensor {
69 u8 y_mm; 69 u8 y_mm;
70}; 70};
71 71
72int rmi_2d_sensor_of_probe(struct device *dev,
73 struct rmi_2d_sensor_platform_data *pdata);
74
72void rmi_2d_sensor_abs_process(struct rmi_2d_sensor *sensor, 75void rmi_2d_sensor_abs_process(struct rmi_2d_sensor *sensor,
73 struct rmi_2d_sensor_abs_object *obj, 76 struct rmi_2d_sensor_abs_object *obj,
74 int slot); 77 int slot);
diff --git a/drivers/input/rmi4/rmi_f11.c b/drivers/input/rmi4/rmi_f11.c
index 948a360b6261..77a5eb84aed9 100644
--- a/drivers/input/rmi4/rmi_f11.c
+++ b/drivers/input/rmi4/rmi_f11.c
@@ -1059,8 +1059,13 @@ static int rmi_f11_initialize(struct rmi_function *fn)
1059 if (!f11) 1059 if (!f11)
1060 return -ENOMEM; 1060 return -ENOMEM;
1061 1061
1062 if (pdata->sensor_pdata) 1062 if (fn->dev.of_node) {
1063 rc = rmi_2d_sensor_of_probe(&fn->dev, &f11->sensor_pdata);
1064 if (rc)
1065 return rc;
1066 } else if (pdata->sensor_pdata) {
1063 f11->sensor_pdata = *pdata->sensor_pdata; 1067 f11->sensor_pdata = *pdata->sensor_pdata;
1068 }
1064 1069
1065 f11->rezero_wait_ms = f11->sensor_pdata.rezero_wait; 1070 f11->rezero_wait_ms = f11->sensor_pdata.rezero_wait;
1066 1071