Received: by 10.223.185.116 with SMTP id b49csp309862wrg; Fri, 2 Mar 2018 19:58:23 -0800 (PST) X-Google-Smtp-Source: AG47ELvEwmoeXB8yv5AXWe+4w0UodGSyckRAVx+r7JRKfZgtpDUl2SVOVwW0/BdYFxkjcxj1LhLM X-Received: by 2002:a17:902:5682:: with SMTP id j2-v6mr7157229pli.441.1520049502991; Fri, 02 Mar 2018 19:58:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520049502; cv=none; d=google.com; s=arc-20160816; b=zW3EU8RyXE/aUqKSYhX1uSRsr+rtMTBhDmvHUPJayGWRfztIjPiIP87StTb6xI8hz9 gXqN8Gu4v/Vkiq9x14jhD4pNrgNgAjl8r4AV87Xe1FPstXgd+3kjQvycS1Kl8RaMPbEg LsMZmGYNU943xlInnOoMu6AI39OIeDaV7BhNxlXBjjUWWCtYoMEAeXpQg5IUk0QBiFjB AEaUDKKiopvrScAis42gvp7mIRIbQnofgORj8mfcXvL8xov/SSNG39yWTJK3UT9PJ95a yz+esJjwjv/Kc3AQBID15whGYTrC4riR019AOuHKKw/a+tIC8+cK6LOOSnN3ZwKDzhBK /FMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=0QgLOFT/eFmNEKYYR5p1lGYPlVqfIDQNH/JzL6E17FY=; b=SfaL3HJ8Xzoh5n+o0Q5y5dldbXESfHjaJr92AUdeisbGE5E2WxBydbTyqT5XOfglfA qzMbcu2lMBK5bgZZ0KwGpGRFJFoN3pWieYjccCPlHFpg8KbgHTSw/g2H7IVp7QHSzsjK HTpqQvbthHocqIUlKorM1/5cEzJTKZBnb7MGcaMin4p0/6yr1RmOKWSDqYUAYiu1Y9cr 4OK/JxbbTvO9MVIs/PZL4/fKpmuAsjELZag8X33qBftWDHxtR90zQMezLNAhdzFanOnc PMxNCIwK9mBpW8tJ5IQU+RYsr+e8CsUGZKAhhpuJ9U8O1ggmumuvcg0+YdWDhwTgLzSp 3bsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=N/FLXdoC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p1si4912726pgc.593.2018.03.02.19.58.08; Fri, 02 Mar 2018 19:58:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=N/FLXdoC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964876AbeCCBKY (ORCPT + 99 others); Fri, 2 Mar 2018 20:10:24 -0500 Received: from mail-it0-f66.google.com ([209.85.214.66]:53159 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964863AbeCCBKV (ORCPT ); Fri, 2 Mar 2018 20:10:21 -0500 Received: by mail-it0-f66.google.com with SMTP id k135so3644875ite.2 for ; Fri, 02 Mar 2018 17:10:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=0QgLOFT/eFmNEKYYR5p1lGYPlVqfIDQNH/JzL6E17FY=; b=N/FLXdoC6tO8PKbx8NwJ+mBurqqiVhgKJCyllwVogJf93KvG9g4NOdibfEQPk6JUg7 fQ9iEsU9F1aw1uxXvKohWvnx1V/7J3vNZlj6+cBOEH7/gEfiWTSUMD+cro3BKr2kaHYy DzXqYlaqI5k0e3iFmk+COQalFcx0jr8DGaCAU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=0QgLOFT/eFmNEKYYR5p1lGYPlVqfIDQNH/JzL6E17FY=; b=ovkRuwh/RZaqt0fGXI9EoaNk0iLFk7wKh9tq/8J+3yUyqiCdqkvkyBjqQk1vjOLp9E 3YewwMZvJEAj2kzuVfslet46xVvBO5rTXScssrnQZnTe3mBoN5lJvf5fCEnHZbr3p4Ja Mkm6TvJJ5xnAcp5Glyp9uCoQKvDcnB2AdZiMvOmnlYPRJQolfSFKT5Gy4NHXaSqMQXIB yXSFV7jKLL+uL2mr31kK+y21wjYRQ11PVVWwenNTqUBKGv/oQYKEMp86USre5gyd74Uf MDNXd65ka0G85jLmzBwUyYEzi2fJawyQphYVycsQ9SVFCt8BRliGimvKalqxERlhHpmt sDFw== X-Gm-Message-State: AElRT7Gn6oDlRO2DX3AHd31tO8zQTIbier1afIvtuW5RoQ1OkSOVhp6/ wQVR9RJcMNFLQZyngY04HVv0sg== X-Received: by 10.36.225.72 with SMTP id n69mr5249602ith.82.1520039421116; Fri, 02 Mar 2018 17:10:21 -0800 (PST) Received: from rodete-desktop-imager.corp.google.com ([2620:0:1000:1501:bc2f:3082:9938:5d41]) by smtp.gmail.com with ESMTPSA id c13sm1439624itd.31.2018.03.02.17.10.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Mar 2018 17:10:20 -0800 (PST) Date: Fri, 2 Mar 2018 17:10:17 -0800 From: Brian Norris To: Jeffy Chen Cc: linux-kernel@vger.kernel.org, briannorris@google.com, heiko@sntech.de, dtor@google.com, dianders@google.com, Guenter Roeck , Enric Balletbo i Serra , Thomas Gleixner , Joseph Lo , stephen lu , Dmitry Torokhov , Kate Stewart , linux-input@vger.kernel.org, Greg Kroah-Hartman , Philippe Ombredanne , Arvind Yadav Subject: Re: [PATCH v3 1/3] Input: gpio-keys - add support for wakeup event action Message-ID: <20180303011016.GA258190@rodete-desktop-imager.corp.google.com> References: <20180302035102.10084-1-jeffy.chen@rock-chips.com> <20180302035102.10084-2-jeffy.chen@rock-chips.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180302035102.10084-2-jeffy.chen@rock-chips.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jeffy, On Fri, Mar 02, 2018 at 11:51:00AM +0800, Jeffy Chen wrote: > Add support for specifying event actions to trigger wakeup when using > the gpio-keys input device as a wakeup source. > > This would allow the device to configure when to wakeup the system. For > example a gpio-keys input device for pen insert, may only want to wakeup > the system when ejecting the pen. > > Suggested-by: Brian Norris > Signed-off-by: Jeffy Chen > --- > > Changes in v3: > Adding more comments as Brian suggested. > > Changes in v2: > Specify wakeup event action instead of irq trigger type as Brian > suggested. > > drivers/input/keyboard/gpio_keys.c | 39 ++++++++++++++++++++++++++++++++++ > include/linux/gpio_keys.h | 2 ++ > include/uapi/linux/input-event-codes.h | 9 ++++++++ > 3 files changed, 50 insertions(+) > > diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c > index 87e613dc33b8..607f3960c886 100644 > --- a/drivers/input/keyboard/gpio_keys.c > +++ b/drivers/input/keyboard/gpio_keys.c ... > @@ -586,6 +606,12 @@ static int gpio_keys_setup_key(struct platform_device *pdev, > > isr = gpio_keys_irq_isr; > irqflags = 0; > + > + /* > + * For IRQ buttons, the irq trigger type for press and release > + * are the same. So we don't need to reconfigure the trigger > + * type for wakeup. > + */ Ah, I think I misunderstood what the (non-GPIO) IRQ-based trigger was doing. It's just emulating an instantaneous press/release (or, with a configurable release delay), so there isn't really a way to say "only wake me on one edge". So that still doesn't really mean we use the "same" trigger for all wakeup trigger types. It really just means we can't support any customization here -- we wake based on whatever the IRQ represents (which today is probably just EV_ACT_ANY). I guess it's fine to just ignore the wakeup-trigger-type property here, but it would also be equally valid to reject it outright I think. Anyway, that's only a mild complaint. For the whole series: Tested-by: Brian Norris Reviewed-by: Brian Norris Thanks! > } > > bdata->code = &ddata->keymap[idx]; ... > diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h > index 53fbae27b280..d7917b0bd438 100644 > --- a/include/uapi/linux/input-event-codes.h > +++ b/include/uapi/linux/input-event-codes.h > @@ -32,6 +32,15 @@ > #define INPUT_PROP_CNT (INPUT_PROP_MAX + 1) > > /* > + * Event action types > + */ > +#define EV_ACT_ANY 0x00 /* asserted or deasserted */ > +#define EV_ACT_ASSERTED 0x01 /* asserted */ > +#define EV_ACT_DEASSERTED 0x02 /* deasserted */ > +#define EV_ACT_MAX 0x02 > +#define EV_ACT_CNT (EV_ACT_MAX+1) > + > +/* > * Event types > */ > > -- > 2.11.0 > >