alienware-wmi.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Alienware WMI special features driver
  4. *
  5. * Copyright (C) 2014 Dell Inc <Dell.Client.Kernel@dell.com>
  6. * Copyright (C) 2024 Kurt Borja <kuurtb@gmail.com>
  7. */
  8. #ifndef _ALIENWARE_WMI_H_
  9. #define _ALIENWARE_WMI_H_
  10. #include <linux/leds.h>
  11. #include <linux/platform_device.h>
  12. #include <linux/wmi.h>
  13. #define LEGACY_CONTROL_GUID "A90597CE-A997-11DA-B012-B622A1EF5492"
  14. #define LEGACY_POWER_CONTROL_GUID "A80593CE-A997-11DA-B012-B622A1EF5492"
  15. #define WMAX_CONTROL_GUID "A70591CE-A997-11DA-B012-B622A1EF5492"
  16. enum INTERFACE_FLAGS {
  17. LEGACY,
  18. WMAX,
  19. };
  20. enum LEGACY_CONTROL_STATES {
  21. LEGACY_RUNNING = 1,
  22. LEGACY_BOOTING = 0,
  23. LEGACY_SUSPEND = 3,
  24. };
  25. enum WMAX_CONTROL_STATES {
  26. WMAX_RUNNING = 0xFF,
  27. WMAX_BOOTING = 0,
  28. WMAX_SUSPEND = 3,
  29. };
  30. struct alienfx_quirks {
  31. u8 num_zones;
  32. bool hdmi_mux;
  33. bool amplifier;
  34. bool deepslp;
  35. };
  36. struct color_platform {
  37. u8 blue;
  38. u8 green;
  39. u8 red;
  40. } __packed;
  41. struct alienfx_priv {
  42. struct platform_device *pdev;
  43. struct led_classdev global_led;
  44. struct color_platform colors[4];
  45. u8 global_brightness;
  46. u8 lighting_control_state;
  47. };
  48. struct alienfx_ops {
  49. int (*upd_led)(struct alienfx_priv *priv, struct wmi_device *wdev,
  50. u8 location);
  51. int (*upd_brightness)(struct alienfx_priv *priv, struct wmi_device *wdev,
  52. u8 brightness);
  53. };
  54. struct alienfx_platdata {
  55. struct wmi_device *wdev;
  56. struct alienfx_ops ops;
  57. };
  58. extern u8 alienware_interface;
  59. extern struct alienfx_quirks *alienfx;
  60. int alienware_wmi_command(struct wmi_device *wdev, u32 method_id,
  61. void *in_args, size_t in_size, u32 *out_data);
  62. int alienware_alienfx_setup(struct alienfx_platdata *pdata);
  63. #if IS_ENABLED(CONFIG_ALIENWARE_WMI_LEGACY)
  64. int __init alienware_legacy_wmi_init(void);
  65. void __exit alienware_legacy_wmi_exit(void);
  66. #else
  67. static inline int alienware_legacy_wmi_init(void)
  68. {
  69. return -ENODEV;
  70. }
  71. static inline void alienware_legacy_wmi_exit(void)
  72. {
  73. }
  74. #endif
  75. #if IS_ENABLED(CONFIG_ALIENWARE_WMI_WMAX)
  76. extern const struct attribute_group wmax_hdmi_attribute_group;
  77. extern const struct attribute_group wmax_amplifier_attribute_group;
  78. extern const struct attribute_group wmax_deepsleep_attribute_group;
  79. #define WMAX_DEV_GROUPS &wmax_hdmi_attribute_group, \
  80. &wmax_amplifier_attribute_group, \
  81. &wmax_deepsleep_attribute_group,
  82. int __init alienware_wmax_wmi_init(void);
  83. void __exit alienware_wmax_wmi_exit(void);
  84. #else
  85. #define WMAX_DEV_GROUPS
  86. static inline int alienware_wmax_wmi_init(void)
  87. {
  88. return -ENODEV;
  89. }
  90. static inline void alienware_wmax_wmi_exit(void)
  91. {
  92. }
  93. #endif
  94. #endif