812f69643f77c213c866a4cca5b79d03c9732fe4
[openwrt/staging/981213.git] /
1 From b92ed4ca0f9be3c8cc1a21dbbef346338d336329 Mon Sep 17 00:00:00 2001
2 From: James Hughes <james.hughes@raspberrypi.org>
3 Date: Wed, 16 Oct 2019 14:49:23 +0100
4 Subject: [PATCH] drm:vc4 Added calls for firmware display
5 blank/unblank
6
7 Requires new display power mailbox call to be present.
8
9 Signed-off-by: James Hughes <james.hughes@raspberrypi.org>
10 ---
11 drivers/gpu/drm/vc4/vc4_firmware_kms.c | 26 ++++++++++++++++++++++
12 include/soc/bcm2835/raspberrypi-firmware.h | 2 +-
13 2 files changed, 27 insertions(+), 1 deletion(-)
14
15 --- a/drivers/gpu/drm/vc4/vc4_firmware_kms.c
16 +++ b/drivers/gpu/drm/vc4/vc4_firmware_kms.c
17 @@ -94,6 +94,12 @@ struct mailbox_blank_display {
18 u32 blank;
19 };
20
21 +struct mailbox_display_pwr {
22 + struct rpi_firmware_property_tag_header tag1;
23 + u32 display;
24 + u32 state;
25 +};
26 +
27 struct mailbox_get_edid {
28 struct rpi_firmware_property_tag_header tag1;
29 u32 block;
30 @@ -274,6 +280,8 @@ to_vc4_crtc_state(struct drm_crtc_state
31 struct vc4_fkms_encoder {
32 struct drm_encoder base;
33 bool hdmi_monitor;
34 + bool rgb_range_selectable;
35 + int display_num;
36 };
37
38 static inline struct vc4_fkms_encoder *
39 @@ -1637,13 +1645,29 @@ static const struct drm_encoder_funcs vc
40 .destroy = vc4_fkms_encoder_destroy,
41 };
42
43 +static void vc4_fkms_display_power(struct drm_encoder *encoder, bool power)
44 +{
45 + struct vc4_fkms_encoder *vc4_encoder = to_vc4_fkms_encoder(encoder);
46 + struct vc4_dev *vc4 = to_vc4_dev(encoder->dev);
47 +
48 + struct mailbox_display_pwr pwr = {
49 + .tag1 = {RPI_FIRMWARE_SET_DISPLAY_POWER, 8, 0, },
50 + .display = vc4_encoder->display_num,
51 + .state = power ? 1 : 0,
52 + };
53 +
54 + rpi_firmware_property_list(vc4->firmware, &pwr, sizeof(pwr));
55 +}
56 +
57 static void vc4_fkms_encoder_enable(struct drm_encoder *encoder)
58 {
59 + vc4_fkms_display_power(encoder, true);
60 DRM_DEBUG_KMS("Encoder_enable\n");
61 }
62
63 static void vc4_fkms_encoder_disable(struct drm_encoder *encoder)
64 {
65 + vc4_fkms_display_power(encoder, false);
66 DRM_DEBUG_KMS("Encoder_disable\n");
67 }
68
69 @@ -1719,6 +1743,8 @@ static int vc4_fkms_create_screen(struct
70 if (!vc4_encoder)
71 return -ENOMEM;
72 vc4_crtc->encoder = &vc4_encoder->base;
73 +
74 + vc4_encoder->display_num = display_ref;
75 vc4_encoder->base.possible_crtcs |= drm_crtc_mask(crtc) ;
76
77 drm_encoder_init(drm, &vc4_encoder->base, &vc4_fkms_encoder_funcs,
78 --- a/include/soc/bcm2835/raspberrypi-firmware.h
79 +++ b/include/soc/bcm2835/raspberrypi-firmware.h
80 @@ -153,7 +153,7 @@ enum rpi_firmware_property_tag {
81 RPI_FIRMWARE_GET_DISPLAY_TIMING = 0x00040017,
82 RPI_FIRMWARE_SET_TIMING = 0x00048017,
83 RPI_FIRMWARE_GET_DISPLAY_CFG = 0x00040018,
84 -
85 + RPI_FIRMWARE_SET_DISPLAY_POWER = 0x00048019,
86 RPI_FIRMWARE_GET_COMMAND_LINE = 0x00050001,
87 RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001,
88 };