From caa5d5dac396f5bfaef8bd65c1c39f4ff03a504a Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Fri, 21 May 2021 11:15:04 +0100 Subject: [PATCH] drm/vc4: FKMS: Change of Broadcast RGB mode needs a mode change The Broadcast RGB (aka HDMI limited/full range) property is only notified to the firmware on mode change, so this needs to be signalled when set. https://github.com/raspberrypi/firmware/issues/1580 Signed-off-by: Dave Stevenson --- drivers/gpu/drm/vc4/vc4_firmware_kms.c | 29 ++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) --- a/drivers/gpu/drm/vc4/vc4_firmware_kms.c +++ b/drivers/gpu/drm/vc4/vc4_firmware_kms.c @@ -1549,6 +1549,34 @@ int vc4_connector_atomic_set_property(st return -EINVAL; } +int vc4_connector_atomic_check(struct drm_connector *connector, + struct drm_atomic_state *state) +{ + struct drm_connector_state *old_state = + drm_atomic_get_old_connector_state(state, connector); + struct vc4_fkms_connector_state *vc4_old_state = + to_vc4_fkms_connector_state(old_state); + struct drm_connector_state *new_state = + drm_atomic_get_new_connector_state(state, connector); + struct vc4_fkms_connector_state *vc4_new_state = + to_vc4_fkms_connector_state(new_state); + struct drm_crtc *crtc = new_state->crtc; + + if (!crtc) + return 0; + + if (vc4_old_state->broadcast_rgb != vc4_new_state->broadcast_rgb) { + struct drm_crtc_state *crtc_state; + + crtc_state = drm_atomic_get_crtc_state(state, crtc); + if (IS_ERR(crtc_state)) + return PTR_ERR(crtc_state); + + crtc_state->mode_changed = true; + } + return 0; +} + static void vc4_hdmi_connector_reset(struct drm_connector *connector) { drm_atomic_helper_connector_reset(connector); @@ -1569,6 +1597,7 @@ static const struct drm_connector_funcs static const struct drm_connector_helper_funcs vc4_fkms_connector_helper_funcs = { .get_modes = vc4_fkms_connector_get_modes, .best_encoder = vc4_fkms_connector_best_encoder, + .atomic_check = vc4_connector_atomic_check, }; static const struct drm_connector_helper_funcs vc4_fkms_lcd_conn_helper_funcs = {