dell-smbios.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * Common functions for kernel modules using Dell SMBIOS
  3. *
  4. * Copyright (c) Red Hat <mjg@redhat.com>
  5. * Copyright (c) 2014 Gabriele Mazzotta <gabriele.mzt@gmail.com>
  6. * Copyright (c) 2014 Pali Rohár <pali.rohar@gmail.com>
  7. *
  8. * Based on documentation in the libsmbios package:
  9. * Copyright (C) 2005-2014 Dell Inc.
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. */
  15. #ifndef _DELL_SMBIOS_H_
  16. #define _DELL_SMBIOS_H_
  17. #include <linux/device.h>
  18. #include <uapi/linux/wmi.h>
  19. /* Classes and selects used only in kernel drivers */
  20. #define CLASS_KBD_BACKLIGHT 4
  21. #define SELECT_KBD_BACKLIGHT 11
  22. /* Tokens used in kernel drivers, any of these
  23. * should be filtered from userspace access
  24. */
  25. #define BRIGHTNESS_TOKEN 0x007d
  26. #define KBD_LED_AC_TOKEN 0x0451
  27. #define KBD_LED_OFF_TOKEN 0x01E1
  28. #define KBD_LED_ON_TOKEN 0x01E2
  29. #define KBD_LED_AUTO_TOKEN 0x01E3
  30. #define KBD_LED_AUTO_25_TOKEN 0x02EA
  31. #define KBD_LED_AUTO_50_TOKEN 0x02EB
  32. #define KBD_LED_AUTO_75_TOKEN 0x02EC
  33. #define KBD_LED_AUTO_100_TOKEN 0x02F6
  34. #define GLOBAL_MIC_MUTE_ENABLE 0x0364
  35. #define GLOBAL_MIC_MUTE_DISABLE 0x0365
  36. struct notifier_block;
  37. struct calling_interface_token {
  38. u16 tokenID;
  39. u16 location;
  40. union {
  41. u16 value;
  42. u16 stringlength;
  43. };
  44. };
  45. struct calling_interface_structure {
  46. struct dmi_header header;
  47. u16 cmdIOAddress;
  48. u8 cmdIOCode;
  49. u32 supportedCmds;
  50. struct calling_interface_token tokens[];
  51. } __packed;
  52. int dell_smbios_register_device(struct device *d, void *call_fn);
  53. void dell_smbios_unregister_device(struct device *d);
  54. int dell_smbios_error(int value);
  55. int dell_smbios_call_filter(struct device *d,
  56. struct calling_interface_buffer *buffer);
  57. int dell_smbios_call(struct calling_interface_buffer *buffer);
  58. struct calling_interface_token *dell_smbios_find_token(int tokenid);
  59. enum dell_laptop_notifier_actions {
  60. DELL_LAPTOP_KBD_BACKLIGHT_BRIGHTNESS_CHANGED,
  61. };
  62. int dell_laptop_register_notifier(struct notifier_block *nb);
  63. int dell_laptop_unregister_notifier(struct notifier_block *nb);
  64. void dell_laptop_call_notifier(unsigned long action, void *data);
  65. /* for the supported backends */
  66. #ifdef CONFIG_DELL_SMBIOS_WMI
  67. int init_dell_smbios_wmi(void);
  68. void exit_dell_smbios_wmi(void);
  69. #else /* CONFIG_DELL_SMBIOS_WMI */
  70. static inline int init_dell_smbios_wmi(void)
  71. {
  72. return -ENODEV;
  73. }
  74. static inline void exit_dell_smbios_wmi(void)
  75. {}
  76. #endif /* CONFIG_DELL_SMBIOS_WMI */
  77. #ifdef CONFIG_DELL_SMBIOS_SMM
  78. int init_dell_smbios_smm(void);
  79. void exit_dell_smbios_smm(void);
  80. #else /* CONFIG_DELL_SMBIOS_SMM */
  81. static inline int init_dell_smbios_smm(void)
  82. {
  83. return -ENODEV;
  84. }
  85. static inline void exit_dell_smbios_smm(void)
  86. {}
  87. #endif /* CONFIG_DELL_SMBIOS_SMM */
  88. #endif /* _DELL_SMBIOS_H_ */