From patchwork Thu Mar 30 22:18:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajat Jain X-Patchwork-Id: 9655261 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1F8556034C for ; Thu, 30 Mar 2017 22:18:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 084BB285BC for ; Thu, 30 Mar 2017 22:18:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EFF8E285F1; Thu, 30 Mar 2017 22:18:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91A5F285BC for ; Thu, 30 Mar 2017 22:18:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752963AbdC3WS3 (ORCPT ); Thu, 30 Mar 2017 18:18:29 -0400 Received: from mail-pg0-f41.google.com ([74.125.83.41]:34758 "EHLO mail-pg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750903AbdC3WS2 (ORCPT ); Thu, 30 Mar 2017 18:18:28 -0400 Received: by mail-pg0-f41.google.com with SMTP id 21so51823100pgg.1 for ; Thu, 30 Mar 2017 15:18:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=UZZfi0bhsPNNApeRB8bPu4i5WLXPxOrHJYsPHcwTkvI=; b=tF+d2Gzg7arAfNMkYkxg9rDiLSyA7Mtp9lY4BZnm3aiOwI1He/lkpWOsFUyXrw4lmn OgtI9997cXix4Lxb7I/uA9mE4c7liX/l3myUgLu55GUe1clk0ntkg7vqRcmnUKjLgRQJ JYPeGxXkww7K9/u9DLXhdIr3zq8BE1fHRZHIizxIW6Xw9v15zZyO7dWiGxPV2n6yVkqk Nk5x9FMZayurnCGKrjDQnit44F9xihG+OJNCRdZ0RzA1lB9RuEWj1/j79b5t7du+OxaJ X5MSaLhgfgXdxT6q+6H9aNhYLv7meeljXahUYmR1RITGELUDvUpIgHwDNuN6QGA5Xoje pHzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=UZZfi0bhsPNNApeRB8bPu4i5WLXPxOrHJYsPHcwTkvI=; b=OkEUrOBBA6lg3VrU/XRc8QPfK3+A82F3tPJobfkbzMumZ93d2aOtPqoDv7GLGwelEe OuVgdCzyARejpxwLHP53Av0PaINRLNb1UUoebHMGST62zHG48ROxOUy41ngurZz3/89C vDUg+1obFMJQHTDcnbL2h6SFaLfj0W3uQryHdnUhcPbWH6BKP0mKeh/cWeJYI8pgVXfz 5RqWHs8b3W2vp/jY1097PT5BrFURLsFSan7bF24NmxbVKCrsSTKvImQrqtCuYwlxORP2 Yc6SMLQx6/nzpDgDZiPC+WGbOk1WkaDbpLGvixGqfylVDsPXaNHKU/3vSzT1lcbIL1i4 j71A== X-Gm-Message-State: AFeK/H0n7TN2KVL1UCkmfe8Wi9i+RZJXWET+nPwbOTH4vFaTlbzoALNmdTjaONBt90HgQLqU X-Received: by 10.98.204.88 with SMTP id a85mr1378070pfg.205.1490912306914; Thu, 30 Mar 2017 15:18:26 -0700 (PDT) Received: from rajat.mtv.corp.google.com ([172.22.64.13]) by smtp.gmail.com with ESMTPSA id x15sm6305928pfk.68.2017.03.30.15.18.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Mar 2017 15:18:26 -0700 (PDT) From: Rajat Jain To: Dmitry Torokhov , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Lee Jones , rajatxjain@gmail.com, dtor@google.com, Rajat Jain Subject: [PATCH] input: cros_ec_keyb: Add an EC event for sysrq Date: Thu, 30 Mar 2017 15:18:07 -0700 Message-Id: <20170330221807.2983-1-rajatja@google.com> X-Mailer: git-send-email 2.12.2.564.g063fe858b8-goog Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 #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 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 {