6487b5a728fd4a51965ba4c9093f07201caf6ea6
[openwrt/staging/stintel.git] /
1 From caa5d5dac396f5bfaef8bd65c1c39f4ff03a504a Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Fri, 21 May 2021 11:15:04 +0100
4 Subject: [PATCH] drm/vc4: FKMS: Change of Broadcast RGB mode needs a
5 mode change
6
7 The Broadcast RGB (aka HDMI limited/full range) property is only
8 notified to the firmware on mode change, so this needs to be
9 signalled when set.
10
11 https://github.com/raspberrypi/firmware/issues/1580
12
13 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
14 ---
15 drivers/gpu/drm/vc4/vc4_firmware_kms.c | 29 ++++++++++++++++++++++++++
16 1 file changed, 29 insertions(+)
17
18 --- a/drivers/gpu/drm/vc4/vc4_firmware_kms.c
19 +++ b/drivers/gpu/drm/vc4/vc4_firmware_kms.c
20 @@ -1549,6 +1549,34 @@ int vc4_connector_atomic_set_property(st
21 return -EINVAL;
22 }
23
24 +int vc4_connector_atomic_check(struct drm_connector *connector,
25 + struct drm_atomic_state *state)
26 +{
27 + struct drm_connector_state *old_state =
28 + drm_atomic_get_old_connector_state(state, connector);
29 + struct vc4_fkms_connector_state *vc4_old_state =
30 + to_vc4_fkms_connector_state(old_state);
31 + struct drm_connector_state *new_state =
32 + drm_atomic_get_new_connector_state(state, connector);
33 + struct vc4_fkms_connector_state *vc4_new_state =
34 + to_vc4_fkms_connector_state(new_state);
35 + struct drm_crtc *crtc = new_state->crtc;
36 +
37 + if (!crtc)
38 + return 0;
39 +
40 + if (vc4_old_state->broadcast_rgb != vc4_new_state->broadcast_rgb) {
41 + struct drm_crtc_state *crtc_state;
42 +
43 + crtc_state = drm_atomic_get_crtc_state(state, crtc);
44 + if (IS_ERR(crtc_state))
45 + return PTR_ERR(crtc_state);
46 +
47 + crtc_state->mode_changed = true;
48 + }
49 + return 0;
50 +}
51 +
52 static void vc4_hdmi_connector_reset(struct drm_connector *connector)
53 {
54 drm_atomic_helper_connector_reset(connector);
55 @@ -1569,6 +1597,7 @@ static const struct drm_connector_funcs
56 static const struct drm_connector_helper_funcs vc4_fkms_connector_helper_funcs = {
57 .get_modes = vc4_fkms_connector_get_modes,
58 .best_encoder = vc4_fkms_connector_best_encoder,
59 + .atomic_check = vc4_connector_atomic_check,
60 };
61
62 static const struct drm_connector_helper_funcs vc4_fkms_lcd_conn_helper_funcs = {