Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 #ifndef _LINUX_I8042_H
0003 #define _LINUX_I8042_H
0004 
0005 
0006 #include <linux/types.h>
0007 
0008 /*
0009  * Standard commands.
0010  */
0011 
0012 #define I8042_CMD_CTL_RCTR  0x0120
0013 #define I8042_CMD_CTL_WCTR  0x1060
0014 #define I8042_CMD_CTL_TEST  0x01aa
0015 
0016 #define I8042_CMD_KBD_DISABLE   0x00ad
0017 #define I8042_CMD_KBD_ENABLE    0x00ae
0018 #define I8042_CMD_KBD_TEST  0x01ab
0019 #define I8042_CMD_KBD_LOOP  0x11d2
0020 
0021 #define I8042_CMD_AUX_DISABLE   0x00a7
0022 #define I8042_CMD_AUX_ENABLE    0x00a8
0023 #define I8042_CMD_AUX_TEST  0x01a9
0024 #define I8042_CMD_AUX_SEND  0x10d4
0025 #define I8042_CMD_AUX_LOOP  0x11d3
0026 
0027 #define I8042_CMD_MUX_PFX   0x0090
0028 #define I8042_CMD_MUX_SEND  0x1090
0029 
0030 /*
0031  * Status register bits.
0032  */
0033 
0034 #define I8042_STR_PARITY    0x80
0035 #define I8042_STR_TIMEOUT   0x40
0036 #define I8042_STR_AUXDATA   0x20
0037 #define I8042_STR_KEYLOCK   0x10
0038 #define I8042_STR_CMDDAT    0x08
0039 #define I8042_STR_MUXERR    0x04
0040 #define I8042_STR_IBF       0x02
0041 #define I8042_STR_OBF       0x01
0042 
0043 /*
0044  * Control register bits.
0045  */
0046 
0047 #define I8042_CTR_KBDINT    0x01
0048 #define I8042_CTR_AUXINT    0x02
0049 #define I8042_CTR_IGNKEYLOCK    0x08
0050 #define I8042_CTR_KBDDIS    0x10
0051 #define I8042_CTR_AUXDIS    0x20
0052 #define I8042_CTR_XLATE     0x40
0053 
0054 struct serio;
0055 
0056 #if defined(CONFIG_SERIO_I8042) || defined(CONFIG_SERIO_I8042_MODULE)
0057 
0058 void i8042_lock_chip(void);
0059 void i8042_unlock_chip(void);
0060 int i8042_command(unsigned char *param, int command);
0061 int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str,
0062                     struct serio *serio));
0063 int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str,
0064                        struct serio *serio));
0065 
0066 #else
0067 
0068 static inline void i8042_lock_chip(void)
0069 {
0070 }
0071 
0072 static inline void i8042_unlock_chip(void)
0073 {
0074 }
0075 
0076 static inline int i8042_command(unsigned char *param, int command)
0077 {
0078     return -ENODEV;
0079 }
0080 
0081 static inline int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str,
0082                     struct serio *serio))
0083 {
0084     return -ENODEV;
0085 }
0086 
0087 static inline int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str,
0088                        struct serio *serio))
0089 {
0090     return -ENODEV;
0091 }
0092 
0093 #endif
0094 
0095 #endif