From patchwork Mon Dec 13 16:26:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12695943 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 E1FBDC433EF for ; Mon, 13 Dec 2021 16:30:10 +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=oeYVu02wrYtyhqj7nh1ugTlOU6kNvy0XTYBHt7+780I=; b=kFAcUx8YKnS0MI BfkN7XAYQED4bDPgSJrhvR9tWAtlZosxCN4yy1WJsbJH8Em875FPbv424Li6z4Uy/RZEoapDG2TVJ pTTvKKcH6nHFBXcmm6pXQlxNc6OjvKv751s9gFn4EC/AC8McDJ42k57tSRgY2eqjYE1mEVVMMUukl rLIqp1kmV1QICx+UkD5ZCp/mGC7l+DN9HOdlUGhi9ZIJ+3GyE8s/xUZU+WjUI7z+jgClS1wQeSqYV fW+seQMbuIgjQvYbn1LuV5smaXHBI8TVK1SKHRCO6tn6hyk9gQbaRRiVLYb0QIg5ypEwUQwNcvKI3 v7Y4tEUnx/fgw6wj0ZRw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mwoBT-00AabR-Jx; Mon, 13 Dec 2021 16:28:15 +0000 Received: from new4-smtp.messagingengine.com ([66.111.4.230]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mwoA2-00Aa28-Ve; Mon, 13 Dec 2021 16:26:48 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id 3A2335801BE; Mon, 13 Dec 2021 11:26:46 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 13 Dec 2021 11:26:46 -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=c7km/lvZ5a2iH qu7qa5YLTQv7U1pBCi32tVq4pp5uwo=; b=OX4pRvqbucgkVQApIEi5wHXzyDlde cf4IvAoI4QqNjyIBsRHf54fAPF4ydWX6zLwyfqHRl2SgoTPnFci7SnSJ2ttzHLkJ lIwyfCnQLfSX5atJITJZrBKa333bQwf//sFe4achkXhM3NSuBh6V+yK5yMAPiqZ+ 6BWaw7RpjgyRUJqm/JPbAJoS0zH4W8IeRjP0uOSyLV4JYRrwnX9omqNRXAJoJL1U 44aS2271zU7uAGhDxhkoCvWuV0U35x+33c1jj8pEAQWzGhN92tmX2Kh4bpbdbTt8 euRkM8KXpc/CqnVEeh45QPM9Ia+0qjvjwFHF4r8RzYdunGqtRHHxZBylA== 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=c7km/lvZ5a2iHqu7qa5YLTQv7U1pBCi32tVq4pp5uwo=; b=OdDaXrWg hZrh9I3zmJc2ieYE4JGU2+2c9OdaZ7NoPfd2UebbAJt02XpqMgnIbh/t5tHbWWC1 xFc3BrgZ3zOKn0lLWylWVWVsVxEmpAR1VVKgFe4lbAAFGpHsFm2ybGCj1OiYP9ZS 0pZoDfHG7h9NVeRmbeL+VTatVfcGyqjEUg7iwPYuXFzFyYJgnxHZ3U6W0w2dJeTC ZXfIGUHgkSmfaouavZ0E+Z6IBRhBJf4lbVkpXYmmDk1z9/x9T11hlr1iHQQYtbLP lv3RSeKiFLMaPMeackfUBm2h8AVtNRU1ITobvPYHg+FdTYmm/I+D+K2p9mm6i7aV h2lOTaOBarN6lw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrkeekgdeklecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpedvkeelveefffekjefhffeuleetleefudeifeehuddugffghffhffehveevheeh vdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 13 Dec 2021 11:26:45 -0500 (EST) From: Maxime Ripard To: Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard , Daniel Vetter , David Airlie , Florian Fainelli , Scott Branden , Nicolas Saenz Julienne , Rob Herring , Frank Rowand , Ray Jui Cc: Dave Stevenson , Phil Elwell , Tim Gover , Dom Cobley , bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH RESEND v4 v4 4/4] drm/vc4: Notify the firmware when DRM is in charge Date: Mon, 13 Dec 2021 17:26:35 +0100 Message-Id: <20211213162635.252582-5-maxime@cerno.tech> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211213162635.252582-1-maxime@cerno.tech> References: <20211213162635.252582-1-maxime@cerno.tech> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211213_082647_150867_7E62A579 X-CRM114-Status: GOOD ( 12.74 ) 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 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index c0d7e510694f..e4bb37a191f6 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" @@ -215,6 +217,7 @@ static void vc4_match_add_drivers(struct device *dev, static int vc4_drm_bind(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); + struct rpi_firmware *firmware = NULL; struct drm_device *drm; struct vc4_dev *vc4; struct device_node *node; @@ -251,10 +254,29 @@ static int vc4_drm_bind(struct device *dev) if (ret) return ret; + node = of_find_compatible_node(NULL, NULL, "raspberrypi,bcm2835-firmware"); + if (node) { + firmware = rpi_firmware_get(node); + of_node_put(node); + + if (!firmware) + return -EPROBE_DEFER; + } + ret = drm_aperture_remove_framebuffers(false, &vc4_drm_driver); if (ret) return ret; + if (firmware) { + ret = rpi_firmware_property(firmware, + RPI_FIRMWARE_NOTIFY_DISPLAY_DONE, + NULL, 0); + if (ret) + drm_warn(drm, "Couldn't stop firmware display driver: %d\n", ret); + + rpi_firmware_put(firmware); + } + ret = component_bind_all(dev, drm); if (ret) return ret;