blob: 8ef7e7faea1e2d438dc607051ba1cdefc1fc310a [file] [log] [blame]
Thomas Gleixner1802d0b2019-05-27 08:55:21 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Andy Lutomirski844af952015-11-24 19:49:23 -08002/*
3 * wmi.h - ACPI WMI interface
4 *
5 * Copyright (c) 2015 Andrew Lutomirski
Andy Lutomirski844af952015-11-24 19:49:23 -08006 */
7
8#ifndef _LINUX_WMI_H
9#define _LINUX_WMI_H
10
11#include <linux/device.h>
12#include <linux/acpi.h>
Mattias Jacobssoneacc95e2019-02-19 20:59:49 +010013#include <linux/mod_devicetable.h>
Mario Limonciello44b6b762017-11-01 14:25:35 -050014#include <uapi/linux/wmi.h>
Andy Lutomirski844af952015-11-24 19:49:23 -080015
16struct wmi_device {
17 struct device dev;
Andy Lutomirskid4fc91a2015-11-25 14:03:43 -080018
Darren Hart (VMware)fd70da62017-05-19 19:28:36 -070019 /* True for data blocks implementing the Set Control Method */
20 bool setable;
Andy Lutomirski844af952015-11-24 19:49:23 -080021};
22
Mario Limonciello722c8562017-11-01 14:25:23 -050023/* evaluate the ACPI method associated with this device */
24extern acpi_status wmidev_evaluate_method(struct wmi_device *wdev,
25 u8 instance, u32 method_id,
26 const struct acpi_buffer *in,
27 struct acpi_buffer *out);
28
Andy Lutomirski56a37022015-11-25 18:19:26 -080029/* Caller must kfree the result. */
30extern union acpi_object *wmidev_block_query(struct wmi_device *wdev,
31 u8 instance);
32
Mario Limonciello44b6b762017-11-01 14:25:35 -050033extern int set_required_buffer_size(struct wmi_device *wdev, u64 length);
34
Andy Lutomirski844af952015-11-24 19:49:23 -080035struct wmi_driver {
36 struct device_driver driver;
37 const struct wmi_device_id *id_table;
38
Mattias Jacobsson440c49832019-05-27 18:21:30 +020039 int (*probe)(struct wmi_device *wdev, const void *context);
Andy Lutomirski844af952015-11-24 19:49:23 -080040 int (*remove)(struct wmi_device *wdev);
Andy Lutomirski1686f542015-11-25 17:33:25 -080041 void (*notify)(struct wmi_device *device, union acpi_object *data);
Mario Limonciello44b6b762017-11-01 14:25:35 -050042 long (*filter_callback)(struct wmi_device *wdev, unsigned int cmd,
43 struct wmi_ioctl_buffer *arg);
Andy Lutomirski844af952015-11-24 19:49:23 -080044};
45
46extern int __must_check __wmi_driver_register(struct wmi_driver *driver,
47 struct module *owner);
48extern void wmi_driver_unregister(struct wmi_driver *driver);
49#define wmi_driver_register(driver) __wmi_driver_register((driver), THIS_MODULE)
50
51#define module_wmi_driver(__wmi_driver) \
52 module_driver(__wmi_driver, wmi_driver_register, \
53 wmi_driver_unregister)
54
55#endif