Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5104299imu; Tue, 13 Nov 2018 00:57:22 -0800 (PST) X-Google-Smtp-Source: AJdET5cM41sepnOS0TDF45yOot3c02VKAv3UYLpBkV+W9n4czbiWJXWRpczolM2JVX7FJI933XBo X-Received: by 2002:a62:6d07:: with SMTP id i7-v6mr4458097pfc.146.1542099442565; Tue, 13 Nov 2018 00:57:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542099442; cv=none; d=google.com; s=arc-20160816; b=TMBashNNvHdj9IpqEGHaNOeIiuAhnZg9Y5C+UqGbq36wqOE9luvC91eU7E/kj73M48 srMc3j8mGuAcoHoj/0a+lYA8YNc1FpmtLlzx2PBUUSvJgzfVNb91H0lylf9SsSa5ACTD cHA3S5BaOfbcQaW+aml+Zs3q5Wh3CKiTXF1WIzUE3esCGn5r4n/oa9w4o9oArVi8JSAp FmeyPIfEKJXBgec5wBpB1kBV21wmebfHw6l4+L/apQ9Iw7ikLPiGO+AjE/53/kCjeAES ML3SvMlA6R/e7Tdf9PRj2D6tZ6C4ag4muaxyH7zu3rtakeJm55WgZ/W1CRrO7YNJ8269 /Xdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:mime-version:message-id :date:subject:cc:to:from; bh=NK2ImQiyOwIwhfQ/Fnvw8XrWahGyWWTJDCMqfUu6rGQ=; b=cou0dlqufx0zj1ijCShq08lidC/80+LfGqDmXy3QB+qC+hFW3baLWHJLcOcbUaVZRY T8/5m+uSHQZ9pbneSyobQvRqsPD8Mz0qvSYBUkXyBqWAFB3sLFCpV8IXsh9lUNvS80De 53pZQr694Snf0A5LpkNU6XDhcG//wP58kDdXTilYNYRiF6HtaGeFl1MF0ZebMiUVV5n6 iYVKoWsqfX02CI4E1AYtzMhSA1/q13VLcUj6ByxEJKl7K4BPtW1SAzQWpBI4JRDN+yzW oVgjbCnyj0girw9EjVC3LQ/DvLcNDKRHFCrEiChTWXcwvB5m/TmyZFl/7TCZ+V95YyMM HcTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=GTtHfQE5; 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=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1si18710556pgq.36.2018.11.13.00.57.06; Tue, 13 Nov 2018 00:57:22 -0800 (PST) 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=@nvidia.com header.s=n1 header.b=GTtHfQE5; 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=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731001AbeKMSxs (ORCPT + 99 others); Tue, 13 Nov 2018 13:53:48 -0500 Received: from hqemgate15.nvidia.com ([216.228.121.64]:5287 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726245AbeKMSxs (ORCPT ); Tue, 13 Nov 2018 13:53:48 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 13 Nov 2018 00:56:34 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 13 Nov 2018 00:56:41 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 13 Nov 2018 00:56:41 -0800 Received: from HQMAIL104.nvidia.com (172.18.146.11) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 13 Nov 2018 08:56:40 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL104.nvidia.com (172.18.146.11) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 13 Nov 2018 08:56:40 +0000 Received: from moonraker.nvidia.com (Not Verified[10.21.132.148]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Tue, 13 Nov 2018 00:56:40 -0800 From: Jon Hunter To: Lee Jones CC: , , Dmitry Osipenko , Thierry Reding , Jonathan Hunter , Subject: [RESEND PATCH] mfd: tps6586x: Handle interrupts on suspend Date: Tue, 13 Nov 2018 08:56:31 +0000 Message-ID: <1542099391-7338-1-git-send-email-jonathanh@nvidia.com> X-Mailer: git-send-email 2.7.4 X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1542099394; bh=NK2ImQiyOwIwhfQ/Fnvw8XrWahGyWWTJDCMqfUu6rGQ=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: X-NVConfidentiality:MIME-Version:Content-Type; b=GTtHfQE581eEbyFpuUzCeKaKUaHKknLAH8ztRcUhyTsobSzHRnOrWyvWSi+PFN6w6 bdEQJ3zIBNIPCQdnmqVbTCti55HqkKTEoXhfy6tdy3TdIaFN136+PxFkR9nM8Lh40P cNN3sH3NiZn6jeFkiFK3z0t2hrQZdY8kyFDspL4rzQ2dZqRAfwM2Ih3m3WJMt6KK1u gWLe3Sh8ViaMJqOveT38PRqnhNNJpmmHRdHeqMyqpP0cLFZutHUg6ZPA8loonr/w6j ycdfBqZpCwXlo+y4eDy227n+Xf8yPrEfBVxhSh8T9gFxhMVQTHzwDsy5WF/hjhoi3Z 6KSYKppm0g99g== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonathan Hunter The tps6586x driver creates an irqchip that is used by its various child devices for managing interrupts. The tps6586x-rtc device is one of its children that uses the tps6586x irqchip. When using the tps6586x-rtc as a wake-up device from suspend, the following is seen: PM: Syncing filesystems ... done. Freezing user space processes ... (elapsed 0.001 seconds) done. OOM killer disabled. Freezing remaining freezable tasks ... (elapsed 0.000 seconds) done. Disabling non-boot CPUs ... Entering suspend state LP1 Enabling non-boot CPUs ... CPU1 is up tps6586x 3-0034: failed to read interrupt status tps6586x 3-0034: failed to read interrupt status The reason why the tps6586x interrupt status cannot be read is because the tps6586x interrupt is not masked during suspend and when the tps6586x-rtc interrupt occurs, to wake-up the device, the interrupt is seen before the i2c controller has been resumed in order to read the tps6586x interrupt status. The tps6586x-rtc driver sets it's interrupt as a wake-up source during suspend, which gets propagated to the parent tps6586x interrupt. However, the tps6586x-rtc driver cannot disable it's interrupt during suspend otherwise we would never be woken up and so the tps6586x must disable it's interrupt instead. Prevent the tps6586x interrupt handler from executing on exiting suspend before the i2c controller has been resumed by disabling the tps6586x interrupt on entering suspend and re-enabling it on resuming from suspend. Cc: stable@vger.kernel.org Signed-off-by: Jon Hunter Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Acked-by: Thierry Reding --- drivers/mfd/tps6586x.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c index b89379782741..9c7925ca13cf 100644 --- a/drivers/mfd/tps6586x.c +++ b/drivers/mfd/tps6586x.c @@ -592,6 +592,29 @@ static int tps6586x_i2c_remove(struct i2c_client *client) return 0; } +static int __maybe_unused tps6586x_i2c_suspend(struct device *dev) +{ + struct tps6586x *tps6586x = dev_get_drvdata(dev); + + if (tps6586x->client->irq) + disable_irq(tps6586x->client->irq); + + return 0; +} + +static int __maybe_unused tps6586x_i2c_resume(struct device *dev) +{ + struct tps6586x *tps6586x = dev_get_drvdata(dev); + + if (tps6586x->client->irq) + enable_irq(tps6586x->client->irq); + + return 0; +} + +static SIMPLE_DEV_PM_OPS(tps6586x_pm_ops, tps6586x_i2c_suspend, + tps6586x_i2c_resume); + static const struct i2c_device_id tps6586x_id_table[] = { { "tps6586x", 0 }, { }, @@ -602,6 +625,7 @@ static struct i2c_driver tps6586x_driver = { .driver = { .name = "tps6586x", .of_match_table = of_match_ptr(tps6586x_of_match), + .pm = &tps6586x_pm_ops, }, .probe = tps6586x_i2c_probe, .remove = tps6586x_i2c_remove, -- 2.7.4