blob: 01c983bb846527a935b6a29b4eb3aa315a7468e1 [file] [log] [blame]
Andres Salomondf08ef22008-09-16 12:30:34 -04001/*
2 * OLPC HGPK (XO-1) touchpad PS/2 mouse driver
3 */
4
5#ifndef _HGPK_H
6#define _HGPK_H
7
Daniel Drakeca94ec42010-11-11 22:19:57 -08008#define HGPK_GS 0xff /* The GlideSensor */
9#define HGPK_PT 0xcf /* The PenTablet */
10
Andres Salomondf08ef22008-09-16 12:30:34 -040011enum 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
Daniel Drakeca94ec42010-11-11 22:19:57 -080019enum hgpk_mode {
20 HGPK_MODE_MOUSE,
21 HGPK_MODE_GLIDESENSOR,
22 HGPK_MODE_PENTABLET,
23 HGPK_MODE_INVALID
24};
25
Andres Salomondf08ef22008-09-16 12:30:34 -040026struct hgpk_data {
27 struct psmouse *psmouse;
Daniel Drakeca94ec42010-11-11 22:19:57 -080028 enum hgpk_mode mode;
Dmitry Torokhovb7802c52009-09-09 19:13:20 -070029 bool powered;
Andres Salomondf08ef22008-09-16 12:30:34 -040030 int count, x_tally, y_tally; /* hardware workaround stuff */
31 unsigned long recalib_window;
32 struct delayed_work recalib_wq;
Daniel Drakeca94ec42010-11-11 22:19:57 -080033 int abs_x, abs_y;
Andres Salomondf08ef22008-09-16 12:30:34 -040034};
35
36#define hgpk_dbg(psmouse, format, arg...) \
37 dev_dbg(&(psmouse)->ps2dev.serio->dev, format, ## arg)
38#define hgpk_err(psmouse, format, arg...) \
39 dev_err(&(psmouse)->ps2dev.serio->dev, format, ## arg)
40#define hgpk_info(psmouse, format, arg...) \
41 dev_info(&(psmouse)->ps2dev.serio->dev, format, ## arg)
42#define hgpk_warn(psmouse, format, arg...) \
43 dev_warn(&(psmouse)->ps2dev.serio->dev, format, ## arg)
44#define hgpk_notice(psmouse, format, arg...) \
45 dev_notice(&(psmouse)->ps2dev.serio->dev, format, ## arg)
46
47#ifdef CONFIG_MOUSE_PS2_OLPC
Daniel Drakeca94ec42010-11-11 22:19:57 -080048void hgpk_module_init(void);
Dmitry Torokhovb7802c52009-09-09 19:13:20 -070049int hgpk_detect(struct psmouse *psmouse, bool set_properties);
Andres Salomondf08ef22008-09-16 12:30:34 -040050int hgpk_init(struct psmouse *psmouse);
51#else
Daniel Drakeca94ec42010-11-11 22:19:57 -080052static inline void hgpk_module_init(void)
53{
54}
Dmitry Torokhovb7802c52009-09-09 19:13:20 -070055static inline int hgpk_detect(struct psmouse *psmouse, bool set_properties)
Andres Salomondf08ef22008-09-16 12:30:34 -040056{
57 return -ENODEV;
58}
59static inline int hgpk_init(struct psmouse *psmouse)
60{
61 return -ENODEV;
62}
63#endif
64
65#endif