From patchwork Tue Apr 24 06:27:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vignesh Raghavendra X-Patchwork-Id: 10358711 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 950FB60225 for ; Tue, 24 Apr 2018 06:27:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79B541FFE6 for ; Tue, 24 Apr 2018 06:27:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E17327F3E; Tue, 24 Apr 2018 06:27:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C78121FFE6 for ; Tue, 24 Apr 2018 06:27:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756008AbeDXG1j (ORCPT ); Tue, 24 Apr 2018 02:27:39 -0400 Received: from fllnx210.ext.ti.com ([198.47.19.17]:49794 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756005AbeDXG1J (ORCPT ); Tue, 24 Apr 2018 02:27:09 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w3O6R7r8014765; Tue, 24 Apr 2018 01:27:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1524551227; bh=Y1unUuEWuTDT/3yAUdh7Oifu4vPMbQViM9YPgOSiotc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=WAEqkwCj2OH1nDMYh+4g2Gwma7s38e00uz5/Ig/KM2UG556mQovEnXPVrHbHlQWjI 6OfSTPgR6h2cjrSTqzwXJIjNCA+YKpFGm1M3c3IozU/mppoEP0n9juEt4uyidDPGH+ csO3Uu8rP/JJuDX+J52i/QhUyiaUnxDOgMwrXGU4= Received: from DFLE111.ent.ti.com (dfle111.ent.ti.com [10.64.6.32]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3O6R1bM021660; Tue, 24 Apr 2018 01:27:07 -0500 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Tue, 24 Apr 2018 01:27:06 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Tue, 24 Apr 2018 01:27:07 -0500 Received: from a0132425.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3O6Qu3R007475; Tue, 24 Apr 2018 01:27:03 -0500 From: Vignesh R To: Dmitry Torokhov CC: Vignesh R , Grygorii Strashko , , , , Tony Lindgren Subject: [PATCH v3 2/3] Input: ti_am335x_tsc - Ack pending IRQs at probe and before suspend Date: Tue, 24 Apr 2018 11:57:40 +0530 Message-ID: <20180424062741.7891-3-vigneshr@ti.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180424062741.7891-1-vigneshr@ti.com> References: <20180424062741.7891-1-vigneshr@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Grygorii Strashko It is seen that just enabling the TSC module triggers a HW_PEN IRQ without any interaction with touchscreen by user. This results in first suspend/resume sequence to fail as system immediately wakes up from suspend as soon as HW_PEN IRQ is enabled in suspend handler due to the pending IRQ. Therefore clear all IRQs at probe and also in suspend callback for sanity. Signed-off-by: Grygorii Strashko Signed-off-by: Vignesh R --- v3: Clear IRQs related to TSC module only drivers/input/touchscreen/ti_am335x_tsc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c index 3908c21862c7..a548b0dbe320 100644 --- a/drivers/input/touchscreen/ti_am335x_tsc.c +++ b/drivers/input/touchscreen/ti_am335x_tsc.c @@ -35,6 +35,8 @@ #define SEQ_SETTLE 275 #define MAX_12BIT ((1 << 12) - 1) +#define TSC_IRQENB_MASK (IRQENB_FIFO0THRES | IRQENB_EOS | IRQENB_HW_PEN) + static const int config_pins[] = { STEPCONFIG_XPP, STEPCONFIG_XNN, @@ -437,6 +439,7 @@ static int titsc_probe(struct platform_device *pdev) if (err) dev_err(&pdev->dev, "irq wake enable failed.\n"); + titsc_writel(ts_dev, REG_IRQSTATUS, TSC_IRQENB_MASK); titsc_writel(ts_dev, REG_IRQENABLE, IRQENB_FIFO0THRES); titsc_writel(ts_dev, REG_IRQENABLE, IRQENB_EOS); err = titsc_config_wires(ts_dev); @@ -502,6 +505,7 @@ static int __maybe_unused titsc_suspend(struct device *dev) tscadc_dev = ti_tscadc_dev_get(to_platform_device(dev)); if (device_may_wakeup(tscadc_dev->dev)) { + titsc_writel(ts_dev, REG_IRQSTATUS, TSC_IRQENB_MASK); idle = titsc_readl(ts_dev, REG_IRQENABLE); titsc_writel(ts_dev, REG_IRQENABLE, (idle | IRQENB_HW_PEN));