Home | History | Annotate | Line # | Download | only in pckbport
synapticsreg.h revision 1.12
      1 /*	$NetBSD: synapticsreg.h,v 1.12 2019/06/02 08:55:00 blymn Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 2005, Steve C. Woodford
      5  * Copyright (c) 2004, Ales Krenek
      6  * Copyright (c) 2004, Kentaro A. Kurahone
      7  * All rights reserved.
      8  *
      9  * Redistribution and use in source and binary forms, with or without
     10  * modification, are permitted provided that the following conditions
     11  * are met:
     12  *
     13  *   * Redistributions of source code must retain the above copyright
     14  *     notice, this list of conditions and the following disclaimer.
     15  *   * Redistributions in binary form must reproduce the above
     16  *     copyright notice, this list of conditions and the following
     17  *     disclaimer in the documentation and/or other materials provided
     18  *     with the distribution.
     19  *   * Neither the name of the Kentaro A. Kurahone nor the names of its
     20  *     contributors may be used to endorse or promote products derived
     21  *     from this software without specific prior written permission.
     22  *
     23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
     26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
     27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
     28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
     31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
     33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     34  * POSSIBILITY OF SUCH DAMAGE.
     35  *
     36  */
     37 
     38 #ifndef	_DEV_PCKBCPORT_SYNAPTICSREG_H_
     39 #define	_DEV_PCKBCPORT_SYNAPTICSREG_H_
     40 
     41 /* Synaptics information queries. */
     42 #define	SYNAPTICS_IDENTIFY_TOUCHPAD	0x0
     43 #define	SYNAPTICS_READ_MODE		0x1
     44 #define	SYNAPTICS_READ_CAPABILITIES	0x2
     45 #define	SYNAPTICS_READ_MODEL_ID		0x3
     46 #define	SYNAPTICS_EXTENDED_QUERY	0x9
     47 #define	SYNAPTICS_CONTINUED_CAPABILITIES 0x0c
     48 #define	SYNAPTICS_WRITE_DELUXE_3	0xc8 /* 6.2.3. Deluxe mode setting sequence */
     49 
     50 /* Synaptics special commands */
     51 #define	SYNAPTICS_CMD_SET_MODE2		0x14
     52 #define	SYNAPTICS_CMD_CLIENT_CMD	0x28
     53 
     54 /* Magic numbers. */
     55 #define	SYNAPTICS_MIN_VERSION		45 /* 4.5 */
     56 #define	SYNAPTICS_MAGIC_BYTE		0x47
     57 
     58 /* Capability bits. */
     59 /* (byte[0] << 8) | byte[2] */
     60 #define SYNAPTICS_CAP_VALUE(b)	(((b)[0] << 8) | (b)[2])
     61 #define	SYNAPTICS_CAP_EXTENDED		(1 << 15)
     62 #define	SYNAPTICS_CAP_EXTNUM		(1 << 14 | 1 << 13 | 1 << 12)
     63 #define	SYNAPTICS_CAP_MBUTTON		(1 << 10)
     64 #define	SYNAPTICS_CAP_PASSTHROUGH	(1 << 7)
     65 #define	SYNAPTICS_CAP_LOWPOWER		(1 << 6)
     66 #define	SYNAPTICS_CAP_MULTIFINGERREPORT (1 << 5)
     67 #define	SYNAPTICS_CAP_SLEEP		(1 << 4)
     68 #define	SYNAPTICS_CAP_4BUTTON		(1 << 3)
     69 #define	SYNAPTICS_CAP_MULTIDETECT	(1 << 1)
     70 #define	SYNAPTICS_CAP_PALMDETECT	(1 << 0)
     71 
     72 /* Continued Capability bits */
     73 /* (byte[0] << 8) | byte[1] */
     74 #define SYN_CCAP_VALUE(b)	(((b)[0] << 8) | (b)[1])
     75 #define SYN_CCAP_COVERED_PAD		__BIT(15)
     76 #define SYN_CCAP_MULTIFINGER_MODE	__BITS(13,14)
     77 #define SYN_CCAP_CLICKPAD_BIT_0		__BIT(12) /* one-button clickpad */
     78 #define SYN_CCAP_HAS_ADV_GESTURE_MODE	__BIT(11)
     79 #define SYN_CCAP_CLEARPAD		__BIT(10)
     80 #define SYN_CCAP_REPORT_MAX		__BIT(9)
     81 #define SYN_CCAP_ADJ_THRESHOLD		__BIT(8)
     82 #define SYN_CCAP_REPORT_MIN		__BIT(5)
     83 #define SYN_CCAP_UNIFORM_CLICKPAD	__BIT(4)
     84 #define SYN_CCAP_IMAGE_SENSOR		__BIT(3)  /* reports V */
     85 #define SYN_CCAP_REDUCED_FILTERING	__BIT(2)
     86 #define SYN_CCAP_DELUX_LED_CONTROLS	__BIT(1)
     87 #define SYN_CCAP_CLICKPAD_BIT_1		__BIT(0)  /* two-button clickpad */
     88 #define SYN_CCAP_CLICKPAD_TYPE(v)	\
     89 	((__SHIFTOUT((v), SYN_CCAP_CLICKPAD_BIT_1) << 1) | \
     90  	  __SHIFTOUT((v), SYN_CCAP_CLICKPAD_BIT_0))
     91 
     92 /* Mode bits. */
     93 #define	SYNAPTICS_MODE_ABSOLUTE		(1 << 7)
     94 #define	SYNAPTICS_MODE_RATE		(1 << 6)
     95 #define	SYNAPTICS_MODE_SLEEP		(1 << 3)
     96 #define	SYNAPTICS_MODE_EXTENDED_W	(1 << 2) /* double meaning */
     97 #define	SYNAPTICS_MODE_GEST		(1 << 2)
     98 #define	SYNAPTICS_MODE_4BYTE_CLIENT	(1 << 1)
     99 #define	SYNAPTICS_MODE_W		(1 << 0)
    100 
    101 /* Extended mode button masks. */
    102 #define	SYN_1BUTMASK			0x1
    103 #define	SYN_2BUTMASK			0x1
    104 #define	SYN_3BUTMASK			0x2
    105 #define	SYN_4BUTMASK			0x2
    106 #define	SYN_5BUTMASK			0x4
    107 #define	SYN_6BUTMASK			0x4
    108 #define	SYN_7BUTMASK			0x8
    109 #define	SYN_8BUTMASK			0x8
    110 
    111 /* Touchpad edge boundaries (Recommended values from Synaptics documentation) */
    112 #define	SYNAPTICS_EDGE_LEFT		1632
    113 #define	SYNAPTICS_EDGE_RIGHT		5312
    114 #define	SYNAPTICS_EDGE_TOP		4288
    115 #define	SYNAPTICS_EDGE_BOTTOM		1568
    116 #define	SYNAPTICS_EDGE_MAX		6143
    117 
    118 /* Finger pressures */
    119 #define	SYNAPTICS_FINGER_NONE		0
    120 #define	SYNAPTICS_FINGER_HOVER		10
    121 #define	SYNAPTICS_FINGER_LIGHT		30
    122 #define	SYNAPTICS_FINGER_NORMAL		80
    123 #define	SYNAPTICS_FINGER_HEAVY		110
    124 #define	SYNAPTICS_FINGER_FLAT		200
    125 #define	SYNAPTICS_FINGER_PALM		255
    126 
    127 /* Width values */
    128 #define	SYNAPTICS_WIDTH_TWO_FINGERS	0
    129 #define	SYNAPTICS_WIDTH_THREE_OR_MORE	1
    130 #define	SYNAPTICS_WIDTH_PEN		2
    131 #define	SYNAPTICS_WIDTH_EXTENDED_W	2
    132 #define	SYNAPTICS_WIDTH_ADVANCEDGESTURE	2
    133 #define	SYNAPTICS_WIDTH_PASSTHROUGH	3
    134 #define	SYNAPTICS_WIDTH_FINGER_MIN	4
    135 #define	SYNAPTICS_WIDTH_FINGER_NORMAL	5
    136 #define	SYNAPTICS_WIDTH_FINGER_MAX	7
    137 #define	SYNAPTICS_WIDTH_PALM_MIN	8
    138 #define	SYNAPTICS_WIDTH_PALM_MAX	14
    139 #define	SYNAPTICS_WIDTH_MAX		15
    140 
    141 /* Extended W types */
    142 #define SYNAPTICS_EW_WHEEL		0
    143 #define SYNAPTICS_EW_SECONDARY_FINGER	1
    144 #define SYNAPTICS_EW_FINGER_STATUS	2
    145 
    146 #endif	/* _DEV_PCKBCPORT_SYNAPTICSREG_H_ */
    147