0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _ELANTECH_H
0011 #define _ELANTECH_H
0012
0013
0014
0015
0016 #define ETP_FW_ID_QUERY 0x00
0017 #define ETP_FW_VERSION_QUERY 0x01
0018 #define ETP_CAPABILITIES_QUERY 0x02
0019 #define ETP_SAMPLE_QUERY 0x03
0020 #define ETP_RESOLUTION_QUERY 0x04
0021 #define ETP_ICBODY_QUERY 0x05
0022
0023
0024
0025
0026 #define ETP_REGISTER_READ 0x10
0027 #define ETP_REGISTER_WRITE 0x11
0028 #define ETP_REGISTER_READWRITE 0x00
0029
0030
0031
0032
0033 #define ETP_PS2_CUSTOM_COMMAND 0xf8
0034
0035
0036
0037
0038 #define ETP_PS2_COMMAND_TRIES 3
0039 #define ETP_PS2_COMMAND_DELAY 500
0040
0041
0042
0043
0044 #define ETP_READ_BACK_TRIES 5
0045 #define ETP_READ_BACK_DELAY 2000
0046
0047
0048
0049
0050 #define ETP_R10_ABSOLUTE_MODE 0x04
0051 #define ETP_R11_4_BYTE_MODE 0x02
0052
0053
0054
0055
0056 #define ETP_CAP_HAS_ROCKER 0x04
0057
0058
0059
0060
0061
0062
0063 #define ETP_EDGE_FUZZ_V1 32
0064
0065 #define ETP_XMIN_V1 ( 0 + ETP_EDGE_FUZZ_V1)
0066 #define ETP_XMAX_V1 (576 - ETP_EDGE_FUZZ_V1)
0067 #define ETP_YMIN_V1 ( 0 + ETP_EDGE_FUZZ_V1)
0068 #define ETP_YMAX_V1 (384 - ETP_EDGE_FUZZ_V1)
0069
0070
0071
0072
0073
0074 #define ETP_XMIN_V2 0
0075 #define ETP_XMAX_V2 1152
0076 #define ETP_YMIN_V2 0
0077 #define ETP_YMAX_V2 768
0078
0079 #define ETP_PMIN_V2 0
0080 #define ETP_PMAX_V2 255
0081 #define ETP_WMIN_V2 0
0082 #define ETP_WMAX_V2 15
0083
0084
0085
0086
0087
0088 #define PACKET_UNKNOWN 0x01
0089 #define PACKET_DEBOUNCE 0x02
0090 #define PACKET_V3_HEAD 0x03
0091 #define PACKET_V3_TAIL 0x04
0092 #define PACKET_V4_HEAD 0x05
0093 #define PACKET_V4_MOTION 0x06
0094 #define PACKET_V4_STATUS 0x07
0095 #define PACKET_TRACKPOINT 0x08
0096
0097
0098
0099
0100 #define ETP_MAX_FINGERS 5
0101
0102
0103
0104
0105 #define ETP_WEIGHT_VALUE 5
0106
0107
0108
0109
0110 #define ETP_BUS_PS2_ONLY 0
0111 #define ETP_BUS_SMB_ALERT_ONLY 1
0112 #define ETP_BUS_SMB_HST_NTFY_ONLY 2
0113 #define ETP_BUS_PS2_SMB_ALERT 3
0114 #define ETP_BUS_PS2_SMB_HST_NTFY 4
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127 #define ETP_NEW_IC_SMBUS_HOST_NOTIFY(fw_version) \
0128 ((((fw_version) & 0x0f2000) == 0x0f2000) && \
0129 ((fw_version) & 0x0000ff) > 0)
0130
0131
0132
0133
0134 struct finger_pos {
0135 unsigned int x;
0136 unsigned int y;
0137 };
0138
0139 struct elantech_device_info {
0140 unsigned char capabilities[3];
0141 unsigned char samples[3];
0142 unsigned char debug;
0143 unsigned char hw_version;
0144 unsigned char pattern;
0145 unsigned int fw_version;
0146 unsigned int ic_version;
0147 unsigned int product_id;
0148 unsigned int x_min;
0149 unsigned int y_min;
0150 unsigned int x_max;
0151 unsigned int y_max;
0152 unsigned int x_res;
0153 unsigned int y_res;
0154 unsigned int x_traces;
0155 unsigned int y_traces;
0156 unsigned int width;
0157 unsigned int bus;
0158 bool paritycheck;
0159 bool jumpy_cursor;
0160 bool reports_pressure;
0161 bool crc_enabled;
0162 bool set_hw_resolution;
0163 bool has_trackpoint;
0164 bool has_middle_button;
0165 int (*send_cmd)(struct psmouse *psmouse, unsigned char c,
0166 unsigned char *param);
0167 };
0168
0169 struct elantech_data {
0170 struct input_dev *tp_dev;
0171 char tp_phys[32];
0172 unsigned char reg_07;
0173 unsigned char reg_10;
0174 unsigned char reg_11;
0175 unsigned char reg_20;
0176 unsigned char reg_21;
0177 unsigned char reg_22;
0178 unsigned char reg_23;
0179 unsigned char reg_24;
0180 unsigned char reg_25;
0181 unsigned char reg_26;
0182 unsigned int single_finger_reports;
0183 unsigned int y_max;
0184 unsigned int width;
0185 struct finger_pos mt[ETP_MAX_FINGERS];
0186 unsigned char parity[256];
0187 struct elantech_device_info info;
0188 void (*original_set_rate)(struct psmouse *psmouse, unsigned int rate);
0189 };
0190
0191 int elantech_detect(struct psmouse *psmouse, bool set_properties);
0192 int elantech_init_ps2(struct psmouse *psmouse);
0193
0194 #ifdef CONFIG_MOUSE_PS2_ELANTECH
0195 int elantech_init(struct psmouse *psmouse);
0196 #else
0197 static inline int elantech_init(struct psmouse *psmouse)
0198 {
0199 return -ENOSYS;
0200 }
0201 #endif
0202
0203 int elantech_init_smbus(struct psmouse *psmouse);
0204
0205 #endif