Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * Asus PC WMI hotkey driver
0004  *
0005  * Copyright(C) 2010 Intel Corporation.
0006  * Copyright(C) 2010-2011 Corentin Chary <corentin.chary@gmail.com>
0007  *
0008  * Portions based on wistron_btns.c:
0009  * Copyright (C) 2005 Miloslav Trmac <mitr@volny.cz>
0010  * Copyright (C) 2005 Bernhard Rosenkraenzer <bero@arklinux.org>
0011  * Copyright (C) 2005 Dmitry Torokhov <dtor@mail.ru>
0012  */
0013 
0014 #ifndef _ASUS_WMI_H_
0015 #define _ASUS_WMI_H_
0016 
0017 #include <linux/platform_device.h>
0018 #include <linux/i8042.h>
0019 
0020 #define ASUS_WMI_KEY_IGNORE (-1)
0021 #define ASUS_WMI_BRN_DOWN   0x20
0022 #define ASUS_WMI_BRN_UP     0x2f
0023 
0024 struct module;
0025 struct key_entry;
0026 struct asus_wmi;
0027 
0028 struct quirk_entry {
0029     bool hotplug_wireless;
0030     bool scalar_panel_brightness;
0031     bool store_backlight_power;
0032     bool wmi_backlight_power;
0033     bool wmi_backlight_native;
0034     bool wmi_backlight_set_devstate;
0035     bool wmi_force_als_set;
0036     bool use_kbd_dock_devid;
0037     bool use_lid_flip_devid;
0038     int wapf;
0039     /*
0040      * For machines with AMD graphic chips, it will send out WMI event
0041      * and ACPI interrupt at the same time while hitting the hotkey.
0042      * To simplify the problem, we just have to ignore the WMI event,
0043      * and let the ACPI interrupt to send out the key event.
0044      */
0045     int no_display_toggle;
0046     u32 xusb2pr;
0047 
0048     bool (*i8042_filter)(unsigned char data, unsigned char str,
0049                  struct serio *serio);
0050 };
0051 
0052 struct asus_wmi_driver {
0053     int         brightness;
0054     int         panel_power;
0055     int         wlan_ctrl_by_user;
0056 
0057     const char      *name;
0058     struct module       *owner;
0059 
0060     const char      *event_guid;
0061 
0062     const struct key_entry  *keymap;
0063     const char      *input_name;
0064     const char      *input_phys;
0065     struct quirk_entry  *quirks;
0066     /* Returns new code, value, and autorelease values in arguments.
0067      * Return ASUS_WMI_KEY_IGNORE in code if event should be ignored. */
0068     void (*key_filter) (struct asus_wmi_driver *driver, int *code,
0069                 unsigned int *value, bool *autorelease);
0070 
0071     int (*probe) (struct platform_device *device);
0072     void (*detect_quirks) (struct asus_wmi_driver *driver);
0073 
0074     struct platform_driver  platform_driver;
0075     struct platform_device *platform_device;
0076 };
0077 
0078 int asus_wmi_register_driver(struct asus_wmi_driver *driver);
0079 void asus_wmi_unregister_driver(struct asus_wmi_driver *driver);
0080 
0081 #endif /* !_ASUS_WMI_H_ */