Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4668235ybi; Tue, 11 Jun 2019 10:24:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqzOkIUb0yndGX5kcjOdfvHti+uqxUeFwoqdfw52Txf8uDEMz/Gn+FXC3zBfnVhlLRZUgIko X-Received: by 2002:a63:374a:: with SMTP id g10mr10712763pgn.31.1560273841560; Tue, 11 Jun 2019 10:24:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560273841; cv=none; d=google.com; s=arc-20160816; b=sr5CwOpVJ4ZpbYIp3Q49xZuLz7mb/YEAtj2ZCe9xQcfxO8Z2G01LOzaXruk8MtEg/A elT6pkQxm0E1kMwalmXO1gb5NY3/MSiZCLbobhL9you8obqULHLomYyoTpEIF3hjEWKB ZN5yB1WWJEZ5Jms00QlZIyBJMURmEKRy4zPvhiRB2Jlav6x/2K/LD+9XBs1doJbcOSQN r/BelXrdiWeygmrH0okjxMuTdHIuPyEltc+ltQkhzt3ZCSu/e38+IXbeXnPwOKOBypzX TiKMCkyKuvg3rIfmoWdbBWsFiap6Ps6bb9vWAKwHXunuMbpHhZgf+dcM1Q9WbKYhyWEU vPbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=jrKQFw+14VxGjJBPfVtp2eO9RYJK23K8W+Cs+ziSadA=; b=yG7asrwFQB4VzIoGqY+7I1MBNDMe6jxyoD0LQcSsNgcbF//AhV1XEAA31AFZdCMnOO xYMH/Q5x/PTTl6nAjfv6kGkZqb/YZQIrdHQaG6nbvU40FtIcathxxmTF7813QAI8LkXU T7+1ME+Q2/rPzetbFRzQxbk49aeB9+cwj7lP4Ge/RCXe8wc2OtYgntjRvECaG2lPafzm 36aXvL1WHQNCEfWLmp7Zh84oQsheHaQc3U/2D/8reUjzD8+0rTSQROvMqYQLr0cjS9+d RaDhklhqDQK0SZmjdkD2rNNO7XT8xP/OUPiI0oxOFeYp2/hJaafmwYjNX0ZgHvBtpN+S OxoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=mEG+Kk+M; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j14si13425972pfe.183.2019.06.11.10.23.46; Tue, 11 Jun 2019 10:24:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=mEG+Kk+M; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406040AbfFKRWO (ORCPT + 99 others); Tue, 11 Jun 2019 13:22:14 -0400 Received: from dc8-smtprelay2.synopsys.com ([198.182.47.102]:58254 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405821AbfFKRWO (ORCPT ); Tue, 11 Jun 2019 13:22:14 -0400 Received: from mailhost.synopsys.com (unknown [10.225.0.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id B9498C016F; Tue, 11 Jun 2019 17:22:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1560273733; bh=0vOMGLO1nb4/1qQXTnpKwZ5ss3VewMScaHY/JKElpRU=; h=From:To:Cc:Subject:Date:From; b=mEG+Kk+MU17YGXVVNiMP3HavxsIygpQwFuDgaPF+bHbluiugCJ2D5Lkt2ZBC/a1VI bvvSqdTRwWuVbzoXESWnEJFYLswnqFnbtAEWIlrYI6Lj3u9hygj2hSQEm4TbCI0owS 8pXg1m1FIasnnAzp7MB4zTylHtWBBOYe/MMNLEa+EiN9/V5vN8i8se3hAQO6oKjmqV 1MBohj45Ky1pn1VzpuYrVSAUFuLti88i1VK4epQIeMFit7S/2PWEPflOPWZsfxDCYT XzO+bvShRqhgABG5Rpgs4O9X4cyAhVF/Btm5YBc/9k48TL5eoI1xGOlQbjVh9mgGJB rbuSCx9xXR6PA== Received: from paltsev-e7480.internal.synopsys.com (paltsev-e7480.internal.synopsys.com [10.121.8.58]) by mailhost.synopsys.com (Postfix) with ESMTP id 97909A022E; Tue, 11 Jun 2019 17:22:08 +0000 (UTC) From: Eugeniy Paltsev To: dri-devel@lists.freedesktop.org, Alexey Brodkin Cc: linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, David Airlie , Daniel Vetter , Eugeniy Paltsev Subject: [PATCH] drm/arcpgu: rework encoder search Date: Tue, 11 Jun 2019 20:21:59 +0300 Message-Id: <20190611172159.24048-1-Eugeniy.Paltsev@synopsys.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of using non-standard "encoder-slave" property to find encoder let's find it by associated endpoint. While I'm on it add corresponding log message if we don't find any encoder and we assume that we use virtual LCD on the simulation platform. Signed-off-by: Eugeniy Paltsev --- drivers/gpu/drm/arc/arcpgu_drv.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c index c9f78397d345..d08b9977f021 100644 --- a/drivers/gpu/drm/arc/arcpgu_drv.c +++ b/drivers/gpu/drm/arc/arcpgu_drv.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -54,7 +55,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_node = NULL, *endpoint_node = NULL; struct resource *res; int ret; @@ -89,14 +90,23 @@ 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); + /* + * There is only one output port inside each device. It is linked with + * encoder endpoint. + */ + endpoint_node = of_graph_get_next_endpoint(pdev->dev.of_node, NULL); + if (endpoint_node) { + encoder_node = of_graph_get_remote_port_parent(endpoint_node); + of_node_put(endpoint_node); + } + if (encoder_node) { ret = arcpgu_drm_hdmi_init(drm, encoder_node); of_node_put(encoder_node); if (ret < 0) return ret; } else { + dev_info(drm->dev, "no encoder found. Assumed virtual LCD on simulation platform\n"); ret = arcpgu_drm_sim_init(drm, NULL); if (ret < 0) return ret; -- 2.21.0