Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Andrew Duggan and committed by
Dmitry Torokhov
aaa27982 ff8f8370

+175 -1
+56
Documentation/devicetree/bindings/input/rmi4/rmi_2d_sensor.txt
··· 1 + Synaptics RMI4 2D Sensor Device Binding 2 + 3 + The Synaptics RMI4 core is able to support RMI4 devices using different 4 + transports and different functions. This file describes the device tree 5 + bindings for devices which contain 2D sensors using Function 11 or 6 + Function 12. Complete documentation for transports and other functions 7 + can be found in: 8 + Documentation/devicetree/bindings/input/rmi4. 9 + 10 + RMI4 Function 11 and Function 12 are for 2D touch position sensing. 11 + Additional documentation for F11 can be found at: 12 + http://www.synaptics.com/sites/default/files/511-000136-01-Rev-E-RMI4-Interfacing-Guide.pdf 13 + 14 + Optional Touch Properties: 15 + Description 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 + 22 + Optional 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 + 42 + Example of a RMI4 I2C device with F11: 43 + Example: 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 + };
+2
Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
··· 18 18 - touchscreen-inverted-y : Y axis is inverted (boolean) 19 19 - touchscreen-swapped-x-y : X and Y axis are swapped (boolean) 20 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 22 24 Deprecated properties for Touchscreens: 23 25 - x-size : deprecated name for touchscreen-size-x
+108
drivers/input/rmi4/rmi_2d_sensor.c
··· 219 219 return 0; 220 220 } 221 221 EXPORT_SYMBOL_GPL(rmi_2d_sensor_configure_input); 222 + 223 + #ifdef CONFIG_OF 224 + int 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 323 + inline int rmi_2d_sensor_of_probe(struct device *dev, 324 + struct rmi_2d_sensor_platform_data *pdata) 325 + { 326 + return -ENODEV; 327 + } 328 + #endif 329 + EXPORT_SYMBOL_GPL(rmi_2d_sensor_of_probe);
+3
drivers/input/rmi4/rmi_2d_sensor.h
··· 69 69 u8 y_mm; 70 70 }; 71 71 72 + int rmi_2d_sensor_of_probe(struct device *dev, 73 + struct rmi_2d_sensor_platform_data *pdata); 74 + 72 75 void rmi_2d_sensor_abs_process(struct rmi_2d_sensor *sensor, 73 76 struct rmi_2d_sensor_abs_object *obj, 74 77 int slot);
+6 -1
drivers/input/rmi4/rmi_f11.c
··· 1059 1059 if (!f11) 1060 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 1067 f11->sensor_pdata = *pdata->sensor_pdata; 1068 + } 1064 1069 1065 1070 f11->rezero_wait_ms = f11->sensor_pdata.rezero_wait; 1066 1071