From patchwork Wed Aug 5 23:24:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 6954991 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 6BC62C05AC for ; Wed, 5 Aug 2015 23:24:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E462420664 for ; Wed, 5 Aug 2015 23:24:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 27ADF205BA for ; Wed, 5 Aug 2015 23:24:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753196AbbHEXYw (ORCPT ); Wed, 5 Aug 2015 19:24:52 -0400 Received: from mail-yk0-f182.google.com ([209.85.160.182]:34363 "EHLO mail-yk0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753104AbbHEXYw (ORCPT ); Wed, 5 Aug 2015 19:24:52 -0400 Received: by ykax123 with SMTP id x123so49204240yka.1 for ; Wed, 05 Aug 2015 16:24:51 -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=7Lc158z9RCHVcmnrBP3NoZi/TdUOuN35EajUROaGcpA=; b=JLjVljoDzXo4nJBqZoQo+fzdjPMHLlUPLAQztlHkt2v/g+ngjGS0Na19XdvmXqfvUX b7QN+2JdkA2yQeYki2mltvKUfdsyOhAHrqJ7iTpVXub3fsgHqTRJLFHwNY90TI/wbcda 0nFT82R369egoXOf0iAYZuPsRWEJb1wcGVLW4/FTUIytbz6xmpj7++Ap1RFQvH6EKkHP 4HdDdw3nvg93PS7xpWbbp8SY/YfiRQ7Z2Eyn6gQL30JzGQ77jzdS2PD9mFXBMsO+DvtP wExVQWdz9P2/uZ8RCm/cttX+W7nUibRWrjWdFwA94SnDfrV1o0mhK4ejUCiwBDVjNnwq d/TQ== X-Received: by 10.170.185.134 with SMTP id b128mr11925904yke.85.1438817091526; Wed, 05 Aug 2015 16:24:51 -0700 (PDT) Received: from jade.localdomain ([187.64.235.140]) by smtp.gmail.com with ESMTPSA id u186sm4327588ywa.4.2015.08.05.16.24.48 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Aug 2015 16:24:50 -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 09/11] drm/exynos: remove exynos_drm_create_enc_conn() Date: Wed, 5 Aug 2015 20:24:20 -0300 Message-Id: <1438817060-22164-10-git-send-email-gustavo@padovan.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1438817060-22164-1-git-send-email-gustavo@padovan.org> References: <1438817060-22164-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.0 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 --- v2: check ret value of hdmi_create_connector() --- 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 6d9d115..4d49d25 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) @@ -1107,7 +1108,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, }; @@ -1188,6 +1188,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; @@ -1280,8 +1281,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