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> |
| 21 | |
| 22 | struct wmi_device { |
| 23 | struct device dev; |
Andy Lutomirski | d4fc91a | 2015-11-25 14:03:43 -0800 | [diff] [blame] | 24 | |
Darren Hart (VMware) | fd70da6 | 2017-05-19 19:28:36 -0700 | [diff] [blame] | 25 | /* True for data blocks implementing the Set Control Method */ |
| 26 | bool setable; |
Andy Lutomirski | 844af95 | 2015-11-24 19:49:23 -0800 | [diff] [blame] | 27 | }; |
| 28 | |
Andy Lutomirski | 56a3702 | 2015-11-25 18:19:26 -0800 | [diff] [blame] | 29 | /* Caller must kfree the result. */ |
| 30 | extern union acpi_object *wmidev_block_query(struct wmi_device *wdev, |
| 31 | u8 instance); |
| 32 | |
Andy Lutomirski | f630198 | 2015-12-29 22:53:51 -0800 | [diff] [blame] | 33 | /* Gets another device on the same bus. Caller must put_device the result. */ |
| 34 | extern struct wmi_device *wmidev_get_other_guid(struct wmi_device *wdev, |
| 35 | const char *guid_string); |
| 36 | |
Andy Lutomirski | 844af95 | 2015-11-24 19:49:23 -0800 | [diff] [blame] | 37 | struct wmi_device_id { |
| 38 | const char *guid_string; |
| 39 | }; |
| 40 | |
| 41 | struct wmi_driver { |
| 42 | struct device_driver driver; |
| 43 | const struct wmi_device_id *id_table; |
| 44 | |
| 45 | int (*probe)(struct wmi_device *wdev); |
| 46 | int (*remove)(struct wmi_device *wdev); |
Andy Lutomirski | 1686f54 | 2015-11-25 17:33:25 -0800 | [diff] [blame] | 47 | void (*notify)(struct wmi_device *device, union acpi_object *data); |
Andy Lutomirski | 844af95 | 2015-11-24 19:49:23 -0800 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | extern int __must_check __wmi_driver_register(struct wmi_driver *driver, |
| 51 | struct module *owner); |
| 52 | extern void wmi_driver_unregister(struct wmi_driver *driver); |
| 53 | #define wmi_driver_register(driver) __wmi_driver_register((driver), THIS_MODULE) |
| 54 | |
| 55 | #define module_wmi_driver(__wmi_driver) \ |
| 56 | module_driver(__wmi_driver, wmi_driver_register, \ |
| 57 | wmi_driver_unregister) |
| 58 | |
| 59 | #endif |