mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-04-18 06:33:43 -04:00
platform/x86: asus-wmi: add keyboard brightness event handler
The keyboard brightness control of Asus WMI keyboards is handled in kernel, which leads to the shortcut going from brightness 0, to 1, to 2, and 3. However, for HID keyboards it is exposed as a key and handled by the user's desktop environment. For the toggle button, this means that brightness control becomes on/off. In addition, in the absence of a DE, the keyboard brightness does not work. Therefore, expose an event handler for the keyboard brightness control which can then be used by hid-asus. Since this handler is called from an interrupt context, defer the actual work to a workqueue. In the process, introduce ASUS_EV_MAX_BRIGHTNESS to hold the constant for maximum brightness since it is shared between hid-asus/asus-wmi. Reviewed-by: Luke D. Jones <luke@ljones.dev> Tested-by: Luke D. Jones <luke@ljones.dev> Acked-by: Benjamin Tissoires <bentiss@kernel.org> Reviewed-by: Denis Benato <benato.denis96@gmail.com> Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev> Link: https://patch.msgid.link/20260122075044.5070-11-lkml@antheas.dev Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
This commit is contained in:
committed by
Ilpo Järvinen
parent
d3133ccaf5
commit
7525566abd
@@ -178,6 +178,14 @@ struct asus_hid_listener {
|
||||
void (*brightness_set)(struct asus_hid_listener *listener, int brightness);
|
||||
};
|
||||
|
||||
enum asus_hid_event {
|
||||
ASUS_EV_BRTUP,
|
||||
ASUS_EV_BRTDOWN,
|
||||
ASUS_EV_BRTTOGGLE,
|
||||
};
|
||||
|
||||
#define ASUS_EV_MAX_BRIGHTNESS 3
|
||||
|
||||
#if IS_REACHABLE(CONFIG_ASUS_WMI)
|
||||
void set_ally_mcu_hack(enum asus_ally_mcu_hack status);
|
||||
void set_ally_mcu_powersave(bool enabled);
|
||||
@@ -186,6 +194,7 @@ int asus_wmi_set_devstate(u32 dev_id, u32 ctrl_param, u32 *retval);
|
||||
int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1, u32 *retval);
|
||||
int asus_hid_register_listener(struct asus_hid_listener *cdev);
|
||||
void asus_hid_unregister_listener(struct asus_hid_listener *cdev);
|
||||
int asus_hid_event(enum asus_hid_event event);
|
||||
#else
|
||||
static inline void set_ally_mcu_hack(enum asus_ally_mcu_hack status)
|
||||
{
|
||||
@@ -213,6 +222,10 @@ static inline int asus_hid_register_listener(struct asus_hid_listener *bdev)
|
||||
static inline void asus_hid_unregister_listener(struct asus_hid_listener *bdev)
|
||||
{
|
||||
}
|
||||
static inline int asus_hid_event(enum asus_hid_event event)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __PLATFORM_DATA_X86_ASUS_WMI_H */
|
||||
|
||||
Reference in New Issue
Block a user