Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * OLPC HGPK (XO-1) touchpad PS/2 mouse driver
0004  */
0005 
0006 #ifndef _HGPK_H
0007 #define _HGPK_H
0008 
0009 #define HGPK_GS     0xff       /* The GlideSensor */
0010 #define HGPK_PT     0xcf       /* The PenTablet */
0011 
0012 enum hgpk_model_t {
0013     HGPK_MODEL_PREA = 0x0a, /* pre-B1s */
0014     HGPK_MODEL_A = 0x14,    /* found on B1s, PT disabled in hardware */
0015     HGPK_MODEL_B = 0x28,    /* B2s, has capacitance issues */
0016     HGPK_MODEL_C = 0x3c,
0017     HGPK_MODEL_D = 0x50,    /* C1, mass production */
0018 };
0019 
0020 enum hgpk_spew_flag {
0021     NO_SPEW,
0022     MAYBE_SPEWING,
0023     SPEW_DETECTED,
0024     RECALIBRATING,
0025 };
0026 
0027 #define SPEW_WATCH_COUNT 42  /* at 12ms/packet, this is 1/2 second */
0028 
0029 enum hgpk_mode {
0030     HGPK_MODE_MOUSE,
0031     HGPK_MODE_GLIDESENSOR,
0032     HGPK_MODE_PENTABLET,
0033     HGPK_MODE_INVALID
0034 };
0035 
0036 struct hgpk_data {
0037     struct psmouse *psmouse;
0038     enum hgpk_mode mode;
0039     bool powered;
0040     enum hgpk_spew_flag spew_flag;
0041     int spew_count, x_tally, y_tally;   /* spew detection */
0042     unsigned long recalib_window;
0043     struct delayed_work recalib_wq;
0044     int abs_x, abs_y;
0045     int dupe_count;
0046     int xbigj, ybigj, xlast, ylast; /* jumpiness detection */
0047     int xsaw_secondary, ysaw_secondary; /* jumpiness detection */
0048 };
0049 
0050 int hgpk_detect(struct psmouse *psmouse, bool set_properties);
0051 int hgpk_init(struct psmouse *psmouse);
0052 
0053 #ifdef CONFIG_MOUSE_PS2_OLPC
0054 void hgpk_module_init(void);
0055 #else
0056 static inline void hgpk_module_init(void)
0057 {
0058 }
0059 #endif
0060 
0061 #endif