From patchwork Thu Oct 3 22:28:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 2986321 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3E97EBFF0B for ; Thu, 3 Oct 2013 22:29:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6D8CE20426 for ; Thu, 3 Oct 2013 22:29:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9FC93201DD for ; Thu, 3 Oct 2013 22:29:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755921Ab3JCW3Q (ORCPT ); Thu, 3 Oct 2013 18:29:16 -0400 Received: from mail-qe0-f45.google.com ([209.85.128.45]:39829 "EHLO mail-qe0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755916Ab3JCW2l (ORCPT ); Thu, 3 Oct 2013 18:28:41 -0400 Received: by mail-qe0-f45.google.com with SMTP id 6so2299901qea.18 for ; Thu, 03 Oct 2013 15:28: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=ifB8xnBIJfd5ECmIMaYmXn2A9U276YIlnI/ph1IIcDE=; b=a2lhRHwxCKQLE5YRcyio4XNaCVpBaPbIIxpfjUav+GI+9znis+EGBjTukDgTgdFxEL mOx0MY1RiomyJIrK7hOU1Maa3XykwQynjI6rXQ5J3a08rfbZZnEpjHi3v0RhMTuAH3nZ mRV0WiJ7ZdiuBwRPDai44/pFEBvw7+RVwCeLc= 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=ifB8xnBIJfd5ECmIMaYmXn2A9U276YIlnI/ph1IIcDE=; b=ZVdtMiBK4z6m1feu7zvfx5pKUvGNmPrPcxOLNcN1ILmNzRcd/C7BTEIcSDL7b5KeUd WEU7ytcKKIsc/sM7WZU3GGMywbCbwcBt05qHBalMqb1x6fffmXOS8Jl+iP60y6z32kXX tW4d0DyzHoYIFZeFFrZT9gMRTlNhKWVOsx0mcUJfN+Omgsg578yK5dgjMFJD56A8Gr4f ZMnowsc2gbxmMIoMiiieLZl+khDnDC12FPj7xycVR6jm8A2Oo4QIyZz8N8Uxt/2s9owy zGs2mqJfnLqbhzMOFladu+7ZTnLp1cxIAknDFWJiMhYxPRSDbjtrpV1nkRAGnH+Ba02d EnIg== X-Gm-Message-State: ALoCoQkmaHEkjfYbl4yb3/SV46Qh80Wa6dFnV8Q2SXRBxm4Tv3p2/0V8j6k0II03vKAcY44lGYrq X-Received: by 10.224.4.70 with SMTP id 6mr13533601qaq.86.1380839320118; Thu, 03 Oct 2013 15:28:40 -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 fx6sm17610020qeb.1.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 03 Oct 2013 15:28: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 Cc: airlied@linux.ie, Sean Paul Subject: [PATCH v2 4/5] drm/exynos: Initialize ptn3460 if present Date: Thu, 3 Oct 2013 18:28:22 -0400 Message-Id: <1380839303-4834-5-git-send-email-seanpaul@chromium.org> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1380839303-4834-1-git-send-email-seanpaul@chromium.org> References: <1380670860-17621-1-git-send-email-seanpaul@chromium.org> <1380839303-4834-1-git-send-email-seanpaul@chromium.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.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 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;