Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2407529imu; Thu, 24 Jan 2019 12:13:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN7PbLRiNgD8cBBxp61TkGKlIjDVOiSg35/VR5hZC/Nvyjmgkf1KBByduYYyOXVeFzqVv9SG X-Received: by 2002:a63:8b41:: with SMTP id j62mr7372229pge.182.1548360830953; Thu, 24 Jan 2019 12:13:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548360830; cv=none; d=google.com; s=arc-20160816; b=nzOhoB/DcuxwmWBJgWnNkOxYVzk2OZe3W8w77M1FFSVSARu1JcxGiyQUUaX6v1mkUv VB2I2bZqayvMFoAGptU4PXQsHIaMripQy7jXdPc2ls0n3tFaEp+Xc/N9lDn0SxxBXXFE mi6ON0EALZZPpjUH608KjeW2Yv8naLCBOzc3tySWVV+FVzSzUQRRkTd8BB+XB9HEowrL D4KpIxK1bYHjWjxd6J8tXrVPr6uddj5ecgU+tgtZ4EF0FXfiqAXyP/T0gfYxXgfoM6kh zgwKE4xwKUv9bT1hfLAp38QmHCc5U7t8X0eel4Vc1KlreiiQU062VEmQ8DqGjkoI3EBo 032A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=D0Qv3K7u1ex61XJzxb9DeWz5TpsYfz4NWshpee1Cqeg=; b=clP62CIzlfHxOdZSgB0LbGRyQJX7bdQpwwVc55IqlbWulBd09nP1aL6Ke93f8k0Sen hfhNPFAqvUzUeJa04hbAxBNnj2nhRXQB7yWYWQiD7aq3sdEIj3ESX1b6ShJdcdGjVrR3 Rnv3v6YAk8A188ht/cVystbfm7Lc6g5GXS+PdgbpAA+h7X3OG7p/qkEGM2KcePNviv7I pxqcX/ysFTYvk3e6INlOzXNi6ZPaYQt/qGAh9JX2gUZuXgmEM+V+UCcH9sPIA/sUFiZ2 Q6yphWd4ZQH3zrqcXLEtWHW34bv5KcZIsla9yFh6FlarXsL0ANuRZ6hHVOYy9EjFbOI3 VCfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iMuhFn2V; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h14si22513397pgd.189.2019.01.24.12.13.35; Thu, 24 Jan 2019 12:13:50 -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=@kernel.org header.s=default header.b=iMuhFn2V; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730506AbfAXT0H (ORCPT + 99 others); Thu, 24 Jan 2019 14:26:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:51964 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728496AbfAXT0G (ORCPT ); Thu, 24 Jan 2019 14:26:06 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1852E218FD; Thu, 24 Jan 2019 19:26:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548357965; bh=NUq9K7QgvCbJkydf93Li7Io578NbuvQQA+AgezARIEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iMuhFn2Vm2ermj9CECXYRgEkdIoZobseoKyS0Etn/7fybV3MbGlN3bTiONEdriEKI eebp8NQ8QzppC+2TbfIfrqaP7+NinYUcCK73a/Js1NgBy3xP3BkeI3NixEKTtZ5c+A Bd9Md4q/3L1IAr6DXQ7EFNlzfnPMtadb9EF/XKyo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jon Hunter , Dmitry Osipenko , Thierry Reding , Lee Jones Subject: [PATCH 4.4 052/104] mfd: tps6586x: Handle interrupts on suspend Date: Thu, 24 Jan 2019 20:19:41 +0100 Message-Id: <20190124190201.503309172@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190124190154.968308875@linuxfoundation.org> References: <20190124190154.968308875@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jonathan Hunter commit ac4ca4b9f4623ba5e1ea7a582f286567c611e027 upstream. 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 Signed-off-by: Lee Jones Signed-off-by: Greg Kroah-Hartman --- drivers/mfd/tps6586x.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) --- a/drivers/mfd/tps6586x.c +++ b/drivers/mfd/tps6586x.c @@ -594,6 +594,29 @@ static int tps6586x_i2c_remove(struct i2 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 }, { }, @@ -604,6 +627,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,