From patchwork Sat Mar 1 10:56:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 25571 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f198.google.com (mail-vc0-f198.google.com [209.85.220.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 71416206A6 for ; Sat, 1 Mar 2014 10:56:31 +0000 (UTC) Received: by mail-vc0-f198.google.com with SMTP id lf12sf4379965vcb.1 for ; Sat, 01 Mar 2014 02:56:31 -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=M0lPCfSjaFcBJh0W4wog8jEGuodlcqIyhclnuHWziHNUwdMLIwOBle++x7PABbmjei OsYSAJZtJtWGByDg7dvHGyW62ozdtvQxlBD2Vo8j+xSF9Ev4oo3I3uAU+yTwIloEb91I zfQfNl/o2gKk1Nyq/u1cN8AA74F6uUvb5o3K/QW/zi4nOm21Xj1AYi/rNICP/qm36oTO 4z89b1W4+Za0oI7d52WZWjox7GhBhako3myWaN8wT7RwY6r4QQjtx/CPZJxeXRACTB8p 5XcAMQXvsVI9YBzMWTcrCPLtXflWCreS/q8sqsDsTcWWo8cmkH3Z2+pkunBabUuzN/IH kkRw== X-Gm-Message-State: ALoCoQnkm7XJX9oy6S/CAPk5RdkYM1irD+TMNJcQmC35+lU2BeFBiJdrjnkShVYZLaSXqq/o4oK5 X-Received: by 10.58.111.202 with SMTP id ik10mr3396203veb.4.1393671391174; Sat, 01 Mar 2014 02:56:31 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.101.134 with SMTP id u6ls1363869qge.79.gmail; Sat, 01 Mar 2014 02:56:31 -0800 (PST) X-Received: by 10.220.114.135 with SMTP id e7mr6967365vcq.23.1393671391091; Sat, 01 Mar 2014 02:56:31 -0800 (PST) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id t20si1326223vek.41.2014.03.01.02.56.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 01 Mar 2014 02:56:31 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id sa20so1832115veb.8 for ; Sat, 01 Mar 2014 02:56:31 -0800 (PST) X-Received: by 10.52.161.130 with SMTP id xs2mr303647vdb.49.1393671390951; Sat, 01 Mar 2014 02:56:30 -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.130.193 with SMTP id u1csp114211vcs; Sat, 1 Mar 2014 02:56:30 -0800 (PST) X-Received: by 10.152.120.201 with SMTP id le9mr17090lab.68.1393671389595; Sat, 01 Mar 2014 02:56:29 -0800 (PST) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com [209.85.215.46]) by mx.google.com with ESMTPS id qn8si7920082lbb.78.2014.03.01.02.56.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 01 Mar 2014 02:56:29 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.46 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id hr17so3442813lab.33 for ; Sat, 01 Mar 2014 02:56:29 -0800 (PST) X-Received: by 10.152.28.7 with SMTP id x7mr23359lag.57.1393671388984; Sat, 01 Mar 2014 02:56:28 -0800 (PST) Received: from linaro-ulf.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id qf1sm4532484lbc.8.2014.03.01.02.56.26 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 01 Mar 2014 02:56:27 -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 , Greg Kroah-Hartman , Mark Brown , Russell King , Linus Walleij , Wolfram Sang , Alessandro Rubini , Josh Cartwright , Ulf Hansson Subject: [PATCH 5/8] i2c: nomadik: Fixup system suspend Date: Sat, 1 Mar 2014 11:56:08 +0100 Message-Id: <1393671371-2398-6-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1393671371-2398-1-git-send-email-ulf.hansson@linaro.org> References: <1393671371-2398-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.128.177 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