2008-09-16 10:30:34 -06:00
|
|
|
/*
|
|
|
|
* OLPC HGPK (XO-1) touchpad PS/2 mouse driver
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _HGPK_H
|
|
|
|
#define _HGPK_H
|
|
|
|
|
2010-11-11 23:19:57 -07:00
|
|
|
#define HGPK_GS 0xff /* The GlideSensor */
|
|
|
|
#define HGPK_PT 0xcf /* The PenTablet */
|
|
|
|
|
2008-09-16 10:30:34 -06:00
|
|
|
enum hgpk_model_t {
|
|
|
|
HGPK_MODEL_PREA = 0x0a, /* pre-B1s */
|
|
|
|
HGPK_MODEL_A = 0x14, /* found on B1s, PT disabled in hardware */
|
|
|
|
HGPK_MODEL_B = 0x28, /* B2s, has capacitance issues */
|
|
|
|
HGPK_MODEL_C = 0x3c,
|
|
|
|
HGPK_MODEL_D = 0x50, /* C1, mass production */
|
|
|
|
};
|
|
|
|
|
2010-11-11 23:20:02 -07:00
|
|
|
enum hgpk_spew_flag {
|
|
|
|
NO_SPEW,
|
|
|
|
MAYBE_SPEWING,
|
|
|
|
SPEW_DETECTED,
|
|
|
|
RECALIBRATING,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define SPEW_WATCH_COUNT 42 /* at 12ms/packet, this is 1/2 second */
|
|
|
|
|
2010-11-11 23:19:57 -07:00
|
|
|
enum hgpk_mode {
|
|
|
|
HGPK_MODE_MOUSE,
|
|
|
|
HGPK_MODE_GLIDESENSOR,
|
|
|
|
HGPK_MODE_PENTABLET,
|
|
|
|
HGPK_MODE_INVALID
|
|
|
|
};
|
|
|
|
|
2008-09-16 10:30:34 -06:00
|
|
|
struct hgpk_data {
|
|
|
|
struct psmouse *psmouse;
|
2010-11-11 23:19:57 -07:00
|
|
|
enum hgpk_mode mode;
|
2009-09-09 20:13:20 -06:00
|
|
|
bool powered;
|
2010-11-11 23:20:02 -07:00
|
|
|
enum hgpk_spew_flag spew_flag;
|
|
|
|
int spew_count, x_tally, y_tally; /* spew detection */
|
2008-09-16 10:30:34 -06:00
|
|
|
unsigned long recalib_window;
|
|
|
|
struct delayed_work recalib_wq;
|
2010-11-11 23:19:57 -07:00
|
|
|
int abs_x, abs_y;
|
2010-11-11 23:20:02 -07:00
|
|
|
int dupe_count;
|
2010-11-11 23:20:03 -07:00
|
|
|
int xbigj, ybigj, xlast, ylast; /* jumpiness detection */
|
|
|
|
int xsaw_secondary, ysaw_secondary; /* jumpiness detection */
|
2008-09-16 10:30:34 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
#define hgpk_dbg(psmouse, format, arg...) \
|
|
|
|
dev_dbg(&(psmouse)->ps2dev.serio->dev, format, ## arg)
|
|
|
|
#define hgpk_err(psmouse, format, arg...) \
|
|
|
|
dev_err(&(psmouse)->ps2dev.serio->dev, format, ## arg)
|
|
|
|
#define hgpk_info(psmouse, format, arg...) \
|
|
|
|
dev_info(&(psmouse)->ps2dev.serio->dev, format, ## arg)
|
|
|
|
#define hgpk_warn(psmouse, format, arg...) \
|
|
|
|
dev_warn(&(psmouse)->ps2dev.serio->dev, format, ## arg)
|
|
|
|
#define hgpk_notice(psmouse, format, arg...) \
|
|
|
|
dev_notice(&(psmouse)->ps2dev.serio->dev, format, ## arg)
|
|
|
|
|
|
|
|
#ifdef CONFIG_MOUSE_PS2_OLPC
|
2010-11-11 23:19:57 -07:00
|
|
|
void hgpk_module_init(void);
|
2009-09-09 20:13:20 -06:00
|
|
|
int hgpk_detect(struct psmouse *psmouse, bool set_properties);
|
2008-09-16 10:30:34 -06:00
|
|
|
int hgpk_init(struct psmouse *psmouse);
|
|
|
|
#else
|
2010-11-11 23:19:57 -07:00
|
|
|
static inline void hgpk_module_init(void)
|
|
|
|
{
|
|
|
|
}
|
2009-09-09 20:13:20 -06:00
|
|
|
static inline int hgpk_detect(struct psmouse *psmouse, bool set_properties)
|
2008-09-16 10:30:34 -06:00
|
|
|
{
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
static inline int hgpk_init(struct psmouse *psmouse)
|
|
|
|
{
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|