From patchwork Thu Feb 20 15:31:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 25060 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 249FE203C6 for ; Thu, 20 Feb 2014 15:31:41 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id g12sf7834267oah.10 for ; Thu, 20 Feb 2014 07:31:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=x5X4vLrabIhyCPyvsVr2meSEBCH+iRLslgOGJwNv0co=; b=i8j6Zu0onsL7tax7RuXkYBJNJKnXvf3uvuphau6G4VxCc03SBwaJxnFXIiA11KmWSy cxrdN9bgsj60JQFUpcJuBo4qtkpBNgpWwzAytcGXnQubmWf7M/40Q72iPXuesztzImRQ KKsFMCDrdSzi9B+8KGcYxmAm3Qxy0MIdktteNDWlYxXR+PgdrqnXXKgmX1czYu7nrCL1 HhgLz/80mheu6LXe3dlqjSp/5cPDV2JTRiFBtBiLkTuYLDgfIvi2MZhQfWxsMZDlZn7z OYmz2wfM6UvCJwPWJw5HQBSppgMxPByxWl5K6TxdpnbOBf0hxVJrDRKiuiqA4fLna1z0 M/RQ== X-Gm-Message-State: ALoCoQn/Fs5Bkxn34Nj5KRn5siPOr0g2FdXFgjkE8ypHmPqExxQGLVPSCfSjZ0dYYYicVp/lCRER X-Received: by 10.50.114.105 with SMTP id jf9mr3437131igb.1.1392910300356; Thu, 20 Feb 2014 07:31:40 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.27.117 with SMTP id 108ls525092qgw.77.gmail; Thu, 20 Feb 2014 07:31:40 -0800 (PST) X-Received: by 10.220.71.20 with SMTP id f20mr1356243vcj.70.1392910300210; Thu, 20 Feb 2014 07:31:40 -0800 (PST) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id yb7si1581603vec.115.2014.02.20.07.31.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Feb 2014 07:31:40 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id lh14so2000974vcb.38 for ; Thu, 20 Feb 2014 07:31:40 -0800 (PST) X-Received: by 10.52.107.35 with SMTP id gz3mr1149556vdb.8.1392910300119; Thu, 20 Feb 2014 07:31:40 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp67166vcz; Thu, 20 Feb 2014 07:31:39 -0800 (PST) X-Received: by 10.180.164.229 with SMTP id yt5mr7592890wib.49.1392910298853; Thu, 20 Feb 2014 07:31:38 -0800 (PST) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by mx.google.com with ESMTPS id gf8si5092086wjc.150.2014.02.20.07.31.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Feb 2014 07:31:38 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.50 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=74.125.82.50; Received: by mail-wg0-f50.google.com with SMTP id z12so1587012wgg.29 for ; Thu, 20 Feb 2014 07:31:38 -0800 (PST) X-Received: by 10.180.185.197 with SMTP id fe5mr7617645wic.56.1392910298377; Thu, 20 Feb 2014 07:31:38 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id h9sm9719799wjz.16.2014.02.20.07.31.36 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Feb 2014 07:31:37 -0800 (PST) From: Ulf Hansson To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , linux-pm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Kevin Hilman , Alan Stern , Mark Brown , Russell King , Linus Walleij , Wolfram Sang , Alessandro Rubini , Ulf Hansson Subject: [PATCH 5/8] i2c: nomadik: Fixup system suspend Date: Thu, 20 Feb 2014 16:31:17 +0100 Message-Id: <1392910280-12891-6-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1392910280-12891-1-git-send-email-ulf.hansson@linaro.org> References: <1392910280-12891-1-git-send-email-ulf.hansson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , For !CONFIG_PM_RUNTIME, the device were never put back into active state while resuming. For CONFIG_PM_RUNTIME, we blindly trusted the device to be inactive while we were about to handle it at suspend late, which is just too optimistic. Even if the driver uses pm_runtime_put_sync() after each tranfer to return it's runtime PM resources, there are no guarantees this will actually mean the device will inactivated. The reason is that the PM core will prevent runtime suspend during system suspend, and thus when a transfer occurs during the early phases of system suspend the device will be kept active after the transfer. To handle both issues above, use pm_runtime_force_suspend|resume() from the system suspend|resume callbacks. Cc: Alessandro Rubini Cc: Linus Walleij Cc: Wolfram Sang Signed-off-by: Ulf Hansson --- drivers/i2c/busses/i2c-nomadik.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c index 8082f5c..519f5b8 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c @@ -879,19 +879,19 @@ static irqreturn_t i2c_irq_handler(int irq, void *arg) #ifdef CONFIG_PM_SLEEP static int nmk_i2c_suspend_late(struct device *dev) { - pinctrl_pm_select_sleep_state(dev); + int ret; + ret = pm_runtime_force_suspend(dev); + if (ret) + return ret; + + pinctrl_pm_select_sleep_state(dev); return 0; } static int nmk_i2c_resume_early(struct device *dev) { - /* First go to the default state */ - pinctrl_pm_select_default_state(dev); - /* Then let's idle the pins until the next transfer happens */ - pinctrl_pm_select_idle_state(dev); - - return 0; + return pm_runtime_force_resume(dev); } #endif