From patchwork Mon Jan 22 17:23:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 10178923 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 099C3601D5 for ; Mon, 22 Jan 2018 17:23:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E25B42841D for ; Mon, 22 Jan 2018 17:23:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6E1628459; Mon, 22 Jan 2018 17:23:37 +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]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 62DC32841D for ; Mon, 22 Jan 2018 17:23:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5A7826E26A; Mon, 22 Jan 2018 17:23:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ot0-f193.google.com (mail-ot0-f193.google.com [74.125.82.193]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1BBE96E26A; Mon, 22 Jan 2018 17:23:33 +0000 (UTC) Received: by mail-ot0-f193.google.com with SMTP id 53so8149726otj.2; Mon, 22 Jan 2018 09:23:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ZF8OxBCPlk+dv76u3tBZpP6dq2bk+/V5+JHTYFag+4Q=; b=dUTV6ow+omy+zoGDTwPXptLUCDwit75HnaIuxH5+3uD4Of7TYO05rzDauVdpoRTSq/ YJX8qDhNH6PnatGdVbdsSJSzY1ivr3qYezngA6hhI5MYP6yr+IW+kWtzPoRlBGYDisd+ 4Wxum8PWYJAi98+10vBkotgiLgTxV7zESZ/uu/rTPz0uozits7LJTXBU8tHhBovSp2h4 2H4XD9jz6V6vs1WJWKNtYnbyg9yfJv7S+vH0qCn5QEOqSzBbwbzycWTtjJFXsU+MrpCV 6vMB5fNmDwF23Tp8H9AFkQlxkKPBXBQEU1lQTDi+6+3p+BcA5lgwflsUcO5YtuRjKpy8 Cmxg== X-Gm-Message-State: AKwxytf5Gj+p3iSyJf8tA5Xd7O67SZn59Q9SJh5PxhRcrCD3g55iqk2F wR9+ChGP+UiibWYMpYbFPA== X-Google-Smtp-Source: AH8x224e7GsWEVtvlhQEUQUaCE+wOT4rh3GqxDN8y24EPZvvZq/pMChAvYCLzeFRbPnRNwfzvbl2Xw== X-Received: by 10.157.86.161 with SMTP id o30mr5120117oth.86.1516641812988; Mon, 22 Jan 2018 09:23:32 -0800 (PST) Received: from localhost (216-188-254-6.dyn.grandenetworks.net. [216.188.254.6]) by smtp.gmail.com with ESMTPSA id d134sm315091oih.5.2018.01.22.09.23.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Jan 2018 09:23:31 -0800 (PST) Date: Mon, 22 Jan 2018 11:23:30 -0600 From: Rob Herring To: Lucas Stach Subject: Re: [PATCH 1/3] drm/etnaviv: add generic compatible for the GPU subsystem node Message-ID: <20180122172330.iddtnl4bzlftofyp@rob-hp-laptop> References: <20180119120634.22856-1-l.stach@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180119120634.22856-1-l.stach@pengutronix.de> User-Agent: NeoMutt/20170609 (1.8.3) Cc: Mark Rutland , devicetree@vger.kernel.org, etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, patchwork-lst@pengutronix.de, kernel@pengutronix.de, Russell King 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Jan 19, 2018 at 01:06:32PM +0100, Lucas Stach wrote: > With different SoCs gaining support for etnaviv it doesn't make much sense > to add specific compatibles for the generic GPU subsystem node, which is > only used to find all GPU core nodes. How many other SoC families? Is it really more than a couple? The strings are already pretty generic. Plus the real GPU nodes already have completely generic compatibles. If you ever need to do something SoC specific, that leaves you with looking at the top-level compatible or SOL. > > Add a generic compatible, that can be used by all new implementations. > > Signed-off-by: Lucas Stach > --- > Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt | 1 + > drivers/gpu/drm/etnaviv/etnaviv_drv.c | 1 + > 2 files changed, 2 insertions(+) > > diff --git a/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt b/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt > index 05176f1ae108..c6f4e023c34a 100644 > --- a/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt > +++ b/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt > @@ -8,6 +8,7 @@ Required properties: > - compatible: Should be one of > "fsl,imx-gpu-subsystem" > "marvell,dove-gpu-subsystem" > + "vivante,gpu-subsystem" I'd prefer to get rid of this fake node altogether. It exists entirely because somewhere in the stack wants 2D and 3D gpus exposed as a single DRM device. That's not really my problem from a DT perspective. Something like the patch below would solve the problem. It does break module auto loading, but that could be fixed by moving the device creation to the platforms (sometimes you just need platform specific code). Note, I probably don't have node ref counting right and the of_device_is_available checking should really be in the core code. diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c index 491eddf9b150..fc62827055a8 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c @@ -662,16 +662,11 @@ static int etnaviv_pdev_probe(struct platform_device *pdev) if (node) { struct device_node *core_node; - int i; - for (i = 0; ; i++) { - core_node = of_parse_phandle(node, "cores", i); - if (!core_node) - break; - - drm_of_component_match_add(&pdev->dev, &match, - compare_of, core_node); - of_node_put(core_node); + for_each_compatible_node(core_node, NULL, "vivante,gc") { + if (of_device_is_available(core_node)) + drm_of_component_match_add(&pdev->dev, &match, + compare_of, core_node); } } else if (dev->platform_data) { char **names = dev->platform_data; @@ -691,28 +686,27 @@ static int etnaviv_pdev_remove(struct platform_device *pdev) return 0; } -static const struct of_device_id dt_match[] = { - { .compatible = "fsl,imx-gpu-subsystem" }, - { .compatible = "marvell,dove-gpu-subsystem" }, - {} -}; -MODULE_DEVICE_TABLE(of, dt_match); - static struct platform_driver etnaviv_platform_driver = { .probe = etnaviv_pdev_probe, .remove = etnaviv_pdev_remove, .driver = { .name = "etnaviv", - .of_match_table = dt_match, }, }; static int __init etnaviv_init(void) { int ret; + struct device_node *node; etnaviv_validate_init(); + node = of_find_compatible_node(NULL, "vivante,gc"); + if (node && of_device_is_available(node)) { + platform_device_register_simple("etnaviv", -1, NULL, 0); + of_node_put(node); + } + ret = platform_driver_register(&etnaviv_gpu_driver); if (ret != 0) return ret;