From patchwork Fri Dec 3 13:51:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12694710 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F054CC433F5 for ; Fri, 3 Dec 2021 13:54:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RBq/6SkCRGpWZrEamgunlV0RcqfqyzBIgE8wj0aCe+k=; b=usuQLQWrAZEx6Q wfuAKevKUs9YTZBsQ0/JIuYk+4uXTO+/9+71h61N3HA7CkXS3+iNDRL3Op8aw14OAXiY4SeWOIVFO 22OjmzYsZezwO72HJdWlM86U4laczlmaFsEf5gZnwCoEEibfXc7GAd2QqL74ME4Ax7ySlEpq9Bgxw MTzicPlwBmVREm75jYT9ALazG4VsxoHCAg0unBVhl462Qn7rDkQJEgsN8C8hhtPaoR1jnTKe7bRqw SZJNWxytJ97yzKNVqxB1OeqhIX73J1qk8QZ761gOk/bg9FK8XOQvzrGD/YhdggauQuXMWbwO4Vr8E rfrp2eJqFttBT4gPdN+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mt8ze-00G47Q-OB; Fri, 03 Dec 2021 13:52:55 +0000 Received: from new2-smtp.messagingengine.com ([66.111.4.224]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mt8yP-00G3a1-G6; Fri, 03 Dec 2021 13:51:39 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id ADE725800F0; Fri, 3 Dec 2021 08:51:36 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 03 Dec 2021 08:51:36 -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=HOi4Gz1hW38Xl SjSMQhvunvdi3R7X8A7uhXWityqRXw=; b=QuZxfjfDAuBHCw/qGhRC4wgLfWeav qPT8KIWs+o2yHgHfamUqT+UCa1LzxdvVHvdXEXnNytGaOi/CQW+b6t80sDiu5aEU iHbt/ITVLyfB+e/gavtofrlgAWVYCTYQyY7LcBLEufecbKfgu2ViTpalEYv4Q/LG q5/c9ZwYOguWNkmENK/XlUSTX9PkirZG6h4ZG9Z7ear0dIQ6ulVmu8oW0hbRrWu0 M/nFMZGC4kEWA7f245TA2l9Tt9MNiUvCRO0H23yuAlTnM4sddCJ2AZ2GVAAFLDCZ zdWQSgMwGzq0gQq6HIeQI0YT6HZ9Bvuy/xpi1c5R+zu1NhjpGbJ8HhOlg== 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=HOi4Gz1hW38XlSjSMQhvunvdi3R7X8A7uhXWityqRXw=; b=aNAhwW77 VFU1zk7cp6ftINRSXZu105qQjpRFURIl6vMwIwyiZL0toUzK+UtU9f57G33iW2MR 7xQXnwFoLttpdB9tldQs+CqMOQwpIVmAuCkMqvmIKGa5JFY4fc6DybiDLkI1o4E4 05GqfX7sMx8dQszXs1D2RHc0E4+eOwgrIH95yWolLzzuprzBbBXyXzs1SfXzqJTJ VxU5HPxETeL+nwcGSoiqV06y0UtBw3GgMvpIe7q2gN53PMSd6ej+AUUo4X2b/mPG OZ8sjzuokr9kkDyuo2wai20TU6PFihHbGCoF3/BPCuAFFgU5HpQ8ycbFp0hrl6m2 o3OqBU54cIiFCQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrieejgdehlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 3 Dec 2021 08:51:36 -0500 (EST) From: Maxime Ripard To: Ray Jui , Scott Branden , Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard , Rob Herring , Frank Rowand , Florian Fainelli , Nicolas Saenz Julienne , Daniel Vetter , David Airlie Cc: Dave Stevenson , Phil Elwell , Tim Gover , Dom Cobley , linux-rpi-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, bcm-kernel-feedback-list@broadcom.com Subject: [PATCH v2 3/3] drm/vc4: Notify the firmware when DRM is in charge Date: Fri, 3 Dec 2021 14:51:26 +0100 Message-Id: <20211203135126.700165-4-maxime@cerno.tech> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211203135126.700165-1-maxime@cerno.tech> References: <20211203135126.700165-1-maxime@cerno.tech> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211203_055137_652711_D0BE145A X-CRM114-Status: GOOD ( 12.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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..38d55a47c831 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_find_compatible_node(NULL, NULL, "raspberrypi,bcm2835-firmware"); + if (node) { + vc4->firmware = devm_rpi_firmware_get(dev, 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;