aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-5.4/950-0331-drm-vc4-Added-calls-for-firmware-display-blank-unbla.patch
blob: 812f69643f77c213c866a4cca5b79d03c9732fe4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
From b92ed4ca0f9be3c8cc1a21dbbef346338d336329 Mon Sep 17 00:00:00 2001
From: James Hughes <james.hughes@raspberrypi.org>
Date: Wed, 16 Oct 2019 14:49:23 +0100
Subject: [PATCH] drm:vc4 Added calls for firmware display
 blank/unblank

Requires new display power mailbox call to be present.

Signed-off-by: James Hughes <james.hughes@raspberrypi.org>
---
 drivers/gpu/drm/vc4/vc4_firmware_kms.c     | 26 ++++++++++++++++++++++
 include/soc/bcm2835/raspberrypi-firmware.h |  2 +-
 2 files changed, 27 insertions(+), 1 deletion(-)

--- a/drivers/gpu/drm/vc4/vc4_firmware_kms.c
+++ b/drivers/gpu/drm/vc4/vc4_firmware_kms.c
@@ -94,6 +94,12 @@ struct mailbox_blank_display {
 	u32 blank;
 };
 
+struct mailbox_display_pwr {
+	struct rpi_firmware_property_tag_header tag1;
+	u32 display;
+	u32 state;
+};
+
 struct mailbox_get_edid {
 	struct rpi_firmware_property_tag_header tag1;
 	u32 block;
@@ -274,6 +280,8 @@ to_vc4_crtc_state(struct drm_crtc_state
 struct vc4_fkms_encoder {
 	struct drm_encoder base;
 	bool hdmi_monitor;
+	bool rgb_range_selectable;
+	int display_num;
 };
 
 static inline struct vc4_fkms_encoder *
@@ -1637,13 +1645,29 @@ static const struct drm_encoder_funcs vc
 	.destroy = vc4_fkms_encoder_destroy,
 };
 
+static void vc4_fkms_display_power(struct drm_encoder *encoder, bool power)
+{
+	struct vc4_fkms_encoder *vc4_encoder = to_vc4_fkms_encoder(encoder);
+	struct vc4_dev *vc4 = to_vc4_dev(encoder->dev);
+
+	struct mailbox_display_pwr pwr = {
+		.tag1 = {RPI_FIRMWARE_SET_DISPLAY_POWER, 8, 0, },
+		.display = vc4_encoder->display_num,
+		.state = power ? 1 : 0,
+	};
+
+	rpi_firmware_property_list(vc4->firmware, &pwr, sizeof(pwr));
+}
+
 static void vc4_fkms_encoder_enable(struct drm_encoder *encoder)
 {
+	vc4_fkms_display_power(encoder, true);
 	DRM_DEBUG_KMS("Encoder_enable\n");
 }
 
 static void vc4_fkms_encoder_disable(struct drm_encoder *encoder)
 {
+	vc4_fkms_display_power(encoder, false);
 	DRM_DEBUG_KMS("Encoder_disable\n");
 }
 
@@ -1719,6 +1743,8 @@ static int vc4_fkms_create_screen(struct
 	if (!vc4_encoder)
 		return -ENOMEM;
 	vc4_crtc->encoder = &vc4_encoder->base;
+
+	vc4_encoder->display_num = display_ref;
 	vc4_encoder->base.possible_crtcs |= drm_crtc_mask(crtc) ;
 
 	drm_encoder_init(drm, &vc4_encoder->base, &vc4_fkms_encoder_funcs,
--- a/include/soc/bcm2835/raspberrypi-firmware.h
+++ b/include/soc/bcm2835/raspberrypi-firmware.h
@@ -153,7 +153,7 @@ enum rpi_firmware_property_tag {
 	RPI_FIRMWARE_GET_DISPLAY_TIMING =                     0x00040017,
 	RPI_FIRMWARE_SET_TIMING =                             0x00048017,
 	RPI_FIRMWARE_GET_DISPLAY_CFG =                        0x00040018,
-
+	RPI_FIRMWARE_SET_DISPLAY_POWER =		      0x00048019,
 	RPI_FIRMWARE_GET_COMMAND_LINE =                       0x00050001,
 	RPI_FIRMWARE_GET_DMA_CHANNELS =                       0x00060001,
 };