Skip to content

Commit

Permalink
Input: cros_ec_keyb - add an EC event for sysrq
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Lee Jones <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
  • Loading branch information
Rajat Jain authored and dtor committed Apr 3, 2017
1 parent f6f08c5 commit e6eba3f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/input/keyboard/cros_ec_keyb.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <linux/notifier.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/sysrq.h>
#include <linux/input/matrix_keypad.h>
#include <linux/mfd/cros_ec.h>
#include <linux/mfd/cros_ec_commands.h>
Expand Down Expand Up @@ -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:
/*
Expand Down
4 changes: 4 additions & 0 deletions include/linux/mfd/cros_ec_commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand All @@ -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 {
Expand Down

0 comments on commit e6eba3f

Please sign in to comment.