rmi_2d_sensor.h 2.3 KB

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