Taniya Das | 6f0884b | 2011-09-06 16:24:21 +0530 | [diff] [blame^] | 1 | /** |
| 2 | * |
| 3 | * Synaptics Register Mapped Interface (RMI4) Header File. |
| 4 | * Copyright (c) 2007 - 2011, Synaptics Incorporated |
| 5 | * |
| 6 | * |
| 7 | */ |
| 8 | /* |
| 9 | * This file is licensed under the GPL2 license. |
| 10 | * |
| 11 | *############################################################################# |
| 12 | * GPL |
| 13 | * |
| 14 | * This program is free software; you can redistribute it and/or modify it |
| 15 | * under the terms of the GNU General Public License version 2 as published |
| 16 | * by the Free Software Foundation. |
| 17 | * |
| 18 | * This program is distributed in the hope that it will be useful, but |
| 19 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 20 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 21 | * for more details. |
| 22 | * |
| 23 | *############################################################################# |
| 24 | */ |
| 25 | |
| 26 | #ifndef _RMI_H |
| 27 | #define _RMI_H |
| 28 | |
| 29 | /* RMI4 Protocol Support |
| 30 | */ |
| 31 | |
| 32 | /* For each function present on the RMI device, we need to get the RMI4 Function |
| 33 | * Descriptor info from the Page Descriptor Table. This will give us the |
| 34 | * addresses for Query, Command, Control, Data and the Source Count (number |
| 35 | * of sources for this function) and the function id. |
| 36 | */ |
| 37 | struct rmi_function_descriptor { |
| 38 | unsigned char queryBaseAddr; |
| 39 | unsigned char commandBaseAddr; |
| 40 | unsigned char controlBaseAddr; |
| 41 | unsigned char dataBaseAddr; |
| 42 | unsigned char interruptSrcCnt; |
| 43 | unsigned char functionNum; |
| 44 | }; |
| 45 | |
| 46 | /* This encapsulates the information found using the RMI4 Function $01 |
| 47 | * query registers. There is only one Function $01 per device. |
| 48 | * |
| 49 | * Assuming appropriate endian-ness, you can populate most of this |
| 50 | * structure by reading query registers starting at the query base address |
| 51 | * that was obtained from RMI4 function 0x01 function descriptor info read |
| 52 | * from the Page Descriptor Table. |
| 53 | * |
| 54 | * Specific register information is provided in the comments for each field. |
| 55 | * For further reference, please see the "Synaptics RMI 4 Interfacing |
| 56 | * Guide" document : go to http://www.synaptics.com/developers/manuals - and |
| 57 | * select "Synaptics RMI 4 Interfacting Guide". |
| 58 | */ |
| 59 | struct rmi_F01_query { |
| 60 | /* The manufacturer identification byte.*/ |
| 61 | unsigned char mfgid; |
| 62 | |
| 63 | /* The Product Properties information.*/ |
| 64 | unsigned char properties; |
| 65 | |
| 66 | /* The product info bytes.*/ |
| 67 | unsigned char prod_info[2]; |
| 68 | |
| 69 | /* Date Code - Year, Month, Day.*/ |
| 70 | unsigned char date_code[3]; |
| 71 | |
| 72 | /* Tester ID (14 bits).*/ |
| 73 | unsigned short tester_id; |
| 74 | |
| 75 | /* Serial Number (14 bits).*/ |
| 76 | unsigned short serial_num; |
| 77 | |
| 78 | /* A null-terminated string that identifies this particular product.*/ |
| 79 | char prod_id[11]; |
| 80 | }; |
| 81 | |
| 82 | /* This encapsulates the F01 Device Control control registers. |
| 83 | * TODO: This isn't right. The number of interrupt enables needs to be determined |
| 84 | * dynamically as the sensor is initialized. Fix this. |
| 85 | */ |
| 86 | struct rmi_F01_control { |
| 87 | unsigned char deviceControl; |
| 88 | unsigned char interruptEnable[1]; |
| 89 | }; |
| 90 | |
| 91 | /** This encapsulates the F01 Device Control data registers. |
| 92 | * TODO: This isn't right. The number of irqs needs to be determined |
| 93 | * dynamically as the sensor is initialized. Fix this. |
| 94 | */ |
| 95 | struct rmi_F01_data { |
| 96 | unsigned char deviceStatus; |
| 97 | unsigned char irqs[1]; |
| 98 | }; |
| 99 | |
| 100 | |
| 101 | /**********************************************************/ |
| 102 | |
| 103 | /** This is the data read from the F11 query registers. |
| 104 | */ |
| 105 | struct rmi_F11_device_query { |
| 106 | bool hasQuery9; |
| 107 | unsigned char numberOfSensors; |
| 108 | }; |
| 109 | |
| 110 | struct rmi_F11_sensor_query { |
| 111 | bool configurable; |
| 112 | bool hasSensitivityAdjust; |
| 113 | bool hasGestures; |
| 114 | bool hasAbs; |
| 115 | bool hasRel; |
| 116 | unsigned char numberOfFingers; |
| 117 | unsigned char numberOfXElectrodes; |
| 118 | unsigned char numberOfYElectrodes; |
| 119 | unsigned char maximumElectrodes; |
| 120 | bool hasAnchoredFinger; |
| 121 | unsigned char absDataSize; |
| 122 | }; |
| 123 | |
| 124 | struct rmi_F11_control { |
| 125 | bool relativeBallistics; |
| 126 | bool relativePositionFilter; |
| 127 | bool absolutePositionFilter; |
| 128 | unsigned char reportingMode; |
| 129 | bool manuallyTrackedFinger; |
| 130 | bool manuallyTrackedFingerEnable; |
| 131 | unsigned char motionSensitivity; |
| 132 | unsigned char palmDetectThreshold; |
| 133 | unsigned char deltaXPosThreshold; |
| 134 | unsigned char deltaYPosThreshold; |
| 135 | unsigned char velocity; |
| 136 | unsigned char acceleration; |
| 137 | unsigned short sensorMaxXPos; |
| 138 | unsigned short sensorMaxYPos; |
| 139 | }; |
| 140 | |
| 141 | |
| 142 | /**********************************************************/ |
| 143 | |
| 144 | /** This is the data read from the F19 query registers. |
| 145 | */ |
| 146 | struct rmi_F19_query { |
| 147 | bool hasHysteresisThreshold; |
| 148 | bool hasSensitivityAdjust; |
| 149 | bool configurable; |
| 150 | unsigned char buttonCount; |
| 151 | }; |
| 152 | |
| 153 | struct rmi_F19_control { |
| 154 | unsigned char buttonUsage; |
| 155 | unsigned char filterMode; |
| 156 | unsigned char *intEnableRegisters; |
| 157 | unsigned char *singleButtonControl; |
| 158 | unsigned char *sensorMap; |
| 159 | unsigned char *singleButtonSensitivity; |
| 160 | unsigned char globalSensitivityAdjustment; |
| 161 | unsigned char globalHysteresisThreshold; |
| 162 | }; |
| 163 | |
| 164 | #endif |