Received: by 10.223.185.116 with SMTP id b49csp8119427wrg; Thu, 1 Mar 2018 17:56:19 -0800 (PST) X-Google-Smtp-Source: AG47ELv/RnKPbto9PhHeVJ/qD2WXXl4cknb/gdhDrhfPk9GcmoYLH4WgLEGTBb7J44jtuEqCfTYN X-Received: by 2002:a17:902:48:: with SMTP id 66-v6mr3629584pla.288.1519955779322; Thu, 01 Mar 2018 17:56:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519955779; cv=none; d=google.com; s=arc-20160816; b=ng43QOKqdTAyEvPVEs18Xq9FHOczkrE7vTtcnvlrpTk2QVNlzRYEWVvShlFFb3q2DT lDo6rJ0kQuy3OhPp7lTESjUEThkeVANJRgXORv/c1+7b6r5/5yLIjzH4AKiPROWhjnEV mD/dge3bw9lfA3OzwRgarka+hP72Ao0uv3G99BeJWQCrVLVHQPf1EFU4UH01lndesAVX Owa3oaBT+Mk1P2pBvACnPcYsSLtDCfd8fxoV9hPv6ockmzSCIQLbC6P/vEdz8ntKdvy2 cRftMwkCFRmm6l1CSAaZyoAe+iSG5GvCI3A0UJAaHe7Cmak4IusF4i+9qwVDZ0LR0GJZ EkjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=mh0q7CYSVJNBXaxelZf+xAJ6fMKTury3kKnvfGy/ffw=; b=yDomNZGiazVRxhGjCAazvrjVqRn/4MFUffLBWX2MHAUDHRgczWnMIe3RKvkHS1Xgy1 Larc2YrKZtPSuwYvLb1Y5WCWfS5MTMBSMaiuVI+pUvXz9yrSYJtgcP4IezSDcJdM8p4E m9VJfYXHVeFwECndwvBSYz08T9zxqfE5prmHzl55l1Y3CZYZ2hRy1qsGQhb8KObme2QB qeOsbw7MX0tiYd7RcNrlclvG/PgW0t7Cxl3ADWny8uHl8iK624mIa7ppY4xNlcOgjJ/3 oRYLPh52VFJb3Sf5fOF2sLYesRV8tUDi3AQ25t2f1+9fK+VGqoJiSuHYr6AqrdPhotty IKqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fyJT5COo; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a2-v6si3883163plp.544.2018.03.01.17.56.04; Thu, 01 Mar 2018 17:56:19 -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=@gmail.com header.s=20161025 header.b=fyJT5COo; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163912AbeCBAoL (ORCPT + 99 others); Thu, 1 Mar 2018 19:44:11 -0500 Received: from mail-pl0-f48.google.com ([209.85.160.48]:35184 "EHLO mail-pl0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163142AbeCBAoI (ORCPT ); Thu, 1 Mar 2018 19:44:08 -0500 Received: by mail-pl0-f48.google.com with SMTP id bb3-v6so4673977plb.2; Thu, 01 Mar 2018 16:44:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=mh0q7CYSVJNBXaxelZf+xAJ6fMKTury3kKnvfGy/ffw=; b=fyJT5COooXgHHPexqL/Z2XLW8uL8HNpjU6heIDyRTHS2B5v4kuyXrfTN81I/Z7fgXD Bxx6Y1hPyD9Sw9mKbipOpBkaiUeWB5+I0r7ONGpU+5WRTdDSqIQJsRQPASsARuMuDy1X ZCYHJCpxPNVT8mvSDmdmpDiN551ip14/dYZ9mhTcoX40dFB1hjMkuh/+IYUW3eCln/x7 r1bsGOwt34rxQFSu/eZBrWaPQLFwfRidpne/AavVKVNArj4k1ZdmqFW82/RY2jl8CmDd p3lwHlNv9176Cf/w02qHseJI6n+N/BYMjipX9cb+oUckTO6N7NXisO3jcBwV/RlkKfKl f5WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=mh0q7CYSVJNBXaxelZf+xAJ6fMKTury3kKnvfGy/ffw=; b=SdHUmMt3Cm9GJa68Gf8sHw7NSpR79ncFN3Tko258UzvHNnVoh6bYe6502hGTSEtUpm iPoe1YXkjQAzNW2Gt4Ibv2uEN8YhMMokZLcDxxCc3LrZMQEjQivZUzLxNZAbl+j78dZL 4xktBCoU0BBAgwp6hJ09bhkd+o+GmhQtuehRczPP2WSimsxqTuwdAz28yLSJi/PgiCxa 1sjZSoo/Vq2IpWjq8tPV//lvFt4mZg8yacLifHIWDz4U9u5Qh/Ppn6uj/eTJCATYwz32 SDGE8x/esoyZ5QPh+0U849Bz9jmE8wo68hnMbmOO8+q3BRB3lGmh/zt5WZbmPVmR5o/5 CUbw== X-Gm-Message-State: APf1xPDr/igSIo52PWsojB8lubLccwuXURDA5mbqb69ji0Je0Glkn0gD ulK0loXOcEeH+uPBEQ0Kpz8= X-Received: by 2002:a17:902:b10b:: with SMTP id q11-v6mr3579458plr.275.1519951447892; Thu, 01 Mar 2018 16:44:07 -0800 (PST) Received: from dtor-ws ([2620:0:1000:1511:8de6:27a8:ed13:2ef5]) by smtp.gmail.com with ESMTPSA id o76sm10294719pfk.62.2018.03.01.16.44.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Mar 2018 16:44:07 -0800 (PST) Date: Thu, 1 Mar 2018 16:44:04 -0800 From: Dmitry Torokhov To: Baolin Wang 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 Subject: Re: [PATCH v3] Input: gpio_keys: Add level trigger support for GPIO keys Message-ID: <20180302004404.GA242226@dtor-ws> References: <826093167e8fb24723f474b0272f3dcab1b6a97e.1519821626.git.baolin.wang@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks. -- Dmitry