Received: by 10.223.185.116 with SMTP id b49csp3408186wrg; Sun, 25 Feb 2018 22:25:34 -0800 (PST) X-Google-Smtp-Source: AH8x224BgPaqMgegLBB6DDwwXIQfnqkCNOsEmNf1AtESMar1X05FuuHPcXJWZ6kUG1lMHVLZElZQ X-Received: by 10.98.202.138 with SMTP id y10mr9506755pfk.184.1519626333977; Sun, 25 Feb 2018 22:25:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519626333; cv=none; d=google.com; s=arc-20160816; b=yBjxG7C+CyTdn3Hdikr9p6StfvKUggrtgQKWsqBUZ853QjuPmMEPA+gHXuDPDnKxJ2 /efFBlNi2jTUiYB9nF1j371zbippXqjcCsgt15LiV3jTc2JfXtvTCSFfr5IJTRqAYNZd RWwNQo0T+4pWaf4ZUCWB2RLayJbqWaPFiChfTE26q1nF7Q6qzwEqkFN0adE+eFooYlyU DVQ6K4VjJLtXCdBBkLqzkKMA0BtPaOZ0H3+kzUAaRZzgDjxDv6B6UbSydsOpNM4tYEtG 37rwdFeRAjYQFbVBe3UsninjQ56xvIWVGvt46YBgbD/6UuQecs48sPQCFaAnLpqBTpAw oaeA== 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=FSx0tdTvHjFibasQCdJ+5+k7ck5jABuKQMc7TczGP9Q=; b=VzpacgVcRgI2K50VevdHQj/n0FX/ADE7HMT6gE5ybbPvID78eTi4mfXagq+47Cb4vR ZaDkiGpV/P+JRMAJWIp5ssQd294GAo4bUI871gOX0SdDkHBekVMeGncfanM41saSlOF4 zEOP0SGquhV7S2UZCRsf0lX+0NTw4DDWxVa23gp1J96NEkzUlGgDmMwE2HEW6cI7+Uw9 Z8GZsdUZcJ44LAjZ7EnzCu7nhRrlznFlti77NYtpv0+oFc9XQDdGdTA+WJbu97unv38r /VxaUAah8f2OHVF8tqR5ercrtyGH3KYMnZm4UgLIlktFD+DgZA7vGIWZQvWA6enc16e+ ydkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Tnb+l7mW; 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-v6si6126377plo.535.2018.02.25.22.25.19; Sun, 25 Feb 2018 22:25:33 -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=Tnb+l7mW; 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 S1752118AbeBZGYN (ORCPT + 99 others); Mon, 26 Feb 2018 01:24:13 -0500 Received: from mail-ot0-f195.google.com ([74.125.82.195]:45188 "EHLO mail-ot0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750807AbeBZGYK (ORCPT ); Mon, 26 Feb 2018 01:24:10 -0500 Received: by mail-ot0-f195.google.com with SMTP id f11so12402788otj.12 for ; Sun, 25 Feb 2018 22:24:10 -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=FSx0tdTvHjFibasQCdJ+5+k7ck5jABuKQMc7TczGP9Q=; b=Tnb+l7mWK/qbfrs+LlswTjpwFFUjrhPySYAtkA8WYTQdqw6r/iAS3m9BtlJaNg0F2c GpKhYkpqp12R6yJhQoHhYUrgcICAk/wRxWlz1JI/ObPbj2tEVmrqqRsbyOvimuoz8uId 5WAPT08Fm1APFp//gJ0nuwJNbeUPCu4hI4ieQ= 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=FSx0tdTvHjFibasQCdJ+5+k7ck5jABuKQMc7TczGP9Q=; b=c40W4j6LCk/h/CUiU5KMLCTrf2BXYcPLX6tM0+qmAZzMY4zl1jRfROQx9flxY9O7lb uB1uN1SZyEU2CnmM3MpC7rXZPgQBkiIpKpXuP9MkFYUiNkDOvobFPoeI/wJTmgdVhEiF MC1y/uXj71yhQKsVt32Y0+u8qSjBzlASHEMSxvDhHSNzx6gty/KI1ZcwhWcLrNl643+m skMFoxwnQEZhd2oW0gkjE0hItPbJWkHbUP5wgOd6R6YkPuoYkWw6YZooW2/2GbcjpPtx F0SealKYrn/U9P4egx+VYGjA6hP/+/X86KL4iSGH0/19dUghBhVpqs8c+6J3pnn/NgIa PAbw== X-Gm-Message-State: APf1xPAmgtqQCZ+wq2uKxWol4Pzf4fiBMesv7aoX2gUU56ph7Vz4gqRm eWQ+gkdex1qKlYcgjzd7TwE4oGXmBcDu1zYolE4D0Q== X-Received: by 10.157.11.130 with SMTP id 2mr2259850oth.40.1519626249820; Sun, 25 Feb 2018 22:24:09 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.96.5 with HTTP; Sun, 25 Feb 2018 22:24:09 -0800 (PST) In-Reply-To: References: <7fc26df245d56fd2014532b56e67630e76e2c513.1518316248.git.baolin.wang@linaro.org> <20180219181159.tzbhhvbvpc236qma@rob-hp-laptop> From: Baolin Wang Date: Mon, 26 Feb 2018 14:24:09 +0800 Message-ID: Subject: Re: [PATCH v2] Input: gpio_keys: Add level trigger support for GPIO keys To: Rob Herring Cc: Dmitry Torokhov , Mark Rutland , Greg KH , stephen lu , Arvind Yadav , Joseph Lo , Kate Stewart , Philippe Ombredanne , Thomas Gleixner , linux-input@vger.kernel.org, DTML , LKML , Mark Brown , Linus Walleij 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 Hi Rob, On 21 February 2018 at 19:35, Baolin Wang wrote: > Hi Rob, > > On 20 February 2018 at 02:11, Rob Herring wrote: >> On Sun, Feb 11, 2018 at 02:55:04PM +0800, Baolin Wang wrote: >>> On some platforms (such as Spreadtrum platform), the GPIO keys can only >>> be triggered by level type. So this patch introduces one property to >>> indicate if the GPIO trigger type is level trigger or edge trigger. >> >> If the parent interrupt controller only supports a certain trigger, then >> it should ignore setting the trigger type. > > We still need to set high level type trigger or low level type trigger > if it only supports level trigger. > >> >>> >>> Signed-off-by: Baolin Wang >>> --- >>> Changes since v1: >>> - Diable the GPIO irq until reversing the GPIO level type. >>> --- >>> .../devicetree/bindings/input/gpio-keys.txt | 2 ++ >>> drivers/input/keyboard/gpio_keys.c | 26 +++++++++++++++++++- >>> include/linux/gpio_keys.h | 1 + >>> 3 files changed, 28 insertions(+), 1 deletion(-) >>> >>> 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? Thanks. gpio-keys { compatible = "gpio-keys"; key-volumedown { label = "Volume Down Key"; linux,code = ; gpios = <&ap_eic_debounce 2 GPIO_ACTIVE_LOW>; debounce-interval = <2>; wakeup-source; interrupts = ; }; key-volumeup { label = "Volume Up Key"; linux,code = ; gpios = <&pmic_eic 10 GPIO_ACTIVE_HIGH>; debounce-interval = <2>; wakeup-source; interrupts = ; }; key-power { label = "Power Key"; linux,code = ; gpios = <&pmic_eic 1 GPIO_ACTIVE_HIGH>; wakeup-source; interrupts = ; }; }; -- Baolin Wang Best Regards