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: 735141 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vZXtG1mkWz9s5g for ; Sat, 4 Mar 2017 02:20:04 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QMgTXdoz"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=juJ4zq2k+8UG//YpA8ZZMq4M3dbubP6P6BnSQI5o/iE=; b=QMg TXdozF5BmvZboZsRFU0KJ4NzwEMeWEx5x0Umrf6CUJ30ud7TRWtZk50SI8PCEuwT0UKMMfQ4YPguW KnvmufiZUirzDnqQ52wfot9vACd+nCKucwEBsVbYNV2p1KuSExUMoXkm5DG6+b3dKrNuOlHJhwBu5 tS0urA5h++Sz9W5Cgs0fZewMJGzIApud+Z+7V2EFakx4ABhwZEr3Us/Jjfm+DsM4t0UQDs3D5ZOBJ 1fDUvCZlRuKY5gS5UCLM3Egi9MXHtlvgp5D1Io477cPF0caYk2EADTJvqJiEM7G6spYzRjg3QgKnZ 0GaDkn1YC45IEcP4u7heNBKmiJYWzWw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cjozy-0006OP-LH; Fri, 03 Mar 2017 15:20:02 +0000 Received: from us01smtprelay-2.synopsys.com ([198.182.60.111] helo=smtprelay.synopsys.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cjozv-00069Z-T0 for linux-snps-arc@lists.infradead.org; Fri, 03 Mar 2017 15:20:01 +0000 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170303_071959_949050_A6CB4FAB X-CRM114-Status: GOOD ( 10.46 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [198.182.60.111 listed in list.dnswl.org] -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [198.182.60.111 listed in wl.mailspike.net] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, David Airlie , Alexey Brodkin , Liviu Dudau , linux-kernel@vger.kernel.org, Rob Herring , Daniel Vetter , linux-snps-arc@lists.infradead.org MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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;