From patchwork Wed May 20 10:02:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barry Song <21cnbao@gmail.com> X-Patchwork-Id: 6444281 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0190A9F1C1 for ; Wed, 20 May 2015 10:03:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 243AB20160 for ; Wed, 20 May 2015 10:03:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 451CE20266 for ; Wed, 20 May 2015 10:03:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753503AbbETKDA (ORCPT ); Wed, 20 May 2015 06:03:00 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:33027 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752453AbbETKC5 (ORCPT ); Wed, 20 May 2015 06:02:57 -0400 Received: by padbw4 with SMTP id bw4so61608697pad.0 for ; Wed, 20 May 2015 03:02:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:cc:content-type; bh=FAkkiHURMTJE8xktDIejfd3F7pyOD6VhbYgW82pF3Qo=; b=FFri/5XBLXB4uZ51kkyDStRSV6DAMI1TBMGtRJAcNptnbNo4CY4CI29KTnLBhVwi/M ZXz/2uRmijmr4Kv8s9ZojXRmrTHCKQC/Tuu1lOydfRLScfBw7q109t5K8otI1ln5J+PD Qd9++DbgIC7slOAiI7ILKXlfji9FDpPeY1fEX0h6oXMkjeKDOayD73rYEmfcTjLSok02 L0RHKhkffBgur9mLNK1F2xM2aGDAclfvez5Z8y2JPbS5Pv6/3fnoOgGboDdSZzEpErT3 mef45PxuRGrFLJXdVOEj4XL2jKT7brMqZcEEirGFb/L7ijKaISeJkibaBiH9KHWM6mLR WI5w== X-Received: by 10.68.243.9 with SMTP id wu9mr3869981pbc.28.1432116176905; Wed, 20 May 2015 03:02:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.66.188.202 with HTTP; Wed, 20 May 2015 03:02:36 -0700 (PDT) From: Barry Song <21cnbao@gmail.com> Date: Wed, 20 May 2015 18:02:36 +0800 Message-ID: Subject: [RFC PATCH] Input: gpio_keys - trigger input event if key is pressed in boot stage To: "linux-input@vger.kernel.org" , Dmitry Torokhov Cc: DL-SHA-WorkGroupLinux , Andy.Sun@csr.com Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP sometimes we press a key to boot, and the boot stage need to get this event. the current codes use edge trigger, so we have no chance to report the cold-touch event. but our user sceneries like Linux navigator does need it. Signed-off-by: Barry Song --- -RFC: for the moment, only an idea drivers/input/keyboard/gpio_keys.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) err_remove_group: diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index ddf4045..77fe0dd 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -766,6 +766,19 @@ static int gpio_keys_probe(struct platform_device *pdev) device_init_wakeup(&pdev->dev, wakeup); + /* if the key is pressed while system boot, force an interrupt */ + for (i = 0; i < pdata->nbuttons; i++) { + const struct gpio_keys_button *button = &pdata->buttons[i]; + struct gpio_button_data *bdata = &ddata->data[i]; + int state; + + if (gpio_is_valid(button->gpio)) { + state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low; + if (state) + gpio_keys_gpio_isr(bdata->irq, bdata); + } + } + return 0;