xref: /openbmc/linux/drivers/input/serio/i8042.h (revision 55fd7e02)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef _I8042_H
3 #define _I8042_H
4 
5 
6 /*
7  *  Copyright (c) 1999-2002 Vojtech Pavlik
8  */
9 
10 /*
11  * Arch-dependent inline functions and defines.
12  */
13 
14 #if defined(CONFIG_MACH_JAZZ)
15 #include "i8042-jazzio.h"
16 #elif defined(CONFIG_SGI_HAS_I8042)
17 #include "i8042-ip22io.h"
18 #elif defined(CONFIG_SNI_RM)
19 #include "i8042-snirm.h"
20 #elif defined(CONFIG_SPARC)
21 #include "i8042-sparcio.h"
22 #elif defined(CONFIG_X86) || defined(CONFIG_IA64)
23 #include "i8042-x86ia64io.h"
24 #elif defined(CONFIG_UNICORE32)
25 #include "i8042-unicore32io.h"
26 #else
27 #include "i8042-io.h"
28 #endif
29 
30 /*
31  * This is in 50us units, the time we wait for the i8042 to react. This
32  * has to be long enough for the i8042 itself to timeout on sending a byte
33  * to a non-existent mouse.
34  */
35 
36 #define I8042_CTL_TIMEOUT	10000
37 
38 /*
39  * Return codes.
40  */
41 
42 #define I8042_RET_CTL_TEST	0x55
43 
44 /*
45  * Expected maximum internal i8042 buffer size. This is used for flushing
46  * the i8042 buffers.
47  */
48 
49 #define I8042_BUFFER_SIZE	16
50 
51 /*
52  * Number of AUX ports on controllers supporting active multiplexing
53  * specification
54  */
55 
56 #define I8042_NUM_MUX_PORTS	4
57 
58 /*
59  * Debug.
60  */
61 
62 #ifdef DEBUG
63 static unsigned long i8042_start_time;
64 #define dbg_init() do { i8042_start_time = jiffies; } while (0)
65 #define dbg(format, arg...)							\
66 	do {									\
67 		if (i8042_debug)						\
68 			printk(KERN_DEBUG KBUILD_MODNAME ": [%d] " format,	\
69 			       (int) (jiffies - i8042_start_time), ##arg);	\
70 	} while (0)
71 
72 #define filter_dbg(filter, data, format, args...)		\
73 	do {							\
74 		if (!i8042_debug)				\
75 			break;					\
76 								\
77 		if (!filter || i8042_unmask_kbd_data)		\
78 			dbg("%02x " format, data, ##args);	\
79 		else						\
80 			dbg("** " format, ##args);		\
81 	} while (0)
82 #else
83 #define dbg_init() do { } while (0)
84 #define dbg(format, arg...)							\
85 	do {									\
86 		if (0)								\
87 			printk(KERN_DEBUG pr_fmt(format), ##arg);		\
88 	} while (0)
89 
90 #define filter_dbg(filter, data, format, args...) do { } while (0)
91 #endif
92 
93 #endif /* _I8042_H */
94