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
178178 void (*brightness_set)(struct asus_hid_listener *listener, int brightness);
179179 };
180180
181+enum 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+
181189 #if IS_REACHABLE(CONFIG_ASUS_WMI)
182190 void set_ally_mcu_hack(enum asus_ally_mcu_hack status);
183191 void 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
186194 int asus_wmi_evaluate_method(u32 method_id, u32 arg0, u32 arg1, u32 *retval);
187195 int asus_hid_register_listener(struct asus_hid_listener *cdev);
188196 void asus_hid_unregister_listener(struct asus_hid_listener *cdev);
197+int asus_hid_event(enum asus_hid_event event);
189198 #else
190199 static inline void set_ally_mcu_hack(enum asus_ally_mcu_hack status)
191200 {
@@ -213,6 +222,10 @@ static inline int asus_hid_register_listener(struct asus_hid_listener *bdev) · 21 unmodified lines
213222 static inline void asus_hid_unregister_listener(struct asus_hid_listener *bdev)
214223 {
215224 }
225+static inline int asus_hid_event(enum asus_hid_event event)
226+{
227+ return -ENODEV;
228+}
216229 #endif
217230
218231 #endif /* __PLATFORM_DATA_X86_ASUS_WMI_H */