History

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.

Antheas Kapenekakis committed 9 months ago

Commit 75255661 parent d3133cc2 files · +54 −5Browse files

Showing the changes to include/linux/platform_data (1 of 2 files). Show all

Unified · Split

include/linux/platform_data/x86/asus-wmi.h+13−0
@@ -178,6 +178,14 @@ struct asus_hid_listener { · 177 unmodified lines
178 void (*brightness_set)(struct asus_hid_listener *listener, int brightness);178 void (*brightness_set)(struct asus_hid_listener *listener, int brightness);
179};179};
180 180
181enum asus_hid_event {
182 ASUS_EV_BRTUP,
183 ASUS_EV_BRTDOWN,
184 ASUS_EV_BRTTOGGLE,
185};
186
187#define ASUS_EV_MAX_BRIGHTNESS 3
188
181#if IS_REACHABLE(CONFIG_ASUS_WMI)189#if IS_REACHABLE(CONFIG_ASUS_WMI)
182void set_ally_mcu_hack(enum asus_ally_mcu_hack status);190void set_ally_mcu_hack(enum asus_ally_mcu_hack status);
183void set_ally_mcu_powersave(bool enabled);191void set_ally_mcu_powersave(bool enabled);
@@ -186,6 +194,7 @@ int asus_wmi_set_devstate(u32 dev_id, u32 ctrl_param, u32 *retval); · 2 unmodified lines
186int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1, u32 *retval);194int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1, u32 *retval);
187int asus_hid_register_listener(struct asus_hid_listener *cdev);195int asus_hid_register_listener(struct asus_hid_listener *cdev);
188void asus_hid_unregister_listener(struct asus_hid_listener *cdev);196void asus_hid_unregister_listener(struct asus_hid_listener *cdev);
197int asus_hid_event(enum asus_hid_event event);
189#else198#else
190static inline void set_ally_mcu_hack(enum asus_ally_mcu_hack status)199static inline void set_ally_mcu_hack(enum asus_ally_mcu_hack status)
191{200{
@@ -213,6 +222,10 @@ static inline int asus_hid_register_listener(struct asus_hid_listener *bdev) · 21 unmodified lines
213static inline void asus_hid_unregister_listener(struct asus_hid_listener *bdev)222static inline void asus_hid_unregister_listener(struct asus_hid_listener *bdev)
214{223{
215}224}
225static inline int asus_hid_event(enum asus_hid_event event)
226{
227 return -ENODEV;
228}
216#endif229#endif
217 230
218#endif /* __PLATFORM_DATA_X86_ASUS_WMI_H */231#endif /* __PLATFORM_DATA_X86_ASUS_WMI_H */