Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6272479imu; Mon, 21 Jan 2019 06:11:15 -0800 (PST) X-Google-Smtp-Source: ALg8bN5MRcxxL+PA9j+JN0/AZWVprR9bZSeofh6YExt1kNqdF9NXGDfKsvLbEZY8izGe13uHCmQi X-Received: by 2002:a62:6503:: with SMTP id z3mr29161648pfb.169.1548079875420; Mon, 21 Jan 2019 06:11:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548079875; cv=none; d=google.com; s=arc-20160816; b=c/RDNWmzK1sevwtAnPFcmTd8BAnG4pHPt7NeCEOJlLaY2Wme+waSc1YH/K+s348hCs GUuYAcT1mIfVZggtc+QbRncmGLwce3w+Y5U6FXK4luqFVNwf/7pul+RAfLVEJeEc3vrm ynrgm3ayngyZS/N7w1zbuCYiHObMXS46LDgkKm8uWtuZN/LRDO2BOLGAGO8K5034JYHv HS22wvo1B+cAsgTWceVnlVXzz1q8y86YCUoFURkrh5tjcRivu7iHYdvUG1tA/y5IDOGx 3NHihUpTyTKwilBZOefKExXfIVXDzgm1zY1NabWs44EyzRqCjk3ebODAVyM4NA6l0vIK BkNw== 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=XB7tpVGIwkEFCZ8uRquVcLtBJOQ2JZv+071TUdXBrtw=; b=S/+ICDan6msrrTgpvxhG7Z5tOZVpcL9TZOam0pvbsqG/cWKTdUMvLgWmslB2+nPyiW YoipJqP5DAjH05t8922STXPWBruJ7ABDXIVQg3ZNu6RJoBw4hT6w8fDWTQso6dfGvBX5 mlX5RLW7B9J0piNXOl6nh5I4PNlSNqm2/nExFCD19BmMVzLnYph76vkNmKFH/wqCAXyU y1LiwbPlcW0LQM2D8kDmksQX+BWwOBl3BtFuwYX+N95oUosZ3t+yYyOpo74RENzRGkGC zb81PWDuaHlHGC8ytxfEReaY0n1XhSbJj5U2vGPUgBI9LotQCVo09TuJQF+bv16oY+L4 MAVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mufkVxFN; 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 r6si12297071pli.248.2019.01.21.06.10.59; Mon, 21 Jan 2019 06:11:15 -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=mufkVxFN; 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 S1731191AbfAUOJZ (ORCPT + 99 others); Mon, 21 Jan 2019 09:09:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:39848 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731679AbfAUNzQ (ORCPT ); Mon, 21 Jan 2019 08:55:16 -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 8CFB32084C; Mon, 21 Jan 2019 13:55:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548078916; bh=Xd7RkH0h/qmc0mCl/9jAwcldtwdtPVJr1MTL8jwz620=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mufkVxFN9L4u0nNU/weMI516gqdgTYANUGJuOHHNdhroLlgpnKsAifHV5elkpE3iE 224qxMjKSYY36tSfgrPeiUsBUWSWbNJH/IYZdbsaL3GJl7IqaU/u38XR8HeNgkeo/3 BBtpxVyOp6CH5qYmhupPEY8LHp+ASIZCJozXIFZc= 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.9 28/51] mfd: tps6586x: Handle interrupts on suspend Date: Mon, 21 Jan 2019 14:44:24 +0100 Message-Id: <20190121122456.215402890@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121122453.700446926@linuxfoundation.org> References: <20190121122453.700446926@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.9-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,