Commit | Line | Data |
---|---|---|
844af950 AL |
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 | ||
16 | #ifndef _LINUX_WMI_H | |
17 | #define _LINUX_WMI_H | |
18 | ||
19 | #include <linux/device.h> | |
20 | #include <linux/acpi.h> | |
eacc95ea | 21 | #include <linux/mod_devicetable.h> |
44b6b766 | 22 | #include <uapi/linux/wmi.h> |
844af950 AL |
23 | |
24 | struct wmi_device { | |
25 | struct device dev; | |
d4fc91ad | 26 | |
fd70da6a DHV |
27 | /* True for data blocks implementing the Set Control Method */ |
28 | bool setable; | |
844af950 AL |
29 | }; |
30 | ||
722c856d ML |
31 | /* evaluate the ACPI method associated with this device */ |
32 | extern acpi_status wmidev_evaluate_method(struct wmi_device *wdev, | |
33 | u8 instance, u32 method_id, | |
34 | const struct acpi_buffer *in, | |
35 | struct acpi_buffer *out); | |
36 | ||
56a37025 AL |
37 | /* Caller must kfree the result. */ |
38 | extern union acpi_object *wmidev_block_query(struct wmi_device *wdev, | |
39 | u8 instance); | |
40 | ||
44b6b766 ML |
41 | extern int set_required_buffer_size(struct wmi_device *wdev, u64 length); |
42 | ||
844af950 AL |
43 | struct wmi_driver { |
44 | struct device_driver driver; | |
45 | const struct wmi_device_id *id_table; | |
46 | ||
47 | int (*probe)(struct wmi_device *wdev); | |
48 | int (*remove)(struct wmi_device *wdev); | |
1686f544 | 49 | void (*notify)(struct wmi_device *device, union acpi_object *data); |
44b6b766 ML |
50 | long (*filter_callback)(struct wmi_device *wdev, unsigned int cmd, |
51 | struct wmi_ioctl_buffer *arg); | |
844af950 AL |
52 | }; |
53 | ||
54 | extern int __must_check __wmi_driver_register(struct wmi_driver *driver, | |
55 | struct module *owner); | |
56 | extern void wmi_driver_unregister(struct wmi_driver *driver); | |
57 | #define wmi_driver_register(driver) __wmi_driver_register((driver), THIS_MODULE) | |
58 | ||
59 | #define module_wmi_driver(__wmi_driver) \ | |
60 | module_driver(__wmi_driver, wmi_driver_register, \ | |
61 | wmi_driver_unregister) | |
62 | ||
63 | #endif |