From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tomasz Figa Subject: Re: [PATCH] Input: gpio_keys - wakeup_trigger Date: Sat, 14 Sep 2013 14:16:47 +0200 Message-ID: <106090496.3hTZTLSVzK@flatron> References: <1379109160-32437-1-git-send-email-bleung@chromium.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Return-path: Received: from mail-ea0-f178.google.com ([209.85.215.178]:46539 "EHLO mail-ea0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752416Ab3INMQx (ORCPT ); Sat, 14 Sep 2013 08:16:53 -0400 In-Reply-To: <1379109160-32437-1-git-send-email-bleung@chromium.org> Sender: linux-gpio-owner@vger.kernel.org List-Id: linux-gpio@vger.kernel.org To: Benson Leung Cc: dmitry.torokhov@gmail.com, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, david@protonic.nl, dianders@chromium.org Hi Benson, On Friday 13 of September 2013 14:52:40 Benson Leung wrote: > Allow wakeup_trigger to be defined per gpio button. Currently, all > gpio buttons are set up as IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING. > It may be more appropriate to only wake the system on one edge, for > example if the gpio is for a Lid Switch. > > Signed-off-by: Benson Leung > --- > .../devicetree/bindings/gpio/gpio_keys.txt | 7 +++++++ > drivers/input/keyboard/gpio_keys.c | 23 > ++++++++++++++++++++-- include/linux/gpio_keys.h > | 3 +++ > 3 files changed, 31 insertions(+), 2 deletions(-) > > diff --git a/Documentation/devicetree/bindings/gpio/gpio_keys.txt > b/Documentation/devicetree/bindings/gpio/gpio_keys.txt index > 5c2c021..243f569 100644 > --- a/Documentation/devicetree/bindings/gpio/gpio_keys.txt > +++ b/Documentation/devicetree/bindings/gpio/gpio_keys.txt > @@ -20,6 +20,13 @@ Optional subnode-properties: > - debounce-interval: Debouncing interval time in milliseconds. > If not specified defaults to 5. > - gpio-key,wakeup: Boolean, button can wake-up the system. > + - gpio-key,wakeup-trigger : Specifies the type of wakeup behavior. > + <1> == Rising Edge Trigger > + <2> == Falling Edge Trigger > + <3> == Both Rising and Falling Edge Trigger > + <4> == Level High Trigger > + <8> == Level Low Trigger > + If not specified, defaults to <3> == Both Rising and Falling. I don't like two things in this patch. First is that this looks completely like a configuration option, not hardware description, so it's not something that should be put into DT. Especially that users might want to use another wake-up trigger depending on their use cases. I'd rather see this as a sysfs entry. Another thing is that this driver assumes that key events are indicated by edges on the GPIO line, so I don't think level trigger setting make any sense here. I'd rather allow three settings here (through a sysfs knob) - key down, key up, key down or up. Best regards, Tomasz