Received: by 10.223.185.116 with SMTP id b49csp8229425wrg; Thu, 1 Mar 2018 20:34:24 -0800 (PST) X-Google-Smtp-Source: AG47ELudVD0yD46awnXFNaoNmKzTh3TYPTnM2O5xs6jOtDyk5+H+I1/otuI07Zirc37hBSG3Tkf7 X-Received: by 10.99.141.200 with SMTP id z191mr3482446pgd.418.1519965264542; Thu, 01 Mar 2018 20:34:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519965264; cv=none; d=google.com; s=arc-20160816; b=Ar7Yh1D+hv/eMbG9cJAZCIj8Xkvb6ascxhnwtr2VqF2iWwMRg6ftZQBCqASqN3927K 0bosNmW64aaEr42Ghsi96gkTmM5jPvzzKliJWbVP+z7Bi+b58RXTTj2ukeiejRLPuXNx Ye7JiLAzUzagL3mM3WT3yosMMblByJojzungYl+71ZfhcHI2/XkDiE/cmkdnPFr/I4l1 yVKiWJCt+C4ISzBueUv7l0GVvBLvGbHq48w5I161e5IvaBTGFaxdU/RwREagioiFXEGB kXw4s4A4YeIhPIK11DfJ31M0mAdgqg0lAttVUWtwDI3bAZi7Eqaml3eh2HILREpwr5Ld sWfQ== 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=ZhOHLPEWWr105dwlMrEyxo/6Mh+DbifvlqrLVLXHVSg=; b=Y6dBf9MI71UjXwYA34FKTG9eSIYYRfxEf6J6xmnMQZ+LANO7NPxGSAiWjH4jN7P8Sa puhM0Uxb/3wIXefsQEdHzJ0C+DbiShPWuYEDL+kD1abCawEbzm2eTo00/tBydyKJooLr ugCl0F/T3CwccqS0smgTBrKix/6Im7RtUgsrajzkbvKxlt5CAgrW83kD96HFQlVjZNnJ 1fc9Qki4Vn8OrPcoyoSYGj9X7/YvpFqDdiWbknmIQsZDqRxkFBRDifWlnm4XWnF9BmAd 7s5w/7i7tH4ha8rWsr2uDCRgPRl/wzczI0Dq4pkUMG80yE26jKdxN4TBiWntMbcG2gJG b9Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kI6602bW; 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 x5-v6si4128818plv.94.2018.03.01.20.34.09; Thu, 01 Mar 2018 20:34:24 -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=kI6602bW; 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 S1164521AbeCBDKe (ORCPT + 99 others); Thu, 1 Mar 2018 22:10:34 -0500 Received: from mail-oi0-f51.google.com ([209.85.218.51]:33769 "EHLO mail-oi0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163974AbeCBDKc (ORCPT ); Thu, 1 Mar 2018 22:10:32 -0500 Received: by mail-oi0-f51.google.com with SMTP id j81so6141568oia.0 for ; Thu, 01 Mar 2018 19:10:32 -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=ZhOHLPEWWr105dwlMrEyxo/6Mh+DbifvlqrLVLXHVSg=; b=kI6602bW251dTsrXf2Rm+NtBCg5Ojpe7fDp6D0kanU5uLO/WihOlXD6Dpo/vQ4WE5j X1U+DcBIoYXQvbetoAP3AdXhT3M9GS78dA8thG+gYjItID2ZOq1Ht5vwXv0TI01yGbEE owBMY5L0BrufjeQ8B88ywCnukE+XhEC4WLaw4= 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=ZhOHLPEWWr105dwlMrEyxo/6Mh+DbifvlqrLVLXHVSg=; b=AjvlhuCL8989SeWMqL63e9FnGtRrTRz2Eiae+UYvsUlz72Us64tib7uFdHWNJ8di3Y OQMsMj30k3UWI34vgET2m8lT7B1LwzzZYWF27gaQ/nhA4ARu7EfKJO4BsHUbYiaFNsz4 B7AP6bjb32lKYSvF7npwWVjRnyB/a0W68eKbZK3GxZekMSEocwAr6CO00gpWgI3FmrUX XagD6tgVungUb3M96pHdxoi2QIu9DxeMlHvxpa45Pd2bZ7knGROXFAJaF8EElXdlUM1B 7gAYxkCwNU1kBzn7SVjtMT3QpN2u41oRXqWtVeu6gEncwE4dyRXR2ftRLpULMHH34no0 qXUw== X-Gm-Message-State: APf1xPDTYPICyQLcwWHKPDoY0Kyesl0T0L2Y09PCl3AhsuxDB6m8fb7a T1fLSppJzHT1o5raDJjBmjcwUdkMe9C3upLG+wHGbg== X-Received: by 10.202.172.138 with SMTP id v132mr2809623oie.320.1519960231852; Thu, 01 Mar 2018 19:10:31 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.96.5 with HTTP; Thu, 1 Mar 2018 19:10:31 -0800 (PST) In-Reply-To: <20180302004404.GA242226@dtor-ws> References: <826093167e8fb24723f474b0272f3dcab1b6a97e.1519821626.git.baolin.wang@linaro.org> <20180302004404.GA242226@dtor-ws> From: Baolin Wang Date: Fri, 2 Mar 2018 11:10:31 +0800 Message-ID: Subject: Re: [PATCH v3] Input: gpio_keys: Add level trigger support for GPIO keys To: Dmitry Torokhov Cc: Arnd Bergmann , Rob Herring , Mark Rutland , gregkh , stephen lu , Arvind Yadav , Joseph Lo , Kate Stewart , Philippe Ombredanne , Thomas Gleixner , "open list:HID CORE LAYER" , DTML , Linux Kernel Mailing List , 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 On 2 March 2018 at 08:44, Dmitry Torokhov wrote: > On Thu, Mar 01, 2018 at 03:35:23PM +0800, Baolin Wang wrote: >> On 28 February 2018 at 22:44, Arnd Bergmann wrote: >> > On Wed, Feb 28, 2018 at 1:44 PM, 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. >> >> >> >> Signed-off-by: Baolin Wang >> >> --- >> >> Changes since v2: >> >> - Use 'interrupt' property to indicate the irq type. >> >> >> >> Changes since v1: >> >> - Diable the GPIO irq until reversing the GPIO level type. >> > >> > I've looked at your patch in more detail now, and given it a bit more thought. >> > >> > I wonder if you could move that logic into your gpiochip/irqchip driver instead. >> > It seems that what you do in the gpio-keys driver is to emulate edge triggered >> > behavior on a level triggered irqchip. >> > >> > If you put the same logic into the gpio driver, you could simply make it >> > pretend to support an edge trigger on both edges and call into the interrupt >> > handler whenever the state changes. >> > >> >> That is really a good suggestion, which can avoid duplicate level >> reverse logic in different drivers. So this patch can be simplified >> just adding one trigger_type to indicate the interrupt type (not >> always edge trigger). Thanks for your suggestion. > > No, there is no need to add trigger type. The gpio-keys driver expects > trigger with both edges, falling and rising. If your GPIO chip does not > support it natively, you need to emulate edge trigger via level > interrupts by reprogramming trigger from active low to active high and > back on the fly. This should be done in the gpiochip/irqchip driver. > There is no need to change gpio-keys driver. Yes, you are right, It can work on my platform after modifying my GPIO driver like you and Arnd's suggestion. Thanks for all your help. -- Baolin.wang Best Regards