Received: by 10.223.185.116 with SMTP id b49csp7126178wrg; Wed, 28 Feb 2018 23:42:12 -0800 (PST) X-Google-Smtp-Source: AG47ELsg64yvKCeV26j1mEjVqPPaEY18YCgcr0h/EaXTMa/BTxK8hRe7x3Yf/yzzQicwfpw+R1HT X-Received: by 2002:a17:902:5906:: with SMTP id o6-v6mr470283pli.60.1519890132857; Wed, 28 Feb 2018 23:42:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519890132; cv=none; d=google.com; s=arc-20160816; b=RRhfX0XTscyhOJwBJoPft2K1JYI2P0H4yy6/YdTN1jQg2blSH7waUxzpcZuasyyRMx bv7N6PJQqgdp8y5eNASW4jBGJCh9n6udjaTSpxtHnRfPYqhvoY+OYvF8r2sTWJMpd+rO 35IjeIOY3n/zAGPHjQYhqzfNjTNFaTsTJnM+OmCu0BVmwKGg4hRI/gsYx50plVT7aNQw Gid4sGErBzoeH5xDRVfgnlAWQvOpzwww+gSrnavbcwepnUAWMYgZLvNdCmhLW1uM0Zro iMcx497szRrjrIGui2kXwTS/ypJu4WzEwfIP0xBsr4FEK7xjg+viYM7TCN/Q8vkwpB25 Dt8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=rR+yhOTfmfndku+4+ZVkjfUdjmECR4VJcmO9ozhINfk=; b=JG7v/niNF0cblH//WoUtsVf+1W/lPkFGDy9+9OjWU3LBU3ZDPZBetgUh7HqZ81oiI3 YBSPAHhAW0wiH3LeHV1XR+1IOatH5LRWROyVZ1b5/mcLA6GRerHXrOnK0T3FSYVw6CxB 4sLXjDU5nRYMej7mITMNruv2ONvpsjCTxM/71ktZ4UoXO+zsCDbr+AA/WDmk7RvFmGZ7 86ii7BPbpVEMryQwRTm1impFJTHK0TSJsN2ASO+gxcA60zgKQ9SJ5/myqZ5RHa1nNPzw S9WqU5RNdTsypcxtPaXc+fbTpGDVaceQ3HsVY9Km1kyhbLfRtenEvfiSk1Cs1dNHmKpT PiSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JLu9igWK; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t17-v6si2558714plo.535.2018.02.28.23.41.57; Wed, 28 Feb 2018 23:42:12 -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=@linaro.org header.s=google header.b=JLu9igWK; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935120AbeCAHlS (ORCPT + 99 others); Thu, 1 Mar 2018 02:41:18 -0500 Received: from mail-oi0-f48.google.com ([209.85.218.48]:45684 "EHLO mail-oi0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933286AbeCAHlQ (ORCPT ); Thu, 1 Mar 2018 02:41:16 -0500 Received: by mail-oi0-f48.google.com with SMTP id j79so3795679oib.12 for ; Wed, 28 Feb 2018 23:41:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=rR+yhOTfmfndku+4+ZVkjfUdjmECR4VJcmO9ozhINfk=; b=JLu9igWK2pp5rH7fq2GuXaW2boxxir2XgpAgmZEWRBKIMbweN080PL1CemJHUpzErw v48+q5gVpIOLMRjpaMpXZEpQSyEbxbd4yu7CFvzq8CtjSIIelMXiHhS1rOjCyMOG+VFg ywL4YYVgp5/vw0rq9rQIZLeQOLoX7qEZk4pL4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=rR+yhOTfmfndku+4+ZVkjfUdjmECR4VJcmO9ozhINfk=; b=Q2O3EjpIK/0z9SPcxX7WD8XaSnwZ1c+8j8FJ44mkBVLyxIsrWKyZBEqsg4lFJRYD58 mI0yy1JzrvDl5OBnUdJRDGs3jTrgzHIWToHlHtBJHu0njP/cf0zbG916Y/bSa6gGJoXR GASFtmRt96/aYV1fjUgVHZtr12s8pc0apBSOHETHOl1pT1HBNELnY66Ur2YTTAFAWPe/ 1W6ZaIGI8+at9XBr8xRM1UQcv6MZz9/SA+s7B0pHFvceiRkeFGpuGbEUtyZCpm4NIOc9 ngnyI2y5HKkK37cpkN0mUsoVbghjErYgEBXp+/qOtOaAE/gFF70f3+zyw3cwXuvThfE4 BeSw== X-Gm-Message-State: AElRT7G8g2ZAyFmNnAgU6WUsK7XWNy75jDewtILEfxLvTr2GnFqV5xLE CzKMRPSudi/1c+Gl63l9yqOFRvK9AyW1gzzDZxWx/FzF X-Received: by 10.202.67.86 with SMTP id q83mr591865oia.168.1519890075787; Wed, 28 Feb 2018 23:41:15 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.96.5 with HTTP; Wed, 28 Feb 2018 23:41:15 -0800 (PST) In-Reply-To: References: <7fc26df245d56fd2014532b56e67630e76e2c513.1518316248.git.baolin.wang@linaro.org> <20180219181159.tzbhhvbvpc236qma@rob-hp-laptop> From: Baolin Wang Date: Thu, 1 Mar 2018 15:41:15 +0800 Message-ID: Subject: Re: [PATCH v2] Input: gpio_keys: Add level trigger support for GPIO keys To: Linus Walleij Cc: Dmitry Torokhov , Rob Herring , Mark Rutland , Greg KH , stephen lu , Arvind Yadav , Joseph Lo , Kate Stewart , Philippe Ombredanne , Thomas Gleixner , Linux Input , DTML , LKML , Mark Brown , Arnd Bergmann Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28 February 2018 at 20:53, Linus Walleij wrote: > On Mon, Feb 26, 2018 at 7:24 AM, Baolin Wang wrote: >> On 21 February 2018 at 19:35, Baolin Wang wrote: >>> On 20 February 2018 at 02:11, Rob Herring wrote: > >>>>> diff --git a/Documentation/devicetree/bindings/input/gpio-keys.txt b/Documentation/devicetree/bindings/input/gpio-keys.txt >>>>> index a949404..e3104bd 100644 >>>>> --- a/Documentation/devicetree/bindings/input/gpio-keys.txt >>>>> +++ b/Documentation/devicetree/bindings/input/gpio-keys.txt >>>>> @@ -29,6 +29,8 @@ Optional subnode-properties: >>>>> - linux,can-disable: Boolean, indicates that button is connected >>>>> to dedicated (not shared) interrupt which can be disabled to >>>>> suppress events from the button. >>>>> + - gpio-key,level-trigger: Boolean, indicates that button's interrupt >>>>> + type is level trigger. Otherwise it is edge trigger as default. >>>> >>>> No. Just use 'interrupts' instead of 'gpios' and specify the trigger >>>> type. Or put both if you need to read the state. >>> >>> Okay, so something as below to get the level type from the >>> 'interrupts' property. >>> if (fwnode_property_read_u32(child, "interrupts", &button->level_type)) >>> button->level_type = IRQ_TYPE_NONE; >> >> After more thinking, if we use 'interrupts' to indicate the irq type >> for this case, we cannot specify the irq number due to the irq number >> should be get by gpiod_to_irq(). So the device nodes look weird, since >> we should define the index of the interrupt controller instead of the >> irq type if the #interrupt_cells is set to 1 according to the >> interrupt controller documentation. What do you think about this? > > I think what you're ultimately seeing is a bad fit between this > GPIO/irq-controller and the Linux gpio keys driver, it doesn't > have very much to do with the device tree bindings. > > What I think is appropriate is to try to create a new input driver > in Linux that just takes an interrupt, not a GPIO, and let the > GPIO chip only act as an irqchip for this. > > This avoid the complicated step of converting a GPIO to an > interrupt in order to use it, when all you really want to > do is use an interrupt, you don't really care about the > GPIO here, correct? Sometimes we should set the GPIO debounce, and read GPIO value to report the event, so I think we can not remove GPIO. > > So we would create > drivers/input/keyboard/interrupt_keys.c > however I suspect a bunch of code would need to be shared > with gpio_keys.c so maybe it is necessary to break out the > parts of gpio_keys.c into its own helper file. > > Or maybe even have the > pure interrupt handling as part of gpio_keys.c, i.e. if the > driver can't find any associated GPIO, it goes on to > check if there is an interrupt assigned to the device node > and use that directly instead. > > Either way, Dmitry must be involved. > > Yours, > Linus Walleij -- Baolin.wang Best Regards