From c29324201eb3c9ad8a9a696218b825253ef83a83 Mon Sep 17 00:00:00 2001 From: Algea Cao Date: Tue, 29 Mar 2022 14:52:58 +0800 Subject: [PATCH] drm/bridge: synopsys: dw-hdmi-qp: Support avi version 3 Signed-off-by: Algea Cao Change-Id: Ic5edfe72e2f3b6914d0b2f4422984ef4ded39a62 --- drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c index 3b6b4d450bd5..6cd7abc2ec79 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c @@ -1033,6 +1033,19 @@ EXPORT_SYMBOL_GPL(dw_hdmi_qp_set_earc); * HDMI TX Setup */ +static void hdmi_infoframe_set_checksum(u8 *ptr, int size) +{ + u8 csum = 0; + int i; + + ptr[3] = 0; + /* compute checksum */ + for (i = 0; i < size; i++) + csum += ptr[i]; + + ptr[3] = 256 - csum; +} + static void hdmi_config_AVI(struct dw_hdmi_qp *hdmi, const struct drm_connector *connector, const struct drm_display_mode *mode) @@ -1103,6 +1116,16 @@ static void hdmi_config_AVI(struct dw_hdmi_qp *hdmi, hdmi_avi_infoframe_pack_only(&frame, buff, 17); + /* mode which vic >= 128 must use avi version 3 */ + if (hdmi->vic >= 128) { + frame.version = 3; + buff[1] = frame.version; + buff[4] &= 0x1f; + buff[4] |= ((frame.colorspace & 0x7) << 5); + buff[7] = frame.video_code; + hdmi_infoframe_set_checksum(buff, 17); + } + /* * The Designware IP uses a different byte format from standard * AVI info frames, though generally the bits are in the correct