From patchwork Wed Nov 17 14:50:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12692925 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 A709AC433F5 for ; Wed, 17 Nov 2021 14:54:00 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 6FB9561B1E for ; Wed, 17 Nov 2021 14:54:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6FB9561B1E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=G/5OuD5uUAjktBzHFsy/A9grXIuSnkKVKD4CXP1rgks=; b=bQvbHgQM/uDXPr q+tgGsaFrjVfcifpj8OHPQeAnLFETbHfmlmiQgJOdLlz6c4TUPC//94/Ru1/0nFOx3Vy+3hzDj/UO w2Mz/dxJjo2O3Ne3YHY+1vdQN8VfrgY8s3EZYBkx9z/aO6XwBocT7rrtopa17SotBDRAL9fLK4LuM gCp9HahdePm73QUiNFd636PQ+MfkO76JK1JBYKGXtMqzTdfM2l7s62zXQxI52xWwfXt65ehZ25nLz zyl50ZPQvkhlBqdDfxk4gjNR7eHorW3ixO3bx+onY7jSbzZb8dH3LNkkLniOgRWDJG3Y9uq60N/0X clVWQsKn5x8bF7JSdktg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mnMII-005EZ7-A9; Wed, 17 Nov 2021 14:52:14 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mnMGy-005E8z-Rs; Wed, 17 Nov 2021 14:50:54 +0000 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211117_065053_056275_9BA85B80 X-CRM114-Status: GOOD ( 13.02 ) 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..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;