ads7846.h 1.9 KB

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