Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5215947ybl; Tue, 27 Aug 2019 00:57:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqyH5WQQ4gHpYR8V2UbSA/GvqQZwJOVDkEjioQYNrcf5OXJ6o9iEywLvFI1+iJeofSXM/xGb X-Received: by 2002:a17:90a:feb:: with SMTP id 98mr22784828pjz.55.1566892622559; Tue, 27 Aug 2019 00:57:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566892622; cv=none; d=google.com; s=arc-20160816; b=fBySRxqUJlu0/S0cq6MWuCAqjV7djRZ6vQd3wNDZHARf/qpLUCwj7It8QYcS2+dSCz 3WCqYAxkAqWzynYN5VokwgYih/gqyqzZadG+SmJ/hI5ETLqWCmgQ+vgo4GSlTTwkyJ0z vVr4cRHdmR/2amgX075jmxxrOvR5FB4W22jbczUq5pae78zxSICvXhgfIfDgz8IjRZGy Qon7wpLcOozh08JClBDyn6njttpl+IwlMIRYuAdkBWs6eoNct8FNOazO4AJakY0TSar5 DokOHSzAPptoUx4VlIokA9Vn2emq3YUrbiOJFf7801ZxU7ao370s3gz6XKRLrTLEzBAq iotg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version; bh=ymty8e8TXGxHOA+y33P/kding/JGANqGbLM/4GYZYLY=; b=u2Sn6M6je4WZgDGdI5+2qqpi25yTsxo9rovkM0TF9QUuZBxQ64BypBIbfKC/YeeTIy Gh99Og5OIFjzrUtc3SWIY6uTcqcpQ58kxHFe7NHpAUVWZJ6a606bzbdlaoKIyCGJolsZ 7dVq1oot7c+hY8aXw67PvHfTa+jZSnDqq5VICzMjqNUxHAptDvbcJW/3HvJI8e+xISIH pkPGTjBIMKvOgAy0qmZGsid7eTsJUpwu6joubaIgEoRsIFfVxR9aJyAgDMdQeI245E2W V7Tz2vYwt02D+O7oL+XcksdtlIGFHIttGpiawc6AfwNUAAJ8rtrusPYY9N7F6hNpULog 4mhw== 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 d24si11900021plr.187.2019.08.27.00.56.47; Tue, 27 Aug 2019 00:57:02 -0700 (PDT) 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 S1729788AbfH0HzW (ORCPT + 99 others); Tue, 27 Aug 2019 03:55:22 -0400 Received: from protonic.xs4all.nl ([83.163.252.89]:51731 "EHLO protonic.nl" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730303AbfH0HzU (ORCPT ); Tue, 27 Aug 2019 03:55:20 -0400 Received: from webmail.promanet.nl (edge2.prtnl [192.168.1.170]) by sparta (Postfix) with ESMTP id EE15344A009E; Tue, 27 Aug 2019 09:57:15 +0200 (CEST) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 27 Aug 2019 09:55:18 +0200 From: robin To: Robin Gong Cc: Rob Herring , Mark Rutland , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , dl-linux-imx , Dmitry Torokhov , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Adam Ford Subject: Re: [PATCH] input: keyboard: snvs_pwrkey: Send press and release event for i.MX6 S,DL and Q In-Reply-To: References: <20190823123002.10448-1-robin@protonic.nl> Message-ID: <83c033a20f5f2e3ce15525a1efd072bb@protonic.nl> X-Sender: robin@protonic.nl User-Agent: Roundcube Webmail/1.3.6 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-08-27 08:17, Robin Gong wrote: > On Fri, Aug 23, 2019 at 02:30:02PM +0200, Robin van der Gracht wrote:> >> The older generation i.MX6 processors send a powerdown request >> interrupt >> if the powerkey 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 powerkey with the older SoCs, we >> need to >> send a keypress AND release when we get the powerdown request >> interrupt. > Please clarify here more clearly that because there is NO press > interrupt triggered > but only release interrupt on elder i.mx6 processors and that HW issue > fixed from > i.mx6sx. ACK >> >> Signed-off-by: Robin van der Gracht >> --- >> arch/arm/boot/dts/imx6qdl.dtsi | 2 +- >> arch/arm/boot/dts/imx6sll.dtsi | 2 +- >> arch/arm/boot/dts/imx6sx.dtsi | 2 +- >> arch/arm/boot/dts/imx6ul.dtsi | 2 +- >> arch/arm/boot/dts/imx7s.dtsi | 2 +- > As Shawn talked, please keep the original "fsl,sec-v4.0-pwrkey", just > add > 'imx6qdl-snvs-pwrkey' for elder i.mx6 processor i.mx6q/dl/sl, thus no > need > to touch other newer processor's dts. ACK > >> >> static void imx_imx_snvs_check_for_events(struct timer_list *t) @@ >> -67,13 >> +85,23 @@ 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); >> + struct input_dev *input = pdata->input; >> u32 lp_status; >> >> - pm_wakeup_event(pdata->input->dev.parent, 0); >> + pm_wakeup_event(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->hwtype == IMX6QDL_SNVS) { >> + input_report_key(input, pdata->keycode, 1); >> + input_report_key(input, pdata->keycode, 0); >> + input_sync(input); >> + pm_relax(input->dev.parent); > Could you move the above input event report steps into > imx_imx_snvs_check_for_events() > as before? That make code better to understand and less operation in > ISR. I placed it here to avoid the unnessesairy debounce delay (since thats already implemented in hardware). I do agree with your arguments so I'll move emitting the events to imx_imx_snvs_check_for_events(). Is it ok if I keep the conditional, but instead of emitting the events, schedule imx_imx_snvs_check_for_events() immidiatly to avoid the debounce, or should I choose clarity over the 30 ms delay? >> + } else { >> + mod_timer(&pdata->check_timer, >> + jiffies + msecs_to_jiffies(DEBOUNCE_TIME)); >> + } >> + } >> >> /* clear SPO status */ >> regmap_write(pdata->snvs, SNVS_LPSR_REG, SNVS_LPSR_SPO); @@ >> -88,11 +116,24 @@ static void imx_snvs_pwrkey_act(void *pdata) >> del_timer_sync(&pd->check_timer); >> } >> >> +static const struct of_device_id imx_snvs_pwrkey_ids[] = { >> + { >> + .compatible = "fsl,imx6sx-sec-v4.0-pwrkey", >> + .data = &imx_snvs_devtype[IMX6SX_SNVS], >> + }, { >> + .compatible = "fsl,imx6qdl-sec-v4.0-pwrkey", >> + .data = &imx_snvs_devtype[IMX6QDL_SNVS], > No ' IMX6QDL_SNVS ' defined in your patch or am I missing? I added an enum 'imx_snvs_hwtype' that defines both IMX6SX_SNVS and IMX6QDL_SNVS. >> + }, >> + { /* sentinel */ } >> +}; >> +MODULE_DEVICE_TABLE(of, imx_snvs_pwrkey_ids); >> -- >> 2.20.1