Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Andres Salomon | df08ef2 | 2008-09-16 12:30:34 -0400 | [diff] [blame] | 2 | /* |
| 3 | * OLPC HGPK (XO-1) touchpad PS/2 mouse driver |
| 4 | */ |
| 5 | |
| 6 | #ifndef _HGPK_H |
| 7 | #define _HGPK_H |
| 8 | |
Daniel Drake | ca94ec4 | 2010-11-11 22:19:57 -0800 | [diff] [blame] | 9 | #define HGPK_GS 0xff /* The GlideSensor */ |
| 10 | #define HGPK_PT 0xcf /* The PenTablet */ |
| 11 | |
Andres Salomon | df08ef2 | 2008-09-16 12:30:34 -0400 | [diff] [blame] | 12 | enum hgpk_model_t { |
| 13 | HGPK_MODEL_PREA = 0x0a, /* pre-B1s */ |
| 14 | HGPK_MODEL_A = 0x14, /* found on B1s, PT disabled in hardware */ |
| 15 | HGPK_MODEL_B = 0x28, /* B2s, has capacitance issues */ |
| 16 | HGPK_MODEL_C = 0x3c, |
| 17 | HGPK_MODEL_D = 0x50, /* C1, mass production */ |
| 18 | }; |
| 19 | |
Daniel Drake | c0dc834 | 2010-11-11 22:20:02 -0800 | [diff] [blame] | 20 | enum hgpk_spew_flag { |
| 21 | NO_SPEW, |
| 22 | MAYBE_SPEWING, |
| 23 | SPEW_DETECTED, |
| 24 | RECALIBRATING, |
| 25 | }; |
| 26 | |
| 27 | #define SPEW_WATCH_COUNT 42 /* at 12ms/packet, this is 1/2 second */ |
| 28 | |
Daniel Drake | ca94ec4 | 2010-11-11 22:19:57 -0800 | [diff] [blame] | 29 | enum hgpk_mode { |
| 30 | HGPK_MODE_MOUSE, |
| 31 | HGPK_MODE_GLIDESENSOR, |
| 32 | HGPK_MODE_PENTABLET, |
| 33 | HGPK_MODE_INVALID |
| 34 | }; |
| 35 | |
Andres Salomon | df08ef2 | 2008-09-16 12:30:34 -0400 | [diff] [blame] | 36 | struct hgpk_data { |
| 37 | struct psmouse *psmouse; |
Daniel Drake | ca94ec4 | 2010-11-11 22:19:57 -0800 | [diff] [blame] | 38 | enum hgpk_mode mode; |
Dmitry Torokhov | b7802c5 | 2009-09-09 19:13:20 -0700 | [diff] [blame] | 39 | bool powered; |
Daniel Drake | c0dc834 | 2010-11-11 22:20:02 -0800 | [diff] [blame] | 40 | enum hgpk_spew_flag spew_flag; |
| 41 | int spew_count, x_tally, y_tally; /* spew detection */ |
Andres Salomon | df08ef2 | 2008-09-16 12:30:34 -0400 | [diff] [blame] | 42 | unsigned long recalib_window; |
| 43 | struct delayed_work recalib_wq; |
Daniel Drake | ca94ec4 | 2010-11-11 22:19:57 -0800 | [diff] [blame] | 44 | int abs_x, abs_y; |
Daniel Drake | c0dc834 | 2010-11-11 22:20:02 -0800 | [diff] [blame] | 45 | int dupe_count; |
Daniel Drake | a309cdc | 2010-11-11 22:20:03 -0800 | [diff] [blame] | 46 | int xbigj, ybigj, xlast, ylast; /* jumpiness detection */ |
| 47 | int xsaw_secondary, ysaw_secondary; /* jumpiness detection */ |
Andres Salomon | df08ef2 | 2008-09-16 12:30:34 -0400 | [diff] [blame] | 48 | }; |
| 49 | |
Andres Salomon | df08ef2 | 2008-09-16 12:30:34 -0400 | [diff] [blame] | 50 | #ifdef CONFIG_MOUSE_PS2_OLPC |
Daniel Drake | ca94ec4 | 2010-11-11 22:19:57 -0800 | [diff] [blame] | 51 | void hgpk_module_init(void); |
Dmitry Torokhov | b7802c5 | 2009-09-09 19:13:20 -0700 | [diff] [blame] | 52 | int hgpk_detect(struct psmouse *psmouse, bool set_properties); |
Andres Salomon | df08ef2 | 2008-09-16 12:30:34 -0400 | [diff] [blame] | 53 | int hgpk_init(struct psmouse *psmouse); |
| 54 | #else |
Daniel Drake | ca94ec4 | 2010-11-11 22:19:57 -0800 | [diff] [blame] | 55 | static inline void hgpk_module_init(void) |
| 56 | { |
| 57 | } |
Dmitry Torokhov | b7802c5 | 2009-09-09 19:13:20 -0700 | [diff] [blame] | 58 | static inline int hgpk_detect(struct psmouse *psmouse, bool set_properties) |
Andres Salomon | df08ef2 | 2008-09-16 12:30:34 -0400 | [diff] [blame] | 59 | { |
| 60 | return -ENODEV; |
| 61 | } |
| 62 | static inline int hgpk_init(struct psmouse *psmouse) |
| 63 | { |
| 64 | return -ENODEV; |
| 65 | } |
| 66 | #endif |
| 67 | |
| 68 | #endif |