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