From patchwork Sat Nov 15 09:55:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Kumar X-Patchwork-Id: 5311321 Return-Path: X-Original-To: patchwork-linux-arm@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 2B266C11AC for ; Sat, 15 Nov 2014 10:05:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 431412014A for ; Sat, 15 Nov 2014 10:05:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4493D20123 for ; Sat, 15 Nov 2014 10:05:35 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XpaCK-0003qv-S8; Sat, 15 Nov 2014 10:03:16 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XpaBD-0003AA-Cl for linux-arm-kernel@lists.infradead.org; Sat, 15 Nov 2014 10:02:08 +0000 Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NF2006JBRUYYA90@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Sat, 15 Nov 2014 19:01:46 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.125]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id EA.35.18167.A8427645; Sat, 15 Nov 2014 19:01:46 +0900 (KST) X-AuditID: cbfee690-f79ab6d0000046f7-18-5467248a187b Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id D0.93.09430.98427645; Sat, 15 Nov 2014 19:01:45 +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:45 +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 Subject: [PATCH V8 06/14] drm/bridge: ptn3460: support drm_panel Date: Sat, 15 Nov 2014 15:25:01 +0530 Message-id: <1416045309-13359-7-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+NgFmpkkeLIzCtJLcpLzFFi42JZI2JSq9ulkh5iMO0sq8WB9wdZLDa8Wchs sWztPxaLhQ/vMlvMP3KO1eLK1/dsFpPuT2Cx6F1wlc1i0+NrrBYzzu9jslh1eAO7xdyDuRY/ d81jceD12PttAYvHzll32T0WbCr1uN99nMlj85J6j74tqxg9Pm+SC2CP4rJJSc3JLEst0rdL 4Mr48Uao4LxGRd/Rj4wNjL2KXYycHBICJhLLNjWwQ9hiEhfurWfrYuTiEBJYyiixZfMpVpii racPMUMkFjFKNPY3QzkTmCQOvLnPBFLFJqAtsW36TRaQhIhAF6PE+wOr2EEcZoHnjBLzLnSw gFQJCzhIdK7bCWazCKhKnFg5gQ3E5hXwkLiw+QTQJA6gfQoScybZgIQ5BTwltn+cD1YuBFSy 9uA/sPskBK6xS0xf9IEdYo6AxLfJh1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KdHkfGCyyCuJNzQ2MTc1NrU0sTAxs1QS5z3Yah0oJJCeWJKanZpakFoE08fEwSnVwJhnsXHR sak3XLM4pim/tPg713bdyia7+xVbjC51/4qWPvdS5P0sE90ZEjff69w7WX9KfIZ+sWX/J3XX KJv6mZFRc4/zVeq4Hl+g/lA0umY2U0Hz6lizEskFXySmTZ3Q67qq1a3ysp5Cn7u494N/LQ8i 2M4F7v+e8+cY70WZSvdjWyc8zTW62K/EUpyRaKjFXFScCADDnm8O3gIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141115_020207_689137_C70456C9 X-CRM114-Status: GOOD ( 14.11 ) X-Spam-Score: -5.0 (-----) Cc: kgene.kim@samsung.com, seanpaul@google.com, daniel.vetter@ffwll.ch, inki.dae@samsung.com, thierry.reding@gmail.com, ajaynumb@gmail.com, bhushan.r@samsung.com, prashanth.g@samsung.com, Ajay Kumar X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 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=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, 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 Add drm_panel calls to the driver to make the panel and bridge work together in tandem. Signed-off-by: Ajay Kumar --- .../devicetree/bindings/drm/bridge/ptn3460.txt | 12 ++++++ drivers/gpu/drm/bridge/Kconfig | 1 + drivers/gpu/drm/bridge/ptn3460.c | 42 ++++++++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/Documentation/devicetree/bindings/drm/bridge/ptn3460.txt b/Documentation/devicetree/bindings/drm/bridge/ptn3460.txt index 52b93b2..663fe6c 100644 --- a/Documentation/devicetree/bindings/drm/bridge/ptn3460.txt +++ b/Documentation/devicetree/bindings/drm/bridge/ptn3460.txt @@ -17,6 +17,11 @@ Required properties: | 6 | 1600x900 | ChiMei M215HGE | +-------+------------+------------------+ + - video interfaces: Device node can contain video interface port + nodes for panel according to [1]. + +[1]: Documentation/devicetree/bindings/media/video-interfaces.txt + Example: lvds-bridge@20 { compatible = "nxp,ptn3460"; @@ -24,4 +29,11 @@ Example: powerdown-gpio = <&gpy2 5 1 0 0>; reset-gpio = <&gpx1 5 1 0 0>; edid-emulation = <5>; + ports { + port@0 { + bridge_out: endpoint { + remote-endpoint = <&panel_in>; + }; + }; + }; }; diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index 4254c2b..8b426e2 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -3,5 +3,6 @@ config DRM_PTN3460 depends on DRM depends on OF && I2C select DRM_KMS_HELPER + select DRM_PANEL ---help--- ptn3460 eDP-LVDS bridge chip driver. diff --git a/drivers/gpu/drm/bridge/ptn3460.c b/drivers/gpu/drm/bridge/ptn3460.c index 7adeb60..e6d5ae7 100644 --- a/drivers/gpu/drm/bridge/ptn3460.c +++ b/drivers/gpu/drm/bridge/ptn3460.c @@ -19,6 +19,9 @@ #include #include #include +#include + +#include #include "bridge/ptn3460.h" @@ -38,6 +41,7 @@ struct ptn3460_bridge { struct i2c_client *client; struct drm_bridge bridge; struct edid *edid; + struct drm_panel *panel; int gpio_pd_n; int gpio_rst_n; u32 edid_emulation; @@ -137,6 +141,11 @@ static void ptn3460_pre_enable(struct drm_bridge *bridge) gpio_set_value(ptn_bridge->gpio_rst_n, 1); } + if (drm_panel_prepare(ptn_bridge->panel)) { + DRM_ERROR("failed to prepare panel\n"); + return; + } + /* * There's a bug in the PTN chip where it falsely asserts hotplug before * it is fully functional. We're forced to wait for the maximum start up @@ -153,6 +162,12 @@ static void ptn3460_pre_enable(struct drm_bridge *bridge) static void ptn3460_enable(struct drm_bridge *bridge) { + struct ptn3460_bridge *ptn_bridge = bridge_to_ptn3460(bridge); + + if (drm_panel_enable(ptn_bridge->panel)) { + DRM_ERROR("failed to enable panel\n"); + return; + } } static void ptn3460_disable(struct drm_bridge *bridge) @@ -164,6 +179,11 @@ static void ptn3460_disable(struct drm_bridge *bridge) ptn_bridge->enabled = false; + if (drm_panel_disable(ptn_bridge->panel)) { + DRM_ERROR("failed to disable panel\n"); + return; + } + if (gpio_is_valid(ptn_bridge->gpio_rst_n)) gpio_set_value(ptn_bridge->gpio_rst_n, 1); @@ -173,6 +193,12 @@ static void ptn3460_disable(struct drm_bridge *bridge) static void ptn3460_post_disable(struct drm_bridge *bridge) { + struct ptn3460_bridge *ptn_bridge = bridge_to_ptn3460(bridge); + + if (drm_panel_unprepare(ptn_bridge->panel)) { + DRM_ERROR("failed to unprepare panel\n"); + return; + } } static int ptn3460_get_modes(struct drm_connector *connector) @@ -267,6 +293,9 @@ int ptn3460_bridge_attach(struct drm_bridge *bridge) drm_mode_connector_attach_encoder(&ptn_bridge->connector, bridge->encoder); + if (ptn_bridge->panel) + drm_panel_attach(ptn_bridge->panel, &ptn_bridge->connector); + return ret; } @@ -283,6 +312,7 @@ static int ptn3460_probe(struct i2c_client *client, { struct device *dev = &client->dev; struct ptn3460_bridge *ptn_bridge; + struct device_node *endpoint, *panel_node; int ret; ptn_bridge = devm_kzalloc(dev, sizeof(*ptn_bridge), GFP_KERNEL); @@ -290,6 +320,17 @@ static int ptn3460_probe(struct i2c_client *client, return -ENOMEM; } + endpoint = of_graph_get_next_endpoint(dev->of_node, NULL); + if (endpoint) { + panel_node = of_graph_get_remote_port_parent(endpoint); + if (panel_node) { + ptn_bridge->panel = of_drm_find_panel(panel_node); + of_node_put(panel_node); + if (!ptn_bridge->panel) + return -EPROBE_DEFER; + } + } + ptn_bridge->client = client; ptn_bridge->gpio_pd_n = of_get_named_gpio(dev->of_node, "powerdown-gpio", 0); @@ -327,6 +368,7 @@ static int ptn3460_probe(struct i2c_client *client, } ptn_bridge->bridge.funcs = &ptn3460_bridge_funcs; + ptn_bridge->bridge.of_node = dev->of_node; ret = drm_bridge_add(&ptn_bridge->bridge); if (ret) { DRM_ERROR("Failed to add bridge\n");