From patchwork Sat Apr 14 09:51:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vignesh Raghavendra X-Patchwork-Id: 10340955 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 5774B602C2 for ; Sat, 14 Apr 2018 09:51:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4670F289ED for ; Sat, 14 Apr 2018 09:51:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B5FF28A41; Sat, 14 Apr 2018 09:51:47 +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=unavailable 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 DFBAD289ED for ; Sat, 14 Apr 2018 09:51:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751063AbeDNJvS (ORCPT ); Sat, 14 Apr 2018 05:51:18 -0400 Received: from fllnx209.ext.ti.com ([198.47.19.16]:58995 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751045AbeDNJvQ (ORCPT ); Sat, 14 Apr 2018 05:51:16 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w3E9pEXB029118; Sat, 14 Apr 2018 04:51:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1523699474; bh=Yd3K6fjl+bLhdLNrivhb30OWlQMfP1NApIqD+FqUngE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=rXQQSLvmKDNvb41rj6mFQ9O/RUUO7ih6LZ5n7ZK2NLHkqB5ts9cj2Wp58V5At+jlz pteX9XDU9sMfI9o/m7Xj2s/2N6yVskYREarMuhz281rBNcwZFtE++3uQYHvVjuPMa/ WzDd8fLW7QQxb00MBU7qSLG/HFcE8i8DKNVefkX0= Received: from DLEE111.ent.ti.com (dlee111.ent.ti.com [157.170.170.22]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3E9pED2030379; Sat, 14 Apr 2018 04:51:14 -0500 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Sat, 14 Apr 2018 04:51:14 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Sat, 14 Apr 2018 04:51:13 -0500 Received: from a0132425.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3E9p6Dw017397; Sat, 14 Apr 2018 04:51:12 -0500 From: Vignesh R To: Dmitry Torokhov CC: Vignesh R , Grygorii Strashko , , , , Tony Lindgren Subject: [PATCH v2 2/3] Input: ti_am335x_tsc - Ack pending IRQs at probe and before suspend Date: Sat, 14 Apr 2018 15:21:52 +0530 Message-ID: <20180414095153.32060-3-vigneshr@ti.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180414095153.32060-1-vigneshr@ti.com> References: <20180414095153.32060-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 Acked-by: Lee Jones --- v2: Add Acks from v1. drivers/input/touchscreen/ti_am335x_tsc.c | 2 ++ include/linux/mfd/ti_am335x_tscadc.h | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c index 810e05c9c4f5..dcd9db768169 100644 --- a/drivers/input/touchscreen/ti_am335x_tsc.c +++ b/drivers/input/touchscreen/ti_am335x_tsc.c @@ -439,6 +439,7 @@ static int titsc_probe(struct platform_device *pdev) dev_err(&pdev->dev, "irq wake enable failed.\n"); } + titsc_writel(ts_dev, REG_IRQSTATUS, IRQENB_MASK); titsc_writel(ts_dev, REG_IRQENABLE, IRQENB_FIFO0THRES); titsc_writel(ts_dev, REG_IRQENABLE, IRQENB_EOS); err = titsc_config_wires(ts_dev); @@ -504,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, IRQENB_MASK); idle = titsc_readl(ts_dev, REG_IRQENABLE); titsc_writel(ts_dev, REG_IRQENABLE, (idle | IRQENB_HW_PEN)); diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h index b9a53e013bff..1a6a34f726cc 100644 --- a/include/linux/mfd/ti_am335x_tscadc.h +++ b/include/linux/mfd/ti_am335x_tscadc.h @@ -63,6 +63,7 @@ #define IRQENB_FIFO1OVRRUN BIT(6) #define IRQENB_FIFO1UNDRFLW BIT(7) #define IRQENB_PENUP BIT(9) +#define IRQENB_MASK (0x7FF) /* Step Configuration */ #define STEPCONFIG_MODE_MASK (3 << 0)