Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp2452101imc; Sat, 23 Feb 2019 03:49:37 -0800 (PST) X-Google-Smtp-Source: AHgI3Ibeobp95gK4ROP4IHIwtHOOEvV3vbjx7hBD/sFSkjZ/RFTdAlaOKdValXEIyj1VSnXjKtZh X-Received: by 2002:a17:902:a5c9:: with SMTP id t9mr8833992plq.196.1550922577509; Sat, 23 Feb 2019 03:49:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550922577; cv=none; d=google.com; s=arc-20160816; b=MqP2DTbq3uphMAui94zkbMIlZXRMMWLaZjQz88dLVZf304w8k+altBPFd1icKMIxtY U08bLDqM+jtHqXxJmT3ey0Ip3hXIMonNrY0sn+AGkerhhGfXeGCSd4J7xC46smnMAC58 XAxpR40Sg5v5/OjSoH6vaahbTukCuJG8rlnmmDhjwYaEPHgjEkIYym6VYpwOuRtpNuJ4 aezcyEYQ6P9gM7GquN2hKjAGtg3FbL42yHexRVqQmAFfttN9ZuQ7FGzSFgrdvF5F82M9 MTH9jsm6zHJEmg68zf0ZAXoYe7t00REvbLmg3rq2xGF1ghsxDh7Evo2/vB1gGYbpw9IT N8fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=dfnI8AG/7RIuy5XqMAGsaQ0IY1OdRaijN2fALgWLVrU=; b=yDvEWN/nlOJiXm8GFLi1fu3UQheDD+zclY44cof6KxU/bhjOjUP2xY9hxfIFknTjWM mAU8Dxf8B2m0hasIAK/p6Jnf6VhfLbIV3uSUTS6wMt53NWiRIvg/vtPBidX1LbcJLbUY 7U2BkCUQMcUjGmY8/PTCNEatN47TdzZPPvmc0HvBvUoyZGe3inu+QsghWVygpL2n5zgp YluE93Phg4dOF2LlP4ZK/EhWSyj1ab1WiCAPJKeiV+EoiZtdhNv5rSwxCjIurtvRZbiw ny4GYCf6E0AUaa/rVilOw6fBqdrFwPD5Vu+VsQ/okR+ZHcH8sPxZmYH9sB3A8/A7h4MB nGnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kemnade.info header.s=20180802 header.b=RF1syzuj; 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 d19si3582153pgg.314.2019.02.23.03.49.21; Sat, 23 Feb 2019 03:49:37 -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=fail header.i=@kemnade.info header.s=20180802 header.b=RF1syzuj; 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 S1727803AbfBWLsG (ORCPT + 99 others); Sat, 23 Feb 2019 06:48:06 -0500 Received: from mail.andi.de1.cc ([85.214.239.24]:52030 "EHLO h2641619.stratoserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726326AbfBWLsF (ORCPT ); Sat, 23 Feb 2019 06:48:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kemnade.info; s=20180802; h=Message-Id:Date:Subject:Cc:To:From:Sender: Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=dfnI8AG/7RIuy5XqMAGsaQ0IY1OdRaijN2fALgWLVrU=; b=RF1syzujEm6nb856B6hByhKLPl rzTWwjk9hN2kj5lg2skaTXUzKr129JIzemmfc2ICJn8qMDBAXVFMKZ8V+MBAlNYXuCkFYb2H46Dpk Ckgkw4req9MEGJKgRjSpFn7Ay5HRDAr4XLu6C6ZgnfTMVbDZoR/YvGsZlXpKxsT8pQCM=; Received: from p200300ccfbc075001a3da2fffebfd33a.dip0.t-ipconnect.de ([2003:cc:fbc0:7500:1a3d:a2ff:febf:d33a] helo=aktux) by h2641619.stratoserver.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gxVmh-0003rx-IA; Sat, 23 Feb 2019 12:47:59 +0100 Received: from andi by aktux with local (Exim 4.89) (envelope-from ) id 1gxVmh-0004Fq-Bx; Sat, 23 Feb 2019 12:47:59 +0100 From: Andreas Kemnade To: tony@atomide.com, lee.jones@linaro.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Wolfram Sang , linux-i2c@vger.kernel.org, Dave Gerlach , Grygorii Strashko , Keerthy , Tero Kristo , letux-kernel@openphoenux.org Cc: Andreas Kemnade Subject: [PATCH] mfd: twl-core: disable irq while suspended Date: Sat, 23 Feb 2019 12:47:54 +0100 Message-Id: <20190223114754.16286-1-andreas@kemnade.info> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Andreas Kemnade --- 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.11.0