blob: ac1d759d0f55bb8b3d6ecbd0ddcf8f77dd5eee6b [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _I8042_H
2#define _I8042_H
3
Linus Torvalds1da177e2005-04-16 15:20:36 -07004
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"
Thomas Bogendoerferf47831f2008-03-10 11:43:54 -070019#elif defined(CONFIG_SGI_HAS_I8042)
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#include "i8042-ip22io.h"
Thomas Bogendoerferf1782442008-03-12 14:58:16 -040021#elif defined(CONFIG_SNI_RM)
22#include "i8042-snirm.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070023#elif defined(CONFIG_PPC)
24#include "i8042-ppcio.h"
Adrian Bunk0b57ee92005-12-22 21:03:47 -080025#elif defined(CONFIG_SPARC)
Linus Torvalds1da177e2005-04-16 15:20:36 -070026#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/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070042 * 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/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070066 * 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
90static unsigned long i8042_start_time;
91#define dbg_init() do { i8042_start_time = jiffies; } while (0)
Joe Perches4eb3c302010-11-29 23:33:07 -080092#define dbg(format, arg...) \
93 do { \
Linus Torvalds1da177e2005-04-16 15:20:36 -070094 if (i8042_debug) \
Joe Perches4eb3c302010-11-29 23:33:07 -080095 printk(KERN_DEBUG KBUILD_MODNAME ": [%d] " format, \
96 (int) (jiffies - i8042_start_time), ##arg); \
Linus Torvalds1da177e2005-04-16 15:20:36 -070097 } while (0)
98#else
99#define dbg_init() do { } while (0)
Joe Perches4eb3c302010-11-29 23:33:07 -0800100#define dbg(format, arg...) \
101 do { \
102 if (0) \
103 printk(KERN_DEBUG pr_fmt(format), ##arg); \
104 } while (0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105#endif
106
107#endif /* _I8042_H */