From patchwork Tue Aug 29 00:59:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 9926631 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 14D7B60380 for ; Tue, 29 Aug 2017 01:10:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0741828821 for ; Tue, 29 Aug 2017 01:10:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F048328825; Tue, 29 Aug 2017 01:10:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6CF5428821 for ; Tue, 29 Aug 2017 01:10:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UKMhrh4O7cfJzrBRK4zRkLZ2HwoZBmiFAY0x6rcgHQY=; b=GNsD4edcbF+5mH avmo35/RIMS/PUMypB+kjn1Z98K0fLQzRAfY76rLnYMWMITy/Xpnz0hFQlP6sGZCEboaWlRP/Ad+m p30rfdGwrDaXdISgGDq7mxcCWs/STEpXc9kOFkflXbHyXPzL6HPJ2aoddfaYeLwt2bw2SPv546vvT wZiaQe3hHvZBb3WiCN/CnWr07RgjrqJWcPdq2X0MyHWsBQExjlaNN6qPBFGtZQ7mGVU488Aor3atw soG4FVnJiwoO7/uBjloRGQdPpy27d02hBWom5m2KH2VbNg8vbftXJEJqxHpJCex5iJurMl0zw/P/C ZKlsa5gYKQfAn2yz5/ew==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dmV2y-0007Qt-UJ; Tue, 29 Aug 2017 01:10:28 +0000 Received: from cloudserver094114.home.net.pl ([79.96.170.134]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dmV2v-0006CD-2Z for linux-arm-kernel@lists.infradead.org; Tue, 29 Aug 2017 01:10:27 +0000 Received: from 79.184.253.199.ipv4.supernova.orange.pl (79.184.253.199) (HELO aspire.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.82) id 8c59de3d6cbe6d1b; Tue, 29 Aug 2017 03:10:00 +0200 From: "Rafael J. Wysocki" To: Ulf Hansson Subject: [PATCH 3/3] PM: i2c-designware-platdrv: System sleep handling rework Date: Tue, 29 Aug 2017 02:59:49 +0200 Message-ID: <6543072.R9SdZCE16v@aspire.rjw.lan> In-Reply-To: <4245176.X6JjkhnUAM@aspire.rjw.lan> References: <1503499329-28834-1-git-send-email-ulf.hansson@linaro.org> <4245176.X6JjkhnUAM@aspire.rjw.lan> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170828_181025_378598_3A449CD4 X-CRM114-Status: UNSURE ( 9.22 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jisheng Zhang , Guodong Xu , linux-pm@vger.kernel.org, Wolfram Sang , Greg Kroah-Hartman , Kevin Hilman , linux-i2c@vger.kernel.org, linux-acpi@vger.kernel.org, Jarkko Nikula , Haojian Zhuang , John Stultz , Andy Shevchenko , Mika Westerberg , Sumit Semwal , linux-arm-kernel@lists.infradead.org, Len Brown Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rafael J. Wysocki Rework the power management part of the i2c-designware-platdrv driver so that its ->suspend and ->resume callbacks do not point to the callback routines used by it for runtime PM. Instead, point its late suspend and early resume callbacks to pm_runtime_force_suspend() and pm_runtime_force_resume(), respectively, and make it set the SAFE_SUSPEND driver flag (introduced earlier) to instruct the generic ACPI PM domain code that the driver can cope with runtime suspended devices in its system sleep callbacks. Signed-off-by: Rafael J. Wysocki --- drivers/i2c/busses/i2c-designware-platdrv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Index: linux-pm/drivers/i2c/busses/i2c-designware-platdrv.c =================================================================== --- linux-pm.orig/drivers/i2c/busses/i2c-designware-platdrv.c +++ linux-pm/drivers/i2c/busses/i2c-designware-platdrv.c @@ -358,6 +358,7 @@ static int dw_i2c_plat_probe(struct plat if (dev->pm_disabled) { pm_runtime_forbid(&pdev->dev); } else { + dev->power.driver_flags = DPM_FLAG_SAFE_SUSPEND; pm_runtime_set_autosuspend_delay(&pdev->dev, 1000); pm_runtime_use_autosuspend(&pdev->dev); pm_runtime_set_active(&pdev->dev); @@ -455,7 +456,8 @@ static int dw_i2c_plat_resume(struct dev static const struct dev_pm_ops dw_i2c_dev_pm_ops = { .prepare = dw_i2c_plat_prepare, .complete = dw_i2c_plat_complete, - SET_SYSTEM_SLEEP_PM_OPS(dw_i2c_plat_suspend, dw_i2c_plat_resume) + SET_LATE_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) SET_RUNTIME_PM_OPS(dw_i2c_plat_suspend, dw_i2c_plat_resume, NULL) };