From patchwork Thu Sep 14 12:01:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 112549 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp656888qgf; Thu, 14 Sep 2017 05:01:33 -0700 (PDT) X-Google-Smtp-Source: ADKCNb5WyWgYjrFOvtZDUUtNZuT7u1GKQ66TRKMbNBgxYa0Dz7bleNrFpRs/0fMaKzUWSQOg4dgK X-Received: by 10.99.39.129 with SMTP id n123mr21189197pgn.240.1505390493375; Thu, 14 Sep 2017 05:01:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505390493; cv=none; d=google.com; s=arc-20160816; b=FSsSfHqHkf9G/l0MSiuF91n11hmiAuzfUtBklC0sXldcBNZjXtegdMbf5Rfx5M8h54 Lf7ipgNu6g6XPUQQMWpcHR9AvPlNvXePLBFuzK7b7ZltU7d/9FW1dDphgNYRhw9WwTPe W1YKTqB6WDcCZY692qh0NirSY1UbSSO8z1gxlJ/fstbUuqFJG7aqhNUsm+IMdWY6eVac 57eidw0Q1ObxGA84m+XjAe1lvI7JnaEaSSCnrGVsAhC29ySvKvF+dnzr8vvRBLyOuZ0r oguFgLytC+cj+CKBkdHTHbc4RHuh6cMbuzfNM25+8MCmnzFRZCds5+dc33I/cb6GhbMp ftlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=BuRly39DRqDojuI4EH+CU0yyR8j48A0VBbZF4c5Fk9o=; b=CMVgYYBGSkvInqVFjd7dc8fJsgTL2VU3SfIXI2tVsTJM+nHsx/H0nJ/pWUwT9ihhqq WHYEGW4b4s68Y+HPA2NaTDIozylCvz/VsZMDRZEW3aiWvUYJb58F3RBuBf9vRmcQBop4 SpuZypUVsrW6xmXrjzPWKhrSz+igGL8pX0JuSe1dEHraoH56hiFx0t0LHYOMcTDiHQjm sgDrFgp1NXP7DbbwMtqeUDdQwu9xafZBF/5HfJuMdQwITGCwK6qXiiZeeWvePr+T8KTo 4SbKPPxEYYTF76GmvWXOSyI+zhqe2i7YSX1W2WuUBqzAnpDnzzl8KapfocvIc0ztU1JC rjZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k185si1778687pgk.706.2017.09.14.05.01.33; Thu, 14 Sep 2017 05:01:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751666AbdINMBc (ORCPT + 4 others); Thu, 14 Sep 2017 08:01:32 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:36409 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751568AbdINMBb (ORCPT ); Thu, 14 Sep 2017 08:01:31 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20170914120130euoutp01ee9cc07ea633ef9a6c0ae09b88ab550e~kOKzNCBTi1766717667euoutp01L; Thu, 14 Sep 2017 12:01:30 +0000 (GMT) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20170914120129eucas1p2ed1460aa6a9c378cdf2e261b71451906~kOKyfNzX_0301403014eucas1p2F; Thu, 14 Sep 2017 12:01:29 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3.samsung.com (EUCPMTA) with SMTP id ED.CF.12867.99F6AB95; Thu, 14 Sep 2017 13:01:29 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20170914120128eucas1p1760828f9d419c724ec5d69d0d6f9796a~kOKxyBS5t1520215202eucas1p1d; Thu, 14 Sep 2017 12:01:28 +0000 (GMT) X-AuditID: cbfec7f2-f793b6d000003243-d5-59ba6f996387 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 25.BB.18832.89F6AB95; Thu, 14 Sep 2017 13:01:28 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OW900LKEQPY7H20@eusync4.samsung.com>; Thu, 14 Sep 2017 13:01:28 +0100 (BST) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Inki Dae , Joonyoung Shim , Seung-Woo Kim , Andrzej Hajda , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Gustavo Padovan , Daniel Vetter Subject: [PATCH 2/2] drm/exynos: Fix suspend/resume support Date: Thu, 14 Sep 2017 14:01:01 +0200 Message-id: <1505390461-14211-3-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1505390461-14211-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOIsWRmVeSWpSXmKPExsWy7djPc7oz83dFGtz5zmdxa905VouNM9az Wix8eJfZ4srX92wWqx6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JxPb/vxkhbDGJC/fWs3UxcnEICSxhlOi7d5cRwmlikjj3bBkbSBWbgKFE 19suMFtEwE2i6fBMVpAiZoFOZok//d9YQBLCAtYSbc/WM4PYLAKqEi8utoLZvAIeEv+/dbJB rJOTOHlsMiuIzSngKbFpx1SgOAfQNg+JL3NCJjDyLmBkWMUoklpanJueW2yoV5yYW1yal66X nJ+7iREYhNuO/dy8g/HSxuBDjAIcjEo8vA8sd0YKsSaWFVfmHmKU4GBWEuH9EbwrUog3JbGy KrUoP76oNCe1+BCjNAeLkjhv757VkUIC6YklqdmpqQWpRTBZJg5OqQbGgjzXc+/dzD6WrG/v 0L5aXJkd8p5/j1Hjgd2h2ZZe/5bMWNK0y2CT2vlDckrsEvEPqt36Aj4cnJD5MyNWI4Jvn+aZ 7W/PJW9UTN6UJpjZnKkatCJixnPr+otx81auLit+fXi7mG2ZvmlPvb7aOxuHuAltE/5fMJJf oGXCu/lG9OMV16dt+8ivxFKckWioxVxUnAgAaO6Z0j4CAAA= X-CMS-MailID: 20170914120128eucas1p1760828f9d419c724ec5d69d0d6f9796a X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1B?= =?utf-8?b?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?utf-8?q?Marek_Szyprowski=1BSRPOL-Kernel_=28TP=29=1BSam?= =?utf-8?q?sung_Electronics=1BSenior_Software_Engineer?= X-Sender-Code: =?utf-8?q?C10=1BEHQ=1BC10CD02CD027392?= CMS-TYPE: 201P X-CMS-RootMailID: 20170914120128eucas1p1760828f9d419c724ec5d69d0d6f9796a X-RootMTR: 20170914120128eucas1p1760828f9d419c724ec5d69d0d6f9796a References: <1505390461-14211-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Commit 7d902c05b480 ("drm: Nuke drm_atomic_helper_connector_dpms") removed drm_atomic_helper_connector_dpms() helper saying that it was a dead code. It was however indirectly used by Exynos DRM driver for implementing suspend/resume support. To fix this regression (after that patch Exynos DRM suspend/resume functions became no-ops and hardware fails to suspend), this patch rewrites them with drm_atomic_helper_suspend/resume() helpers. Fixes: 7d902c05b480 ("drm: Nuke drm_atomic_helper_connector_dpms") Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/exynos/exynos_drm_drv.c | 40 ++++++++++--------------------- drivers/gpu/drm/exynos/exynos_drm_drv.h | 1 + drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 20 ++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_fbdev.h | 10 ++++++++ 4 files changed, 43 insertions(+), 28 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Acked-by: Krzysztof Kozlowski diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 7f3cfc5dd320..e651a58c18cf 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -168,25 +168,19 @@ static void exynos_drm_lastclose(struct drm_device *dev) static int exynos_drm_suspend(struct device *dev) { struct drm_device *drm_dev = dev_get_drvdata(dev); - struct drm_connector *connector; - struct drm_connector_list_iter conn_iter; + struct exynos_drm_private *private = drm_dev->dev_private; if (pm_runtime_suspended(dev) || !drm_dev) return 0; - drm_modeset_lock_all(drm_dev); - drm_connector_list_iter_begin(drm_dev, &conn_iter); - drm_for_each_connector_iter(connector, &conn_iter) { - int old_dpms = connector->dpms; - - if (connector->funcs->dpms) - connector->funcs->dpms(connector, DRM_MODE_DPMS_OFF); - - /* Set the old mode back to the connector for resume */ - connector->dpms = old_dpms; + drm_kms_helper_poll_disable(drm_dev); + exynos_drm_fbdev_suspend(drm_dev); + private->suspend_state = drm_atomic_helper_suspend(drm_dev); + if (IS_ERR(private->suspend_state)) { + exynos_drm_fbdev_resume(drm_dev); + drm_kms_helper_poll_enable(drm_dev); + return PTR_ERR(private->suspend_state); } - drm_connector_list_iter_end(&conn_iter); - drm_modeset_unlock_all(drm_dev); return 0; } @@ -194,24 +188,14 @@ static int exynos_drm_suspend(struct device *dev) static int exynos_drm_resume(struct device *dev) { struct drm_device *drm_dev = dev_get_drvdata(dev); - struct drm_connector *connector; - struct drm_connector_list_iter conn_iter; + struct exynos_drm_private *private = drm_dev->dev_private; if (pm_runtime_suspended(dev) || !drm_dev) return 0; - drm_modeset_lock_all(drm_dev); - drm_connector_list_iter_begin(drm_dev, &conn_iter); - drm_for_each_connector_iter(connector, &conn_iter) { - if (connector->funcs->dpms) { - int dpms = connector->dpms; - - connector->dpms = DRM_MODE_DPMS_OFF; - connector->funcs->dpms(connector, dpms); - } - } - drm_connector_list_iter_end(&conn_iter); - drm_modeset_unlock_all(drm_dev); + drm_atomic_helper_resume(drm_dev, private->suspend_state); + exynos_drm_fbdev_resume(drm_dev); + drm_kms_helper_poll_enable(drm_dev); return 0; } diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index cf131c2aa23e..f8bae4cb4823 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -202,6 +202,7 @@ struct drm_exynos_file_private { */ struct exynos_drm_private { struct drm_fb_helper *fb_helper; + struct drm_atomic_state *suspend_state; struct device *dma_dev; void *mapping; diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index c3a068409b48..dfb66ecf417b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -18,6 +18,8 @@ #include #include +#include + #include "exynos_drm_drv.h" #include "exynos_drm_fb.h" #include "exynos_drm_fbdev.h" @@ -285,3 +287,21 @@ void exynos_drm_output_poll_changed(struct drm_device *dev) drm_fb_helper_hotplug_event(fb_helper); } + +void exynos_drm_fbdev_suspend(struct drm_device *dev) +{ + struct exynos_drm_private *private = dev->dev_private; + + console_lock(); + drm_fb_helper_set_suspend(private->fb_helper, 1); + console_unlock(); +} + +void exynos_drm_fbdev_resume(struct drm_device *dev) +{ + struct exynos_drm_private *private = dev->dev_private; + + console_lock(); + drm_fb_helper_set_suspend(private->fb_helper, 0); + console_unlock(); +} diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.h b/drivers/gpu/drm/exynos/exynos_drm_fbdev.h index 330eef87f718..8cdc2e8a1c6a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.h +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.h @@ -21,6 +21,8 @@ void exynos_drm_fbdev_fini(struct drm_device *dev); void exynos_drm_fbdev_restore_mode(struct drm_device *dev); void exynos_drm_output_poll_changed(struct drm_device *dev); +void exynos_drm_fbdev_suspend(struct drm_device *drm); +void exynos_drm_fbdev_resume(struct drm_device *drm); #else @@ -39,6 +41,14 @@ static inline void exynos_drm_fbdev_restore_mode(struct drm_device *dev) #define exynos_drm_output_poll_changed (NULL) +static inline void exynos_drm_fbdev_suspend(struct drm_device *drm) +{ +} + +static inline void exynos_drm_fbdev_resume(struct drm_device *drm) +{ +} + #endif #endif