Loading...
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) || defined(CONFIG_LOONGARCH)
23#include "i8042-acpipnpio.h"
24#else
25#include "i8042-io.h"
26#endif
27
28/*
29 * This is in 50us units, the time we wait for the i8042 to react. This
30 * has to be long enough for the i8042 itself to timeout on sending a byte
31 * to a non-existent mouse.
32 */
33
34#define I8042_CTL_TIMEOUT 10000
35
36/*
37 * Return codes.
38 */
39
40#define I8042_RET_CTL_TEST 0x55
41
42/*
43 * Expected maximum internal i8042 buffer size. This is used for flushing
44 * the i8042 buffers.
45 */
46
47#define I8042_BUFFER_SIZE 16
48
49/*
50 * Number of AUX ports on controllers supporting active multiplexing
51 * specification
52 */
53
54#define I8042_NUM_MUX_PORTS 4
55
56/*
57 * Debug.
58 */
59
60#ifdef DEBUG
61static unsigned long i8042_start_time;
62#define dbg_init() do { i8042_start_time = jiffies; } while (0)
63#define dbg(format, arg...) \
64 do { \
65 if (i8042_debug) \
66 printk(KERN_DEBUG KBUILD_MODNAME ": [%d] " format, \
67 (int) (jiffies - i8042_start_time), ##arg); \
68 } while (0)
69
70#define filter_dbg(filter, data, format, args...) \
71 do { \
72 if (!i8042_debug) \
73 break; \
74 \
75 if (!filter || i8042_unmask_kbd_data) \
76 dbg("%02x " format, data, ##args); \
77 else \
78 dbg("** " format, ##args); \
79 } while (0)
80#else
81#define dbg_init() do { } while (0)
82#define dbg(format, arg...) \
83 do { \
84 if (0) \
85 printk(KERN_DEBUG pr_fmt(format), ##arg); \
86 } while (0)
87
88#define filter_dbg(filter, data, format, args...) do { } while (0)
89#endif
90
91#endif /* _I8042_H */
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_PPC)
21#include "i8042-ppcio.h"
22#elif defined(CONFIG_SPARC)
23#include "i8042-sparcio.h"
24#elif defined(CONFIG_X86) || defined(CONFIG_IA64)
25#include "i8042-x86ia64io.h"
26#elif defined(CONFIG_UNICORE32)
27#include "i8042-unicore32io.h"
28#else
29#include "i8042-io.h"
30#endif
31
32/*
33 * This is in 50us units, the time we wait for the i8042 to react. This
34 * has to be long enough for the i8042 itself to timeout on sending a byte
35 * to a non-existent mouse.
36 */
37
38#define I8042_CTL_TIMEOUT 10000
39
40/*
41 * Return codes.
42 */
43
44#define I8042_RET_CTL_TEST 0x55
45
46/*
47 * Expected maximum internal i8042 buffer size. This is used for flushing
48 * the i8042 buffers.
49 */
50
51#define I8042_BUFFER_SIZE 16
52
53/*
54 * Number of AUX ports on controllers supporting active multiplexing
55 * specification
56 */
57
58#define I8042_NUM_MUX_PORTS 4
59
60/*
61 * Debug.
62 */
63
64#ifdef DEBUG
65static unsigned long i8042_start_time;
66#define dbg_init() do { i8042_start_time = jiffies; } while (0)
67#define dbg(format, arg...) \
68 do { \
69 if (i8042_debug) \
70 printk(KERN_DEBUG KBUILD_MODNAME ": [%d] " format, \
71 (int) (jiffies - i8042_start_time), ##arg); \
72 } while (0)
73
74#define filter_dbg(filter, data, format, args...) \
75 do { \
76 if (!i8042_debug) \
77 break; \
78 \
79 if (!filter || i8042_unmask_kbd_data) \
80 dbg("%02x " format, data, ##args); \
81 else \
82 dbg("** " format, ##args); \
83 } while (0)
84#else
85#define dbg_init() do { } while (0)
86#define dbg(format, arg...) \
87 do { \
88 if (0) \
89 printk(KERN_DEBUG pr_fmt(format), ##arg); \
90 } while (0)
91
92#define filter_dbg(filter, data, format, args...) do { } while (0)
93#endif
94
95#endif /* _I8042_H */