xref: /netbsd-src/sys/dev/pckbport/alpsreg.h (revision 39c3181ae10851dd86e4862f90d1edeff4fe8949)
1 /* $NetBSD: alpsreg.h,v 1.2 2019/05/28 08:59:35 msaitoh Exp $ */
2 
3 /*-
4  * Copyright (c) 2017 Ryo ONODERA <ryo@tetera.org>
5  * Copyright (c) 2008 Jared D. McNeill <jmcneill@invisible.ca>
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef _DEV_PCKBCPORT_ALPSREG_H
31 #define _DEV_PCKBCPORT_ALPSREG_H
32 
33 #include <dev/pckbport/pmsreg.h>
34 
35 #define ALPS_PROTO_V2 (2)
36 #define ALPS_PROTO_V7 (7)
37 
38 struct alps_nibble_command_data {
39 	uint8_t command;
40 	uint8_t data;
41 	int sendparam;
42 	int receive;
43 };
44 
45 struct alps_nibble_command_data alps_v7_nibble_command_data_arr[] = {
46 	{ PMS_SET_REMOTE_MODE,	   0, 0, 0 }, /* 0 F0 */
47 	{ PMS_SET_DEFAULTS,	   0, 0, 0 }, /* 1 F6 */
48 	{ PMS_SET_SCALE21,	   0, 0, 0 }, /* 2 E7 */
49 	{ PMS_SET_SAMPLE,	0x0a, 1, 0 }, /* 3 F3 */
50 	{ PMS_SET_SAMPLE,	0x14, 1, 0 }, /* 4 F3 */
51 	{ PMS_SET_SAMPLE,	0x28, 1, 0 }, /* 5 F3 */
52 	{ PMS_SET_SAMPLE,	0x3c, 1, 0 }, /* 6 F3 */
53 	{ PMS_SET_SAMPLE,	0x50, 1, 0 }, /* 7 F3 */
54 	{ PMS_SET_SAMPLE,	0x64, 1, 0 }, /* 8 F3 */
55 	{ PMS_SET_SAMPLE,	0xc8, 1, 0 }, /* 9 F3 */
56 	{ PMS_SEND_DEV_ID,	   0, 0, 1 }, /* a F2 */
57 	{ PMS_SET_RES,		0x00, 1, 0 }, /* b E8 */
58 	{ PMS_SET_RES,		0x01, 1, 0 }, /* c E8 */
59 	{ PMS_SET_RES,		0x02, 1, 0 }, /* d E8 */
60 	{ PMS_SET_RES,		0x03, 1, 0 }, /* e E8 */
61 	{ PMS_SET_SCALE11,	   0, 0, 0 }, /* f E6 */
62 };
63 
64 #define ALPS_V7_PACKETID_UNKNOWN	0
65 #define ALPS_V7_PACKETID_TWOFINGER	1
66 #define ALPS_V7_PACKETID_MULTIFINGER	2
67 #define ALPS_V7_PACKETID_NEWPACKET	3
68 #define ALPS_V7_PACKETID_IDLE		4
69 
70 #endif /* !_DEV_PCKBCPORT_ALPSREG_H */
71