xref: /openbmc/linux/drivers/platform/x86/asus-wmi.h (revision 7f1005dd)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Asus PC WMI hotkey driver
4  *
5  * Copyright(C) 2010 Intel Corporation.
6  * Copyright(C) 2010-2011 Corentin Chary <corentin.chary@gmail.com>
7  *
8  * Portions based on wistron_btns.c:
9  * Copyright (C) 2005 Miloslav Trmac <mitr@volny.cz>
10  * Copyright (C) 2005 Bernhard Rosenkraenzer <bero@arklinux.org>
11  * Copyright (C) 2005 Dmitry Torokhov <dtor@mail.ru>
12  */
13 
14 #ifndef _ASUS_WMI_H_
15 #define _ASUS_WMI_H_
16 
17 #include <linux/platform_device.h>
18 #include <linux/i8042.h>
19 
20 #define ASUS_WMI_KEY_IGNORE (-1)
21 #define ASUS_WMI_BRN_DOWN	0x2e
22 #define ASUS_WMI_BRN_UP		0x2f
23 
24 struct module;
25 struct key_entry;
26 struct asus_wmi;
27 
28 enum asus_wmi_tablet_switch_mode {
29 	asus_wmi_no_tablet_switch,
30 	asus_wmi_kbd_dock_devid,
31 	asus_wmi_lid_flip_devid,
32 	asus_wmi_lid_flip_rog_devid,
33 };
34 
35 struct quirk_entry {
36 	bool hotplug_wireless;
37 	bool scalar_panel_brightness;
38 	bool store_backlight_power;
39 	bool wmi_backlight_set_devstate;
40 	bool wmi_force_als_set;
41 	bool wmi_ignore_fan;
42 	enum asus_wmi_tablet_switch_mode tablet_switch_mode;
43 	int wapf;
44 	/*
45 	 * For machines with AMD graphic chips, it will send out WMI event
46 	 * and ACPI interrupt at the same time while hitting the hotkey.
47 	 * To simplify the problem, we just have to ignore the WMI event,
48 	 * and let the ACPI interrupt to send out the key event.
49 	 */
50 	int no_display_toggle;
51 	u32 xusb2pr;
52 
53 	bool (*i8042_filter)(unsigned char data, unsigned char str,
54 			     struct serio *serio);
55 };
56 
57 struct asus_wmi_driver {
58 	int			brightness;
59 	int			panel_power;
60 	int			wlan_ctrl_by_user;
61 
62 	const char		*name;
63 	struct module		*owner;
64 
65 	const char		*event_guid;
66 
67 	const struct key_entry	*keymap;
68 	const char		*input_name;
69 	const char		*input_phys;
70 	struct quirk_entry	*quirks;
71 	/* Returns new code, value, and autorelease values in arguments.
72 	 * Return ASUS_WMI_KEY_IGNORE in code if event should be ignored. */
73 	void (*key_filter) (struct asus_wmi_driver *driver, int *code,
74 			    unsigned int *value, bool *autorelease);
75 
76 	int (*probe) (struct platform_device *device);
77 	void (*detect_quirks) (struct asus_wmi_driver *driver);
78 
79 	struct platform_driver	platform_driver;
80 	struct platform_device *platform_device;
81 };
82 
83 int asus_wmi_register_driver(struct asus_wmi_driver *driver);
84 void asus_wmi_unregister_driver(struct asus_wmi_driver *driver);
85 
86 #endif /* !_ASUS_WMI_H_ */
87