From dcc81b085f4bfb88985a78ced17b98bc7bfa0f73 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Thu, 21 Nov 2024 18:28:22 +0000 Subject: [PATCH] drm/vc4: hdmi: Add a clear_infoframe hook If you disable HDR metadata, then the hardware should stop sending the infoframe, and that is implemented by the clear_infoframe hook which wasn't implemented. Add it. Signed-off-by: Dave Stevenson --- drivers/gpu/drm/vc4/vc4_hdmi.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -764,6 +764,24 @@ out: return ret; } +static int vc4_hdmi_clear_infoframe(struct drm_connector *connector, + enum hdmi_infoframe_type type) +{ + struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector); + struct drm_device *drm = connector->dev; + int ret; + int idx; + + if (!drm_dev_enter(drm, &idx)) + return 0; + + ret = vc4_hdmi_stop_packet(vc4_hdmi, type, true); + if (ret) + drm_err(drm, "Failed to wait for infoframe to go idle: %d\n", ret); + + drm_dev_exit(idx); + return ret; +} #define SCRAMBLING_POLLING_DELAY_MS 1000 static void vc4_hdmi_enable_scrambling(struct drm_encoder *encoder) @@ -1722,6 +1740,7 @@ vc4_hdmi_connector_clock_valid(const str static const struct drm_connector_hdmi_funcs vc4_hdmi_hdmi_connector_funcs = { .tmds_char_rate_valid = vc4_hdmi_connector_clock_valid, .write_infoframe = vc4_hdmi_write_infoframe, + .clear_infoframe = vc4_hdmi_clear_infoframe, }; #define WIFI_2_4GHz_CH1_MIN_FREQ 2400000000ULL