1*541e316aSStephen Evanchik /* 2*541e316aSStephen Evanchik * IBM TrackPoint PS/2 mouse driver 3*541e316aSStephen Evanchik * 4*541e316aSStephen Evanchik * Stephen Evanchik <evanchsa@gmail.com> 5*541e316aSStephen Evanchik * 6*541e316aSStephen Evanchik * This program is free software; you can redistribute it and/or modify it 7*541e316aSStephen Evanchik * under the terms of the GNU General Public License version 2 as published by 8*541e316aSStephen Evanchik * the Free Software Foundation. 9*541e316aSStephen Evanchik */ 10*541e316aSStephen Evanchik 11*541e316aSStephen Evanchik #ifndef _TRACKPOINT_H 12*541e316aSStephen Evanchik #define _TRACKPOINT_H 13*541e316aSStephen Evanchik 14*541e316aSStephen Evanchik /* 15*541e316aSStephen Evanchik * These constants are from the TrackPoint System 16*541e316aSStephen Evanchik * Engineering documentation Version 4 from IBM Watson 17*541e316aSStephen Evanchik * research: 18*541e316aSStephen Evanchik * http://wwwcssrv.almaden.ibm.com/trackpoint/download.html 19*541e316aSStephen Evanchik */ 20*541e316aSStephen Evanchik 21*541e316aSStephen Evanchik #define TP_COMMAND 0xE2 /* Commands start with this */ 22*541e316aSStephen Evanchik 23*541e316aSStephen Evanchik #define TP_READ_ID 0xE1 /* Sent for device identification */ 24*541e316aSStephen Evanchik #define TP_MAGIC_IDENT 0x01 /* Sent after a TP_READ_ID followed */ 25*541e316aSStephen Evanchik /* by the firmware ID */ 26*541e316aSStephen Evanchik 27*541e316aSStephen Evanchik 28*541e316aSStephen Evanchik /* 29*541e316aSStephen Evanchik * Commands 30*541e316aSStephen Evanchik */ 31*541e316aSStephen Evanchik #define TP_RECALIB 0x51 /* Recalibrate */ 32*541e316aSStephen Evanchik #define TP_POWER_DOWN 0x44 /* Can only be undone through HW reset */ 33*541e316aSStephen Evanchik #define TP_EXT_DEV 0x21 /* Determines if external device is connected (RO) */ 34*541e316aSStephen Evanchik #define TP_EXT_BTN 0x4B /* Read extended button status */ 35*541e316aSStephen Evanchik #define TP_POR 0x7F /* Execute Power on Reset */ 36*541e316aSStephen Evanchik #define TP_POR_RESULTS 0x25 /* Read Power on Self test results */ 37*541e316aSStephen Evanchik #define TP_DISABLE_EXT 0x40 /* Disable external pointing device */ 38*541e316aSStephen Evanchik #define TP_ENABLE_EXT 0x41 /* Enable external pointing device */ 39*541e316aSStephen Evanchik 40*541e316aSStephen Evanchik /* 41*541e316aSStephen Evanchik * Mode manipulation 42*541e316aSStephen Evanchik */ 43*541e316aSStephen Evanchik #define TP_SET_SOFT_TRANS 0x4E /* Set mode */ 44*541e316aSStephen Evanchik #define TP_CANCEL_SOFT_TRANS 0xB9 /* Cancel mode */ 45*541e316aSStephen Evanchik #define TP_SET_HARD_TRANS 0x45 /* Mode can only be set */ 46*541e316aSStephen Evanchik 47*541e316aSStephen Evanchik 48*541e316aSStephen Evanchik /* 49*541e316aSStephen Evanchik * Register oriented commands/properties 50*541e316aSStephen Evanchik */ 51*541e316aSStephen Evanchik #define TP_WRITE_MEM 0x81 52*541e316aSStephen Evanchik #define TP_READ_MEM 0x80 /* Not used in this implementation */ 53*541e316aSStephen Evanchik 54*541e316aSStephen Evanchik /* 55*541e316aSStephen Evanchik * RAM Locations for properties 56*541e316aSStephen Evanchik */ 57*541e316aSStephen Evanchik #define TP_SENS 0x4A /* Sensitivity */ 58*541e316aSStephen Evanchik #define TP_MB 0x4C /* Read Middle Button Status (RO) */ 59*541e316aSStephen Evanchik #define TP_INERTIA 0x4D /* Negative Inertia */ 60*541e316aSStephen Evanchik #define TP_SPEED 0x60 /* Speed of TP Cursor */ 61*541e316aSStephen Evanchik #define TP_REACH 0x57 /* Backup for Z-axis press */ 62*541e316aSStephen Evanchik #define TP_DRAGHYS 0x58 /* Drag Hysteresis */ 63*541e316aSStephen Evanchik /* (how hard it is to drag */ 64*541e316aSStephen Evanchik /* with Z-axis pressed) */ 65*541e316aSStephen Evanchik 66*541e316aSStephen Evanchik #define TP_MINDRAG 0x59 /* Minimum amount of force needed */ 67*541e316aSStephen Evanchik /* to trigger dragging */ 68*541e316aSStephen Evanchik 69*541e316aSStephen Evanchik #define TP_THRESH 0x5C /* Minimum value for a Z-axis press */ 70*541e316aSStephen Evanchik #define TP_UP_THRESH 0x5A /* Used to generate a 'click' on Z-axis */ 71*541e316aSStephen Evanchik #define TP_Z_TIME 0x5E /* How sharp of a press */ 72*541e316aSStephen Evanchik #define TP_JENKS_CURV 0x5D /* Minimum curvature for double click */ 73*541e316aSStephen Evanchik 74*541e316aSStephen Evanchik /* 75*541e316aSStephen Evanchik * Toggling Flag bits 76*541e316aSStephen Evanchik */ 77*541e316aSStephen Evanchik #define TP_TOGGLE 0x47 /* Toggle command */ 78*541e316aSStephen Evanchik 79*541e316aSStephen Evanchik #define TP_TOGGLE_MB 0x23 /* Disable/Enable Middle Button */ 80*541e316aSStephen Evanchik #define TP_MASK_MB 0x01 81*541e316aSStephen Evanchik #define TP_TOGGLE_EXT_DEV 0x23 /* Toggle external device */ 82*541e316aSStephen Evanchik #define TP_MASK_EXT_DEV 0x02 83*541e316aSStephen Evanchik #define TP_TOGGLE_DRIFT 0x23 /* Drift Correction */ 84*541e316aSStephen Evanchik #define TP_MASK_DRIFT 0x80 85*541e316aSStephen Evanchik #define TP_TOGGLE_BURST 0x28 /* Burst Mode */ 86*541e316aSStephen Evanchik #define TP_MASK_BURST 0x80 87*541e316aSStephen Evanchik #define TP_TOGGLE_PTSON 0x2C /* Press to Select */ 88*541e316aSStephen Evanchik #define TP_MASK_PTSON 0x01 89*541e316aSStephen Evanchik #define TP_TOGGLE_HARD_TRANS 0x2C /* Alternate method to set Hard Transparency */ 90*541e316aSStephen Evanchik #define TP_MASK_HARD_TRANS 0x80 91*541e316aSStephen Evanchik #define TP_TOGGLE_TWOHAND 0x2D /* Two handed */ 92*541e316aSStephen Evanchik #define TP_MASK_TWOHAND 0x01 93*541e316aSStephen Evanchik #define TP_TOGGLE_STICKY_TWO 0x2D /* Sticky two handed */ 94*541e316aSStephen Evanchik #define TP_MASK_STICKY_TWO 0x04 95*541e316aSStephen Evanchik #define TP_TOGGLE_SKIPBACK 0x2D /* Suppress movement after drag release */ 96*541e316aSStephen Evanchik #define TP_MASK_SKIPBACK 0x08 97*541e316aSStephen Evanchik #define TP_TOGGLE_SOURCE_TAG 0x20 /* Bit 3 of the first packet will be set to 98*541e316aSStephen Evanchik to the origin of the packet (external or TP) */ 99*541e316aSStephen Evanchik #define TP_MASK_SOURCE_TAG 0x80 100*541e316aSStephen Evanchik #define TP_TOGGLE_EXT_TAG 0x22 /* Bit 3 of the first packet coming from the 101*541e316aSStephen Evanchik external device will be forced to 1 */ 102*541e316aSStephen Evanchik #define TP_MASK_EXT_TAG 0x04 103*541e316aSStephen Evanchik 104*541e316aSStephen Evanchik 105*541e316aSStephen Evanchik /* Power on Self Test Results */ 106*541e316aSStephen Evanchik #define TP_POR_SUCCESS 0x3B 107*541e316aSStephen Evanchik 108*541e316aSStephen Evanchik /* 109*541e316aSStephen Evanchik * Default power on values 110*541e316aSStephen Evanchik */ 111*541e316aSStephen Evanchik #define TP_DEF_SENS 0x80 112*541e316aSStephen Evanchik #define TP_DEF_INERTIA 0x06 113*541e316aSStephen Evanchik #define TP_DEF_SPEED 0x61 114*541e316aSStephen Evanchik #define TP_DEF_REACH 0x0A 115*541e316aSStephen Evanchik 116*541e316aSStephen Evanchik #define TP_DEF_DRAGHYS 0xFF 117*541e316aSStephen Evanchik #define TP_DEF_MINDRAG 0x14 118*541e316aSStephen Evanchik 119*541e316aSStephen Evanchik #define TP_DEF_THRESH 0x08 120*541e316aSStephen Evanchik #define TP_DEF_UP_THRESH 0xFF 121*541e316aSStephen Evanchik #define TP_DEF_Z_TIME 0x26 122*541e316aSStephen Evanchik #define TP_DEF_JENKS_CURV 0x87 123*541e316aSStephen Evanchik 124*541e316aSStephen Evanchik /* Toggles */ 125*541e316aSStephen Evanchik #define TP_DEF_MB 0x00 126*541e316aSStephen Evanchik #define TP_DEF_PTSON 0x00 127*541e316aSStephen Evanchik #define TP_DEF_SKIPBACK 0x00 128*541e316aSStephen Evanchik #define TP_DEF_EXT_DEV 0x01 129*541e316aSStephen Evanchik 130*541e316aSStephen Evanchik #define MAKE_PS2_CMD(params, results, cmd) ((params<<12) | (results<<8) | (cmd)) 131*541e316aSStephen Evanchik 132*541e316aSStephen Evanchik struct trackpoint_data 133*541e316aSStephen Evanchik { 134*541e316aSStephen Evanchik unsigned char sensitivity, speed, inertia, reach; 135*541e316aSStephen Evanchik unsigned char draghys, mindrag; 136*541e316aSStephen Evanchik unsigned char thresh, upthresh; 137*541e316aSStephen Evanchik unsigned char ztime, jenks; 138*541e316aSStephen Evanchik 139*541e316aSStephen Evanchik unsigned char press_to_select; 140*541e316aSStephen Evanchik unsigned char skipback; 141*541e316aSStephen Evanchik 142*541e316aSStephen Evanchik unsigned char ext_dev; 143*541e316aSStephen Evanchik }; 144*541e316aSStephen Evanchik 145*541e316aSStephen Evanchik extern int trackpoint_detect(struct psmouse *psmouse, int set_properties); 146*541e316aSStephen Evanchik 147*541e316aSStephen Evanchik #endif /* _TRACKPOINT_H */ 148