Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp7091048ybn; Mon, 30 Sep 2019 08:31:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxVD+6LChZJNAm3BoQhTdhPSEMkByi7wlOL8BwGhyC/xP4LcjU0CE26YXrVBP+hI2/NgB41 X-Received: by 2002:a05:6402:121a:: with SMTP id c26mr20815246edw.100.1569857497104; Mon, 30 Sep 2019 08:31:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569857497; cv=none; d=google.com; s=arc-20160816; b=RGYmicgxvO2zg5oKLiMctISIVxhRy15mefYS/qr98p90mEtgh8NiIqnTfynTa9XGfg 2+v4KoU4ehcaE129mL4gXwFNbiwrCfzdWwT9Etf/63nvAu8ojz5uH7XpSxA8ZfDYLHPi NnFpRSIssFGsCIJbrNyv0x452Ck9lzVT1JbqgEiAnkUysvW5Qwx7TsjUyDQJhZpjknX/ 4QhPl8iB/npprXx174PM10afakfTQVg8Pu5w7UVxUvmNJL5QrVQjKWrxW9SSmraDlKiR l/Mq3XN1ZvuKqycqfEwTjKiMKXR6xu8IChZq5ZdglqgzLZBpTgmyYmYa395a5oUwPtSb Q9bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=GcQj6Rd9F3KLevHVxis1OmxH3WVUvsmgXjMTIJqkIFg=; b=ZLRY/5v1O91zJ2Qgb7eg9GfvNuTvMYB/+4qZStacdG0LQ8Q9TXHHO1LeF3v74NJFKx qkzkV6IgI2dFTFUTkyYjIVU55Y0vqUO0ulskcy0uy2rz8k2PSkfq9rC2eLsqjyh1kj1j eOHCVcnAcVsKuFaVTZH861NvM/ZmDsf+QlAbL9ZqADC/dH9wA2rtr/kRmECpzYYaqSTX SUZVYiCncqOkZUqt04D5DOWkEeJjlEVr0fZQHJoRT83cKhbz7XB2i67T5RaAkVVtC/q1 TILI6RfSVsHYs848Wtemha3lVtfhNhDYzd2QWHC1zppXsdkjklc9kLR0GP4RkhW8qC3y AcIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=YRKoZku4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ns21si7098928ejb.167.2019.09.30.08.31.12; Mon, 30 Sep 2019 08:31:37 -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; dkim=pass header.i=@chromium.org header.s=google header.b=YRKoZku4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732022AbfI3P3s (ORCPT + 99 others); Mon, 30 Sep 2019 11:29:48 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:41249 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730809AbfI3P3s (ORCPT ); Mon, 30 Sep 2019 11:29:48 -0400 Received: by mail-lf1-f66.google.com with SMTP id r2so7360514lfn.8 for ; Mon, 30 Sep 2019 08:29:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GcQj6Rd9F3KLevHVxis1OmxH3WVUvsmgXjMTIJqkIFg=; b=YRKoZku4KnTPIutFbWgtdiIEXuEq2kFBYAHLjWVBAEIc7HkbxZtYTWPaO8ybwJfh/G uFAGnzV940ibk70MdpNMBMwiYmlhz6ySOXR2VA7v7BaWU1ZYGh9ZMzdHPwCBbBWX5O1f gWW4L64pcsKVCOfVF2OPnqp5LyGYrfKIUos4U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GcQj6Rd9F3KLevHVxis1OmxH3WVUvsmgXjMTIJqkIFg=; b=MHjtVjst2mDmYPJJUOyOiXpeAtcupy3a7il2AmtwFNR90pisPeSIpX11biHgJTZEL1 svG0lt5B1N63+GBaSoPgbcfDDhkYOFPazGVzLsbcZ05g33ZHcaJhR5HVm2sEyfa3JFf7 YVWtmKDWehbDpr+e0/+57z1eUIYeYUna4Jb2bOj7Bo0POSuJpM0G7TjACFenJPl3ZmGs ypA+Glxnld1Oz32sGpyUTMC+8QE7470F6CgrmR1SobCOC540wvst3WG7V73KASO74hWz 8AfAlSmmLxfw7B5t0Aw9qF/lTZV23mdq0RzL4jVwpgu0TxukYDI7zJgnMPdbVsridbGG 1ZIA== X-Gm-Message-State: APjAAAW7NBTmsmzUKjPkJYk98yIqO3in0SpbjbMQth9EO/f1jwzz+RtL tLegqgfifrPOAuOMYWOkH8//7X2F7AY= X-Received: by 2002:a19:2c1:: with SMTP id 184mr11862060lfc.100.1569857385725; Mon, 30 Sep 2019 08:29:45 -0700 (PDT) Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com. [209.85.208.178]) by smtp.gmail.com with ESMTPSA id o2sm3316895lfl.20.2019.09.30.08.29.44 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Sep 2019 08:29:44 -0700 (PDT) Received: by mail-lj1-f178.google.com with SMTP id j19so9991628lja.1 for ; Mon, 30 Sep 2019 08:29:44 -0700 (PDT) X-Received: by 2002:a2e:9f12:: with SMTP id u18mr12939698ljk.23.1569857383671; Mon, 30 Sep 2019 08:29:43 -0700 (PDT) MIME-Version: 1.0 References: <20190924215238.184750-1-evgreen@chromium.org> <20190928001626.GT237523@dtor-ws> In-Reply-To: <20190928001626.GT237523@dtor-ws> From: Evan Green Date: Mon, 30 Sep 2019 08:29:06 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] Input: atmel_mxt_ts - Disable IRQ across suspend To: Dmitry Torokhov Cc: Nick Dyer , Jongpil Jung , Furquan Shaikh , Rajat Jain , LKML , linux-input@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 27, 2019 at 5:16 PM Dmitry Torokhov wrote: > > Hi Evan, > > On Tue, Sep 24, 2019 at 02:52:38PM -0700, Evan Green wrote: > > Across suspend and resume, we are seeing error messages like the following: > > > > atmel_mxt_ts i2c-PRP0001:00: __mxt_read_reg: i2c transfer failed (-121) > > atmel_mxt_ts i2c-PRP0001:00: Failed to read T44 and T5 (-121) > > > > This occurs because the driver leaves its IRQ enabled. Upon resume, there > > is an IRQ pending, but the interrupt is serviced before both the driver and > > the underlying I2C bus have been resumed. This causes EREMOTEIO errors. > > > > Disable the IRQ in suspend, and re-enable it on resume. If there are cases > > where the driver enters suspend with interrupts disabled, that's a bug we > > should fix separately. > > > > Signed-off-by: Evan Green > > --- > > > > Changes in v2: > > - Enable and disable unconditionally (Dmitry) > > > > drivers/input/touchscreen/atmel_mxt_ts.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c > > index 24c4b691b1c9..a58092488679 100644 > > --- a/drivers/input/touchscreen/atmel_mxt_ts.c > > +++ b/drivers/input/touchscreen/atmel_mxt_ts.c > > @@ -3155,6 +3155,7 @@ static int __maybe_unused mxt_suspend(struct device *dev) > > mxt_stop(data); > > > > mutex_unlock(&input_dev->mutex); > > + disable_irq(data->irq); > > > > return 0; > > } > > @@ -3174,6 +3175,7 @@ static int __maybe_unused mxt_resume(struct device *dev) > > mxt_start(data); > > > > mutex_unlock(&input_dev->mutex); > > + enable_irq(data->irq); > > At least for older devices that do soft reset on resume we need > interrupts to already work when we call mxt_start(). > > In general, order of resume steps should mirror suspend. Ok, I can move the enable_irq up towards the top of resume. I was worried that a pending IRQ might not get handled correctly if mxt_start() hadn't been called yet. But if we need IRQs for mxt_start() to run anyway, then I guess it should be handled. -Evan