hgpk.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * OLPC HGPK (XO-1) touchpad PS/2 mouse driver
  4. */
  5. #ifndef _HGPK_H
  6. #define _HGPK_H
  7. #define HGPK_GS 0xff /* The GlideSensor */
  8. #define HGPK_PT 0xcf /* The PenTablet */
  9. enum hgpk_model_t {
  10. HGPK_MODEL_PREA = 0x0a, /* pre-B1s */
  11. HGPK_MODEL_A = 0x14, /* found on B1s, PT disabled in hardware */
  12. HGPK_MODEL_B = 0x28, /* B2s, has capacitance issues */
  13. HGPK_MODEL_C = 0x3c,
  14. HGPK_MODEL_D = 0x50, /* C1, mass production */
  15. };
  16. enum hgpk_spew_flag {
  17. NO_SPEW,
  18. MAYBE_SPEWING,
  19. SPEW_DETECTED,
  20. RECALIBRATING,
  21. };
  22. #define SPEW_WATCH_COUNT 42 /* at 12ms/packet, this is 1/2 second */
  23. enum hgpk_mode {
  24. HGPK_MODE_MOUSE,
  25. HGPK_MODE_GLIDESENSOR,
  26. HGPK_MODE_PENTABLET,
  27. HGPK_MODE_INVALID
  28. };
  29. struct hgpk_data {
  30. struct psmouse *psmouse;
  31. enum hgpk_mode mode;
  32. bool powered;
  33. enum hgpk_spew_flag spew_flag;
  34. int spew_count, x_tally, y_tally; /* spew detection */
  35. unsigned long recalib_window;
  36. struct delayed_work recalib_wq;
  37. int abs_x, abs_y;
  38. int dupe_count;
  39. int xbigj, ybigj, xlast, ylast; /* jumpiness detection */
  40. int xsaw_secondary, ysaw_secondary; /* jumpiness detection */
  41. };
  42. int hgpk_detect(struct psmouse *psmouse, bool set_properties);
  43. int hgpk_init(struct psmouse *psmouse);
  44. #ifdef CONFIG_MOUSE_PS2_OLPC
  45. void hgpk_module_init(void);
  46. #else
  47. static inline void hgpk_module_init(void)
  48. {
  49. }
  50. #endif
  51. #endif