blob: 3452708fbe3b809e5dafbd0291d69ed6c77c5dbf [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"
GuanXuetao425ad522011-01-15 18:28:19 +080029#elif defined(CONFIG_UNICORE32)
30#include "i8042-unicore32io.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#else
32#include "i8042-io.h"
33#endif
34
35/*
36 * This is in 50us units, the time we wait for the i8042 to react. This
37 * has to be long enough for the i8042 itself to timeout on sending a byte
38 * to a non-existent mouse.
39 */
40
41#define I8042_CTL_TIMEOUT 10000
42
43/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070044 * Status register bits.
45 */
46
47#define I8042_STR_PARITY 0x80
48#define I8042_STR_TIMEOUT 0x40
49#define I8042_STR_AUXDATA 0x20
50#define I8042_STR_KEYLOCK 0x10
51#define I8042_STR_CMDDAT 0x08
52#define I8042_STR_MUXERR 0x04
53#define I8042_STR_IBF 0x02
54#define I8042_STR_OBF 0x01
55
56/*
57 * Control register bits.
58 */
59
60#define I8042_CTR_KBDINT 0x01
61#define I8042_CTR_AUXINT 0x02
62#define I8042_CTR_IGNKEYLOCK 0x08
63#define I8042_CTR_KBDDIS 0x10
64#define I8042_CTR_AUXDIS 0x20
65#define I8042_CTR_XLATE 0x40
66
67/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070068 * Return codes.
69 */
70
71#define I8042_RET_CTL_TEST 0x55
72
73/*
74 * Expected maximum internal i8042 buffer size. This is used for flushing
75 * the i8042 buffers.
76 */
77
78#define I8042_BUFFER_SIZE 16
79
80/*
81 * Number of AUX ports on controllers supporting active multiplexing
82 * specification
83 */
84
85#define I8042_NUM_MUX_PORTS 4
86
87/*
88 * Debug.
89 */
90
91#ifdef DEBUG
92static unsigned long i8042_start_time;
93#define dbg_init() do { i8042_start_time = jiffies; } while (0)
Joe Perches4eb3c302010-11-29 23:33:07 -080094#define dbg(format, arg...) \
95 do { \
Linus Torvalds1da177e2005-04-16 15:20:36 -070096 if (i8042_debug) \
Joe Perches4eb3c302010-11-29 23:33:07 -080097 printk(KERN_DEBUG KBUILD_MODNAME ": [%d] " format, \
98 (int) (jiffies - i8042_start_time), ##arg); \
Linus Torvalds1da177e2005-04-16 15:20:36 -070099 } while (0)
100#else
101#define dbg_init() do { } while (0)
Joe Perches4eb3c302010-11-29 23:33:07 -0800102#define dbg(format, arg...) \
103 do { \
104 if (0) \
105 printk(KERN_DEBUG pr_fmt(format), ##arg); \
106 } while (0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107#endif
108
109#endif /* _I8042_H */