ads7846.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* linux/spi/ads7846.h */
  2. /* Touchscreen characteristics vary between boards and models. The
  3. * platform_data for the device's "struct device" holds this information.
  4. *
  5. * It's OK if the min/max values are zero.
  6. */
  7. enum ads7846_filter {
  8. ADS7846_FILTER_OK,
  9. ADS7846_FILTER_REPEAT,
  10. ADS7846_FILTER_IGNORE,
  11. };
  12. struct ads7846_platform_data {
  13. u16 model; /* 7843, 7845, 7846. */
  14. u16 vref_delay_usecs; /* 0 for external vref; etc */
  15. u16 vref_mv; /* external vref value, milliVolts */
  16. bool keep_vref_on; /* set to keep vref on for differential
  17. * measurements as well */
  18. /* Settling time of the analog signals; a function of Vcc and the
  19. * capacitance on the X/Y drivers. If set to non-zero, two samples
  20. * are taken with settle_delay us apart, and the second one is used.
  21. * ~150 uSec with 0.01uF caps.
  22. */
  23. u16 settle_delay_usecs;
  24. /* If set to non-zero, after samples are taken this delay is applied
  25. * and penirq is rechecked, to help avoid false events. This value
  26. * is affected by the material used to build the touch layer.
  27. */
  28. u16 penirq_recheck_delay_usecs;
  29. u16 x_plate_ohms;
  30. u16 y_plate_ohms;
  31. u16 x_min, x_max;
  32. u16 y_min, y_max;
  33. u16 pressure_min, pressure_max;
  34. u16 debounce_max; /* max number of additional readings
  35. * per sample */
  36. u16 debounce_tol; /* tolerance used for filtering */
  37. u16 debounce_rep; /* additional consecutive good readings
  38. * required after the first two */
  39. int gpio_pendown; /* the GPIO used to decide the pendown
  40. * state if get_pendown_state == NULL
  41. */
  42. int (*get_pendown_state)(void);
  43. int (*filter_init) (struct ads7846_platform_data *pdata,
  44. void **filter_data);
  45. int (*filter) (void *filter_data, int data_idx, int *val);
  46. void (*filter_cleanup)(void *filter_data);
  47. };