From: Rajat Jain Date: Mon, 3 Apr 2017 18:53:41 +0000 (-0700) Subject: Input: cros_ec_keyb - add an EC event for sysrq X-Git-Tag: v4.14-rc1~4^2~36^2~97 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e6eba3fac9a0eb2018a85505b91740e27c60fdba;p=platform%2Fkernel%2Flinux-rpi3.git 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 Acked-by: Lee Jones Signed-off-by: Dmitry Torokhov --- diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c index 6a250d6..c7a8120 100644 --- a/drivers/input/keyboard/cros_ec_keyb.c +++ b/drivers/input/keyboard/cros_ec_keyb.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -260,6 +261,12 @@ static int cros_ec_keyb_work(struct notifier_block *nb, ckdev->ec->event_size); break; + case EC_MKBP_EVENT_SYSRQ: + val = get_unaligned_le32(&ckdev->ec->event_data.data.sysrq); + dev_dbg(ckdev->dev, "sysrq code from EC: %#x\n", val); + handle_sysrq(val); + break; + case EC_MKBP_EVENT_BUTTON: case EC_MKBP_EVENT_SWITCH: /* diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h index da1c188..3ceebf6 100644 --- a/include/linux/mfd/cros_ec_commands.h +++ b/include/linux/mfd/cros_ec_commands.h @@ -2040,6 +2040,9 @@ enum ec_mkbp_event { /* The state of the switches have changed. */ EC_MKBP_EVENT_SWITCH = 4, + /* EC sent a sysrq command */ + EC_MKBP_EVENT_SYSRQ = 6, + /* Number of MKBP events */ EC_MKBP_EVENT_COUNT, }; @@ -2052,6 +2055,7 @@ union ec_response_get_next_data { uint32_t buttons; uint32_t switches; + uint32_t sysrq; } __packed; struct ec_response_get_next_event {