From patchwork Mon Apr 9 23:00:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Anholt X-Patchwork-Id: 10332103 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 AE1E86020F for ; Mon, 9 Apr 2018 23:01:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C0BB28C1A for ; Mon, 9 Apr 2018 23:01:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9097128C2C; Mon, 9 Apr 2018 23:01:15 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EEFA328C1A for ; Mon, 9 Apr 2018 23:01:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=Z7XWdENeBqecTpHQPv0Rcpgy47QHdKqrS9U33XnCEmA=; b=jOk XKhVDqN2kjWh9hpKhIMDeUAfM2HVSmnJIGfJ0NvicvsmPJiRMMF3eZSon51mQanMj/b43UXqDqTJI UtGzvrTrHiLCmy6TTzJdoNvY7GhjjavqEn1uzNg3luPZkR56maMWxtcigDOQnxsp6wlLkmTCYBJbx 1oB/ZVRKuFj3P1H4SMQBf5lUs5r4GDl72QDIkZvbyXH96Zq69p62I6y8gERfT8tPymynPsUkDkWUW UVt6WtCl2eudzQcQgxPOYSIHzbNUKimLINcQQb4acBVJhJ1sX2wikQmHVaEtvguMBNfMjHR6SwEWG q4R3nBdTVaS/xnQ591DD1+ff7g2ZjAQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f5fmX-0004a3-HT; Mon, 09 Apr 2018 23:01:01 +0000 Received: from anholt.net ([50.246.234.109]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f5fmT-0004WK-7F; Mon, 09 Apr 2018 23:00:58 +0000 Received: from localhost (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id 2248810A15FF; Mon, 9 Apr 2018 16:00:45 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at anholt.net Received: from anholt.net ([127.0.0.1]) by localhost (kingsolver.anholt.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id bMWZZCiQbD4P; Mon, 9 Apr 2018 16:00:42 -0700 (PDT) Received: from eliezer.anholt.net (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id 650D310A11F5; Mon, 9 Apr 2018 16:00:41 -0700 (PDT) Received: by eliezer.anholt.net (Postfix, from userid 1000) id 904DC2FE2D4F; Mon, 9 Apr 2018 16:00:40 -0700 (PDT) From: Eric Anholt To: dri-devel@lists.freedesktop.org, Rob Herring , Mark Rutland , Ray Jui , Scott Branden , Jon Mason , bcm-kernel-feedback-list@broadcom.com, Florian Fainelli , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Stefan Wahren , linux-rpi-kernel@lists.infradead.org Subject: [PATCH 1/3] drm/vc4: Remove the need for the GPU-subsystem DT node. Date: Mon, 9 Apr 2018 16:00:38 -0700 Message-Id: <20180409230040.1100-1-eric@anholt.net> X-Mailer: git-send-email 2.17.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180409_160057_337425_62C70BEA X-CRM114-Status: GOOD ( 19.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Anholt MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The GPU subsystem node was a workaround to have a central device to bind V3D and display to. Following the lead of 246774d17fc0 ("drm/etnaviv: remove the need for a gpu-subsystem DT node"), remove the subsystem node usage and just create a platform device for the DRM device to attach to if any of the subsystem devices are present. Signed-off-by: Eric Anholt --- .../bindings/display/brcm,bcm-vc4.txt | 7 ---- drivers/gpu/drm/vc4/vc4_drv.c | 33 ++++++++++++++----- drivers/gpu/drm/vc4/vc4_hvs.c | 1 + drivers/gpu/drm/vc4/vc4_v3d.c | 1 + 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt b/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt index 284e2b14cfbe..5fd4717101d6 100644 --- a/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt +++ b/Documentation/devicetree/bindings/display/brcm,bcm-vc4.txt @@ -4,9 +4,6 @@ The VC4 device present on the Raspberry Pi includes a display system with HDMI output and the HVS (Hardware Video Scaler) for compositing display planes. -Required properties for VC4: -- compatible: Should be "brcm,bcm2835-vc4" or "brcm,cygnus-vc4" - Required properties for Pixel Valve: - compatible: Should be one of "brcm,bcm2835-pixelvalve0", "brcm,bcm2835-pixelvalve1", or "brcm,bcm2835-pixelvalve2" @@ -153,10 +150,6 @@ v3d: v3d@7ec00000 { interrupts = <1 10>; }; -vc4: gpu { - compatible = "brcm,bcm2835-vc4"; -}; - panel: panel { compatible = "ontat,yx700wv03", "simple-panel"; diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index 7c95ed5c5cac..d282ab7de03a 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -364,22 +364,34 @@ static int vc4_platform_drm_remove(struct platform_device *pdev) return 0; } -static const struct of_device_id vc4_of_match[] = { - { .compatible = "brcm,bcm2835-vc4", }, - { .compatible = "brcm,cygnus-vc4", }, - {}, -}; -MODULE_DEVICE_TABLE(of, vc4_of_match); - static struct platform_driver vc4_platform_driver = { .probe = vc4_platform_drm_probe, .remove = vc4_platform_drm_remove, .driver = { .name = "vc4-drm", - .of_match_table = vc4_of_match, }, }; +static bool +driver_of_table_has_a_match(const struct platform_driver *driver) +{ + int i; + + for (i = 0; driver->driver.of_match_table[i].compatible; i++) { + const char *compat = driver->driver.of_match_table[i].compatible; + struct device_node *node; + + while ((node = of_find_compatible_node(node, NULL, compat))) { + if (of_device_is_available(node)) { + of_node_put(node); + return true; + } + } + } + + return false; +} + static int __init vc4_drm_register(void) { int ret; @@ -389,6 +401,11 @@ static int __init vc4_drm_register(void) if (ret) return ret; + if (driver_of_table_has_a_match(&vc4_v3d_driver) || + driver_of_table_has_a_match(&vc4_hvs_driver)) { + platform_device_register_simple("vc4-drm", -1, NULL, 0); + } + return platform_driver_register(&vc4_platform_driver); } diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c index 2b62fc5b8d85..730813ee74ae 100644 --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c @@ -262,6 +262,7 @@ static const struct of_device_id vc4_hvs_dt_match[] = { { .compatible = "brcm,bcm2835-hvs" }, {} }; +MODULE_DEVICE_TABLE(of, vc4_hvs_dt_match); struct platform_driver vc4_hvs_driver = { .probe = vc4_hvs_dev_probe, diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c index bfc2fa73d2ae..e77e9ebbab4b 100644 --- a/drivers/gpu/drm/vc4/vc4_v3d.c +++ b/drivers/gpu/drm/vc4/vc4_v3d.c @@ -459,6 +459,7 @@ static const struct of_device_id vc4_v3d_dt_match[] = { { .compatible = "brcm,vc4-v3d" }, {} }; +MODULE_DEVICE_TABLE(of, vc4_v3d_dt_match); struct platform_driver vc4_v3d_driver = { .probe = vc4_v3d_dev_probe,