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
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 | 26 ++++++++++++++++++++++
12 include/soc/bcm2835/raspberrypi-firmware.h | 2 +-
13 2 files changed, 27 insertions(+), 1 deletion(-)
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 {
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 @@ -274,6 +280,8 @@ to_vc4_crtc_state(struct drm_crtc_state
31 struct vc4_fkms_encoder {
32 struct drm_encoder base;
34 + bool rgb_range_selectable;
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,
43 +static void vc4_fkms_display_power(struct drm_encoder *encoder, bool power)
45 + struct vc4_fkms_encoder *vc4_encoder = to_vc4_fkms_encoder(encoder);
46 + struct vc4_dev *vc4 = to_vc4_dev(encoder->dev);
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,
54 + rpi_firmware_property_list(vc4->firmware, &pwr, sizeof(pwr));
57 static void vc4_fkms_encoder_enable(struct drm_encoder *encoder)
59 + vc4_fkms_display_power(encoder, true);
60 DRM_DEBUG_KMS("Encoder_enable\n");
63 static void vc4_fkms_encoder_disable(struct drm_encoder *encoder)
65 + vc4_fkms_display_power(encoder, false);
66 DRM_DEBUG_KMS("Encoder_disable\n");
69 @@ -1719,6 +1743,8 @@ static int vc4_fkms_create_screen(struct
72 vc4_crtc->encoder = &vc4_encoder->base;
74 + vc4_encoder->display_num = display_ref;
75 vc4_encoder->base.possible_crtcs |= drm_crtc_mask(crtc) ;
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,
85 + RPI_FIRMWARE_SET_DISPLAY_POWER = 0x00048019,
86 RPI_FIRMWARE_GET_COMMAND_LINE = 0x00050001,
87 RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001,