Received: by 10.223.185.116 with SMTP id b49csp716386wrg; Sat, 10 Feb 2018 17:56:59 -0800 (PST) X-Google-Smtp-Source: AH8x224PvOE36dBZPpsMVz16Iy7oCi6qVYFftsOUt45fLWMCYwxdd7JvrvE8hCS7i7/8SdiOmpds X-Received: by 2002:a17:902:720b:: with SMTP id ba11-v6mr6829332plb.371.1518314219343; Sat, 10 Feb 2018 17:56:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518314219; cv=none; d=google.com; s=arc-20160816; b=wApc4WMMQUVAxt1+BcOWib1APvTW5AsU/ePr5/poexiqquFN9BO0bE7wIyv+wwBtNq olbxmTC4P5BFOhGRp9zLl6HtQp0AH62g7vAbjHIbbMIfkJqXiUSboGt2No1APpewDqwH 2u+0Jimi4yccpfj9RSAF9/bf+EHQeyCvwq7AUaNNloZv3ScdpXxeiMKzpE/deZWnYTAe Jr3T+5RuhctDhBBc3aIYWgKbINT+yWxIU5AgAgHudgOMC3vOGac26iuhbeo2MncMkqXj 48BkbPbhw7WkazVH9BdKO/2/9USlCBD/JVyEptSnHjigUBfyeCtiGIx0fDDUa7LJ5osF etNA== 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=imnet78Me5JbaOvc0AUP5mChTCXF+fwDvLNVLnpYreE=; b=eCeMkhdnRYyIIXD8mql/3TePzuYYG06EhuQxSGObpSxRwLcmCioZWZI/b9OZy9ht+0 4VR7ygHiNI9Ovrd0I1FQbpoNt9pUA7gKAuNmnsOxotL4ne0vbC03KXmxcfV/zmzxQrWF JWPgph2grknuRWqaIFjEUCs73qQtZxUlDV40kWhdifM8jPffsHLlR/SLbrXWjyMdKXU+ oouKyiyer7seCzJSuJYf08fRDwbBdsm4tvLYUHg90l9IYuBLv/f7F/RcOpgQqlZsK3oL lN6TEqDfX3keNkp9I9JBSmb7Ol5j3rrECVoo/ud3Vznxe6qc6Pg76dWEAlX2buQuw8G0 S7UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ca53fvbF; 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 q11-v6si1988124pli.790.2018.02.10.17.56.45; Sat, 10 Feb 2018 17:56:59 -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=Ca53fvbF; 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 S1752167AbeBKByy (ORCPT + 99 others); Sat, 10 Feb 2018 20:54:54 -0500 Received: from mail-ot0-f178.google.com ([74.125.82.178]:33966 "EHLO mail-ot0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751149AbeBKByw (ORCPT ); Sat, 10 Feb 2018 20:54:52 -0500 Received: by mail-ot0-f178.google.com with SMTP id l10so11179008oth.1 for ; Sat, 10 Feb 2018 17:54:52 -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=imnet78Me5JbaOvc0AUP5mChTCXF+fwDvLNVLnpYreE=; b=Ca53fvbFP9QyUSK+jnPZLNYmlwWVcCrQwPy8rg/TUgYfOt538eviLbfOkT5ohcTn/F AXzPsTYbl7HDHPay3SmWpwQclCG3BBdth0MuUUzp88U2t9E6xWkq5ROwa4qySWUI4MEm Ee1nMbql6tWYNl2lPpkp1zvXGAyHp1fDH8j4Q= 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=imnet78Me5JbaOvc0AUP5mChTCXF+fwDvLNVLnpYreE=; b=nOwtTsZ+dnV762kdGUXdx8i8xoPHsegKZczCzQ8TkbyVLjpzBdMS3PczyGx3AUS4lg WTWK4zxIo8vrBIwKWT23T5DwdTiaPJQdhu7/Bz/W8pJRO6reLEZnjsaX79a266h2JriI 4n+jExrK/Gbj578exG4W0mlvyMJ+Cequ/U8epeWJGwtG6YhTSdO1T+vo3bTVqVOsihCW uP7mqJWYexoS8gdW47jN59THqeXdHyiqVWwfHesse72z6ZgJgY3BW0GUdhs1s+Er60pZ nydppP7TcP8yJC/SvXC/tzUtMMzmxa2XbbNI58DoUtLHarNDJUb0H9j4sxT0Yey4EFis XEoA== X-Gm-Message-State: APf1xPAUFA0KSf5q5UtstD0022zDWFLMo/WCbhM3Cd73ZzqYvroULCXQ LWm50mdHV+KpxVS7bu3mpLieC7RCCI2ryxaF2sM+jg== X-Received: by 10.157.86.202 with SMTP id b10mr6000354otj.64.1518314091583; Sat, 10 Feb 2018 17:54:51 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.28.174 with HTTP; Sat, 10 Feb 2018 17:54:51 -0800 (PST) In-Reply-To: References: <6c53b9ccfd4a56fc1b00e243bb9e7cae9e124932.1518155780.git.baolin.wang@linaro.org> From: Baolin Wang Date: Sun, 11 Feb 2018 09:54:51 +0800 Message-ID: Subject: Re: [PATCH] Input: gpio_keys: Add level trigger support for GPIO keys To: Andy Shevchenko Cc: Dmitry Torokhov , Rob Herring , Mark Rutland , Greg Kroah-Hartman , 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 On 9 February 2018 at 23:03, Andy Shevchenko wrote: > On Fri, Feb 9, 2018 at 11:23 AM, Baolin Wang wrote: >> On 9 February 2018 at 14:39, Dmitry Torokhov wrote: >>> On Thu, Feb 8, 2018 at 10:08 PM, Baolin Wang wrote: >>>> On some platforms (such as Spreadtrum platform), the GPIO keys can only >>>> be triggered by level type. >>> >>> How do you stop the interrupt from re-triggering as long as the key >>> stays pressed? >> >> We will set the level type irq handler as handle_level_irq(), in this >> function, it will mask and ack the irq firstly. > > Wouldn't be ambiguous? > > 1. User presses the key -> > a) we got edge followed by level signaling; > b) IRQ core masks line, calls handler, ACKs, unmasks; > c) somewhere here Press Event is sent; > d) we still have level... We get IRQ fired again? But see 1. It > obviously not the case. > 2. User releases the key -> > ... > > So, the main question if I understood Dmitry correctly is the period > in time where IRQ line should be masked on one hand, and on the other > it will guarantee that user didn't release-press cylcle. Yes, you and Dmitry are right. I realized my problem. When I tested on Spreadtrum platform, we use Spreadtrum-special EIC (external interrupt controller) to trigger button events, if we acked the EIC irq, it will drop the interrupt line and never trigger events until we set irq type again. But this can not work for general GPIOs like you said. So I think I need disable the irq until reversing the level type. Thanks. -- Baolin.wang Best Regards