Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2571790yba; Mon, 6 May 2019 08:10:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqzBP74sOqjgOViKMOfztURABgAqoFmo6HqEC1q9zkhc3sY77hIZD6wvgUr07/d+SForOoLG X-Received: by 2002:a65:6145:: with SMTP id o5mr32561214pgv.262.1557155419575; Mon, 06 May 2019 08:10:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557155419; cv=none; d=google.com; s=arc-20160816; b=NIpkGKdL+ilnBu5KKZg5JmTdZ54YbK10Fmk9PFupHKmULbogrthlLySQ/zO/Qtp4lf MoAt7nGOU/9cvwcCngaoxkdG2fJldXXN3dye4I9Kh9WYyj5w0Pr/0IlHMr8ZHvhUyo7C t/Ena4ohvk41HiWdVVWyzvGhVmilRRkfiDclxSxSA8nsUNAoqYghnXepW/kE0ItvyYAA /rVThPX4tzgKQvwJLy6npKZimaGHPEb+j8WNx+6O3O51pt7A4dexXQnAp4golal88HR1 FSs7atW1wPYFwswNBWh4l9r2YG5X0l8QUUwRo2PfJjiUedLN9ZdVliCs87aD/nyXFaJB ugPg== 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=PKpHUYnc93saOxVpFvrR60xPjRP+f1odz1UG1waOAyg=; b=NiOngq86tjBHKxdj6WlPCjNA127KcV+BhIZXsxcimJK8yzBtKy1j2+YAjY+4v8v89t VdUU1sATpqxj/k3PzoYXkMSkNkynnM61YCVZRQiVwWZ6PsKG0tA9bSg5yBUB/M7ncSJB DBzsVOBDj4em/cFpVwPoTXEnMnrMP2tIilUpx8jeEof4Gq895t58FXbau7IczVPe/viQ a1FezuAQaCRKguGm8oZhZb1XsPAJcybmoQE3XjqkCfPFVXlkn64H74I34gv5uTpoC9cD loJdFQhLxzjFrDirDHL/hrM0/S4Qhbq8RFHbFu+eEFeehv3TYgqsIGmKqiSmVO3NkiqJ qcqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DMxM2xtQ; 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 14si15411293ple.218.2019.05.06.08.10.03; Mon, 06 May 2019 08:10:19 -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=@kernel.org header.s=default header.b=DMxM2xtQ; 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 S1727145AbfEFPI5 (ORCPT + 99 others); Mon, 6 May 2019 11:08:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:56138 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727043AbfEFOf4 (ORCPT ); Mon, 6 May 2019 10:35:56 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 E3FE021479; Mon, 6 May 2019 14:35:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557153355; bh=78zibKYhiig/J4kVmq6XTXpHwwwZRz64lGOKhh4NTDo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DMxM2xtQJVDSGl6WTwiyaYpzow+wd91sIHn6riOc6C5UM6UBx+6I0TJc9+U4KnFfZ xj+W1eJ+l42CJ3bClWCRevvgAZ7EjsMZWwUygwpJLO3F0b9ApXQ4HnrcPYmarHTDzW dfBr/jpi7QJI9O/AnMg81BzX5C5LAYlTiQAkCLYA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andreas Kemnade , Tony Lindgren , Lee Jones , "Sasha Levin (Microsoft)" Subject: [PATCH 5.0 058/122] mfd: twl-core: Disable IRQ while suspended Date: Mon, 6 May 2019 16:31:56 +0200 Message-Id: <20190506143100.226604550@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190506143054.670334917@linuxfoundation.org> References: <20190506143054.670334917@linuxfoundation.org> User-Agent: quilt/0.66 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 [ Upstream commit 20bb907f7dc82ecc9e135ad7067ac7eb69c81222 ] Since commit 6e2bd956936 ("i2c: omap: Use noirq system sleep pm ops to idle device for suspend") on gta04 we have handle_twl4030_pih() called in situations where pm_runtime_get() in i2c-omap.c returns -EACCES. [ 86.474365] Freezing remaining freezable tasks ... (elapsed 0.002 seconds) done. [ 86.485473] printk: Suspending console(s) (use no_console_suspend to debug) [ 86.555572] Disabling non-boot CPUs ... [ 86.555664] Successfully put all powerdomains to target state [ 86.563720] twl: Read failed (mod 1, reg 0x01 count 1) [ 86.563751] twl4030: I2C error -13 reading PIH ISR [ 86.563812] twl: Read failed (mod 1, reg 0x01 count 1) [ 86.563812] twl4030: I2C error -13 reading PIH ISR [ 86.563873] twl: Read failed (mod 1, reg 0x01 count 1) [ 86.563903] twl4030: I2C error -13 reading PIH ISR This happens when we wakeup via something behing twl4030 (powerbutton or rtc alarm). This goes on for minutes until the system is finally resumed. Disable the irq on suspend and enable it on resume to avoid having i2c access problems when the irq registers are checked. Fixes: 6e2bd956936 ("i2c: omap: Use noirq system sleep pm ops to idle device for suspend") Signed-off-by: Andreas Kemnade Tested-by: Tony Lindgren Signed-off-by: Lee Jones Signed-off-by: Sasha Levin (Microsoft) --- drivers/mfd/twl-core.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index 299016bc46d9..104477b512a2 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c @@ -1245,6 +1245,28 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) return status; } +static int __maybe_unused twl_suspend(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + + if (client->irq) + disable_irq(client->irq); + + return 0; +} + +static int __maybe_unused twl_resume(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + + if (client->irq) + enable_irq(client->irq); + + return 0; +} + +static SIMPLE_DEV_PM_OPS(twl_dev_pm_ops, twl_suspend, twl_resume); + static const struct i2c_device_id twl_ids[] = { { "twl4030", TWL4030_VAUX2 }, /* "Triton 2" */ { "twl5030", 0 }, /* T2 updated */ @@ -1262,6 +1284,7 @@ static const struct i2c_device_id twl_ids[] = { /* One Client Driver , 4 Clients */ static struct i2c_driver twl_driver = { .driver.name = DRIVER_NAME, + .driver.pm = &twl_dev_pm_ops, .id_table = twl_ids, .probe = twl_probe, .remove = twl_remove, -- 2.20.1