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