1541e316aSStephen Evanchik /* 2541e316aSStephen Evanchik * IBM TrackPoint PS/2 mouse driver 3541e316aSStephen Evanchik * 4541e316aSStephen Evanchik * Stephen Evanchik <evanchsa@gmail.com> 5541e316aSStephen Evanchik * 6541e316aSStephen Evanchik * This program is free software; you can redistribute it and/or modify it 7541e316aSStephen Evanchik * under the terms of the GNU General Public License version 2 as published by 8541e316aSStephen Evanchik * the Free Software Foundation. 9541e316aSStephen Evanchik */ 10541e316aSStephen Evanchik 11541e316aSStephen Evanchik #ifndef _TRACKPOINT_H 12541e316aSStephen Evanchik #define _TRACKPOINT_H 13541e316aSStephen Evanchik 14541e316aSStephen Evanchik /* 15541e316aSStephen Evanchik * These constants are from the TrackPoint System 16541e316aSStephen Evanchik * Engineering documentation Version 4 from IBM Watson 17541e316aSStephen Evanchik * research: 18541e316aSStephen Evanchik * http://wwwcssrv.almaden.ibm.com/trackpoint/download.html 19541e316aSStephen Evanchik */ 20541e316aSStephen Evanchik 21541e316aSStephen Evanchik #define TP_COMMAND 0xE2 /* Commands start with this */ 22541e316aSStephen Evanchik 23541e316aSStephen Evanchik #define TP_READ_ID 0xE1 /* Sent for device identification */ 24541e316aSStephen Evanchik 25*2a924d71SDmitry Torokhov /* 26*2a924d71SDmitry Torokhov * Valid first byte responses to the "Read Secondary ID" (0xE1) command. 27*2a924d71SDmitry Torokhov * 0x01 was the original IBM trackpoint, others implement very limited 28*2a924d71SDmitry Torokhov * subset of trackpoint features. 29*2a924d71SDmitry Torokhov */ 30*2a924d71SDmitry Torokhov #define TP_VARIANT_IBM 0x01 31*2a924d71SDmitry Torokhov #define TP_VARIANT_ALPS 0x02 32*2a924d71SDmitry Torokhov #define TP_VARIANT_ELAN 0x03 33*2a924d71SDmitry Torokhov #define TP_VARIANT_NXP 0x04 34541e316aSStephen Evanchik 35541e316aSStephen Evanchik /* 36541e316aSStephen Evanchik * Commands 37541e316aSStephen Evanchik */ 38541e316aSStephen Evanchik #define TP_RECALIB 0x51 /* Recalibrate */ 39541e316aSStephen Evanchik #define TP_POWER_DOWN 0x44 /* Can only be undone through HW reset */ 40541e316aSStephen Evanchik #define TP_EXT_DEV 0x21 /* Determines if external device is connected (RO) */ 41541e316aSStephen Evanchik #define TP_EXT_BTN 0x4B /* Read extended button status */ 42541e316aSStephen Evanchik #define TP_POR 0x7F /* Execute Power on Reset */ 43541e316aSStephen Evanchik #define TP_POR_RESULTS 0x25 /* Read Power on Self test results */ 44541e316aSStephen Evanchik #define TP_DISABLE_EXT 0x40 /* Disable external pointing device */ 45541e316aSStephen Evanchik #define TP_ENABLE_EXT 0x41 /* Enable external pointing device */ 46541e316aSStephen Evanchik 47541e316aSStephen Evanchik /* 48541e316aSStephen Evanchik * Mode manipulation 49541e316aSStephen Evanchik */ 50541e316aSStephen Evanchik #define TP_SET_SOFT_TRANS 0x4E /* Set mode */ 51541e316aSStephen Evanchik #define TP_CANCEL_SOFT_TRANS 0xB9 /* Cancel mode */ 52541e316aSStephen Evanchik #define TP_SET_HARD_TRANS 0x45 /* Mode can only be set */ 53541e316aSStephen Evanchik 54541e316aSStephen Evanchik 55541e316aSStephen Evanchik /* 56541e316aSStephen Evanchik * Register oriented commands/properties 57541e316aSStephen Evanchik */ 58541e316aSStephen Evanchik #define TP_WRITE_MEM 0x81 59541e316aSStephen Evanchik #define TP_READ_MEM 0x80 /* Not used in this implementation */ 60541e316aSStephen Evanchik 61541e316aSStephen Evanchik /* 62541e316aSStephen Evanchik * RAM Locations for properties 63541e316aSStephen Evanchik */ 64541e316aSStephen Evanchik #define TP_SENS 0x4A /* Sensitivity */ 65541e316aSStephen Evanchik #define TP_MB 0x4C /* Read Middle Button Status (RO) */ 66541e316aSStephen Evanchik #define TP_INERTIA 0x4D /* Negative Inertia */ 67541e316aSStephen Evanchik #define TP_SPEED 0x60 /* Speed of TP Cursor */ 68541e316aSStephen Evanchik #define TP_REACH 0x57 /* Backup for Z-axis press */ 69541e316aSStephen Evanchik #define TP_DRAGHYS 0x58 /* Drag Hysteresis */ 70541e316aSStephen Evanchik /* (how hard it is to drag */ 71541e316aSStephen Evanchik /* with Z-axis pressed) */ 72541e316aSStephen Evanchik 73541e316aSStephen Evanchik #define TP_MINDRAG 0x59 /* Minimum amount of force needed */ 74541e316aSStephen Evanchik /* to trigger dragging */ 75541e316aSStephen Evanchik 76541e316aSStephen Evanchik #define TP_THRESH 0x5C /* Minimum value for a Z-axis press */ 77541e316aSStephen Evanchik #define TP_UP_THRESH 0x5A /* Used to generate a 'click' on Z-axis */ 78541e316aSStephen Evanchik #define TP_Z_TIME 0x5E /* How sharp of a press */ 79541e316aSStephen Evanchik #define TP_JENKS_CURV 0x5D /* Minimum curvature for double click */ 802ba35320Shaarp #define TP_DRIFT_TIME 0x5F /* How long a 'hands off' condition */ 812ba35320Shaarp /* must last (x*107ms) for drift */ 822ba35320Shaarp /* correction to occur */ 83541e316aSStephen Evanchik 84541e316aSStephen Evanchik /* 85541e316aSStephen Evanchik * Toggling Flag bits 86541e316aSStephen Evanchik */ 87541e316aSStephen Evanchik #define TP_TOGGLE 0x47 /* Toggle command */ 88541e316aSStephen Evanchik 89541e316aSStephen Evanchik #define TP_TOGGLE_MB 0x23 /* Disable/Enable Middle Button */ 90541e316aSStephen Evanchik #define TP_MASK_MB 0x01 91b8044c74SDmitry Torokhov #define TP_TOGGLE_EXT_DEV 0x23 /* Disable external device */ 92541e316aSStephen Evanchik #define TP_MASK_EXT_DEV 0x02 93541e316aSStephen Evanchik #define TP_TOGGLE_DRIFT 0x23 /* Drift Correction */ 94541e316aSStephen Evanchik #define TP_MASK_DRIFT 0x80 95541e316aSStephen Evanchik #define TP_TOGGLE_BURST 0x28 /* Burst Mode */ 96541e316aSStephen Evanchik #define TP_MASK_BURST 0x80 97541e316aSStephen Evanchik #define TP_TOGGLE_PTSON 0x2C /* Press to Select */ 98541e316aSStephen Evanchik #define TP_MASK_PTSON 0x01 99541e316aSStephen Evanchik #define TP_TOGGLE_HARD_TRANS 0x2C /* Alternate method to set Hard Transparency */ 100541e316aSStephen Evanchik #define TP_MASK_HARD_TRANS 0x80 101541e316aSStephen Evanchik #define TP_TOGGLE_TWOHAND 0x2D /* Two handed */ 102541e316aSStephen Evanchik #define TP_MASK_TWOHAND 0x01 103541e316aSStephen Evanchik #define TP_TOGGLE_STICKY_TWO 0x2D /* Sticky two handed */ 104541e316aSStephen Evanchik #define TP_MASK_STICKY_TWO 0x04 105541e316aSStephen Evanchik #define TP_TOGGLE_SKIPBACK 0x2D /* Suppress movement after drag release */ 106541e316aSStephen Evanchik #define TP_MASK_SKIPBACK 0x08 107541e316aSStephen Evanchik #define TP_TOGGLE_SOURCE_TAG 0x20 /* Bit 3 of the first packet will be set to 108541e316aSStephen Evanchik to the origin of the packet (external or TP) */ 109541e316aSStephen Evanchik #define TP_MASK_SOURCE_TAG 0x80 110541e316aSStephen Evanchik #define TP_TOGGLE_EXT_TAG 0x22 /* Bit 3 of the first packet coming from the 111541e316aSStephen Evanchik external device will be forced to 1 */ 112541e316aSStephen Evanchik #define TP_MASK_EXT_TAG 0x04 113541e316aSStephen Evanchik 114541e316aSStephen Evanchik 115541e316aSStephen Evanchik /* Power on Self Test Results */ 116541e316aSStephen Evanchik #define TP_POR_SUCCESS 0x3B 117541e316aSStephen Evanchik 118541e316aSStephen Evanchik /* 119541e316aSStephen Evanchik * Default power on values 120541e316aSStephen Evanchik */ 121541e316aSStephen Evanchik #define TP_DEF_SENS 0x80 122541e316aSStephen Evanchik #define TP_DEF_INERTIA 0x06 123541e316aSStephen Evanchik #define TP_DEF_SPEED 0x61 124541e316aSStephen Evanchik #define TP_DEF_REACH 0x0A 125541e316aSStephen Evanchik 126541e316aSStephen Evanchik #define TP_DEF_DRAGHYS 0xFF 127541e316aSStephen Evanchik #define TP_DEF_MINDRAG 0x14 128541e316aSStephen Evanchik 129541e316aSStephen Evanchik #define TP_DEF_THRESH 0x08 130541e316aSStephen Evanchik #define TP_DEF_UP_THRESH 0xFF 131541e316aSStephen Evanchik #define TP_DEF_Z_TIME 0x26 132541e316aSStephen Evanchik #define TP_DEF_JENKS_CURV 0x87 1332ba35320Shaarp #define TP_DEF_DRIFT_TIME 0x05 134541e316aSStephen Evanchik 135541e316aSStephen Evanchik /* Toggles */ 136541e316aSStephen Evanchik #define TP_DEF_MB 0x00 137541e316aSStephen Evanchik #define TP_DEF_PTSON 0x00 138541e316aSStephen Evanchik #define TP_DEF_SKIPBACK 0x00 139b8044c74SDmitry Torokhov #define TP_DEF_EXT_DEV 0x00 /* 0 means enabled */ 1400c6a6165SShawn Nematbakhsh #define TP_DEF_TWOHAND 0x00 1410c6a6165SShawn Nematbakhsh #define TP_DEF_SOURCE_TAG 0x00 142541e316aSStephen Evanchik 143541e316aSStephen Evanchik #define MAKE_PS2_CMD(params, results, cmd) ((params<<12) | (results<<8) | (cmd)) 144541e316aSStephen Evanchik 145*2a924d71SDmitry Torokhov struct trackpoint_data { 146*2a924d71SDmitry Torokhov u8 variant_id; 147*2a924d71SDmitry Torokhov u8 firmware_id; 148*2a924d71SDmitry Torokhov 149*2a924d71SDmitry Torokhov u8 sensitivity, speed, inertia, reach; 150*2a924d71SDmitry Torokhov u8 draghys, mindrag; 151*2a924d71SDmitry Torokhov u8 thresh, upthresh; 152*2a924d71SDmitry Torokhov u8 ztime, jenks; 153*2a924d71SDmitry Torokhov u8 drift_time; 154541e316aSStephen Evanchik 1550c6a6165SShawn Nematbakhsh /* toggles */ 156*2a924d71SDmitry Torokhov bool press_to_select; 157*2a924d71SDmitry Torokhov bool skipback; 158*2a924d71SDmitry Torokhov bool ext_dev; 159541e316aSStephen Evanchik }; 160541e316aSStephen Evanchik 16155e3d922SAndres Salomon #ifdef CONFIG_MOUSE_PS2_TRACKPOINT 162b7802c5cSDmitry Torokhov int trackpoint_detect(struct psmouse *psmouse, bool set_properties); 16355e3d922SAndres Salomon #else 164b7802c5cSDmitry Torokhov inline int trackpoint_detect(struct psmouse *psmouse, bool set_properties) 16555e3d922SAndres Salomon { 16655e3d922SAndres Salomon return -ENOSYS; 16755e3d922SAndres Salomon } 16855e3d922SAndres Salomon #endif /* CONFIG_MOUSE_PS2_TRACKPOINT */ 169541e316aSStephen Evanchik 170541e316aSStephen Evanchik #endif /* _TRACKPOINT_H */ 171