ads7846.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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, 7873. */
  14. u16 vref_delay_usecs; /* 0 for external vref; etc */
  15. u16 vref_mv; /* external vref value, milliVolts
  16. * ads7846: if 0, use internal vref */
  17. bool keep_vref_on; /* set to keep vref on for differential
  18. * measurements as well */
  19. bool swap_xy; /* swap x and y axes */
  20. /* Settling time of the analog signals; a function of Vcc and the
  21. * capacitance on the X/Y drivers. If set to non-zero, two samples
  22. * are taken with settle_delay us apart, and the second one is used.
  23. * ~150 uSec with 0.01uF caps.
  24. */
  25. u16 settle_delay_usecs;
  26. /* If set to non-zero, after samples are taken this delay is applied
  27. * and penirq is rechecked, to help avoid false events. This value
  28. * is affected by the material used to build the touch layer.
  29. */
  30. u16 penirq_recheck_delay_usecs;
  31. u16 x_plate_ohms;
  32. u16 y_plate_ohms;
  33. u16 x_min, x_max;
  34. u16 y_min, y_max;
  35. u16 pressure_min, pressure_max;
  36. u16 debounce_max; /* max number of additional readings
  37. * per sample */
  38. u16 debounce_tol; /* tolerance used for filtering */
  39. u16 debounce_rep; /* additional consecutive good readings
  40. * required after the first two */
  41. int gpio_pendown; /* the GPIO used to decide the pendown
  42. * state if get_pendown_state == NULL */
  43. int gpio_pendown_debounce; /* platform specific debounce time for
  44. * the gpio_pendown */
  45. int (*get_pendown_state)(void);
  46. int (*filter_init) (const struct ads7846_platform_data *pdata,
  47. void **filter_data);
  48. int (*filter) (void *filter_data, int data_idx, int *val);
  49. void (*filter_cleanup)(void *filter_data);
  50. void (*wait_for_sync)(void);
  51. bool wakeup;
  52. unsigned long irq_flags;
  53. };