i8042.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. #ifndef _LINUX_I8042_H
  3. #define _LINUX_I8042_H
  4. #include <linux/types.h>
  5. /*
  6. * Standard commands.
  7. */
  8. #define I8042_CMD_CTL_RCTR 0x0120
  9. #define I8042_CMD_CTL_WCTR 0x1060
  10. #define I8042_CMD_CTL_TEST 0x01aa
  11. #define I8042_CMD_KBD_DISABLE 0x00ad
  12. #define I8042_CMD_KBD_ENABLE 0x00ae
  13. #define I8042_CMD_KBD_TEST 0x01ab
  14. #define I8042_CMD_KBD_LOOP 0x11d2
  15. #define I8042_CMD_AUX_DISABLE 0x00a7
  16. #define I8042_CMD_AUX_ENABLE 0x00a8
  17. #define I8042_CMD_AUX_TEST 0x01a9
  18. #define I8042_CMD_AUX_SEND 0x10d4
  19. #define I8042_CMD_AUX_LOOP 0x11d3
  20. #define I8042_CMD_MUX_PFX 0x0090
  21. #define I8042_CMD_MUX_SEND 0x1090
  22. /*
  23. * Status register bits.
  24. */
  25. #define I8042_STR_PARITY 0x80
  26. #define I8042_STR_TIMEOUT 0x40
  27. #define I8042_STR_AUXDATA 0x20
  28. #define I8042_STR_KEYLOCK 0x10
  29. #define I8042_STR_CMDDAT 0x08
  30. #define I8042_STR_MUXERR 0x04
  31. #define I8042_STR_IBF 0x02
  32. #define I8042_STR_OBF 0x01
  33. /*
  34. * Control register bits.
  35. */
  36. #define I8042_CTR_KBDINT 0x01
  37. #define I8042_CTR_AUXINT 0x02
  38. #define I8042_CTR_IGNKEYLOCK 0x08
  39. #define I8042_CTR_KBDDIS 0x10
  40. #define I8042_CTR_AUXDIS 0x20
  41. #define I8042_CTR_XLATE 0x40
  42. struct serio;
  43. #if defined(CONFIG_SERIO_I8042) || defined(CONFIG_SERIO_I8042_MODULE)
  44. void i8042_lock_chip(void);
  45. void i8042_unlock_chip(void);
  46. int i8042_command(unsigned char *param, int command);
  47. int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str,
  48. struct serio *serio));
  49. int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str,
  50. struct serio *serio));
  51. #else
  52. static inline void i8042_lock_chip(void)
  53. {
  54. }
  55. static inline void i8042_unlock_chip(void)
  56. {
  57. }
  58. static inline int i8042_command(unsigned char *param, int command)
  59. {
  60. return -ENODEV;
  61. }
  62. static inline int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str,
  63. struct serio *serio))
  64. {
  65. return -ENODEV;
  66. }
  67. static inline int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str,
  68. struct serio *serio))
  69. {
  70. return -ENODEV;
  71. }
  72. #endif
  73. #endif