rmi_platformdata.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /**
  2. *
  3. * Synaptics RMI platform data definitions for use in board files.
  4. * Copyright (c) 2007 - 2011, Synaptics Incorporated
  5. *
  6. */
  7. /*
  8. * This file is licensed under the GPL2 license.
  9. *
  10. *############################################################################
  11. * GPL
  12. *
  13. * This program is free software; you can redistribute it and/or modify it
  14. * under the terms of the GNU General Public License version 2 as published
  15. * by the Free Software Foundation.
  16. *
  17. * This program is distributed in the hope that it will be useful, but
  18. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  19. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  20. * for more details.
  21. *
  22. *############################################################################
  23. */
  24. #if !defined(_RMI_PLATFORMDATA_H)
  25. #define _RMI_PLATFORMDATA_H
  26. #define RMI_F01_INDEX 0x01
  27. #define RMI_F11_INDEX 0x11
  28. #define RMI_F19_INDEX 0x19
  29. #define RMI_F34_INDEX 0x34
  30. /* A couple of structs that are useful for frequently occuring constructs,such
  31. * as coordinate origin offsets or coordinate clipping values.
  32. */
  33. struct rmi_XY_pair {
  34. int x;
  35. int y;
  36. };
  37. struct rmi_range {
  38. int min;
  39. int max;
  40. };
  41. /* This contains sensor specific data that is not specialized to I2C or SPI.
  42. */
  43. struct rmi_sensordata {
  44. /* This will be called from rmi_register_sensor(). You can use it
  45. * to set up gpios, IRQs, and other platform specific infrastructure.
  46. */
  47. int (*rmi_sensor_setup)(void);
  48. /* This will be called when the sensor is unloaded. Use this to
  49. * release gpios, IRQs, and other platform specific infrastructure.
  50. */
  51. void (*rmi_sensor_teardown)(void);
  52. /* Use this to specify non-default settings on a per function basis.
  53. */
  54. struct rmi_functiondata_list *perfunctiondata;
  55. };
  56. /* This contains the per-function customization for a given function.We store
  57. * the data this way in order to avoid allocating a large sparse array
  58. * typically
  59. * only a few functions are present on a sensor, and even fewer will be have
  60. * custom settings. There is a very small penalty paid for doing a linear
  61. * search through the list to find a given function's data, but since the list
  62. * is typically very short and is searched only at system boot time, this is
  63. * considered acceptable.
  64. *
  65. * When adding new fields to a functiondata struct, please follow these rules:
  66. * - Where possible, use 0 to indicate that the value should be defaulted.
  67. * This works pretty well for bools, ints, and chars.
  68. * - Where this is not practical (for example, in coordinate offsets or
  69. * range clipping), use a pointer. Set that pointer to null to indicate
  70. * that the value should be defaulted.
  71. */
  72. struct rmi_functiondata {
  73. unsigned char function_index;
  74. void *data;
  75. };
  76. /* This can be included in the platformdata for SPI or I2C RMI4 devices to
  77. * customize the settings of the functions on a given sensor.
  78. */
  79. struct rmi_functiondata_list {
  80. unsigned char count; /* Number of elements in the array */
  81. struct rmi_functiondata *functiondata;
  82. };
  83. struct rmi_f01_functiondata {
  84. /* What this does is product specific. For most, but not all, RMI4
  85. * devices, you can set this to true in order to request the device
  86. * report data at half the usual rate. This can be useful on slow
  87. * CPUs that don't have the resources to process data at the usual
  88. * rate. However, the meaning of this field is product specific, and
  89. * you should consult the product spec for your sensor to find out
  90. * what this will do.
  91. */
  92. bool nonstandard_report_rate;
  93. };
  94. struct rmi_f11_functiondata {
  95. bool swap_axes;
  96. bool flipX;
  97. bool flipY;
  98. int button_height;
  99. struct rmi_XY_pair *offset;
  100. struct rmi_range *clipX;
  101. struct rmi_range *clipY;
  102. };
  103. struct rmi_button_map {
  104. unsigned char nbuttons;
  105. unsigned char *map;
  106. };
  107. struct rmi_f19_functiondata {
  108. struct rmi_button_map *button_map;
  109. };
  110. #endif