Andy Lutomirski | 844af95 | 2015-11-24 19:49:23 -0800 | [diff] [blame] | 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> |
Mario Limonciello | 44b6b76 | 2017-11-01 14:25:35 -0500 | [diff] [blame] | 21 | #include <uapi/linux/wmi.h> |
Andy Lutomirski | 844af95 | 2015-11-24 19:49:23 -0800 | [diff] [blame] | 22 | |
| 23 | struct wmi_device { |
| 24 | struct device dev; |
Andy Lutomirski | d4fc91a | 2015-11-25 14:03:43 -0800 | [diff] [blame] | 25 | |
Darren Hart (VMware) | fd70da6 | 2017-05-19 19:28:36 -0700 | [diff] [blame] | 26 | /* True for data blocks implementing the Set Control Method */ |
| 27 | bool setable; |
Andy Lutomirski | 844af95 | 2015-11-24 19:49:23 -0800 | [diff] [blame] | 28 | }; |
| 29 | |
Mario Limonciello | 722c856 | 2017-11-01 14:25:23 -0500 | [diff] [blame] | 30 | /* evaluate the ACPI method associated with this device */ |
| 31 | extern acpi_status wmidev_evaluate_method(struct wmi_device *wdev, |
| 32 | u8 instance, u32 method_id, |
| 33 | const struct acpi_buffer *in, |
| 34 | struct acpi_buffer *out); |
| 35 | |
Andy Lutomirski | 56a3702 | 2015-11-25 18:19:26 -0800 | [diff] [blame] | 36 | /* Caller must kfree the result. */ |
| 37 | extern union acpi_object *wmidev_block_query(struct wmi_device *wdev, |
| 38 | u8 instance); |
| 39 | |
Mario Limonciello | 44b6b76 | 2017-11-01 14:25:35 -0500 | [diff] [blame] | 40 | extern int set_required_buffer_size(struct wmi_device *wdev, u64 length); |
| 41 | |
Andy Lutomirski | 844af95 | 2015-11-24 19:49:23 -0800 | [diff] [blame] | 42 | struct wmi_device_id { |
| 43 | const char *guid_string; |
| 44 | }; |
| 45 | |
| 46 | struct wmi_driver { |
| 47 | struct device_driver driver; |
| 48 | const struct wmi_device_id *id_table; |
| 49 | |
| 50 | int (*probe)(struct wmi_device *wdev); |
| 51 | int (*remove)(struct wmi_device *wdev); |
Andy Lutomirski | 1686f54 | 2015-11-25 17:33:25 -0800 | [diff] [blame] | 52 | void (*notify)(struct wmi_device *device, union acpi_object *data); |
Mario Limonciello | 44b6b76 | 2017-11-01 14:25:35 -0500 | [diff] [blame] | 53 | long (*filter_callback)(struct wmi_device *wdev, unsigned int cmd, |
| 54 | struct wmi_ioctl_buffer *arg); |
Andy Lutomirski | 844af95 | 2015-11-24 19:49:23 -0800 | [diff] [blame] | 55 | }; |
| 56 | |
| 57 | extern int __must_check __wmi_driver_register(struct wmi_driver *driver, |
| 58 | struct module *owner); |
| 59 | extern void wmi_driver_unregister(struct wmi_driver *driver); |
| 60 | #define wmi_driver_register(driver) __wmi_driver_register((driver), THIS_MODULE) |
| 61 | |
| 62 | #define module_wmi_driver(__wmi_driver) \ |
| 63 | module_driver(__wmi_driver, wmi_driver_register, \ |
| 64 | wmi_driver_unregister) |
| 65 | |
| 66 | #endif |