wmi.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * wmi.h - ACPI WMI interface
  3. *
  4. * Copyright (c) 2015 Andrew Lutomirski
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. */
  15. #ifndef _LINUX_WMI_H
  16. #define _LINUX_WMI_H
  17. #include <linux/device.h>
  18. #include <linux/acpi.h>
  19. #include <uapi/linux/wmi.h>
  20. struct wmi_device {
  21. struct device dev;
  22. /* True for data blocks implementing the Set Control Method */
  23. bool setable;
  24. };
  25. /* evaluate the ACPI method associated with this device */
  26. extern acpi_status wmidev_evaluate_method(struct wmi_device *wdev,
  27. u8 instance, u32 method_id,
  28. const struct acpi_buffer *in,
  29. struct acpi_buffer *out);
  30. /* Caller must kfree the result. */
  31. extern union acpi_object *wmidev_block_query(struct wmi_device *wdev,
  32. u8 instance);
  33. extern int set_required_buffer_size(struct wmi_device *wdev, u64 length);
  34. struct wmi_device_id {
  35. const char *guid_string;
  36. };
  37. struct wmi_driver {
  38. struct device_driver driver;
  39. const struct wmi_device_id *id_table;
  40. int (*probe)(struct wmi_device *wdev);
  41. int (*remove)(struct wmi_device *wdev);
  42. void (*notify)(struct wmi_device *device, union acpi_object *data);
  43. long (*filter_callback)(struct wmi_device *wdev, unsigned int cmd,
  44. struct wmi_ioctl_buffer *arg);
  45. };
  46. extern int __must_check __wmi_driver_register(struct wmi_driver *driver,
  47. struct module *owner);
  48. extern void wmi_driver_unregister(struct wmi_driver *driver);
  49. #define wmi_driver_register(driver) __wmi_driver_register((driver), THIS_MODULE)
  50. #define module_wmi_driver(__wmi_driver) \
  51. module_driver(__wmi_driver, wmi_driver_register, \
  52. wmi_driver_unregister)
  53. #endif