Skip to content

Commit c888d0b

Browse files
ionutnechitaJiri Kosina
authored andcommitted
HID: asus: Add WMI communication infrastructure
Add infrastructure for the HID driver to communicate with the asus-wmi driver for handling special keys that require WMI communication. This includes: - Define ASUS_WMI_METHODID_NOTIF method ID in asus-wmi.h - Implement asus_wmi_send_event() function to send events to asus-wmi Reviewed-by: Denis Benato <benato.denis96@gmail.com> Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org> Signed-off-by: Ionut Nechita <ionut_n2001@yahoo.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent 7fe565f commit c888d0b

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

drivers/hid/hid-asus.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
/*
2424
*/
2525

26+
#include <linux/acpi.h>
2627
#include <linux/dmi.h>
2728
#include <linux/hid.h>
2829
#include <linux/module.h>
@@ -320,6 +321,29 @@ static int asus_e1239t_event(struct asus_drvdata *drvdat, u8 *data, int size)
320321
return 0;
321322
}
322323

324+
/*
325+
* Send events to asus-wmi driver for handling special keys
326+
*/
327+
static int asus_wmi_send_event(struct asus_drvdata *drvdata, u8 code)
328+
{
329+
int err;
330+
u32 retval;
331+
332+
err = asus_wmi_evaluate_method(ASUS_WMI_METHODID_DEVS,
333+
ASUS_WMI_METHODID_NOTIF, code, &retval);
334+
if (err) {
335+
pr_warn("Failed to notify asus-wmi: %d\n", err);
336+
return err;
337+
}
338+
339+
if (retval != 0) {
340+
pr_warn("Failed to notify asus-wmi (retval): 0x%x\n", retval);
341+
return -EIO;
342+
}
343+
344+
return 0;
345+
}
346+
323347
static int asus_event(struct hid_device *hdev, struct hid_field *field,
324348
struct hid_usage *usage, __s32 value)
325349
{

include/linux/platform_data/x86/asus-wmi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#define ASUS_WMI_METHODID_KBFT 0x5446424B /* KeyBoard FilTer */
2828
#define ASUS_WMI_METHODID_INIT 0x54494E49 /* INITialize */
2929
#define ASUS_WMI_METHODID_HKEY 0x59454B48 /* Hot KEY ?? */
30+
#define ASUS_WMI_METHODID_NOTIF 0x00100021 /* Notify method */
3031

3132
#define ASUS_WMI_UNSUPPORTED_METHOD 0xFFFFFFFE
3233

0 commit comments

Comments
 (0)