blob: b302415bf1d951a8f6a81bc0d83ea4f1d1beddde [file] [log] [blame]
Thomas Gleixner1a59d1b82019-05-27 08:55:05 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Corentin Charye12e6d92011-02-26 10:20:31 +01002/*
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>
Corentin Charye12e6d92011-02-26 10:20:31 +010012 */
13
14#ifndef _ASUS_WMI_H_
15#define _ASUS_WMI_H_
16
17#include <linux/platform_device.h>
Oleksij Rempelb5643532016-09-12 17:48:17 +020018#include <linux/i8042.h>
Corentin Charye12e6d92011-02-26 10:20:31 +010019
Seth Forsheec4453f62011-07-01 11:34:27 +020020#define ASUS_WMI_KEY_IGNORE (-1)
Corentin Chary3ba03022012-11-29 09:12:38 +010021#define ASUS_WMI_BRN_DOWN 0x20
22#define ASUS_WMI_BRN_UP 0x2f
Seth Forsheec4453f62011-07-01 11:34:27 +020023
Corentin Charye12e6d92011-02-26 10:20:31 +010024struct module;
25struct key_entry;
26struct asus_wmi;
27
AceLan Kaoc87992d2012-03-20 09:53:08 +010028struct quirk_entry {
29 bool hotplug_wireless;
30 bool scalar_panel_brightness;
AceLan Kao6e0044b2012-03-20 09:53:09 +010031 bool store_backlight_power;
AceLan Kao272c77d2012-06-13 09:32:06 +020032 bool wmi_backlight_power;
zino lin999d4372016-08-28 16:12:06 +080033 bool wmi_backlight_native;
Hans de Goede401fee82019-06-12 09:02:02 +020034 bool wmi_backlight_set_devstate;
Oleksij Rempele9b61512017-04-28 16:19:49 +020035 bool wmi_force_als_set;
Hans de Goede1797d582020-09-16 16:14:39 +020036 bool use_kbd_dock_devid;
Samuel Čavojea856ec2020-10-21 00:09:44 +020037 bool use_lid_flip_devid;
Corentin Chary6a2bccc2012-03-20 09:53:10 +010038 int wapf;
AceLan Kaoa2a96f02012-10-03 11:26:31 +020039 /*
40 * For machines with AMD graphic chips, it will send out WMI event
41 * and ACPI interrupt at the same time while hitting the hotkey.
42 * To simplify the problem, we just have to ignore the WMI event,
43 * and let the ACPI interrupt to send out the key event.
44 */
45 int no_display_toggle;
Kai-Chuan Hsieh8023eff2016-09-01 23:55:55 +080046 u32 xusb2pr;
Oleksij Rempelb5643532016-09-12 17:48:17 +020047
48 bool (*i8042_filter)(unsigned char data, unsigned char str,
49 struct serio *serio);
AceLan Kaoc87992d2012-03-20 09:53:08 +010050};
51
Corentin Charye12e6d92011-02-26 10:20:31 +010052struct asus_wmi_driver {
AceLan Kaoc87992d2012-03-20 09:53:08 +010053 int brightness;
AceLan Kao6e0044b2012-03-20 09:53:09 +010054 int panel_power;
AceLan Kaoa50bd122012-07-26 17:13:31 +080055 int wlan_ctrl_by_user;
Corentin Charye12e6d92011-02-26 10:20:31 +010056
57 const char *name;
58 struct module *owner;
59
60 const char *event_guid;
61
62 const struct key_entry *keymap;
63 const char *input_name;
64 const char *input_phys;
AceLan Kaoc87992d2012-03-20 09:53:08 +010065 struct quirk_entry *quirks;
Seth Forsheec4453f62011-07-01 11:34:27 +020066 /* Returns new code, value, and autorelease values in arguments.
67 * Return ASUS_WMI_KEY_IGNORE in code if event should be ignored. */
68 void (*key_filter) (struct asus_wmi_driver *driver, int *code,
69 unsigned int *value, bool *autorelease);
Corentin Charye12e6d92011-02-26 10:20:31 +010070
71 int (*probe) (struct platform_device *device);
AceLan Kaoc87992d2012-03-20 09:53:08 +010072 void (*detect_quirks) (struct asus_wmi_driver *driver);
Corentin Charye12e6d92011-02-26 10:20:31 +010073
74 struct platform_driver platform_driver;
75 struct platform_device *platform_device;
76};
77
78int asus_wmi_register_driver(struct asus_wmi_driver *driver);
79void asus_wmi_unregister_driver(struct asus_wmi_driver *driver);
80
81#endif /* !_ASUS_WMI_H_ */