11a59d1b8SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */ 2e12e6d94SCorentin Chary /* 3e12e6d94SCorentin Chary * Asus PC WMI hotkey driver 4e12e6d94SCorentin Chary * 5e12e6d94SCorentin Chary * Copyright(C) 2010 Intel Corporation. 6e12e6d94SCorentin Chary * Copyright(C) 2010-2011 Corentin Chary <corentin.chary@gmail.com> 7e12e6d94SCorentin Chary * 8e12e6d94SCorentin Chary * Portions based on wistron_btns.c: 9e12e6d94SCorentin Chary * Copyright (C) 2005 Miloslav Trmac <mitr@volny.cz> 10e12e6d94SCorentin Chary * Copyright (C) 2005 Bernhard Rosenkraenzer <bero@arklinux.org> 11e12e6d94SCorentin Chary * Copyright (C) 2005 Dmitry Torokhov <dtor@mail.ru> 12e12e6d94SCorentin Chary */ 13e12e6d94SCorentin Chary 14e12e6d94SCorentin Chary #ifndef _ASUS_WMI_H_ 15e12e6d94SCorentin Chary #define _ASUS_WMI_H_ 16e12e6d94SCorentin Chary 17e12e6d94SCorentin Chary #include <linux/platform_device.h> 18b5643539SOleksij Rempel #include <linux/i8042.h> 19e12e6d94SCorentin Chary 20c4453f6aSSeth Forshee #define ASUS_WMI_KEY_IGNORE (-1) 21*f37cc2fcSHans de Goede #define ASUS_WMI_BRN_DOWN 0x2e 223ba0302bSCorentin Chary #define ASUS_WMI_BRN_UP 0x2f 23c4453f6aSSeth Forshee 24e12e6d94SCorentin Chary struct module; 25e12e6d94SCorentin Chary struct key_entry; 26e12e6d94SCorentin Chary struct asus_wmi; 27e12e6d94SCorentin Chary 2800aa8469SLuke D. Jones enum asus_wmi_tablet_switch_mode { 2900aa8469SLuke D. Jones asus_wmi_no_tablet_switch, 3000aa8469SLuke D. Jones asus_wmi_kbd_dock_devid, 3100aa8469SLuke D. Jones asus_wmi_lid_flip_devid, 32e397c3c4SLuke D. Jones asus_wmi_lid_flip_rog_devid, 3300aa8469SLuke D. Jones }; 3400aa8469SLuke D. Jones 35c87992d1SAceLan Kao struct quirk_entry { 36e12e6d94SCorentin Chary bool hotplug_wireless; 37c87992d1SAceLan Kao bool scalar_panel_brightness; 386e0044beSAceLan Kao bool store_backlight_power; 39401fee81SHans de Goede bool wmi_backlight_set_devstate; 40e9b61518SOleksij Rempel bool wmi_force_als_set; 41c874b6deSThomas Weißschuh bool wmi_ignore_fan; 4200aa8469SLuke D. Jones enum asus_wmi_tablet_switch_mode tablet_switch_mode; 436a2bcccdSCorentin Chary int wapf; 44a2a96f0cSAceLan Kao /* 45a2a96f0cSAceLan Kao * For machines with AMD graphic chips, it will send out WMI event 46a2a96f0cSAceLan Kao * and ACPI interrupt at the same time while hitting the hotkey. 47a2a96f0cSAceLan Kao * To simplify the problem, we just have to ignore the WMI event, 48a2a96f0cSAceLan Kao * and let the ACPI interrupt to send out the key event. 49a2a96f0cSAceLan Kao */ 50a2a96f0cSAceLan Kao int no_display_toggle; 518023eff1SKai-Chuan Hsieh u32 xusb2pr; 52b5643539SOleksij Rempel 53b5643539SOleksij Rempel bool (*i8042_filter)(unsigned char data, unsigned char str, 54b5643539SOleksij Rempel struct serio *serio); 55c87992d1SAceLan Kao }; 56c87992d1SAceLan Kao 57c87992d1SAceLan Kao struct asus_wmi_driver { 58c87992d1SAceLan Kao int brightness; 596e0044beSAceLan Kao int panel_power; 60a50bd128SAceLan Kao int wlan_ctrl_by_user; 61e12e6d94SCorentin Chary 62e12e6d94SCorentin Chary const char *name; 63e12e6d94SCorentin Chary struct module *owner; 64e12e6d94SCorentin Chary 65e12e6d94SCorentin Chary const char *event_guid; 66e12e6d94SCorentin Chary 67e12e6d94SCorentin Chary const struct key_entry *keymap; 68e12e6d94SCorentin Chary const char *input_name; 69e12e6d94SCorentin Chary const char *input_phys; 70c87992d1SAceLan Kao struct quirk_entry *quirks; 71c4453f6aSSeth Forshee /* Returns new code, value, and autorelease values in arguments. 72c4453f6aSSeth Forshee * Return ASUS_WMI_KEY_IGNORE in code if event should be ignored. */ 73c4453f6aSSeth Forshee void (*key_filter) (struct asus_wmi_driver *driver, int *code, 74c4453f6aSSeth Forshee unsigned int *value, bool *autorelease); 75e12e6d94SCorentin Chary 76e12e6d94SCorentin Chary int (*probe) (struct platform_device *device); 77c87992d1SAceLan Kao void (*detect_quirks) (struct asus_wmi_driver *driver); 78e12e6d94SCorentin Chary 79e12e6d94SCorentin Chary struct platform_driver platform_driver; 80e12e6d94SCorentin Chary struct platform_device *platform_device; 81e12e6d94SCorentin Chary }; 82e12e6d94SCorentin Chary 83e12e6d94SCorentin Chary int asus_wmi_register_driver(struct asus_wmi_driver *driver); 84e12e6d94SCorentin Chary void asus_wmi_unregister_driver(struct asus_wmi_driver *driver); 85e12e6d94SCorentin Chary 86e12e6d94SCorentin Chary #endif /* !_ASUS_WMI_H_ */ 87