1 From 9e9177db83609c19bbe523cc4d20119cf09ea787 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Wed, 15 Dec 2021 10:51:17 +0100
4 Subject: [PATCH] drm/vc4: Notify the firmware when DRM is in charge
6 Once the call to drm_fb_helper_remove_conflicting_framebuffers() has
7 been made, simplefb has been unregistered and the KMS driver is entirely
8 in charge of the display.
10 Thus, we can notify the firmware it can free whatever resource it was
11 using to maintain simplefb functional.
13 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
14 Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
15 Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
16 Link: https://patchwork.freedesktop.org/patch/msgid/20211215095117.176435-5-maxime@cerno.tech
18 drivers/gpu/drm/vc4/vc4_drv.c | 22 ++++++++++++++++++++++
19 1 file changed, 22 insertions(+)
21 --- a/drivers/gpu/drm/vc4/vc4_drv.c
22 +++ b/drivers/gpu/drm/vc4/vc4_drv.c
24 #include <drm/drm_fb_helper.h>
25 #include <drm/drm_vblank.h>
27 +#include <soc/bcm2835/raspberrypi-firmware.h>
29 #include "uapi/drm/vc4_drm.h"
32 @@ -226,6 +228,7 @@ static const struct of_device_id vc4_dma
33 static int vc4_drm_bind(struct device *dev)
35 struct platform_device *pdev = to_platform_device(dev);
36 + struct rpi_firmware *firmware = NULL;
37 struct drm_device *drm;
39 struct device_node *node;
40 @@ -272,10 +275,29 @@ static int vc4_drm_bind(struct device *d
44 + node = of_find_compatible_node(NULL, NULL, "raspberrypi,bcm2835-firmware");
46 + firmware = rpi_firmware_get(node);
50 + return -EPROBE_DEFER;
53 ret = drm_aperture_remove_framebuffers(false, &vc4_drm_driver);
58 + ret = rpi_firmware_property(firmware,
59 + RPI_FIRMWARE_NOTIFY_DISPLAY_DONE,
62 + drm_warn(drm, "Couldn't stop firmware display driver: %d\n", ret);
64 + rpi_firmware_put(firmware);
67 ret = component_bind_all(dev, drm);