Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: cros_ec_keyb - add an EC event for sysrq

Some form factors (detachables/tablets) may not have a keyboard and
thus user may have to resort to using a defined EC UI to send sysrq(s)
to the kernel in order to collect crash info etc. This UI typically
is in the form of user pressing volume / power buttons in some specific
sequence and for some specific time. Add a new EC event that allows EC
to communicate the sysrq to the AP.

(We're skipping event number 5 because it has been reserved for
something else)

Signed-off-by: Rajat Jain <rajatja@google.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Rajat Jain and committed by
Dmitry Torokhov
e6eba3fa f6f08c55

+11
+7
drivers/input/keyboard/cros_ec_keyb.c
··· 30 30 #include <linux/notifier.h> 31 31 #include <linux/platform_device.h> 32 32 #include <linux/slab.h> 33 + #include <linux/sysrq.h> 33 34 #include <linux/input/matrix_keypad.h> 34 35 #include <linux/mfd/cros_ec.h> 35 36 #include <linux/mfd/cros_ec_commands.h> ··· 259 258 cros_ec_keyb_process(ckdev, 260 259 ckdev->ec->event_data.data.key_matrix, 261 260 ckdev->ec->event_size); 261 + break; 262 + 263 + case EC_MKBP_EVENT_SYSRQ: 264 + val = get_unaligned_le32(&ckdev->ec->event_data.data.sysrq); 265 + dev_dbg(ckdev->dev, "sysrq code from EC: %#x\n", val); 266 + handle_sysrq(val); 262 267 break; 263 268 264 269 case EC_MKBP_EVENT_BUTTON:
+4
include/linux/mfd/cros_ec_commands.h
··· 2040 2040 /* The state of the switches have changed. */ 2041 2041 EC_MKBP_EVENT_SWITCH = 4, 2042 2042 2043 + /* EC sent a sysrq command */ 2044 + EC_MKBP_EVENT_SYSRQ = 6, 2045 + 2043 2046 /* Number of MKBP events */ 2044 2047 EC_MKBP_EVENT_COUNT, 2045 2048 }; ··· 2055 2052 2056 2053 uint32_t buttons; 2057 2054 uint32_t switches; 2055 + uint32_t sysrq; 2058 2056 } __packed; 2059 2057 2060 2058 struct ec_response_get_next_event {