Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6269661imu; Mon, 21 Jan 2019 06:08:48 -0800 (PST) X-Google-Smtp-Source: ALg8bN6Mm0GQDm8zHvzMbCC4628EWo2ILToXOnw1GIbBD9DOrPWmnVX5BU5ZdAvr1lI/yUAL44PH X-Received: by 2002:a63:9a09:: with SMTP id o9mr27163789pge.94.1548079728008; Mon, 21 Jan 2019 06:08:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548079727; cv=none; d=google.com; s=arc-20160816; b=blVkHLVC1P4qRhXeOGUCEKe003aygjRuItgEu7WjWDGUbLge2vML9q9KQ+Hufj+6Tk fHwmZMCM1wXkGpmSUb45V/fbdrEvK+IrcaxqGfViEkr7dswF4qDiMVNZWiXpU/Rwfkei x2u756ddtQL8ZB+gaLYoV2N3VlwD4VB5xqx0pc8R0gRrIflxySOi9efx6YZxBMJ2I7ze 4M4AeQTH7RRwAf1BIvHKcaoowwyuBiCdMRuQH0WBMBz+UEyPHgrPigyg2ZWjqG+SjetS JnbeeBJBFm9XMX8tmDcayyNdiS5Ieh+I6BEGsC7fPW5SAfOJU55XK+TcwPtT/iqPp7du Kv/Q== 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=5d4FvbsbYNw2vJ0GRlsom/157rCJV/7PW3sMgbKS8nk=; b=fQs4y+9AGB6DkUr9H0iLdn3TBcir0214oUiMJfsIkJ0sPKQg1YLXkr5eNMsfGGZUSy L9sDNBuCNpcMmQ0DfdXFvJWbiW+GZ2vtChVjb5JWm00x0Wd9axV+7p/1Imz6naJR7fsf Bg9Q22tFkVn6snKaLar1mLnHru/fzLrpmQ6TttZtIyOJNGm2gI1a9sfPe3QH2S89Uf0x cxDvjsHcs3lyhDKGOOvt7tzzUr33YE1+iHpo5xwpgzcsPqMVuDiCx1ABbHKlkllgufRW 1qbhI9RJN3JnyAfJ27XdtCdZm3cp80HQCv3nDXzcwjb1QoYvn+qUoeeoT7UcLnBA7P6B 4Xpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MLp0B1si; 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 p10si9944876pgi.549.2019.01.21.06.08.32; Mon, 21 Jan 2019 06:08:47 -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=MLp0B1si; 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 S1732374AbfAUOAW (ORCPT + 99 others); Mon, 21 Jan 2019 09:00:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:46840 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732367AbfAUOAV (ORCPT ); Mon, 21 Jan 2019 09:00:21 -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 D0D2B2084C; Mon, 21 Jan 2019 14:00:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548079220; bh=rmNxFb8V1JQfNnIDsaFd+oELqZu5FFJ639lHwa9mS4A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MLp0B1siT6uBUEmlWln4Wc7zH8IznS+VS3OtAEant27Gd9F3bGra1oGLLGCFRRrq0 xT9KvJ4yJXe652rbvVoxfZGMruDwRR9Hukvoxy3PJ41N8Sw1Ozw21BP7U09AGpWtt1 hpw2d3BRiygwkMN0wP+u6COBzzGd8IkpAMsPa+U8= 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.19 50/99] mfd: tps6586x: Handle interrupts on suspend Date: Mon, 21 Jan 2019 14:48:42 +0100 Message-Id: <20190121134915.878420227@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121134913.924726465@linuxfoundation.org> References: <20190121134913.924726465@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.19-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 @@ -592,6 +592,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 }, { }, @@ -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,