Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1369745ybj; Thu, 7 May 2020 23:03:36 -0700 (PDT) X-Google-Smtp-Source: APiQypICULlCl485r53IE1xt8d9l499Xow5lnEbNuQE2KPvpWwb8ZKY/2ASXO2wrTH0c/3cQNPRa X-Received: by 2002:a05:6402:30bb:: with SMTP id df27mr751302edb.267.1588917815930; Thu, 07 May 2020 23:03:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588917815; cv=none; d=google.com; s=arc-20160816; b=V6S3Mjgvbx5NSPZvM2b7Q5BU6MBoD/EC0el2HN9Z8hiib8RArwCPj87zmMjRk7UU+7 nSaZUTu65MNwO6FxQjhc+ixUGfmRFFXGr9bg4UmDjcDFNghaqb7ausqjEoNK3+P4BTgf JbqF/tgIRD2vzd7/P0Ximulwejs2RFwzE/X5lCCsHjO209ss0i4dV+g4AoLrX+Qs/0LZ yeSNojZafL8tRPHv6ZhGmi8DoA4cr7hEQ+okPqbDuso6aRU5XtKXIE7G7zpb8zKGbK6l wwpVGXSQ2z2p0SBMr3yGC4Mqo8dRxmVakZB9IpfNRAwqQFS71aaaUvPZHSUbObMAY6q0 VSow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=RwLqyxWNTN+TDvGqPMxCTypAEi1O4APsZEKo1jh/UnM=; b=PJmT2YMTRyRiWLjhNd4oz5IF/OPuILswRnMvq7U8EB1azA6R/Ok5/8RMqwO5jd+yO6 WAFSPfwWh0/mKR50G44RGG/4Q1CoRdojFGfKtAUXlBgukCk2kGf1c5jgs1B3Cr1edw27 HeWrfmP+nmMPaWiixPV0w46IoEWjutIv5A1F1Jr7td/6cqTWLLgYDHDTPBEbI9sJozPS ALXyj79ksbY8VcmvYQyczLbgD71P5IvlExa2MaOVjWkavBUD5cyICsNnUd7jwivtkDVm bYyZ0+0UbddZh71ifhMHx5m1nALYFMS1OGjnf34TlFUtDF2lC7JSGu6Az+yi3qnISArG 41ng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f19si425093edm.263.2020.05.07.23.03.12; Thu, 07 May 2020 23:03:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728128AbgEHF7J (ORCPT + 99 others); Fri, 8 May 2020 01:59:09 -0400 Received: from esa4.mentor.iphmx.com ([68.232.137.252]:45906 "EHLO esa4.mentor.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727104AbgEHF7H (ORCPT ); Fri, 8 May 2020 01:59:07 -0400 IronPort-SDR: kd2aHmj3S5MtHjs5/Y3KvnLZ3qZnvdYSKtn8Sipzo6oY0Q2B3k8tPkhOX6XtVIZO/GKZvDahP8 BeCFAiRC4TtI7YkeJrbLmcVi+gRnmWSjrmGlEPO1bIq8RvTpipyPJBpkBEdmiu6rbE5O5YDP5d imz4L2K8V6aoD9ko5RVcxEML7RCKDheY8NdTKiQrmsPxL7vbSOJrJacfNba4ugoCfwWyx+B2FF 8yflF2KMDQriBPWyjNxIzVwvpD//i/rxcsoCHFgiR+h31ppHxsmrStb6fxp8ZGPMRsRZR+IZqG vxI= X-IronPort-AV: E=Sophos;i="5.73,366,1583222400"; d="scan'208";a="48710641" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 07 May 2020 21:59:06 -0800 IronPort-SDR: n7cFua7QuikEzDD4KAs4w9QXmKbbTSm0kImUI6TqaYGu54Wx/g73pXxFjrKfjUU05Fj9Nkg93J s6CIQwZy+ukF5mmnmmOXIjfGEh5wcfMqDXY9v+YXnsPqWT7jInihLmGrWjCZEBNHe5+cPXp6zM YjQ7lJ/FxbVqRqtoz20/Ah2n0M5PppgONTfH3FBOzKscXy837AbCpc5ag9+nV6M20u2zOkmhdt XcxT+qSoRoShU+vIusp0MguBJluS4H4IrS6+zKoHjqNSiy1XgWZuRvd5xphpvx3FEyCh7MPpTV dzY= From: Jiada Wang To: , , , , CC: , , , , Subject: [PATCH v11 33/56] Input: atmel_mxt_ts - delay enabling IRQ when not using regulators Date: Thu, 7 May 2020 22:56:33 -0700 Message-ID: <20200508055656.96389-34-jiada_wang@mentor.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200508055656.96389-1-jiada_wang@mentor.com> References: <20200508055656.96389-1-jiada_wang@mentor.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The path of enabling the IRQ in the probe function is not safe in level triggered operation, if it was already powered up and there is a message waiting on the device (eg finger down) because the object table has not yet been read. This forces the ISR into a hard loop. Delay enabling the interrupt until it is first needed, by set flag IRQ_NOAUTOEN. Signed-off-by: Jiada Wang CC: Dmitry Osipenko --- drivers/input/touchscreen/atmel_mxt_ts.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 7c9a738e633a..ab4eceac8fe7 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -3822,6 +3822,7 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) return error; } + irq_set_status_flags(client->irq, IRQ_NOAUTOEN); error = devm_request_threaded_irq(&client->dev, client->irq, NULL, mxt_interrupt, IRQF_ONESHOT, client->name, data); @@ -3831,17 +3832,19 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) } if (data->suspend_mode == MXT_SUSPEND_REGULATOR) { + enable_irq(data->irq); + error = mxt_probe_regulators(data); if (error) return error; + + disable_irq(data->irq); } else if (data->reset_gpio) { msleep(MXT_RESET_GPIO_TIME); gpiod_set_value(data->reset_gpio, 1); msleep(MXT_RESET_INVALID_CHG); } - disable_irq(data->irq); - error = mxt_initialize(data); if (error) return error; -- 2.17.1