From patchwork Sat Nov 15 09:55:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Kumar X-Patchwork-Id: 5311171 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 EBBD59FD26 for ; Sat, 15 Nov 2014 10:01:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0160820160 for ; Sat, 15 Nov 2014 10:01:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8E22120121 for ; Sat, 15 Nov 2014 10:01:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752222AbaKOKBq (ORCPT ); Sat, 15 Nov 2014 05:01:46 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:44640 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752097AbaKOKBo (ORCPT ); Sat, 15 Nov 2014 05:01:44 -0500 Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NF2009S0RUVBZ80@mailout2.samsung.com>; Sat, 15 Nov 2014 19:01:43 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.123]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id E9.35.18167.68427645; Sat, 15 Nov 2014 19:01:43 +0900 (KST) X-AuditID: cbfee690-f79ab6d0000046f7-05-546724862dfd Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 64.3D.20081.68427645; Sat, 15 Nov 2014 19:01:42 +0900 (KST) Received: from chromebld-server.sisodomain.com ([107.108.73.106]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NF200LRLRTSF980@mmp1.samsung.com>; Sat, 15 Nov 2014 19:01:42 +0900 (KST) From: Ajay Kumar To: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: inki.dae@samsung.com, kgene.kim@samsung.com, seanpaul@google.com, thierry.reding@gmail.com, daniel.vetter@ffwll.ch, ajaynumb@gmail.com, bhushan.r@samsung.com, prashanth.g@samsung.com, Ajay Kumar Subject: [PATCH V8 05/14] drm/exynos: dp: support drm_bridge Date: Sat, 15 Nov 2014 15:25:00 +0530 Message-id: <1416045309-13359-6-git-send-email-ajaykumar.rs@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1416045309-13359-1-git-send-email-ajaykumar.rs@samsung.com> References: <1416045309-13359-1-git-send-email-ajaykumar.rs@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkkeLIzCtJLcpLzFFi42JZI2JSrduukh5i0NHEZHHg/UEWiw1vFjJb LFv7j8Vi4cO7zBbzj5xjtbjy9T2bxaT7E1gsehdcZbPY9Pgaq8WM8/uYLFYd3sBuMfdgrsXP XfNYHHg99n5bwOKxc9Zddo8Fm0o97ncfZ/LYvKTeo2/LKkaPz5vkAtijuGxSUnMyy1KL9O0S uDJ+/LrKVDBJsaL5w26WBsZO6S5GTg4JAROJN49nMEPYYhIX7q1nA7GFBJYySry6KAtTc2nJ aZYuRi6g+CJGiX//5zFCOBOYJJas384KUsUmoC2xbfpNsCoRgS5GifcHVrGDOMwCzxkl5l3o YAGpEhawkbi++TJYB4uAqsS/I3+ZQGxeAQ+J5xfvAt3BAbRPQWLOJBuQMKeAp8T2j/NZIE7y kFh78B8byEwJgWvsEne2tDJBzB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QWH2I0BTpq IrOUaHI+MF3klcQbGpuYmxqbWppYmJhZKonzHmi1DhQSSE8sSc1OTS1ILYLpY+LglGpgbJjy 1NRmc8DbH3vnlJ/do/1NudRSxmL1RT/VNUsYdi/uPH/Ka6fRDEshm7wtN436dxz+a2eySkMq flH4xkvtr/Zb9O2bMJ91wvNrGtGyR46eVPuW6CtU6Dslet/tfbzudR8qLq30t2Y9YB+l8tGr cuUs0d8G4rOfq6vOYOK2FRZMSxf6/kXOX4mlOCPRUIu5qDgRANl4yU/fAgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected 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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, 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 Modify driver to support drm_bridge. Signed-off-by: Ajay Kumar --- .../devicetree/bindings/video/exynos_dp.txt | 12 +++++++ drivers/gpu/drm/exynos/exynos_dp_core.c | 37 ++++++++++++++++---- drivers/gpu/drm/exynos/exynos_dp_core.h | 1 + 3 files changed, 44 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/video/exynos_dp.txt b/Documentation/devicetree/bindings/video/exynos_dp.txt index 53dbccf..7a3a9cd 100644 --- a/Documentation/devicetree/bindings/video/exynos_dp.txt +++ b/Documentation/devicetree/bindings/video/exynos_dp.txt @@ -66,6 +66,10 @@ Optional properties for dp-controller: Hotplug detect GPIO. Indicates which GPIO should be used for hotplug detection + -video interfaces: Device node can contain video interface port + nodes according to [1]. + +[1]: Documentation/devicetree/bindings/media/video-interfaces.txt Example: @@ -105,4 +109,12 @@ Board Specific portion: vsync-len = <6>; }; }; + + ports { + port@0 { + dp_out: endpoint { + remote-endpoint = <&bridge_in>; + }; + }; + }; }; diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index 5025b70..d30c748 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -989,9 +990,19 @@ static struct drm_connector_helper_funcs exynos_dp_connector_helper_funcs = { }; /* returns the number of bridges attached */ -static int exynos_drm_attach_lcd_bridge(struct drm_device *dev, +static int exynos_drm_attach_lcd_bridge(struct exynos_dp_device *dp, struct drm_encoder *encoder) { + int ret; + + encoder->bridge = dp->bridge; + dp->bridge->encoder = encoder; + ret = drm_bridge_attach(encoder->dev, dp->bridge); + if (ret) { + DRM_ERROR("Failed to attach bridge to drm\n"); + return ret; + } + return 0; } @@ -1005,9 +1016,11 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display, 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; + if (dp->bridge) { + ret = exynos_drm_attach_lcd_bridge(dp, encoder); + if (!ret) + return 0; + } connector->polled = DRM_CONNECTOR_POLL_HPD; @@ -1259,7 +1272,7 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data) if (ret) return ret; - if (!dp->panel) { + if (!dp->panel && !dp->bridge) { ret = exynos_dp_dt_parse_panel(dp); if (ret) return ret; @@ -1345,7 +1358,7 @@ static const struct component_ops exynos_dp_ops = { static int exynos_dp_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct device_node *panel_node; + struct device_node *panel_node, *bridge_node, *endpoint; struct exynos_dp_device *dp; int ret; @@ -1367,6 +1380,18 @@ static int exynos_dp_probe(struct platform_device *pdev) return -EPROBE_DEFER; } + endpoint = of_graph_get_next_endpoint(dev->of_node, NULL); + if (endpoint) { + bridge_node = of_graph_get_remote_port_parent(endpoint); + if (bridge_node) { + dp->bridge = of_drm_find_bridge(bridge_node); + of_node_put(bridge_node); + if (!dp->bridge) + return -EPROBE_DEFER; + } else + return -EPROBE_DEFER; + } + exynos_dp_display.ctx = dp; ret = component_add(&pdev->dev, &exynos_dp_ops); diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h b/drivers/gpu/drm/exynos/exynos_dp_core.h index a1aee69..3b0ba93 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.h +++ b/drivers/gpu/drm/exynos/exynos_dp_core.h @@ -150,6 +150,7 @@ struct exynos_dp_device { struct drm_connector connector; struct drm_encoder *encoder; struct drm_panel *panel; + struct drm_bridge *bridge; struct clk *clock; unsigned int irq; void __iomem *reg_base;