From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E23EC433FE for ; Wed, 17 Nov 2021 14:51:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3422161B4C for ; Wed, 17 Nov 2021 14:51:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232190AbhKQOyA (ORCPT ); Wed, 17 Nov 2021 09:54:00 -0500 Received: from new1-smtp.messagingengine.com ([66.111.4.221]:56275 "EHLO new1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232209AbhKQOxw (ORCPT ); Wed, 17 Nov 2021 09:53:52 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 23FF7580882; Wed, 17 Nov 2021 09:50:52 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 17 Nov 2021 09:50:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=23dqcmjSH9B2h 73WyYCD5rWytbbg/psxAuav/PZZVQg=; b=MG2lEI8rPFK2Ha+6tbxWgg3qMZreD TzODacTLdimFuYRN8UkNSJkzlLg2UCFWYwA6zZ3OhRgvhCnJGjeYBoMD3Cr8/23F f8WupOmKUBkP9+Iary7EK6CjU6azQ7FFefwJYdkigi/M3aoVQo1wK3i/1dILAQD+ eOo+SWtNFSn0/xGdZxryVpnrhEu7qywhwxlLJDIgRe3Jt9gmqMz6dF8DjXfmEu1g VTtb5UasGFAGY6RnxSzRF6W7QCKv2Y4q1Univb275yt45ExMRae/vqv05/X/SODb OTgzhoR+FE0948ql8YYkCWWKiLw5l7p/xJZMCpAlA3kZ3YZq2N+RJbgaA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=23dqcmjSH9B2h73WyYCD5rWytbbg/psxAuav/PZZVQg=; b=EpF92wSo aJS5IZZcQSznSPQLcmMoEQ6reQ/KUXtB7YXBC7ZBudq8WkjfvWw7wNIDVR3NwGM3 E5GoXJ1pv+Bg7/OguMNVCPnOR0SqqrRJeMP5JT/5Q4jkGtzG/cPokWu/3mqWAL2d 9ULv5ji4e5LN3Xk+QCVWOfhn/63Ih/VEcByYcd0mJbdMbvTxGWilb+PWk5HQ8omu XLJpJiE9pFpygpkU6yBBERiuC85krn0UKmBKR/OaWgEWMogGEUFNJNPzXJOuro2B cSuYK6JM9Vj/LC5gLd0MbJpoN4uwU8F/VO2Vfk5iIn06oxrNvZBDW3qtpP6wyPlJ eWWu608MKD6OOw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrfeeggdeifecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 17 Nov 2021 09:50:51 -0500 (EST) From: Maxime Ripard To: Scott Branden , Nicolas Saenz Julienne , Rob Herring , Frank Rowand , Ray Jui , Florian Fainelli , Daniel Vetter , David Airlie , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard Cc: linux-rpi-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, Dave Stevenson , Phil Elwell , Tim Gover , Dom Cobley , devicetree@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com Subject: [PATCH 4/5] drm/vc4: Notify the firmware when DRM is in charge Date: Wed, 17 Nov 2021 15:50:39 +0100 Message-Id: <20211117145040.334827-5-maxime@cerno.tech> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211117145040.334827-1-maxime@cerno.tech> References: <20211117145040.334827-1-maxime@cerno.tech> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Once the call to drm_fb_helper_remove_conflicting_framebuffers() has been made, simplefb has been unregistered and the KMS driver is entirely in charge of the display. Thus, we can notify the firmware it can free whatever resource it was using to maintain simplefb functional. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_drv.c | 19 +++++++++++++++++++ drivers/gpu/drm/vc4/vc4_drv.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index 8ab89f805826..d09fa9c130da 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -37,6 +37,8 @@ #include #include +#include + #include "uapi/drm/vc4_drm.h" #include "vc4_drv.h" @@ -251,10 +253,27 @@ static int vc4_drm_bind(struct device *dev) if (ret) return ret; + node = of_parse_phandle(dev->of_node, "raspberrypi,firmware", 0); + if (node) { + vc4->firmware = rpi_firmware_get(node); + of_node_put(node); + + if (!vc4->firmware) + return -EPROBE_DEFER; + } + ret = drm_aperture_remove_framebuffers(false, &vc4_drm_driver); if (ret) return ret; + if (vc4->firmware) { + ret = rpi_firmware_property(vc4->firmware, + RPI_FIRMWARE_NOTIFY_DISPLAY_DONE, + NULL, 0); + if (ret) + drm_warn(drm, "Couldn't stop firmware display driver: %d\n", ret); + } + ret = component_bind_all(dev, drm); if (ret) return ret; diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index 4329e09d357c..b840654c53a9 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -76,6 +76,8 @@ struct vc4_dev { unsigned int irq; + struct rpi_firmware *firmware; + struct vc4_hvs *hvs; struct vc4_v3d *v3d; struct vc4_dpi *dpi; -- 2.33.1