From patchwork Thu Oct 10 22:26: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: 3019251 Return-Path: X-Original-To: patchwork-linux-arm@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 93A769F245 for ; Thu, 10 Oct 2013 22:27:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B8D04202BE for ; Thu, 10 Oct 2013 22:27:49 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B7D692026F for ; Thu, 10 Oct 2013 22:27:48 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VUOhh-0006AI-7S; Thu, 10 Oct 2013 22:27:33 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VUOhZ-00063i-Qg; Thu, 10 Oct 2013 22:27:25 +0000 Received: from mail-pb0-x229.google.com ([2607:f8b0:400e:c01::229]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VUOhB-0005yT-VO for linux-arm-kernel@lists.infradead.org; Thu, 10 Oct 2013 22:27:02 +0000 Received: by mail-pb0-f41.google.com with SMTP id rp2so3277901pbb.28 for ; Thu, 10 Oct 2013 15:26:40 -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=tmcF6OK/FxJQcxD5V1Bni1b9SuadDFWJvVSZZWJuaTs=; b=Ks2WMvZY9uw7VnwdWnF0XXm78fxmwOC9lUDGCQveBi9IF5qxDTxgP1DyLZeHIrHonr tbOP4TDAEl0KmSL+8a3MFsp6O5h9kaXvuLyu5EfS518kNizcJufwsmNPC8XccyJNHvvg MsgCb6deOiVSlkz6PgHP/YVZvpZHKt0L9u8Bw= 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=tmcF6OK/FxJQcxD5V1Bni1b9SuadDFWJvVSZZWJuaTs=; b=ldUQqA7JC3FNG67Nb+Fkj4k8Zu4GwA8s+OyBjH7OAflXdx7Yj+au8Ct+Ae7b70YU4t PyG2ajrW3+fJcy1HdJApJO6VhrsYkKNIb+KOaRWCKecix5NmSRYaS6CFmUjDRPow3H7B v0VhcKk8kDhtg9FaQjTTq3d2PzZIe3W5WxLi8avQqDeoY68pJmeMXwzi/qcn6csAXWPA I49So7/io4S9mNiQ8ONJOg3+YxWR83Bl16lM+14BuzeAJ3z1jFxxqbh6V5sgSY9L7Btp SroapPdSEzMcqBlqMXQqxW3P4vk3EajO/1wbLBkfBfY35hLKV+V7a7wx6VR7ZGiadHu2 ralw== X-Gm-Message-State: ALoCoQmuRbXlSIagh3fP4UByqsDAbA7sal4gNI0JskR+wLMSm5sG81Fq4oSn4N5Ywr7IoV507H5c X-Received: by 10.66.175.133 with SMTP id ca5mr18411884pac.40.1381444000621; Thu, 10 Oct 2013 15:26:40 -0700 (PDT) Received: from seanpaul-glaptop.corp.google.com (dhcp-172-19-29-233.mtv.corp.google.com [172.19.29.233]) by mx.google.com with ESMTPSA id f2sm55418619pbg.44.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 10 Oct 2013 15:26:39 -0700 (PDT) From: Sean Paul To: kgene.kim@samsung.com, 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 v3 4/5] drm/exynos: Initialize ptn3460 if present Date: Thu, 10 Oct 2013 18:26:17 -0400 Message-Id: <1381443978-5654-5-git-send-email-seanpaul@chromium.org> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1381443978-5654-1-git-send-email-seanpaul@chromium.org> References: <1380839303-4834-1-git-send-email-seanpaul@chromium.org> <1381443978-5654-1-git-send-email-seanpaul@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131010_182702_186463_0A839EE1 X-CRM114-Status: GOOD ( 14.98 ) X-Spam-Score: -2.0 (--) Cc: airlied@linux.ie, Sean Paul X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.3 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 --- v2: - Changed include from of_i2c.h to i2c.h - Changed of_find_by_name to of_find_compatible v3: No changes 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..08ca4f9 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 *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_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;