From patchwork Tue Oct 1 23:40:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 2972771 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 C35D39F527 for ; Tue, 1 Oct 2013 23:48:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F2EB3203DB for ; Tue, 1 Oct 2013 23:48:44 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2C023203B4 for ; Tue, 1 Oct 2013 23:48:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 08D60E79AF for ; Tue, 1 Oct 2013 16:48:44 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qc0-f169.google.com (mail-qc0-f169.google.com [209.85.216.169]) by gabe.freedesktop.org (Postfix) with ESMTP id CFCDDE798D for ; Tue, 1 Oct 2013 16:41:17 -0700 (PDT) Received: by mail-qc0-f169.google.com with SMTP id c9so35855qcz.0 for ; Tue, 01 Oct 2013 16:41: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=Kx6rNYfVzkmO1J6mEb6a16/2CLqv5+7qGto3x3YC6Sg=; b=O9Wdyze+/ELwwUUxCx+Ceqp9NupYaFKZDRCQ1IUUX1cKKOBrcZgNOnVnIkjbYyq5x8 t8VC4DOjpu9O+DSsEE1fVTfgHGqVYmSXNx2CktgkTgv+6eMqiHvNjvwxBJ36Zg7Ot0DD xgDJfMej5f+4jxSjuENtqO/Y3kX/OUHdjK0DE= 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=Kx6rNYfVzkmO1J6mEb6a16/2CLqv5+7qGto3x3YC6Sg=; b=NnNBew+AD+LC5A+PshiovLgcM9LXwhbGwBPQ8mFJuNkN3uo5Vxrwkh0hFnobhTHaco 8AuAfOHDnFO+VaJxZtrIOo/0lrpxBhQxCDxISLzzlJO8E/Cfq5wwM/R3ovctOxC5gl4l T727t6KOLIlgAl97FAwKAaaF3xpPIMlP2/YYUkvk7mV4y1ULYqBsI/CnRrE4avwuB1Ay xUKggBtH4GLExh/fGSiPWfyH4wVO/WL+DnUE0QJCzMrMXeP6sj7KiWRNLnb/BEJE72bo Lan4EtlgN1ryfnx8jfJgsyI9NMSmCyoHEj94uxzf/CUckAII+h9vkzIP0zyDALkmZpV3 xt+w== X-Gm-Message-State: ALoCoQlfuV4S2i+a8Pk5coGrt+oZVrl/MKvh1uVckqixJOnW+yMkHqcf0ebxBrDP0OLO+6jULv/e X-Received: by 10.224.92.81 with SMTP id q17mr19012651qam.92.1380670877490; Tue, 01 Oct 2013 16:41: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 x8sm19199109qam.2.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 01 Oct 2013 16:41:16 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, inki.dae@samsung.com Subject: [PATCH 4/5] drm/exynos: Initialize ptn3460 if present Date: Tue, 1 Oct 2013 19:40:59 -0400 Message-Id: <1380670860-17621-5-git-send-email-seanpaul@chromium.org> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1380670860-17621-1-git-send-email-seanpaul@chromium.org> References: <1380670860-17621-1-git-send-email-seanpaul@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+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.7 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 adds code to look for the ptn3460 in the device tree file on exynos initialization. If ptn node is found, the driver will initialize the ptn3460 driver and skip creating a DP connector (since the bridge driver will register its own connector). Signed-off-by: Sean Paul --- drivers/gpu/drm/exynos/exynos_drm_core.c | 44 +++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c index 1bef6dc..9cf4476 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_core.c +++ b/drivers/gpu/drm/exynos/exynos_drm_core.c @@ -12,7 +12,9 @@ * option) any later version. */ +#include #include +#include #include "exynos_drm_drv.h" #include "exynos_drm_encoder.h" #include "exynos_drm_connector.h" @@ -20,6 +22,40 @@ static LIST_HEAD(exynos_drm_subdrv_list); +struct bridge_init { + struct i2c_client *client; + struct device_node *node; +}; + +static bool find_bridge(const char *name, struct bridge_init *bridge) +{ + bridge->client = NULL; + bridge->node = of_find_node_by_name(NULL, name); + 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("ptn3460-bridge", &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_subdrv *subdrv) { @@ -36,6 +72,13 @@ static int exynos_drm_create_enc_conn(struct drm_device *dev, DRM_ERROR("failed to create encoder\n"); return -EFAULT; } + subdrv->encoder = encoder; + + if (subdrv->manager->display_ops->type == EXYNOS_DISPLAY_TYPE_LCD) { + ret = exynos_drm_attach_lcd_bridge(dev, encoder); + if (ret) + return 0; + } /* * create and initialize a connector for this sub driver and @@ -48,7 +91,6 @@ static int exynos_drm_create_enc_conn(struct drm_device *dev, goto err_destroy_encoder; } - subdrv->encoder = encoder; subdrv->connector = connector; return 0;