From patchwork Tue Feb 7 09:16:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 9559587 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 2AFF260434 for ; Tue, 7 Feb 2017 09:18:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1435E2236A for ; Tue, 7 Feb 2017 09:18:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 050D02832F; Tue, 7 Feb 2017 09:18:53 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5B58D2236A for ; Tue, 7 Feb 2017 09:18:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BEF5E6E626; Tue, 7 Feb 2017 09:18:51 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4895B6E627 for ; Tue, 7 Feb 2017 09:18:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 25713202FF; Tue, 7 Feb 2017 09:18:49 +0000 (UTC) Received: from localhost.localdomain (li411-102.members.linode.com [106.187.91.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 47B82202FE; Tue, 7 Feb 2017 09:18:37 +0000 (UTC) From: Shawn Guo To: Daniel Vetter Subject: [PATCH v3 08/23] drm: exynos: use vblank hooks in struct drm_crtc_funcs Date: Tue, 7 Feb 2017 17:16:20 +0800 Message-Id: <1486458995-31018-9-git-send-email-shawnguo@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1486458995-31018-1-git-send-email-shawnguo@kernel.org> References: <1486458995-31018-1-git-send-email-shawnguo@kernel.org> X-Virus-Scanned: ClamAV using ClamSMTP Cc: Neil Armstrong , Liviu Dudau , Laurent Pinchart , Daniel Vetter , Marek Vasut , Alexey Brodkin , Russell King , Xinliang Liu , Tomi Valkeinen , Mali DP Maintainers , Ben Skeggs , Jyri Sarha , dri-devel@lists.freedesktop.org, Maxime Ripard X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Shawn Guo The vblank hooks in struct drm_driver are deprecated and only meant for legacy drivers. For modern drivers with DRIVER_MODESET flag, the hooks in struct drm_crtc_funcs should be used instead. As the result, exynos_drm_crtc_enable[disable]_vblank() become static functions. They are moved around a bit to save forward declaration though. Also while at it, we move one step further to kill exynos_drm_crtc_from_pipe() completely by updating hdmi_bind() a bit. Signed-off-by: Shawn Guo Cc: Inki Dae Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 40 ++++++++++++++++---------------- drivers/gpu/drm/exynos/exynos_drm_crtc.h | 2 -- drivers/gpu/drm/exynos/exynos_drm_drv.c | 3 --- drivers/gpu/drm/exynos/exynos_drm_drv.h | 8 ------- drivers/gpu/drm/exynos/exynos_hdmi.c | 7 ++++-- 5 files changed, 25 insertions(+), 35 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index 5367b6664fe3..fa32091af924 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c @@ -122,6 +122,24 @@ static void exynos_drm_crtc_destroy(struct drm_crtc *crtc) kfree(exynos_crtc); } +static int exynos_drm_crtc_enable_vblank(struct drm_crtc *crtc) +{ + struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); + + if (exynos_crtc->ops->enable_vblank) + return exynos_crtc->ops->enable_vblank(exynos_crtc); + + return 0; +} + +static void exynos_drm_crtc_disable_vblank(struct drm_crtc *crtc) +{ + struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc); + + if (exynos_crtc->ops->disable_vblank) + exynos_crtc->ops->disable_vblank(exynos_crtc); +} + static const struct drm_crtc_funcs exynos_crtc_funcs = { .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip, @@ -129,6 +147,8 @@ static void exynos_drm_crtc_destroy(struct drm_crtc *crtc) .reset = drm_atomic_helper_crtc_reset, .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, + .enable_vblank = exynos_drm_crtc_enable_vblank, + .disable_vblank = exynos_drm_crtc_disable_vblank, }; struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev, @@ -168,26 +188,6 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev, return ERR_PTR(ret); } -int exynos_drm_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe) -{ - struct exynos_drm_crtc *exynos_crtc = exynos_drm_crtc_from_pipe(dev, - pipe); - - if (exynos_crtc->ops->enable_vblank) - return exynos_crtc->ops->enable_vblank(exynos_crtc); - - return 0; -} - -void exynos_drm_crtc_disable_vblank(struct drm_device *dev, unsigned int pipe) -{ - struct exynos_drm_crtc *exynos_crtc = exynos_drm_crtc_from_pipe(dev, - pipe); - - if (exynos_crtc->ops->disable_vblank) - exynos_crtc->ops->disable_vblank(exynos_crtc); -} - int exynos_drm_crtc_get_pipe_from_type(struct drm_device *drm_dev, enum exynos_drm_output_type out_type) { diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.h b/drivers/gpu/drm/exynos/exynos_drm_crtc.h index 6a581a8af465..4e986ba92320 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.h +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.h @@ -23,8 +23,6 @@ struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev, enum exynos_drm_output_type type, const struct exynos_drm_crtc_ops *ops, void *context); -int exynos_drm_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe); -void exynos_drm_crtc_disable_vblank(struct drm_device *dev, unsigned int pipe); void exynos_drm_crtc_wait_pending_update(struct exynos_drm_crtc *exynos_crtc); void exynos_drm_crtc_finish_update(struct exynos_drm_crtc *exynos_crtc, struct exynos_drm_plane *exynos_plane); diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index a1c22eb12f4b..b4522f67b3cb 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -22,7 +22,6 @@ #include #include "exynos_drm_drv.h" -#include "exynos_drm_crtc.h" #include "exynos_drm_fbdev.h" #include "exynos_drm_fb.h" #include "exynos_drm_gem.h" @@ -263,8 +262,6 @@ static void exynos_drm_lastclose(struct drm_device *dev) .preclose = exynos_drm_preclose, .lastclose = exynos_drm_lastclose, .postclose = exynos_drm_postclose, - .enable_vblank = exynos_drm_crtc_enable_vblank, - .disable_vblank = exynos_drm_crtc_disable_vblank, .gem_free_object_unlocked = exynos_drm_gem_free_object, .gem_vm_ops = &exynos_drm_gem_vm_ops, .dumb_create = exynos_drm_gem_dumb_create, diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index cf6e08cb35a7..cb3176930596 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -222,14 +222,6 @@ struct exynos_drm_private { wait_queue_head_t wait; }; -static inline struct exynos_drm_crtc * -exynos_drm_crtc_from_pipe(struct drm_device *dev, int pipe) -{ - struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe); - - return to_exynos_crtc(crtc); -} - static inline struct device *to_dma_dev(struct drm_device *dev) { struct exynos_drm_private *priv = dev->dev_private; diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 5ed8b1effe71..752e8a3afc79 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -42,7 +42,6 @@ #include -#include "exynos_drm_drv.h" #include "exynos_drm_crtc.h" #define HOTPLUG_DEBOUNCE_MS 1100 @@ -1657,6 +1656,8 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data) struct drm_device *drm_dev = data; struct hdmi_context *hdata = dev_get_drvdata(dev); struct drm_encoder *encoder = &hdata->encoder; + struct exynos_drm_crtc *exynos_crtc; + struct drm_crtc *crtc; int ret, pipe; hdata->drm_dev = drm_dev; @@ -1668,7 +1669,9 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data) hdata->phy_clk.enable = hdmiphy_clk_enable; - exynos_drm_crtc_from_pipe(drm_dev, pipe)->pipe_clk = &hdata->phy_clk; + crtc = drm_crtc_from_index(drm_dev, pipe); + exynos_crtc = to_exynos_crtc(crtc); + exynos_crtc->pipe_clk = &hdata->phy_clk; encoder->possible_crtcs = 1 << pipe;