2008-10-17 09:10:19 +07:00
|
|
|
/*
|
2009-04-19 09:05:40 +07:00
|
|
|
* Elantech Touchpad driver (v6)
|
2008-10-17 09:10:19 +07:00
|
|
|
*
|
2009-04-19 09:05:40 +07:00
|
|
|
* Copyright (C) 2007-2009 Arjan Opmeer <arjan@opmeer.net>
|
2008-10-17 09:10:19 +07:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 as published
|
|
|
|
* by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* Trademarks are the property of their respective owners.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _ELANTECH_H
|
|
|
|
#define _ELANTECH_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Command values for Synaptics style queries
|
|
|
|
*/
|
2011-09-10 00:30:31 +07:00
|
|
|
#define ETP_FW_ID_QUERY 0x00
|
2008-10-17 09:10:19 +07:00
|
|
|
#define ETP_FW_VERSION_QUERY 0x01
|
|
|
|
#define ETP_CAPABILITIES_QUERY 0x02
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Command values for register reading or writing
|
|
|
|
*/
|
|
|
|
#define ETP_REGISTER_READ 0x10
|
|
|
|
#define ETP_REGISTER_WRITE 0x11
|
2011-09-10 00:30:31 +07:00
|
|
|
#define ETP_REGISTER_READWRITE 0x00
|
2008-10-17 09:10:19 +07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Hardware version 2 custom PS/2 command value
|
|
|
|
*/
|
|
|
|
#define ETP_PS2_CUSTOM_COMMAND 0xf8
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Times to retry a ps2_command and millisecond delay between tries
|
|
|
|
*/
|
|
|
|
#define ETP_PS2_COMMAND_TRIES 3
|
|
|
|
#define ETP_PS2_COMMAND_DELAY 500
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Times to try to read back a register and millisecond delay between tries
|
|
|
|
*/
|
|
|
|
#define ETP_READ_BACK_TRIES 5
|
|
|
|
#define ETP_READ_BACK_DELAY 2000
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Register bitmasks for hardware version 1
|
|
|
|
*/
|
|
|
|
#define ETP_R10_ABSOLUTE_MODE 0x04
|
|
|
|
#define ETP_R11_4_BYTE_MODE 0x02
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Capability bitmasks
|
|
|
|
*/
|
|
|
|
#define ETP_CAP_HAS_ROCKER 0x04
|
|
|
|
|
|
|
|
/*
|
|
|
|
* One hard to find application note states that X axis range is 0 to 576
|
|
|
|
* and Y axis range is 0 to 384 for harware version 1.
|
|
|
|
* Edge fuzz might be necessary because of bezel around the touchpad
|
|
|
|
*/
|
|
|
|
#define ETP_EDGE_FUZZ_V1 32
|
|
|
|
|
|
|
|
#define ETP_XMIN_V1 ( 0 + ETP_EDGE_FUZZ_V1)
|
|
|
|
#define ETP_XMAX_V1 (576 - ETP_EDGE_FUZZ_V1)
|
|
|
|
#define ETP_YMIN_V1 ( 0 + ETP_EDGE_FUZZ_V1)
|
|
|
|
#define ETP_YMAX_V1 (384 - ETP_EDGE_FUZZ_V1)
|
|
|
|
|
|
|
|
/*
|
2011-09-10 00:27:42 +07:00
|
|
|
* The resolution for older v2 hardware doubled.
|
|
|
|
* (newer v2's firmware provides command so we can query)
|
2008-10-17 09:10:19 +07:00
|
|
|
*/
|
2011-09-10 00:27:42 +07:00
|
|
|
#define ETP_XMIN_V2 0
|
|
|
|
#define ETP_XMAX_V2 1152
|
|
|
|
#define ETP_YMIN_V2 0
|
|
|
|
#define ETP_YMAX_V2 768
|
2008-10-17 09:10:19 +07:00
|
|
|
|
2011-05-17 12:45:54 +07:00
|
|
|
#define ETP_PMIN_V2 0
|
|
|
|
#define ETP_PMAX_V2 255
|
|
|
|
#define ETP_WMIN_V2 0
|
|
|
|
#define ETP_WMAX_V2 15
|
|
|
|
|
2011-09-10 00:30:31 +07:00
|
|
|
/*
|
|
|
|
* v3 hardware has 2 kinds of packet types.
|
|
|
|
*/
|
|
|
|
#define PACKET_UNKNOWN 0x01
|
|
|
|
#define PACKET_DEBOUNCE 0x02
|
|
|
|
#define PACKET_V3_HEAD 0x03
|
|
|
|
#define PACKET_V3_TAIL 0x04
|
|
|
|
|
2008-10-17 09:10:19 +07:00
|
|
|
struct elantech_data {
|
|
|
|
unsigned char reg_10;
|
|
|
|
unsigned char reg_11;
|
|
|
|
unsigned char reg_20;
|
|
|
|
unsigned char reg_21;
|
|
|
|
unsigned char reg_22;
|
|
|
|
unsigned char reg_23;
|
|
|
|
unsigned char reg_24;
|
|
|
|
unsigned char reg_25;
|
|
|
|
unsigned char reg_26;
|
|
|
|
unsigned char debug;
|
2011-09-10 00:26:16 +07:00
|
|
|
unsigned char capabilities[3];
|
2010-08-06 13:51:49 +07:00
|
|
|
bool paritycheck;
|
|
|
|
bool jumpy_cursor;
|
2011-05-17 12:45:54 +07:00
|
|
|
bool reports_pressure;
|
2010-05-13 14:41:15 +07:00
|
|
|
unsigned char hw_version;
|
2010-08-06 13:51:49 +07:00
|
|
|
unsigned int fw_version;
|
|
|
|
unsigned int single_finger_reports;
|
2011-09-10 00:26:16 +07:00
|
|
|
unsigned int y_max;
|
2011-09-10 00:30:31 +07:00
|
|
|
unsigned int prev_x;
|
|
|
|
unsigned int prev_y;
|
2008-10-17 09:10:19 +07:00
|
|
|
unsigned char parity[256];
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef CONFIG_MOUSE_PS2_ELANTECH
|
2009-09-10 09:13:20 +07:00
|
|
|
int elantech_detect(struct psmouse *psmouse, bool set_properties);
|
2008-10-17 09:10:19 +07:00
|
|
|
int elantech_init(struct psmouse *psmouse);
|
|
|
|
#else
|
2009-09-10 09:13:20 +07:00
|
|
|
static inline int elantech_detect(struct psmouse *psmouse, bool set_properties)
|
2008-10-17 09:10:19 +07:00
|
|
|
{
|
|
|
|
return -ENOSYS;
|
|
|
|
}
|
|
|
|
static inline int elantech_init(struct psmouse *psmouse)
|
|
|
|
{
|
|
|
|
return -ENOSYS;
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_MOUSE_PS2_ELANTECH */
|
|
|
|
|
|
|
|
#endif
|