blob: 38dc27ad3c18fc1c1a6c7569d1f5d213838f8911 [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002#ifndef _I8042_H
3#define _I8042_H
4
Linus Torvalds1da177e2005-04-16 15:20:36 -07005
6/*
7 * Copyright (c) 1999-2002 Vojtech Pavlik
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 */
9
10/*
11 * Arch-dependent inline functions and defines.
12 */
13
14#if defined(CONFIG_MACH_JAZZ)
15#include "i8042-jazzio.h"
Thomas Bogendoerferf47831f2008-03-10 11:43:54 -070016#elif defined(CONFIG_SGI_HAS_I8042)
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#include "i8042-ip22io.h"
Thomas Bogendoerferf1782442008-03-12 14:58:16 -040018#elif defined(CONFIG_SNI_RM)
19#include "i8042-snirm.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#elif defined(CONFIG_PPC)
21#include "i8042-ppcio.h"
Adrian Bunk0b57ee92005-12-22 21:03:47 -080022#elif defined(CONFIG_SPARC)
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#include "i8042-sparcio.h"
24#elif defined(CONFIG_X86) || defined(CONFIG_IA64)
25#include "i8042-x86ia64io.h"
GuanXuetao425ad522011-01-15 18:28:19 +080026#elif defined(CONFIG_UNICORE32)
27#include "i8042-unicore32io.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070028#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/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070041 * 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)
Joe Perches4eb3c302010-11-29 23:33:07 -080067#define dbg(format, arg...) \
68 do { \
Linus Torvalds1da177e2005-04-16 15:20:36 -070069 if (i8042_debug) \
Joe Perches4eb3c302010-11-29 23:33:07 -080070 printk(KERN_DEBUG KBUILD_MODNAME ": [%d] " format, \
71 (int) (jiffies - i8042_start_time), ##arg); \
Linus Torvalds1da177e2005-04-16 15:20:36 -070072 } while (0)
Stephen Chandler Paule1443d22015-07-15 10:20:17 -070073
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)
Linus Torvalds1da177e2005-04-16 15:20:36 -070084#else
85#define dbg_init() do { } while (0)
Joe Perches4eb3c302010-11-29 23:33:07 -080086#define dbg(format, arg...) \
87 do { \
88 if (0) \
89 printk(KERN_DEBUG pr_fmt(format), ##arg); \
90 } while (0)
Stephen Chandler Paule1443d22015-07-15 10:20:17 -070091
92#define filter_dbg(filter, data, format, args...) do { } while (0)
Linus Torvalds1da177e2005-04-16 15:20:36 -070093#endif
94
95#endif /* _I8042_H */