From patchwork Fri Mar 3 15:19:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Brodkin X-Patchwork-Id: 9604919 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6D37060234 for ; Mon, 6 Mar 2017 00:13:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F9FE27D0C for ; Mon, 6 Mar 2017 00:13:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 549A727D5D; Mon, 6 Mar 2017 00:13:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D9F8027D0C for ; Mon, 6 Mar 2017 00:13:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B40986E35C; Mon, 6 Mar 2017 00:09:07 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtprelay.synopsys.com (smtprelay.synopsys.com [198.182.60.111]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9DBA46ED56 for ; Fri, 3 Mar 2017 15:19:38 +0000 (UTC) Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id AB49110C150A; Fri, 3 Mar 2017 07:19:37 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 887FE324; Fri, 3 Mar 2017 07:19:37 -0800 (PST) Received: from abrodkin-7440l.internal.synopsys.com (unknown [10.121.8.45]) by mailhost.synopsys.com (Postfix) with ESMTP id E588E2E7; Fri, 3 Mar 2017 07:19:34 -0800 (PST) From: Alexey Brodkin To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/arcpgu: Get rid of "encoder-slave" property Date: Fri, 3 Mar 2017 18:19:24 +0300 Message-Id: <1488554364-25579-1-git-send-email-abrodkin@synopsys.com> X-Mailer: git-send-email 2.7.4 X-Mailman-Approved-At: Mon, 06 Mar 2017 00:08:29 +0000 Cc: devicetree@vger.kernel.org, Alexey Brodkin , Liviu Dudau , linux-kernel@vger.kernel.org, Rob Herring , linux-snps-arc@lists.infradead.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP We used to use "encoder-slave" property in PGU's Device Tree node to refer to the encoder, but since there's a way to find it with some code smarts we get rid of obviously extra complication in PGU node. Again inspired by ARM's HDLCD code. Signed-off-by: Alexey Brodkin Cc: Liviu Dudau Cc: Daniel Vetter Cc: David Airlie Cc: Rob Herring --- arch/arc/boot/dts/axs10x_mb.dtsi | 1 - drivers/gpu/drm/arc/arcpgu_drv.c | 23 +++++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/arch/arc/boot/dts/axs10x_mb.dtsi b/arch/arc/boot/dts/axs10x_mb.dtsi index 41cfb29b62c1..2fe030186b9d 100644 --- a/arch/arc/boot/dts/axs10x_mb.dtsi +++ b/arch/arc/boot/dts/axs10x_mb.dtsi @@ -287,7 +287,6 @@ pgu@17000 { compatible = "snps,arcpgu"; reg = <0x17000 0x400>; - encoder-slave = <&adv7511>; clocks = <&pguclk>; clock-names = "pxlclk"; memory-region = <&frame_buffer>; diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c index 5c82f52fba80..b1b2286bda95 100644 --- a/drivers/gpu/drm/arc/arcpgu_drv.c +++ b/drivers/gpu/drm/arc/arcpgu_drv.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include "arcpgu.h" @@ -83,7 +84,7 @@ static int arcpgu_load(struct drm_device *drm) { struct platform_device *pdev = to_platform_device(drm->dev); struct arcpgu_drm_private *arcpgu; - struct device_node *encoder_node; + struct device_node *encoder, *port; struct resource *res; int ret; @@ -118,14 +119,24 @@ static int arcpgu_load(struct drm_device *drm) if (arc_pgu_setup_crtc(drm) < 0) return -ENODEV; - /* find the encoder node and initialize it */ - encoder_node = of_parse_phandle(drm->dev->of_node, "encoder-slave", 0); - if (encoder_node) { - ret = arcpgu_drm_hdmi_init(drm, encoder_node); - of_node_put(encoder_node); + /* There is only one output port inside each device, find it */ + port = of_graph_get_next_endpoint(pdev->dev.of_node, NULL); + + if (port) { + if (of_device_is_available(port)) + encoder = of_graph_get_remote_port_parent(port); + of_node_put(port); + } + + if (encoder && of_device_is_available(encoder)) { + dev_info(drm->dev, "Found encoder node %s, proceeding with it\n", + encoder->name); + ret = arcpgu_drm_hdmi_init(drm, encoder); + of_node_put(encoder); if (ret < 0) return ret; } else { + dev_info(drm->dev, "No encoder node, assume simulation\n"); ret = arcpgu_drm_sim_init(drm, NULL); if (ret < 0) return ret;