rmi_2d_sensor.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. #ifndef _RMI_2D_SENSOR_H
  10. #define _RMI_2D_SENSOR_H
  11. enum rmi_2d_sensor_object_type {
  12. RMI_2D_OBJECT_NONE,
  13. RMI_2D_OBJECT_FINGER,
  14. RMI_2D_OBJECT_STYLUS,
  15. RMI_2D_OBJECT_PALM,
  16. RMI_2D_OBJECT_UNCLASSIFIED,
  17. };
  18. struct rmi_2d_sensor_abs_object {
  19. enum rmi_2d_sensor_object_type type;
  20. int mt_tool;
  21. u16 x;
  22. u16 y;
  23. u8 z;
  24. u8 wx;
  25. u8 wy;
  26. };
  27. /**
  28. * @axis_align - controls parameters that are useful in system prototyping
  29. * and bring up.
  30. * @max_x - The maximum X coordinate that will be reported by this sensor.
  31. * @max_y - The maximum Y coordinate that will be reported by this sensor.
  32. * @nbr_fingers - How many fingers can this sensor report?
  33. * @data_pkt - buffer for data reported by this sensor.
  34. * @pkt_size - number of bytes in that buffer.
  35. * @attn_size - Size of the HID attention report (only contains abs data).
  36. * position when two fingers are on the device. When this is true, we
  37. * assume we have one of those sensors and report events appropriately.
  38. * @sensor_type - indicates whether we're touchscreen or touchpad.
  39. * @input - input device for absolute pointing stream
  40. * @input_phys - buffer for the absolute phys name for this sensor.
  41. */
  42. struct rmi_2d_sensor {
  43. struct rmi_2d_axis_alignment axis_align;
  44. struct input_mt_pos *tracking_pos;
  45. int *tracking_slots;
  46. bool kernel_tracking;
  47. struct rmi_2d_sensor_abs_object *objs;
  48. int dmax;
  49. u16 min_x;
  50. u16 max_x;
  51. u16 min_y;
  52. u16 max_y;
  53. u8 nbr_fingers;
  54. u8 *data_pkt;
  55. int pkt_size;
  56. int attn_size;
  57. bool topbuttonpad;
  58. enum rmi_sensor_type sensor_type;
  59. struct input_dev *input;
  60. struct rmi_function *fn;
  61. char input_phys[32];
  62. u8 report_abs;
  63. u8 report_rel;
  64. u8 x_mm;
  65. u8 y_mm;
  66. };
  67. int rmi_2d_sensor_of_probe(struct device *dev,
  68. struct rmi_2d_sensor_platform_data *pdata);
  69. void rmi_2d_sensor_abs_process(struct rmi_2d_sensor *sensor,
  70. struct rmi_2d_sensor_abs_object *obj,
  71. int slot);
  72. void rmi_2d_sensor_abs_report(struct rmi_2d_sensor *sensor,
  73. struct rmi_2d_sensor_abs_object *obj,
  74. int slot);
  75. void rmi_2d_sensor_rel_report(struct rmi_2d_sensor *sensor, int x, int y);
  76. int rmi_2d_sensor_configure_input(struct rmi_function *fn,
  77. struct rmi_2d_sensor *sensor);
  78. #endif /* _RMI_2D_SENSOR_H */