hgpk.h 1.5 KB

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