From patchwork Tue Oct 29 16:13:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 3109201 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 208119F2B7 for ; Tue, 29 Oct 2013 16:19:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F0F842037F for ; Tue, 29 Oct 2013 16:19:08 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 6D6C92037A for ; Tue, 29 Oct 2013 16:19:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 50028EEBEB; Tue, 29 Oct 2013 09:16:00 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qa0-f47.google.com (mail-qa0-f47.google.com [209.85.216.47]) by gabe.freedesktop.org (Postfix) with ESMTP id C1001EEBBB for ; Tue, 29 Oct 2013 09:14:17 -0700 (PDT) Received: by mail-qa0-f47.google.com with SMTP id k15so3009638qaq.20 for ; Tue, 29 Oct 2013 09:14:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GLf27hWyQnCiE0Ks663G7hA0QZAnOdmccbvbTAhYXqw=; b=HDNBLMkuu6Hkb5UOqQunaJBUQuG14N8yHixsKv7+WOxuSwRMVQ164TQtYmEvaqS2CV /9G1U71JKKHAQj7fsYQWGcdQ7UcOohS6j+X2E7L7xEyMZA80LYJr1uv8DaVSsAHtVc5I hLFJP2hE7myJHsVP0OCjpzerloPvMbQsz8z8Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GLf27hWyQnCiE0Ks663G7hA0QZAnOdmccbvbTAhYXqw=; b=HK7Wyv4LqRKeWoFhfcz98PVByz9zcR5VcPkxxR2xd+tqXplZjnIN7rmX/2EvDqp5U1 cLooLOYh5OWO2Qcarfg+92gFGOcHDOsdap+s+HqECe/JNd5TF/gQ1ay80gFXivpUbUua mCLAwHslwRC+1tBvy2BRLK+E2mvOSqVsUeHjlfoE7B1LAw+xTBR+Q8DtDy04UotOJvNQ yzcVS50Rw/CYtmGJCBd+jM9RKWXMO3VpUOklvxw4EIPmiPQUaaxbhbeoWQEy7j2xM/Nz 6jPImL5HScVaeyHEk2dvvTnjbI9QcdlY1ezZxIlyr0e38ESMYz/TkqyFqI2GiOl2lSNS zXdA== X-Gm-Message-State: ALoCoQk7fbQf1nLgIojA+bgOETD2VIf1Mbj5PA/grE1Bm03BeIQnsswO1t7MKEhCL0Fh6JmjzmSb X-Received: by 10.49.109.10 with SMTP id ho10mr548685qeb.84.1383063257306; Tue, 29 Oct 2013 09:14:17 -0700 (PDT) Received: from seanpaul-glaptop.roam.corp.google.com (cpe-173-095-180-236.nc.res.rr.com. [173.95.180.236]) by mx.google.com with ESMTPSA id h9sm66581946qaq.9.2013.10.29.09.14.16 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 29 Oct 2013 09:14:16 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, inki.dae@samsung.com Subject: [PATCH v3 31/32] drm/exynos: Move lvds bridge discovery into DP driver Date: Tue, 29 Oct 2013 12:13:17 -0400 Message-Id: <1383063198-10526-32-git-send-email-seanpaul@chromium.org> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1383063198-10526-1-git-send-email-seanpaul@chromium.org> References: <1383063198-10526-1-git-send-email-seanpaul@chromium.org> Cc: marcheu@chromium.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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 This patch moves the lvds bridge discovery and connector pre-emption code from exynos common code into the dp driver (since the bridge is only applicable for dp). Signed-off-by: Sean Paul --- Changes in v3: - Added to the patchset drivers/gpu/drm/exynos/exynos_dp_core.c | 41 ++++++++++++++++++++++++++++++++ drivers/gpu/drm/exynos/exynos_drm_core.c | 41 -------------------------------- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index 139ea15..32ba791 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "exynos_drm_drv.h" #include "exynos_dp_core.h" @@ -31,6 +32,11 @@ #define ctx_from_connector(c) container_of(c, struct exynos_dp_device, \ connector) +struct bridge_init { + struct i2c_client *client; + struct device_node *node; +}; + static int exynos_dp_init_dp(struct exynos_dp_device *dp) { exynos_dp_reset(dp); @@ -972,6 +978,35 @@ static int exynos_dp_initialize(struct exynos_drm_display *display, return 0; } +static bool find_bridge(const char *compat, struct bridge_init *bridge) +{ + bridge->client = NULL; + bridge->node = of_find_compatible_node(NULL, NULL, compat); + if (!bridge->node) + return false; + + bridge->client = of_find_i2c_device_by_node(bridge->node); + if (!bridge->client) + return false; + + return true; +} + +/* returns the number of bridges attached */ +static int exynos_drm_attach_lcd_bridge(struct drm_device *dev, + struct drm_encoder *encoder) +{ + struct bridge_init bridge; + int ret; + + if (find_bridge("nxp,ptn3460", &bridge)) { + ret = ptn3460_init(dev, encoder, bridge.client, bridge.node); + if (!ret) + return 1; + } + return 0; +} + static int exynos_dp_create_connector(struct exynos_drm_display *display, struct drm_encoder *encoder) { @@ -980,6 +1015,12 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display, int ret; dp->encoder = encoder; + + /* Pre-empt DP connector creation if there's a bridge */ + ret = exynos_drm_attach_lcd_bridge(dp->drm_dev, encoder); + if (ret) + return 0; + connector->polled = DRM_CONNECTOR_POLL_HPD; ret = drm_connector_init(dp->drm_dev, connector, diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c index 1a60f5a..2446352 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_core.c +++ b/drivers/gpu/drm/exynos/exynos_drm_core.c @@ -14,7 +14,6 @@ #include #include -#include #include "exynos_drm_drv.h" #include "exynos_drm_crtc.h" #include "exynos_drm_encoder.h" @@ -25,40 +24,6 @@ static LIST_HEAD(exynos_drm_subdrv_list); static LIST_HEAD(exynos_drm_manager_list); static LIST_HEAD(exynos_drm_display_list); -struct bridge_init { - struct i2c_client *client; - struct device_node *node; -}; - -static bool find_bridge(const char *compat, struct bridge_init *bridge) -{ - bridge->client = NULL; - bridge->node = of_find_compatible_node(NULL, NULL, compat); - if (!bridge->node) - return false; - - bridge->client = of_find_i2c_device_by_node(bridge->node); - if (!bridge->client) - return false; - - return true; -} - -/* returns the number of bridges attached */ -static int exynos_drm_attach_lcd_bridge(struct drm_device *dev, - struct drm_encoder *encoder) -{ - struct bridge_init bridge; - int ret; - - if (find_bridge("nxp,ptn3460", &bridge)) { - ret = ptn3460_init(dev, encoder, bridge.client, bridge.node); - if (!ret) - return 1; - } - return 0; -} - static int exynos_drm_create_enc_conn(struct drm_device *dev, struct exynos_drm_display *display) { @@ -81,12 +46,6 @@ static int exynos_drm_create_enc_conn(struct drm_device *dev, } display->encoder = encoder; - if (display->type == EXYNOS_DISPLAY_TYPE_LCD) { - ret = exynos_drm_attach_lcd_bridge(dev, encoder); - if (ret) - return 0; - } - if (display->ops->create_connector) return display->ops->create_connector(display, encoder);