linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Lee Jones <lee.jones@linaro.org>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Rajat Jain <rajatja@google.com>,
	rajatxjain@gmail.com, dtor@google.com
Subject: Re: [PATCH] input: cros_ec_keyb: Add an EC event for sysrq
Date: Sat, 1 Apr 2017 10:16:27 -0700	[thread overview]
Message-ID: <20170401171627.GJ17130@dtor-ws> (raw)
In-Reply-To: <20170330221807.2983-1-rajatja@google.com>

On Thu, Mar 30, 2017 at 03:18:07PM -0700, Rajat Jain wrote:
> 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>

Lee, is it OK to route through my tree or you want to take it?

> ---
>  drivers/input/keyboard/cros_ec_keyb.c | 7 +++++++
>  include/linux/mfd/cros_ec_commands.h  | 4 ++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c
> index 6a250d65f8fe..00a3a830cd3a 100644
> --- a/drivers/input/keyboard/cros_ec_keyb.c
> +++ b/drivers/input/keyboard/cros_ec_keyb.c
> @@ -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>
> @@ -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 f1ef6388c233..c93e7e0300ef 100644
> --- a/include/linux/mfd/cros_ec_commands.h
> +++ b/include/linux/mfd/cros_ec_commands.h
> @@ -2041,6 +2041,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,
>  };
> @@ -2053,6 +2056,7 @@ union ec_response_get_next_data {
>  
>  	uint32_t   buttons;
>  	uint32_t   switches;
> +	uint32_t   sysrq;
>  } __packed;
>  
>  struct ec_response_get_next_event {
> -- 
> 2.12.2.564.g063fe858b8-goog
> 

-- 
Dmitry

  reply	other threads:[~2017-04-01 17:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-30 22:18 [PATCH] input: cros_ec_keyb: Add an EC event for sysrq Rajat Jain
2017-04-01 17:16 ` Dmitry Torokhov [this message]
2017-04-03  9:56   ` Lee Jones
2017-04-03 18:54     ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170401171627.GJ17130@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=dtor@google.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rajatja@google.com \
    --cc=rajatxjain@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).