From patchwork Thu Jun 23 14:13:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Archit Taneja X-Patchwork-Id: 9195317 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 EE21F6077D for ; Thu, 23 Jun 2016 14:15:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E03F126B39 for ; Thu, 23 Jun 2016 14:15:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D50EE2844A; Thu, 23 Jun 2016 14:15:28 +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]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9220726B39 for ; Thu, 23 Jun 2016 14:15:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 359B46E96C; Thu, 23 Jun 2016 14:15:13 +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 F11A76E94E for ; Thu, 23 Jun 2016 14:14:45 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id DBDAD61378; Thu, 23 Jun 2016 14:14:45 +0000 (UTC) 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 7400D61368; Thu, 23 Jun 2016 14:14:43 +0000 (UTC) From: Archit Taneja To: robdclark@gmail.com Subject: [PATCH v2 16/25] drm/msm: Drop the gpu binding Date: Thu, 23 Jun 2016 19:43:21 +0530 Message-Id: <1466691210-22779-17-git-send-email-architt@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466691210-22779-1-git-send-email-architt@codeaurora.org> References: <1466077007-26792-1-git-send-email-architt@codeaurora.org> <1466691210-22779-1-git-send-email-architt@codeaurora.org> Cc: 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 the GPU components it needs by parsing a phandle list from the 'gpus' DT property. This isn't the right binding to go with. So, for now, just search all device nodes and find the gpu node we need by parsing a list of compatible strings. Once we know how to link the kms and gpu drivers, we'll drop this method and use the correct binding. Signed-off-by: Archit Taneja --- drivers/gpu/drm/msm/msm_drv.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 79437f9..be8f73a 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -804,25 +804,6 @@ static int compare_of(struct device *dev, void *data) return dev->of_node == data; } -static int add_components(struct device *dev, struct component_match **matchptr, - const char *name) -{ - struct device_node *np = dev->of_node; - unsigned i; - - for (i = 0; ; i++) { - struct device_node *node; - - node = of_parse_phandle(np, name, i); - if (!node) - break; - - component_match_add(dev, matchptr, compare_of, node); - } - - return 0; -} - /* * Identify what components need to be added by parsing what remote-endpoints * our MDP output ports are connected to. In the case of LVDS on MDP4, there @@ -939,10 +920,31 @@ static int add_display_components(struct device *dev, return ret; } +/* + * We don't know what's the best binding to link the gpu with the drm device. + * Fow now, we just hunt for all the possible gpus that we support, and add them + * as components. + */ +static const struct of_device_id msm_gpu_match[] = { + { .compatible = "qcom,adreno-3xx" }, + { .compatible = "qcom,kgsl-3d0" }, + { }, +}; + static int add_gpu_components(struct device *dev, struct component_match **matchptr) { - return add_components(&pdev->dev, matchptr, "gpus"); + struct device_node *np; + + np = of_find_matching_node(NULL, msm_gpu_match); + if (!np) + return 0; + + of_node_put(np); + + component_match_add(dev, matchptr, compare_of, np); + + return 0; } static int msm_drm_bind(struct device *dev)