From patchwork Sat Apr 14 09:51:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vignesh Raghavendra X-Patchwork-Id: 10340949 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 D0BDA602C2 for ; Sat, 14 Apr 2018 09:51:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFBF1289ED for ; Sat, 14 Apr 2018 09:51:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B46CD28A41; Sat, 14 Apr 2018 09:51:38 +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 5FACB289ED for ; Sat, 14 Apr 2018 09:51:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751127AbeDNJvY (ORCPT ); Sat, 14 Apr 2018 05:51:24 -0400 Received: from lelnx194.ext.ti.com ([198.47.27.80]:15211 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751073AbeDNJvT (ORCPT ); Sat, 14 Apr 2018 05:51:19 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w3E9pHT1019492; Sat, 14 Apr 2018 04:51:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1523699477; bh=n5RZoUWKwEP5KZaosLCAv/DnWH+6hRqJM2oTJEAZURo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=kBMBIvrs67iVWGX5tShNjiNeLNufo1Je+NG8zJu6OA3M6bUmvX6o96IXpdwUAhG8n pVaWbzbXoulwn1seAWUROzytTkdwJolxMsDSPCkYVDmVWD8DPBz2icp78cCXBcS4FH 6WiFj7VO8nIBOa94c8huurzLOVGjwkMyit1K7Ehs= Received: from DLEE110.ent.ti.com (dlee110.ent.ti.com [157.170.170.21]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3E9pG51022169; Sat, 14 Apr 2018 04:51:16 -0500 Received: from DLEE106.ent.ti.com (157.170.170.36) by DLEE110.ent.ti.com (157.170.170.21) 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:16 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE106.ent.ti.com (157.170.170.36) 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:16 -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 w3E9p6Dx017397; Sat, 14 Apr 2018 04:51:14 -0500 From: Vignesh R To: Dmitry Torokhov CC: Vignesh R , Grygorii Strashko , , , , Tony Lindgren Subject: [PATCH v2 3/3] Input: ti_am335x_tsc - Prevent system suspend when TSC is in use Date: Sat, 14 Apr 2018 15:21:53 +0530 Message-ID: <20180414095153.32060-4-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-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Grygorii Strashko Prevent system suspend while user has finger on touch screen, because TSC is wakeup source and suspending device while in use will result in failure to disable the module. This patch uses pm_stay_awake() and pm_relax() APIs to prevent and resume system suspend as required. Signed-off-by: Grygorii Strashko Signed-off-by: Vignesh R --- v2: No changes. drivers/input/touchscreen/ti_am335x_tsc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c index dcd9db768169..43b22e071842 100644 --- a/drivers/input/touchscreen/ti_am335x_tsc.c +++ b/drivers/input/touchscreen/ti_am335x_tsc.c @@ -275,6 +275,7 @@ static irqreturn_t titsc_irq(int irq, void *dev) if (status & IRQENB_HW_PEN) { ts_dev->pen_down = true; irqclr |= IRQENB_HW_PEN; + pm_stay_awake(ts_dev->mfd_tscadc->dev); } if (status & IRQENB_PENUP) { @@ -284,6 +285,7 @@ static irqreturn_t titsc_irq(int irq, void *dev) input_report_key(input_dev, BTN_TOUCH, 0); input_report_abs(input_dev, ABS_PRESSURE, 0); input_sync(input_dev); + pm_relax(ts_dev->mfd_tscadc->dev); } else { ts_dev->pen_down = true; } @@ -524,6 +526,7 @@ static int __maybe_unused titsc_resume(struct device *dev) titsc_writel(ts_dev, REG_IRQWAKEUP, 0x00); titsc_writel(ts_dev, REG_IRQCLR, IRQENB_HW_PEN); + pm_relax(ts_dev->mfd_tscadc->dev); } titsc_step_config(ts_dev); titsc_writel(ts_dev, REG_FIFO0THR,