hgpk.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. #define hgpk_dbg(psmouse, format, arg...) \
  42. dev_dbg(&(psmouse)->ps2dev.serio->dev, format, ## arg)
  43. #define hgpk_err(psmouse, format, arg...) \
  44. dev_err(&(psmouse)->ps2dev.serio->dev, format, ## arg)
  45. #define hgpk_info(psmouse, format, arg...) \
  46. dev_info(&(psmouse)->ps2dev.serio->dev, format, ## arg)
  47. #define hgpk_warn(psmouse, format, arg...) \
  48. dev_warn(&(psmouse)->ps2dev.serio->dev, format, ## arg)
  49. #define hgpk_notice(psmouse, format, arg...) \
  50. dev_notice(&(psmouse)->ps2dev.serio->dev, format, ## arg)
  51. #ifdef CONFIG_MOUSE_PS2_OLPC
  52. void hgpk_module_init(void);
  53. int hgpk_detect(struct psmouse *psmouse, bool set_properties);
  54. int hgpk_init(struct psmouse *psmouse);
  55. #else
  56. static inline void hgpk_module_init(void)
  57. {
  58. }
  59. static inline int hgpk_detect(struct psmouse *psmouse, bool set_properties)
  60. {
  61. return -ENODEV;
  62. }
  63. static inline int hgpk_init(struct psmouse *psmouse)
  64. {
  65. return -ENODEV;
  66. }
  67. #endif
  68. #endif