From patchwork Tue May 3 10:57:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Archit Taneja X-Patchwork-Id: 9002791 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 D97CEBF29F for ; Tue, 3 May 2016 10:58:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0D2352021F for ; Tue, 3 May 2016 10:58:17 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2EFFF201B4 for ; Tue, 3 May 2016 10:58:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 43DCF6E75B; Tue, 3 May 2016 10:58:15 +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 867336E75B for ; Tue, 3 May 2016 10:58:14 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 775EA6133E; Tue, 3 May 2016 10:58:14 +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 C9F9B612F3; Tue, 3 May 2016 10:58:12 +0000 (UTC) From: Archit Taneja To: robdclark@gmail.com, robh@kernel.org Subject: [PATCH 2/9] drm/msm: Drop the gpu binding Date: Tue, 3 May 2016 16:27:54 +0530 Message-Id: <1462273081-5814-3-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 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 | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 30b8f3b..f717a69 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -1068,20 +1068,32 @@ 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) +static const char * const msm_compatible_gpus[] = { + "qcom,adreno-3xx", + "qcom,kgsl-3d0", +}; + +/* + * 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 int add_gpu_components(struct device *dev, + struct component_match **matchptr) { - struct device_node *np = dev->of_node; unsigned i; - for (i = 0; ; i++) { + for (i = 0; i < ARRAY_SIZE(msm_compatible_gpus); i++) { struct device_node *node; - node = of_parse_phandle(np, name, i); + node = of_find_compatible_node(NULL, NULL, + msm_compatible_gpus[i]); if (!node) - break; + continue; component_match_add(dev, matchptr, compare_of, node); + + of_node_put(node); } return 0; @@ -1163,7 +1175,7 @@ static int msm_pdev_probe(struct platform_device *pdev) struct component_match *match = NULL; add_mdss_components(&pdev->dev, &match); - add_components(&pdev->dev, &match, "gpus"); + add_gpu_components(&pdev->dev, &match); pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); return component_master_add_with_match(&pdev->dev, &msm_drm_ops, match);