1 From ebb8a4e93e242311d319098ea56e4ef4d92c4d19 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
7 Requires new display power mailbox call to be present.
9 Signed-off-by: James Hughes <james.hughes@raspberrypi.org>
11 drivers/gpu/drm/vc4/vc4_firmware_kms.c | 25 ++++++++++++++++++++++
12 include/soc/bcm2835/raspberrypi-firmware.h | 2 +-
13 2 files changed, 26 insertions(+), 1 deletion(-)
15 --- a/drivers/gpu/drm/vc4/vc4_firmware_kms.c
16 +++ b/drivers/gpu/drm/vc4/vc4_firmware_kms.c
17 @@ -91,6 +91,12 @@ struct mailbox_blank_display {
21 +struct mailbox_display_pwr {
22 + struct rpi_firmware_property_tag_header tag1;
27 struct mailbox_get_edid {
28 struct rpi_firmware_property_tag_header tag1;
30 @@ -272,6 +278,7 @@ struct vc4_fkms_encoder {
31 struct drm_encoder base;
33 bool rgb_range_selectable;
37 static inline struct vc4_fkms_encoder *
38 @@ -1613,13 +1620,29 @@ static const struct drm_encoder_funcs vc
39 .destroy = vc4_fkms_encoder_destroy,
42 +static void vc4_fkms_display_power(struct drm_encoder *encoder, bool power)
44 + struct vc4_fkms_encoder *vc4_encoder = to_vc4_fkms_encoder(encoder);
45 + struct vc4_dev *vc4 = to_vc4_dev(encoder->dev);
47 + struct mailbox_display_pwr pwr = {
48 + .tag1 = {RPI_FIRMWARE_SET_DISPLAY_POWER, 8, 0, },
49 + .display = vc4_encoder->display_num,
50 + .state = power ? 1 : 0,
53 + rpi_firmware_property_list(vc4->firmware, &pwr, sizeof(pwr));
56 static void vc4_fkms_encoder_enable(struct drm_encoder *encoder)
58 + vc4_fkms_display_power(encoder, true);
59 DRM_DEBUG_KMS("Encoder_enable\n");
62 static void vc4_fkms_encoder_disable(struct drm_encoder *encoder)
64 + vc4_fkms_display_power(encoder, false);
65 DRM_DEBUG_KMS("Encoder_disable\n");
68 @@ -1695,6 +1718,8 @@ static int vc4_fkms_create_screen(struct
71 vc4_crtc->encoder = &vc4_encoder->base;
73 + vc4_encoder->display_num = display_ref;
74 vc4_encoder->base.possible_crtcs |= drm_crtc_mask(crtc) ;
76 drm_encoder_init(drm, &vc4_encoder->base, &vc4_fkms_encoder_funcs,
77 --- a/include/soc/bcm2835/raspberrypi-firmware.h
78 +++ b/include/soc/bcm2835/raspberrypi-firmware.h
79 @@ -155,7 +155,7 @@ enum rpi_firmware_property_tag {
80 RPI_FIRMWARE_GET_DISPLAY_TIMING = 0x00040017,
81 RPI_FIRMWARE_SET_TIMING = 0x00048017,
82 RPI_FIRMWARE_GET_DISPLAY_CFG = 0x00040018,
84 + RPI_FIRMWARE_SET_DISPLAY_POWER = 0x00048019,
85 RPI_FIRMWARE_GET_COMMAND_LINE = 0x00050001,
86 RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001,