xref: /openbmc/linux/drivers/input/serio/i8042.h (revision a1e58bbd)
1 #ifndef _I8042_H
2 #define _I8042_H
3 
4 
5 /*
6  *  Copyright (c) 1999-2002 Vojtech Pavlik
7  *
8  * This program is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License version 2 as published by
10  * the Free Software Foundation.
11  */
12 
13 /*
14  * Arch-dependent inline functions and defines.
15  */
16 
17 #if defined(CONFIG_MACH_JAZZ)
18 #include "i8042-jazzio.h"
19 #elif defined(CONFIG_SGI_HAS_I8042)
20 #include "i8042-ip22io.h"
21 #elif defined(CONFIG_SNI_RM)
22 #include "i8042-snirm.h"
23 #elif defined(CONFIG_PPC)
24 #include "i8042-ppcio.h"
25 #elif defined(CONFIG_SPARC)
26 #include "i8042-sparcio.h"
27 #elif defined(CONFIG_X86) || defined(CONFIG_IA64)
28 #include "i8042-x86ia64io.h"
29 #else
30 #include "i8042-io.h"
31 #endif
32 
33 /*
34  * This is in 50us units, the time we wait for the i8042 to react. This
35  * has to be long enough for the i8042 itself to timeout on sending a byte
36  * to a non-existent mouse.
37  */
38 
39 #define I8042_CTL_TIMEOUT	10000
40 
41 /*
42  * Status register bits.
43  */
44 
45 #define I8042_STR_PARITY	0x80
46 #define I8042_STR_TIMEOUT	0x40
47 #define I8042_STR_AUXDATA	0x20
48 #define I8042_STR_KEYLOCK	0x10
49 #define I8042_STR_CMDDAT	0x08
50 #define I8042_STR_MUXERR	0x04
51 #define I8042_STR_IBF		0x02
52 #define	I8042_STR_OBF		0x01
53 
54 /*
55  * Control register bits.
56  */
57 
58 #define I8042_CTR_KBDINT	0x01
59 #define I8042_CTR_AUXINT	0x02
60 #define I8042_CTR_IGNKEYLOCK	0x08
61 #define I8042_CTR_KBDDIS	0x10
62 #define I8042_CTR_AUXDIS	0x20
63 #define I8042_CTR_XLATE		0x40
64 
65 /*
66  * Return codes.
67  */
68 
69 #define I8042_RET_CTL_TEST	0x55
70 
71 /*
72  * Expected maximum internal i8042 buffer size. This is used for flushing
73  * the i8042 buffers.
74  */
75 
76 #define I8042_BUFFER_SIZE	16
77 
78 /*
79  * Number of AUX ports on controllers supporting active multiplexing
80  * specification
81  */
82 
83 #define I8042_NUM_MUX_PORTS	4
84 
85 /*
86  * Debug.
87  */
88 
89 #ifdef DEBUG
90 static unsigned long i8042_start_time;
91 #define dbg_init() do { i8042_start_time = jiffies; } while (0)
92 #define dbg(format, arg...) 							\
93 	do { 									\
94 		if (i8042_debug)						\
95 			printk(KERN_DEBUG __FILE__ ": " format " [%d]\n" ,	\
96 	 			## arg, (int) (jiffies - i8042_start_time));	\
97 	} while (0)
98 #else
99 #define dbg_init() do { } while (0)
100 #define dbg(format, arg...) do {} while (0)
101 #endif
102 
103 #endif /* _I8042_H */
104