Received: by 10.223.185.116 with SMTP id b49csp6146124wrg; Wed, 28 Feb 2018 04:55:15 -0800 (PST) X-Google-Smtp-Source: AH8x225oyK5XXXdKJoOFIQL7AxMWwVAv+8trajKyNF7U24NHDtfftSJtuhmT815GBHBX+qFkJkQF X-Received: by 10.98.150.212 with SMTP id s81mr17919849pfk.100.1519822515522; Wed, 28 Feb 2018 04:55:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519822515; cv=none; d=google.com; s=arc-20160816; b=shwB2hQ+YFvsaxbsZEv+erEj2SnehUc3hPDusfvUeIgzBZlr1cnJ0U44KJiIhNxiVn YmBL2OluPHcZBkZg7u2S8wFeIAmwd4yw8D3fKaA4AywVSDYirDC3tCSWK4SqhC3h+jFU veLvc4KOojMk7JdvUDOBJnHcrfz6tgSdW5ikVVSIohox+4qPb4QyyYzxlFBg1SQkm4NW 7uHZxqjE4azYtsmNtJU3ZIYGFeOQUQcQeI3Vboir5TqDw/W6vC/NCUC4+Of8ssq2qclD xvqXwUoryDqTkWihGlwvVuG17XX50OjpZGXlUgT4cwH2grGqoeqxNBlE+uSYjz5HJBiE 4XLw== 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=47GfvlBT1cpSC+Pn6FcUtKow8k6FN9Lye6zjM7bvkT0=; b=Z37kvIS23svRRu4U0TUxpE6VPzQpJ4kd3SBtV3NCj4KLp5oJxWxB+qzfCN28dc5Cnh IgGZD3XJ9yc/Mxh9v82vryZHm5J60A3cvvV4DWQZXre8AFTNZt9PavMLdK5040WIQ/9k kdKtDQ/r1CwBxwo5OjHskfui57VI0yK7zmgZqLijNpQES7YukJ4qCwVlYX0rwehUzNGR 8dp8yw974V0lVxjnk9yy3SdDV4p1+/M2aNbUtW7Swm3l7bCExyCoJ2DxcThan5kE/H+N CBB8OnvBfGP9OqU4bRAJH55PSBj/9BmjtunkskzmmhbZZIXsiyjOepGoYXJPsxqNj646 niFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CA+pwgFM; 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 c14si1143884pfn.313.2018.02.28.04.55.00; Wed, 28 Feb 2018 04:55:15 -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=CA+pwgFM; 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 S1752575AbeB1Mxq (ORCPT + 99 others); Wed, 28 Feb 2018 07:53:46 -0500 Received: from mail-it0-f43.google.com ([209.85.214.43]:35916 "EHLO mail-it0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752535AbeB1Mxo (ORCPT ); Wed, 28 Feb 2018 07:53:44 -0500 Received: by mail-it0-f43.google.com with SMTP id u5so3401013itc.1 for ; Wed, 28 Feb 2018 04:53:44 -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=47GfvlBT1cpSC+Pn6FcUtKow8k6FN9Lye6zjM7bvkT0=; b=CA+pwgFMlSbiNKj1pHory4g7qTCeQQ1paMgoIRSFmiUOaJ5+2eqvVgIYSXjY8yVYxZ OMSYzqk7oqi0aHndtcMky9R1tfBxVNUCBQcoE3PTi4vOTfF4uhd5BVe9r7GRoKu+kxvE ERugUocnE1ZMYFkSHByZjnz0DDVVq+V4ZIf0U= 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=47GfvlBT1cpSC+Pn6FcUtKow8k6FN9Lye6zjM7bvkT0=; b=AYkW6aI0dXZZ53KTBCwi8cpcES8ujguPQetji5QgBoYk3Mg5NIUIpUl46LiNjO6xO0 LntBmZIsMg672lnSySBn+N9liO9WvQavT8g2/64dYCKzzs1pugngaqy8mqZbWug4ulzW FfFpy+jCTHJ6w/RohDaOECqv0u/OdBAEaiaAOJABw1bdfXrTxT6d75QhswlbHEy1ZJ8R jSCYJ9tCcoqdILNeJwwkBn0RtJlG/2jtGKKWpni+1rDmqEB/ecnbghgNBziGH3KJZI6i 65klYqFV9WwW6qx3OXKL4BS+ae2ZxNarIPu4oV33VX5DfuyKc92wvKvZg1/wk3na0t0E WssQ== X-Gm-Message-State: APf1xPBjSpKpsiK2of0RQro3675nx7pzaIjcqkAP3E4tKlyFlJfWppqF 1BVGSBlgHEc4PiFSwKUSh/gchJrH5T745q+q7Jh45Q== X-Received: by 10.36.120.19 with SMTP id p19mr9652642itc.115.1519822424031; Wed, 28 Feb 2018 04:53:44 -0800 (PST) MIME-Version: 1.0 Received: by 10.79.230.25 with HTTP; Wed, 28 Feb 2018 04:53:43 -0800 (PST) In-Reply-To: References: <7fc26df245d56fd2014532b56e67630e76e2c513.1518316248.git.baolin.wang@linaro.org> <20180219181159.tzbhhvbvpc236qma@rob-hp-laptop> From: Linus Walleij Date: Wed, 28 Feb 2018 13:53:43 +0100 Message-ID: Subject: Re: [PATCH v2] Input: gpio_keys: Add level trigger support for GPIO keys To: Baolin Wang , Dmitry Torokhov Cc: Rob Herring , Mark Rutland , Greg KH , stephen lu , Arvind Yadav , Joseph Lo , Kate Stewart , Philippe Ombredanne , Thomas Gleixner , Linux Input , DTML , LKML , Mark Brown 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 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? 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