From patchwork Thu Oct 23 13:48:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 5140761 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0C51E9F349 for ; Thu, 23 Oct 2014 13:51:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2B9D120136 for ; Thu, 23 Oct 2014 13:51:50 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 341C32024F for ; Thu, 23 Oct 2014 13:51:49 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XhIlH-0005LF-9l; Thu, 23 Oct 2014 13:49:07 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XhIlD-0005GH-RK for linux-arm-kernel@lists.infradead.org; Thu, 23 Oct 2014 13:49:05 +0000 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NDW00AM9H5R35B0@mailout2.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 23 Oct 2014 14:51:27 +0100 (BST) X-AuditID: cbfec7f5-b7f956d000005ed7-df-54490735a064 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 80.43.24279.53709445; Thu, 23 Oct 2014 14:48:38 +0100 (BST) Received: from AMDC1943.digital.local ([106.116.151.171]) by eusync4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NDW005PLH0TGQ80@eusync4.samsung.com>; Thu, 23 Oct 2014 14:48:37 +0100 (BST) From: Krzysztof Kozlowski To: "Rafael J. Wysocki" , Pavel Machek , Len Brown , Greg Kroah-Hartman , Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , David Airlie , Kukjin Kim , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [RFC 1/2] PM / Domains: Power on domain early during system resume Date: Thu, 23 Oct 2014 15:48:09 +0200 Message-id: <1414072090-11293-2-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1414072090-11293-1-git-send-email-k.kozlowski@samsung.com> References: <1414072090-11293-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrMLMWRmVeSWpSXmKPExsVy+t/xa7pm7J4hBrMcLG6tO8dq0XvuJJPF xhnrWS2ufH3PZtG8eD2bxaT7E1gsXty7yGLx+oWhRe+Cq2wWZ5vesFvMmrKXyWLT42usFpd3 zWGz+Nx7hNFixvl9TBZrj9xlt7h76iibxZnTl1gtZkx+yeYg7LF4z0smj+3fHrB67J+7ht3j fvdxJo/NS+o9tlxtZ/Ho27KK0WPF6u/sHp83yQVwRnHZpKTmZJalFunbJXBlzHqyhLXgn2TF iW9/mBoYn4h2MXJySAiYSHzYuoIVwhaTuHBvPVsXIxeHkMBSRomWnw1MEE4fk8SvXfvZQarY BIwlNi9fwgZiiwisZ5G4dNALpIhZYD+jxK+7K8FGCQt4S3yZthrMZhFQlXi2axmYzSvgLvH2 93E2iHVyEiePTQaLcwp4SDyd85i5i5EDaJu7xLItFhMYeRcwMqxiFE0tTS4oTkrPNdIrTswt Ls1L10vOz93ECAn4rzsYlx6zOsQowMGoxMNbkewRIsSaWFZcmXuIUYKDWUmEN57VM0SINyWx siq1KD++qDQntfgQIxMHp1QDI/vFFFYNvS0LZqyMymSKkTr0cHfHotlhbcKF9Ysrv4Xt1tDe wCntzHE3U/ido9acifK1hXyzP3UorhBXeiNjuPrAny9sIVO9665e/LxwX3swU/qXZ41cES8W VTusM4mYoNnlvOrmG71vR+yCBNamdP5dqLbe89zxewej16z8Mk29NoLzVVwTqxJLcUaioRZz UXEiADxAs3tWAgAA X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141023_064904_043784_F8F06F37 X-CRM114-Status: GOOD ( 12.20 ) X-Spam-Score: -6.4 (------) Cc: Andrzej Hajda , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Marek Szyprowski X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When resuming the system the power domain has to be powered on early so any runtime PM aware devices could resume. This fixes following scenario reproduced on Exynos DRM: 1. Power domain is off before suspending the system. 2. System is suspended to RAM. 3. Resuming starts. The Exynos DRM driver resume callback is called. 4. The Exynos DRM driver calls drm_helper_resume_force_mode which turns the screen on by calling exynos_dsi_dpms with DRM_MODE_DPMS_ON. 5. The Exynos DSI driver calls pm_runtime_get. The driver runtime resumes and this should turn LCD power domain on. 6. Unfortunately the domain cannot be turned on because system resume is in progress and genpd->prepared_count is positive. Steps to reproduce: 1. Add runtime PM to Exynos DSI driver. 2. Build Exynos DRM/FB without FRAMEBUFFER_CONSOLE. 3. Enable the connector and screen (e.g. with modeset-vsync application). 4. echo 3 > /sys/devices/platform/exynos-drm/graphics/fb0/blank 5. echo mem > /sys/power/state 6. Resume. [ 77.712469] PM: early resume of devices complete after 3.854 msecs [ 77.712739] exynos-dsi 11c80000.dsi: pm_genpd_resume() [ 77.712758] exynos4-fimc 11800000.fimc: pm_genpd_resume() [ 77.712774] exynos4-fimc 11810000.fimc: pm_genpd_resume() [ 77.712787] exynos-drm-fimc 11820000.fimc: pm_genpd_resume() [ 77.712802] exynos-drm-fimc 11830000.fimc: pm_genpd_resume() [ 77.712815] s5p-mipi-csis 11880000.csis: pm_genpd_resume() [ 77.712829] s5p-mipi-csis 11890000.csis: pm_genpd_resume() [ 77.712843] exynos-fimc-lite 12390000.fimc-lite: pm_genpd_resume() [ 77.712856] exynos-fimc-lite 123a0000.fimc-lite: pm_genpd_resume() [ 77.713788] exynos4-fb 11c00000.fimd: pm_genpd_resume() [ 77.713912] wake disabled for irq 184 [ 77.713923] wake disabled for irq 185 [ 77.714082] wake disabled for irq 173 [ 77.715676] wake disabled for irq 176 [ 77.718540] exynos4-fb 11c00000.fimd: pm_genpd_runtime_resume() [ 77.718567] exynos4-fb 11c00000.fimd: state restore latency exceeded, new value 1708 ns [ 77.718636] exynos-dsi 11c80000.dsi: pm_genpd_runtime_resume() [ 77.892366] exynos-dsi 11c80000.dsi: PLL failed to stabilize [ 77.892377] exynos-dsi 11c80000.dsi: failed to configure DSI PLL [ 78.192168] exynos-dsi 11c80000.dsi: timeout waiting for reset [ 78.211578] exynos-dsi 11c80000.dsi: waiting for bus lanes timed out [ 78.307173] exynos-dsi 11c80000.dsi: xfer timed out: d1 00 (null) [ 78.307190] panel_s6e8aa0 11c80000.dsi.0: error -110 reading dcs seq(0xd1) [ 78.307199] panel_s6e8aa0 11c80000.dsi.0: read id failed Signed-off-by: Krzysztof Kozlowski --- drivers/base/power/domain.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 40bc2f4072cc..4fdfe404a04c 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -179,8 +179,7 @@ static int __pm_genpd_poweron(struct generic_pm_domain *genpd) } finish_wait(&genpd->status_wait_queue, &wait); - if (genpd->status == GPD_STATE_ACTIVE - || (genpd->prepared_count > 0 && genpd->suspend_power_off)) + if (genpd->status == GPD_STATE_ACTIVE) return 0; if (genpd->status != GPD_STATE_POWER_OFF) {