dell-smbios.h 2.6 KB

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