blob: 2cd10c3b89e92a0d1269a4377242098f185d83ef [file] [log] [blame]
Andy Lutomirski844af952015-11-24 19:49:23 -08001/*
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
22struct wmi_device {
23 struct device dev;
Andy Lutomirskid4fc91a2015-11-25 14:03:43 -080024
Darren Hart (VMware)fd70da62017-05-19 19:28:36 -070025 /* True for data blocks implementing the Set Control Method */
26 bool setable;
Andy Lutomirski844af952015-11-24 19:49:23 -080027};
28
Mario Limonciello722c8562017-11-01 14:25:23 -050029/* evaluate the ACPI method associated with this device */
30extern acpi_status wmidev_evaluate_method(struct wmi_device *wdev,
31 u8 instance, u32 method_id,
32 const struct acpi_buffer *in,
33 struct acpi_buffer *out);
34
Andy Lutomirski56a37022015-11-25 18:19:26 -080035/* Caller must kfree the result. */
36extern union acpi_object *wmidev_block_query(struct wmi_device *wdev,
37 u8 instance);
38
Andy Lutomirskif6301982015-12-29 22:53:51 -080039/* Gets another device on the same bus. Caller must put_device the result. */
40extern struct wmi_device *wmidev_get_other_guid(struct wmi_device *wdev,
41 const char *guid_string);
42
Andy Lutomirski844af952015-11-24 19:49:23 -080043struct wmi_device_id {
44 const char *guid_string;
45};
46
47struct wmi_driver {
48 struct device_driver driver;
49 const struct wmi_device_id *id_table;
50
51 int (*probe)(struct wmi_device *wdev);
52 int (*remove)(struct wmi_device *wdev);
Andy Lutomirski1686f542015-11-25 17:33:25 -080053 void (*notify)(struct wmi_device *device, union acpi_object *data);
Andy Lutomirski844af952015-11-24 19:49:23 -080054};
55
56extern int __must_check __wmi_driver_register(struct wmi_driver *driver,
57 struct module *owner);
58extern void wmi_driver_unregister(struct wmi_driver *driver);
59#define wmi_driver_register(driver) __wmi_driver_register((driver), THIS_MODULE)
60
61#define module_wmi_driver(__wmi_driver) \
62 module_driver(__wmi_driver, wmi_driver_register, \
63 wmi_driver_unregister)
64
65#endif