Implement the clear_infoframe callback, disabling corresponding
InfoFrame type.

Signed-off-by: Dmitry Baryshkov <[email protected]>
---
 drivers/gpu/drm/vc4/vc4_hdmi.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index 1798d1156d10..4cfb7ebc0c81 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -624,6 +624,30 @@ static int vc4_hdmi_stop_packet(struct vc4_hdmi *vc4_hdmi,
        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;
+
+       WARN_ONCE(!(HDMI_READ(HDMI_RAM_PACKET_CONFIG) &
+                   VC4_HDMI_RAM_PACKET_ENABLE),
+                 "Packet RAM has to be on to store the packet.");
+
+       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;
+}
+
 static int vc4_hdmi_write_infoframe(struct drm_connector *connector,
                                    enum hdmi_infoframe_type type,
                                    const u8 *infoframe, size_t len)
@@ -1660,6 +1684,7 @@ vc4_hdmi_connector_clock_valid(const struct drm_connector 
*connector,
 
 static const struct drm_connector_hdmi_funcs vc4_hdmi_hdmi_connector_funcs = {
        .tmds_char_rate_valid   = vc4_hdmi_connector_clock_valid,
+       .clear_infoframe        = vc4_hdmi_clear_infoframe,
        .write_infoframe        = vc4_hdmi_write_infoframe,
 };
 

-- 
2.47.3

Reply via email to