From patchwork Tue May 3 10:57:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Archit Taneja X-Patchwork-Id: 9002781 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C7176BF29F for ; Tue, 3 May 2016 10:58:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E1B752021F for ; Tue, 3 May 2016 10:58:14 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E699F201B4 for ; Tue, 3 May 2016 10:58:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E35F6E75A; Tue, 3 May 2016 10:58:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.codeaurora.org (smtp.codeaurora.org [198.145.29.96]) by gabe.freedesktop.org (Postfix) with ESMTPS id 82E4F6E75A for ; Tue, 3 May 2016 10:58:10 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 7DB326131D; Tue, 3 May 2016 10:58:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from localhost (unknown [202.46.23.61]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: architt@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id CC80060231; Tue, 3 May 2016 10:58:08 +0000 (UTC) From: Archit Taneja To: robdclark@gmail.com, robh@kernel.org Subject: [PATCH 1/9] drm/msm: Get mdss components via parsing ports Date: Tue, 3 May 2016 16:27:53 +0530 Message-Id: <1462273081-5814-2-git-send-email-architt@codeaurora.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1462273081-5814-1-git-send-email-architt@codeaurora.org> References: <1462273081-5814-1-git-send-email-architt@codeaurora.org> Cc: devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.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 The driver currently identifies all the mdss components it needs by parsing a phandle list from the 'connectors' DT property. Instead of this, describe a list of ports that the MDP hardware provides to the external world. These ports are linked to external encoder interfaces such as DSI, HDMI in MDSS. These are also the subcomponent devices that we need add. This description of ports complies with the generic graph bindings. In MDP4, the LVDS port's output connects directly to the LVDS panel. In this case, we don't try to add it as a component. Signed-off-by: Archit Taneja --- drivers/gpu/drm/msm/msm_drv.c | 54 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 955ddfd..30b8f3b 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -1087,6 +1087,58 @@ static int add_components(struct device *dev, struct component_match **matchptr, return 0; } +/* + * Identify what components need to be added by parsing what the endpoints in + * our output ports are we. In the case of LVDS, there is no external component + * that we need to add since it's a part of MDP itself. + */ +static int add_mdss_components(struct device *dev, + struct component_match **matchptr) +{ + struct device_node *np = dev->of_node; + struct device_node *ep_node; + + for_each_endpoint_of_node(np, ep_node) { + struct device_node *intf; + struct of_endpoint ep; + int ret; + + ret = of_graph_parse_endpoint(ep_node, &ep); + if (ret) { + dev_err(dev, "unable to parse port endpoint\n"); + of_node_put(ep_node); + return ret; + } + + /* + * The LCDC/LVDS port on MDP4 is a speacial case where the + * remote-endpoint isn't a component that we need to add + */ + if (of_device_is_compatible(np, "qcom,mdp4") && ep.port == 0) { + of_node_put(ep_node); + continue; + } + + /* + * It's okay if some of the ports don't have a remote endpoint + * specified. It just means that the port isn't connected to + * any external interface. + */ + intf = of_graph_get_remote_port_parent(ep_node); + if (!intf) { + of_node_put(ep_node); + continue; + } + + component_match_add(dev, matchptr, compare_of, intf); + + of_node_put(intf); + of_node_put(ep_node); + } + + return 0; +} + static int msm_drm_bind(struct device *dev) { return msm_drm_init(dev, &msm_driver); @@ -1110,7 +1162,7 @@ static int msm_pdev_probe(struct platform_device *pdev) { struct component_match *match = NULL; - add_components(&pdev->dev, &match, "connectors"); + add_mdss_components(&pdev->dev, &match); add_components(&pdev->dev, &match, "gpus"); pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);