From patchwork Mon Aug 3 19:09:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 6932871 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 106B8C05AC for ; Mon, 3 Aug 2015 19:10:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3709720632 for ; Mon, 3 Aug 2015 19:10:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 466F02064E for ; Mon, 3 Aug 2015 19:10:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753741AbbHCTKd (ORCPT ); Mon, 3 Aug 2015 15:10:33 -0400 Received: from mail-yk0-f177.google.com ([209.85.160.177]:36546 "EHLO mail-yk0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754917AbbHCTKd (ORCPT ); Mon, 3 Aug 2015 15:10:33 -0400 Received: by ykeo23 with SMTP id o23so21938654yke.3 for ; Mon, 03 Aug 2015 12:10:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AGOdOnensIRPdk/xGzduBckeSyaaEz03ivuce88TwdA=; b=IETVzf4Fla4E+/nxocauK7uroDs4Fk99S53HSdRZlvrCV4Ecn61dzoSa96i5BMdzL3 cERTCAric9bWXIcVRWQHufEx6q5Rn9hAxlQ03XI3X71/oaOsKOISPMfIN29QYS7mh0EN 3BCDwvfTAgZbscKtytt21YX+ZYACRvmDPhv86kfZhdCE0go7TnWeZdr0J8jrtItf6NOC jh33d0F1es7FqN6FAJQbfwElvedPyr3ZTL14sTCzK4JUI3RnX+hQCqMkxwSH/R3/43az 0CIf5thu+de4/BCnF3mvqa/98uCGxVc1qEfhg1xnpWAwgyb3hfQuCl8bdEfW3jpN/Tot bFJA== X-Received: by 10.170.137.11 with SMTP id e11mr22052276ykc.50.1438629032373; Mon, 03 Aug 2015 12:10:32 -0700 (PDT) Received: from jade.localdomain ([187.64.235.140]) by smtp.gmail.com with ESMTPSA id i130sm15006226ywb.21.2015.08.03.12.10.29 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Aug 2015 12:10:31 -0700 (PDT) From: Gustavo Padovan To: linux-samsung-soc@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, inki.dae@samsung.com, jy0922.shim@samsung.com, tjakobi@math.uni-bielefeld.de, Gustavo Padovan Subject: [PATCH 11/11] drm/exynos: remove struct exynos_drm_encoder layer Date: Mon, 3 Aug 2015 16:09:58 -0300 Message-Id: <1438628998-3435-12-git-send-email-gustavo@padovan.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1438628998-3435-1-git-send-email-gustavo@padovan.org> References: <1438628998-3435-1-git-send-email-gustavo@padovan.org> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 From: Gustavo Padovan struct exynos_drm_encoder was justing wrapping struct drm_encoder, it had only a drm_encoder member and the internal exynos_drm_encoders ops that was directly mapped to the drm_encoder helper funcs. So now exynos DRM uses struct drm_encoder directly, this removes completely the struct exynos_drm_encoder. Signed-off-by: Gustavo Padovan --- drivers/gpu/drm/exynos/Makefile | 7 +- drivers/gpu/drm/exynos/exynos7_drm_decon.c | 2 +- drivers/gpu/drm/exynos/exynos_dp_core.c | 68 ++++++++++++------ drivers/gpu/drm/exynos/exynos_dp_core.h | 2 +- drivers/gpu/drm/exynos/exynos_drm_core.c | 1 - drivers/gpu/drm/exynos/exynos_drm_crtc.c | 1 - drivers/gpu/drm/exynos/exynos_drm_dpi.c | 51 ++++++++------ drivers/gpu/drm/exynos/exynos_drm_drv.c | 1 - drivers/gpu/drm/exynos/exynos_drm_drv.h | 47 ++----------- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 80 +++++++++++---------- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 105 ---------------------------- drivers/gpu/drm/exynos/exynos_drm_encoder.h | 22 ------ drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 71 ++++++++++++++----- drivers/gpu/drm/exynos/exynos_hdmi.c | 85 +++++++++++++--------- 15 files changed, 236 insertions(+), 309 deletions(-) delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_encoder.c delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_encoder.h diff --git a/drivers/gpu/drm/exynos/Makefile b/drivers/gpu/drm/exynos/Makefile index 7de0b10..61c2906 100644 --- a/drivers/gpu/drm/exynos/Makefile +++ b/drivers/gpu/drm/exynos/Makefile @@ -3,10 +3,9 @@ # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/exynos -exynosdrm-y := exynos_drm_drv.o exynos_drm_encoder.o \ - exynos_drm_crtc.o exynos_drm_fbdev.o exynos_drm_fb.o \ - exynos_drm_buf.o exynos_drm_gem.o exynos_drm_core.o \ - exynos_drm_plane.o exynos_drm_dmabuf.o +exynosdrm-y := exynos_drm_drv.o exynos_drm_crtc.o exynos_drm_fbdev.o \ + exynos_drm_fb.o exynos_drm_buf.o exynos_drm_gem.o \ + exynos_drm_core.o exynos_drm_plane.o exynos_drm_dmabuf.o exynosdrm-$(CONFIG_DRM_EXYNOS_IOMMU) += exynos_drm_iommu.o exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD) += exynos_drm_fimd.o diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index e1a2ce7..0792654 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -61,7 +61,7 @@ struct decon_context { atomic_t wait_vsync_event; struct exynos_drm_panel_info panel; - struct exynos_drm_encoder *encoder; + struct drm_encoder *encoder; }; static const struct of_device_id decon_driver_dt_match[] = { diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index a4a902a..19ed422 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c @@ -32,18 +32,18 @@ #include #include "exynos_dp_core.h" -#include "exynos_drm_encoder.h" +#include "exynos_drm_crtc.h" #define ctx_from_connector(c) container_of(c, struct exynos_dp_device, \ connector) static inline struct exynos_drm_crtc *dp_to_crtc(struct exynos_dp_device *dp) { - return to_exynos_crtc(dp->encoder.base.crtc); + return to_exynos_crtc(dp->encoder.crtc); } static inline struct exynos_dp_device *encoder_to_dp( - struct exynos_drm_encoder *e) + struct drm_encoder *e) { return container_of(e, struct exynos_dp_device, encoder); } @@ -889,7 +889,7 @@ static void exynos_dp_hotplug(struct work_struct *work) drm_helper_hpd_irq_event(dp->drm_dev); } -static void exynos_dp_commit(struct exynos_drm_encoder *encoder) +static void exynos_dp_commit(struct drm_encoder *encoder) { struct exynos_dp_device *dp = encoder_to_dp(encoder); int ret; @@ -995,7 +995,7 @@ static struct drm_encoder *exynos_dp_best_encoder( { struct exynos_dp_device *dp = ctx_from_connector(connector); - return &dp->encoder.base; + return &dp->encoder; } static struct drm_connector_helper_funcs exynos_dp_connector_helper_funcs = { @@ -1020,10 +1020,9 @@ static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp, return 0; } -static int exynos_dp_create_connector(struct exynos_drm_encoder *exynos_encoder) +static int exynos_dp_create_connector(struct drm_encoder *encoder) { - struct exynos_dp_device *dp = encoder_to_dp(exynos_encoder); - struct drm_encoder *encoder = &exynos_encoder->base; + struct exynos_dp_device *dp = encoder_to_dp(encoder); struct drm_connector *connector = &dp->connector; int ret; @@ -1053,7 +1052,20 @@ static int exynos_dp_create_connector(struct exynos_drm_encoder *exynos_encoder) return ret; } -static void exynos_dp_enable(struct exynos_drm_encoder *encoder) +static bool exynos_dp_mode_fixup(struct drm_encoder *encoder, + const struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode) +{ + return true; +} + +static void exynos_dp_mode_set(struct drm_encoder *encoder, + struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode) +{ +} + +static void exynos_dp_enable(struct drm_encoder *encoder) { struct exynos_dp_device *dp = encoder_to_dp(encoder); struct exynos_drm_crtc *crtc = dp_to_crtc(dp); @@ -1078,7 +1090,7 @@ static void exynos_dp_enable(struct exynos_drm_encoder *encoder) exynos_dp_commit(&dp->encoder); } -static void exynos_dp_disable(struct exynos_drm_encoder *encoder) +static void exynos_dp_disable(struct drm_encoder *encoder) { struct exynos_dp_device *dp = encoder_to_dp(encoder); struct exynos_drm_crtc *crtc = dp_to_crtc(dp); @@ -1104,11 +1116,17 @@ static void exynos_dp_disable(struct exynos_drm_encoder *encoder) } } -static struct exynos_drm_encoder_ops exynos_dp_encoder_ops = { +static struct drm_encoder_helper_funcs exynos_dp_encoder_helper_funcs = { + .mode_fixup = exynos_dp_mode_fixup, + .mode_set = exynos_dp_mode_set, .enable = exynos_dp_enable, .disable = exynos_dp_disable, }; +static struct drm_encoder_funcs exynos_dp_encoder_funcs = { + .destroy = drm_encoder_cleanup, +}; + static struct video_info *exynos_dp_dt_parse_pdata(struct device *dev) { struct device_node *dp_node = dev->of_node; @@ -1185,10 +1203,10 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data) struct exynos_dp_device *dp = dev_get_drvdata(dev); struct platform_device *pdev = to_platform_device(dev); struct drm_device *drm_dev = data; - struct exynos_drm_encoder *exynos_encoder = &dp->encoder; + struct drm_encoder *encoder = &dp->encoder; struct resource *res; unsigned int irq_flags; - int ret = 0; + int pipe, ret = 0; dp->dev = &pdev->dev; dp->dpms_mode = DRM_MODE_DPMS_OFF; @@ -1278,17 +1296,24 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data) dp->drm_dev = drm_dev; - ret = exynos_drm_encoder_create(drm_dev, exynos_encoder, - EXYNOS_DISPLAY_TYPE_LCD); - if (ret) { - DRM_ERROR("failed to create encoder\n"); - return ret; - } + pipe = exynos_drm_crtc_get_pipe_from_type(drm_dev, + EXYNOS_DISPLAY_TYPE_LCD); + if (pipe < 0) + return pipe; + + encoder->possible_crtcs = 1 << pipe; + + DRM_DEBUG_KMS("possible_crtcs = 0x%x\n", encoder->possible_crtcs); + + drm_encoder_init(drm_dev, encoder, &exynos_dp_encoder_funcs, + DRM_MODE_ENCODER_TMDS); + + drm_encoder_helper_add(encoder, &exynos_dp_encoder_helper_funcs); - ret = exynos_dp_create_connector(exynos_encoder); + ret = exynos_dp_create_connector(encoder); if (ret) { DRM_ERROR("failed to create connector ret = %d\n", ret); - drm_encoder_cleanup(&exynos_encoder->base); + drm_encoder_cleanup(encoder); return ret; } @@ -1319,7 +1344,6 @@ static int exynos_dp_probe(struct platform_device *pdev) if (!dp) return -ENOMEM; - dp->encoder.ops = &exynos_dp_encoder_ops; platform_set_drvdata(pdev, dp); panel_node = of_parse_phandle(dev->of_node, "panel", 0); diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h b/drivers/gpu/drm/exynos/exynos_dp_core.h index f8cc202..e413b6f 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.h +++ b/drivers/gpu/drm/exynos/exynos_dp_core.h @@ -147,7 +147,7 @@ struct link_train { }; struct exynos_dp_device { - struct exynos_drm_encoder encoder; + struct drm_encoder encoder; struct device *dev; struct drm_device *drm_dev; struct drm_connector connector; diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c index 1f38a44..c68a6a2 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_core.c +++ b/drivers/gpu/drm/exynos/exynos_drm_core.c @@ -15,7 +15,6 @@ #include #include "exynos_drm_drv.h" #include "exynos_drm_crtc.h" -#include "exynos_drm_encoder.h" #include "exynos_drm_fbdev.h" static LIST_HEAD(exynos_drm_subdrv_list); diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index 2715c2a..b9b0e9c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c @@ -19,7 +19,6 @@ #include "exynos_drm_crtc.h" #include "exynos_drm_drv.h" -#include "exynos_drm_encoder.h" #include "exynos_drm_plane.h" static void exynos_drm_crtc_enable(struct drm_crtc *crtc) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c index 6850ce5..0476260 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c @@ -20,11 +20,10 @@ #include