From patchwork Mon Jul 6 14:20:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 6725061 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 21EC6C05AC for ; Mon, 6 Jul 2015 14:21:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9719E2057F for ; Mon, 6 Jul 2015 14:21:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 014DE20584 for ; Mon, 6 Jul 2015 14:21:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753145AbbGFOVj (ORCPT ); Mon, 6 Jul 2015 10:21:39 -0400 Received: from mail-qk0-f175.google.com ([209.85.220.175]:36307 "EHLO mail-qk0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750765AbbGFOVj (ORCPT ); Mon, 6 Jul 2015 10:21:39 -0400 Received: by qkei195 with SMTP id i195so117965971qke.3 for ; Mon, 06 Jul 2015 07:21:38 -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=arbg3C6ZDDp8SBKfXhJ7h/5i5zO6Ubke+7ZVlevpZPQ=; b=T9AZfvqadrcMYceZvake6nEp1a3o7iIWXb5Ui0o5wLSZ4FUd06iXDPA+c5gKoMIzX5 kEFRotip/NkxOYtHkeuGMVH/rC3nGLilOMJbdqYW6nP5RQmh4bLYSUTO3IYYgoT3JP/Y uylPFNE9gx30hyPq5qm/o8mGkLjmtgPCbirdsjGS198LSshAjzjS6XnzMKwBiKjAOAXx wagfHM/Dyq3q0phQV4fJAkzgpaIqsnQ04QzJV7L49S95utvexOA0kigrbvmuonxdr3zW OYETQ9r+tKLg9GtUpzUnk4Sr3p1XEWgetFHslcZy8k/PwGVCGn/J8VuYiJN2Hncn3Up6 Le8g== X-Received: by 10.140.108.201 with SMTP id j67mr73243872qgf.83.1436192498164; Mon, 06 Jul 2015 07:21:38 -0700 (PDT) Received: from jade.localdomain ([191.255.48.48]) by mx.google.com with ESMTPSA id f207sm1707424qhc.41.2015.07.06.07.21.35 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jul 2015 07:21:37 -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 v2 21/23] drm/exynos: remove exynos_drm_create_enc_conn() Date: Mon, 6 Jul 2015 11:20:22 -0300 Message-Id: <1436192424-18194-22-git-send-email-gustavo@padovan.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1436192424-18194-1-git-send-email-gustavo@padovan.org> References: <1436192424-18194-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.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 | 13 ++++++------- 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(+), 70 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index e9854d4..4bcc161 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