Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _I8042_H |
| 2 | #define _I8042_H |
| 3 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | |
| 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 Bogendoerfer | f47831f | 2008-03-10 11:43:54 -0700 | [diff] [blame] | 19 | #elif defined(CONFIG_SGI_HAS_I8042) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | #include "i8042-ip22io.h" |
Thomas Bogendoerfer | f178244 | 2008-03-12 14:58:16 -0400 | [diff] [blame] | 21 | #elif defined(CONFIG_SNI_RM) |
| 22 | #include "i8042-snirm.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | #elif defined(CONFIG_PPC) |
| 24 | #include "i8042-ppcio.h" |
Adrian Bunk | 0b57ee9 | 2005-12-22 21:03:47 -0800 | [diff] [blame] | 25 | #elif defined(CONFIG_SPARC) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | * 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | * 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 |
| 90 | static unsigned long i8042_start_time; |
| 91 | #define dbg_init() do { i8042_start_time = jiffies; } while (0) |
Joe Perches | 4eb3c30 | 2010-11-29 23:33:07 -0800 | [diff] [blame] | 92 | #define dbg(format, arg...) \ |
| 93 | do { \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | if (i8042_debug) \ |
Joe Perches | 4eb3c30 | 2010-11-29 23:33:07 -0800 | [diff] [blame] | 95 | printk(KERN_DEBUG KBUILD_MODNAME ": [%d] " format, \ |
| 96 | (int) (jiffies - i8042_start_time), ##arg); \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | } while (0) |
| 98 | #else |
| 99 | #define dbg_init() do { } while (0) |
Joe Perches | 4eb3c30 | 2010-11-29 23:33:07 -0800 | [diff] [blame] | 100 | #define dbg(format, arg...) \ |
| 101 | do { \ |
| 102 | if (0) \ |
| 103 | printk(KERN_DEBUG pr_fmt(format), ##arg); \ |
| 104 | } while (0) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | #endif |
| 106 | |
| 107 | #endif /* _I8042_H */ |