bcm27xx: switch to 5.15
[openwrt/staging/chunkeey.git] / target / linux / bcm27xx / patches-5.10 / 950-0665-drm-vc4-Notify-the-firmware-when-DRM-is-in-charge.patch
1 From 154a12e5c0d417cae205b8e16431f29c627311e6 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Wed, 23 Jun 2021 11:54:58 +0200
4 Subject: [PATCH] drm/vc4: Notify the firmware when DRM is in charge
5
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.
9
10 Thus, we can notify the firmware it can free whatever resource it was
11 using to maintain simplefb functional.
12
13 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
14 ---
15 drivers/gpu/drm/vc4/vc4_drv.c | 19 +++++++++++++++++++
16 1 file changed, 19 insertions(+)
17
18 --- a/drivers/gpu/drm/vc4/vc4_drv.c
19 +++ b/drivers/gpu/drm/vc4/vc4_drv.c
20 @@ -36,6 +36,8 @@
21 #include <drm/drm_fb_helper.h>
22 #include <drm/drm_vblank.h>
23
24 +#include <soc/bcm2835/raspberrypi-firmware.h>
25 +
26 #include "uapi/drm/vc4_drm.h"
27
28 #include "vc4_drv.h"
29 @@ -305,8 +307,25 @@ static int vc4_drm_bind(struct device *d
30 if (ret)
31 return ret;
32
33 + node = of_parse_phandle(dev->of_node, "raspberrypi,firmware", 0);
34 + if (node) {
35 + vc4->firmware = rpi_firmware_get(dev->of_node);
36 + of_node_put(node);
37 +
38 + if (!vc4->firmware)
39 + return -EPROBE_DEFER;
40 + }
41 +
42 drm_fb_helper_remove_conflicting_framebuffers(NULL, "vc4drmfb", false);
43
44 + if (vc4->firmware) {
45 + ret = rpi_firmware_property(vc4->firmware,
46 + RPI_FIRMWARE_NOTIFY_DISPLAY_DONE,
47 + NULL, 0);
48 + if (ret)
49 + drm_warn(drm, "Couldn't stop firmware display driver: %d\n", ret);
50 + }
51 +
52 ret = component_bind_all(dev, drm);
53 if (ret)
54 return ret;