drm/bridge: synopsys: dw-hdmi-qp: Support avi version 3

Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
Change-Id: Ic5edfe72e2f3b6914d0b2f4422984ef4ded39a62
This commit is contained in:
Algea Cao
2022-03-29 14:52:58 +08:00
parent 256ea0c899
commit c29324201e

View File

@@ -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