From patchwork Mon Aug 3 19:09:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 6932831 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 EA4DDC05AC for ; Mon, 3 Aug 2015 19:10:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 34122205D1 for ; Mon, 3 Aug 2015 19:10:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 96D652064E for ; Mon, 3 Aug 2015 19:10:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754894AbbHCTK2 (ORCPT ); Mon, 3 Aug 2015 15:10:28 -0400 Received: from mail-yk0-f178.google.com ([209.85.160.178]:35421 "EHLO mail-yk0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754870AbbHCTK2 (ORCPT ); Mon, 3 Aug 2015 15:10:28 -0400 Received: by ykdu72 with SMTP id u72so118822198ykd.2 for ; Mon, 03 Aug 2015 12:10:27 -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=9ZuMqutvf7yn3ReRj2Cts0PxX0IIEPPyz/Q6SJlHwUU=; b=a6NBzF7/NCiZu5AiGulQvGSoX15XzFaCBqCNGqbUyqJ3hz1C4qA5vawGQpfTdc3n2t i5OxwHEoJhF4cC10uwEeYMrRKN+pF328XEspqsP3JDzBhXsewatCFE3D4r9ObJXk/X+L rcdyBl5nZXJLmJcM++PlCutqnAfAKCg9mQkcDiLrvoi1zXvVRWJoIvO3nlit18Rnjekm 8GCHySQPOTSmYbZp8qXmg0p0x9V9ZP87vgkm/oxZJeuy5zaDHrM0IaQTXKh47g2IWwaR gHccN5YBH3uHZFaavoQBDmYHNFpkpecjOnc+dXw9qll6cUeo0nnGGHTQ6uDDHKuAhOms 0DQg== X-Received: by 10.13.208.193 with SMTP id s184mr22546026ywd.135.1438629027391; Mon, 03 Aug 2015 12:10:27 -0700 (PDT) Received: from jade.localdomain ([187.64.235.140]) by smtp.gmail.com with ESMTPSA id i130sm15006226ywb.21.2015.08.03.12.10.24 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Aug 2015 12:10:26 -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 09/11] drm/exynos: remove exynos_drm_create_enc_conn() Date: Mon, 3 Aug 2015 16:09:56 -0300 Message-Id: <1438628998-3435-10-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 This functions was just hiding the encoder and connector creation in a way that was less clean than if we get rid of it. For example, exynos_encoder ops had .create_connector() defined only because we were handing off the encoder and connector creation to exynos_drm_create_enc_conn(). Without this function we can directly call the create_connector function internally in the code, without the need of any vtable access. It also does some refactoring in the code like creating a bind function for dpi devices. Signed-off-by: Gustavo Padovan --- drivers/gpu/drm/exynos/exynos7_drm_decon.c | 3 +-- drivers/gpu/drm/exynos/exynos_dp_core.c | 20 ++++++++++++++++--- drivers/gpu/drm/exynos/exynos_drm_core.c | 30 ----------------------------- drivers/gpu/drm/exynos/exynos_drm_dpi.c | 26 +++++++++++++++++++++++-- drivers/gpu/drm/exynos/exynos_drm_drv.h | 12 ++++++------ drivers/gpu/drm/exynos/exynos_drm_dsi.c | 20 ++++++++++++------- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 11 +++++++---- drivers/gpu/drm/exynos/exynos_drm_encoder.h | 4 +++- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 3 +-- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 20 ++++++++++--------- drivers/gpu/drm/exynos/exynos_hdmi.c | 21 +++++++++++++++++--- 11 files changed, 101 insertions(+), 69 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index 1b89e94..e1a2ce7 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -682,8 +682,7 @@ static int decon_bind(struct device *dev, struct device *master, void *data) } if (ctx->encoder) - exynos_drm_create_enc_conn(drm_dev, ctx->encoder, - EXYNOS_DISPLAY_TYPE_LCD); + exynos_dpi_bind(drm_dev, ctx->encoder); return 0; diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index 253f955..a4a902a 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c @@ -32,6 +32,7 @@ #include #include "exynos_dp_core.h" +#include "exynos_drm_encoder.h" #define ctx_from_connector(c) container_of(c, struct exynos_dp_device, \ connector) @@ -1104,7 +1105,6 @@ static void exynos_dp_disable(struct exynos_drm_encoder *encoder) } static struct exynos_drm_encoder_ops exynos_dp_encoder_ops = { - .create_connector = exynos_dp_create_connector, .enable = exynos_dp_enable, .disable = exynos_dp_disable, }; @@ -1185,6 +1185,7 @@ 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 resource *res; unsigned int irq_flags; int ret = 0; @@ -1277,8 +1278,21 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data) dp->drm_dev = drm_dev; - return exynos_drm_create_enc_conn(drm_dev, &dp->encoder, - EXYNOS_DISPLAY_TYPE_LCD); + ret = exynos_drm_encoder_create(drm_dev, exynos_encoder, + EXYNOS_DISPLAY_TYPE_LCD); + if (ret) { + DRM_ERROR("failed to create encoder\n"); + return ret; + } + + ret = exynos_dp_create_connector(exynos_encoder); + if (ret) { + DRM_ERROR("failed to create connector ret = %d\n", ret); + drm_encoder_cleanup(&exynos_encoder->base); + return ret; + } + + return 0; } static void exynos_dp_unbind(struct device *dev, struct device *master, diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c index e386452..1f38a44 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_core.c +++ b/drivers/gpu/drm/exynos/exynos_drm_core.c @@ -20,36 +20,6 @@ static LIST_HEAD(exynos_drm_subdrv_list); -int exynos_drm_create_enc_conn(struct drm_device *dev, - struct exynos_drm_encoder *exynos_encoder, - enum exynos_drm_output_type type) -{ - int ret; - unsigned long possible_crtcs = 0; - - ret = exynos_drm_crtc_get_pipe_from_type(dev, type); - if (ret < 0) - return ret; - - possible_crtcs |= 1 << ret; - - /* create and initialize a encoder for this sub driver. */ - ret = exynos_drm_encoder_create(dev, exynos_encoder, possible_crtcs); - if (ret) { - DRM_ERROR("failed to create encoder\n"); - return ret; - } - - ret = exynos_encoder->ops->create_connector(exynos_encoder); - if (ret) { - DRM_ERROR("failed to create connector ret = %d\n", ret); - drm_encoder_cleanup(&exynos_encoder->base); - return ret; - } - - return 0; -} - int exynos_drm_subdrv_register(struct exynos_drm_subdrv *subdrv) { if (!subdrv) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c index 60a3161..6850ce5 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c @@ -20,7 +20,8 @@ #include