Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1812171ybc; Wed, 20 Nov 2019 04:35:42 -0800 (PST) X-Google-Smtp-Source: APXvYqwq5pLKlIQVy4h960JhNt+0K2w2tlZ/BZKyC3gr98Rfq7K/77p2UjB7c7ZNSdBF57Z+M2wl X-Received: by 2002:adf:e78d:: with SMTP id n13mr2814817wrm.59.1574253342376; Wed, 20 Nov 2019 04:35:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574253342; cv=none; d=google.com; s=arc-20160816; b=AwZ5o2Do/f7+T0j5bj1gLdgXfGYUOeBMhoRIRql7ThH9U4ZR4J3mrROo3nE2FVj98S /1LHrsysGSdxpqhE1yV8+VSiH3NYCPSZNuu0uSCcyF2SbvLW1cVmChM/2YgnIbVtgodt 3D3Hq3ljc8Qv66t7qLofthWDejDHIyj9VLu7oiOXdVq0BhuGHFeKgBDT0sWOvB3FZrs/ xQHMql89INvXGWKgT2GR/10VUMWfYlokoHAVEl4LTuq0jL5Fvz3v3gEmPnYByGbboB3B fyVov53rGlFpfTFVSAAvR3tNQRI0O6StvzSmswipDgC8HGLefiYUs2ski6Id+vRdccyC LC5Q== 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; bh=QuR8XDnw2V531rQOvSh8RaBAYHJ8z0ndZbGkv0WYZQw=; b=zVkCFMzctY7Xk6OMOwtlhl9i4GAGMKxzBfozUREvqJVTwQiMq6OeQ9+hXtXiIZGJ4k RbZdZFA/kW+uHa9GdhhM1nIoJuq97EQk5Rd3b+orYN5+AZXjXf7REAK5QU6TgLm/zzL2 8418Uun65T7E91b/FsNBpbbe5URxFSaUweJbVMcGo8cGD0O1vWikUS2hBmv4wfentW6Q t7N4JMfw0I1W2ayp0Heo1PCV4lzf7OvvbF9j0dZ8xl59oZkGjjL5YzGA6p9pvT45u0C5 4vbx0pwL6az7O4+OCg4PeHXajee1OscClOfq7RHpmY6rBSy4g8mzVx07xoJTGl5wOBa4 FmTA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b15si18171827eda.174.2019.11.20.04.35.15; Wed, 20 Nov 2019 04:35:42 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728231AbfKTJ1y (ORCPT + 99 others); Wed, 20 Nov 2019 04:27:54 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:49001 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727491AbfKTJ1x (ORCPT ); Wed, 20 Nov 2019 04:27:53 -0500 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iXMH8-0002YO-Bd; Wed, 20 Nov 2019 10:27:50 +0100 Received: from mfe by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1iXMH7-0006fJ-8R; Wed, 20 Nov 2019 10:27:49 +0100 Date: Wed, 20 Nov 2019 10:27:49 +0100 From: Marco Felsch To: Dmitry Torokhov Cc: Robin Gong , robin , "linux-input @ vger . kernel . org" , "linux-kernel @ vger . kernel . org" , Pengutronix Kernel Team , Shawn Guo , Adam Ford , "linux-arm-kernel @ lists . infradead . org" Subject: Re: [PATCH v3] input: keyboard: snvs_pwrkey: Send key events for i.MX6 S, DL and Q Message-ID: <20191120092749.7rru5fj7eybs4tl6@pengutronix.de> References: <20190904062329.97520-1-robin@protonic.nl> <20190912201300.GA636@penguin> <803592d161b9ca75d6ac1c2c54e891a1@protonic.nl> <20190916233701.GH237523@dtor-ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190916233701.GH237523@dtor-ws> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 10:21:16 up 5 days, 39 min, 19 users, load average: 0.09, 0.04, 0.01 User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: mfe@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Robin, On 19-09-16 16:37, Dmitry Torokhov wrote: > On Mon, Sep 16, 2019 at 07:45:37AM +0000, Robin Gong wrote: > > On 2019/9/13 15:31 robin wrote:> > > > Hi Dmitry, > > > > > > On 2019-09-12 22:13, Dmitry Torokhov wrote: > > > > Hi Robin, > > > > > > > > On Wed, Sep 04, 2019 at 06:23:29AM +0000, Robin van der Gracht wrote: > > > >> The first generation i.MX6 processors does not send an interrupt when > > > >> the power key is pressed. It sends a power down request interrupt if > > > >> the key is released before a hard shutdown (5 second press). This > > > >> should allow software to bring down the SoC safely. > > > >> > > > >> For this driver to work as a regular power key with the older SoCs, > > > >> we need to send a keypress AND release when we get the power down > > > >> request irq. > > > >> > > > >> Signed-off-by: Robin van der Gracht > > > >> --- > > > >> @@ -67,13 +83,17 @@ static irqreturn_t imx_snvs_pwrkey_interrupt(int > > > >> irq, void *dev_id) { > > > >> struct platform_device *pdev = dev_id; > > > >> struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev); > > > >> + unsigned long expire = jiffies; > > > >> u32 lp_status; > > > >> > > > >> pm_wakeup_event(pdata->input->dev.parent, 0); > > > >> > > > >> regmap_read(pdata->snvs, SNVS_LPSR_REG, &lp_status); > > > >> - if (lp_status & SNVS_LPSR_SPO) > > > >> - mod_timer(&pdata->check_timer, jiffies + > > > >> msecs_to_jiffies(DEBOUNCE_TIME)); > > > >> + if (lp_status & SNVS_LPSR_SPO) { > > > >> + if (pdata->minor_rev > 0) > > > >> + expire = jiffies + msecs_to_jiffies(DEBOUNCE_TIME); > > > >> + mod_timer(&pdata->check_timer, expire); > > > > > > > > Why do we even need to fire the timer in case of the first generation > > > > hardware? Just send press and release events directly from the ISR. > > That timer looks like a software debounce to prevent unexpected and > > meaningless interrupt/event caused by quick press/release. > > Right, but in case of the first generation hardware we schedule the > timer immediately (expire == 0) and do not check state of the hardware > in the timer handler, but rather simply emit down/up events, so we do > not really get any benefit from the timer (again, I am talking about > first generation hardware only). Did you prepared a v4? Just ask to avoid a duplicated work :) Regards, Marco > Thanks. > > -- > Dmitry >