From afc1bd643af233dfc54fe96ca7016ea5f83de597 Mon Sep 17 00:00:00 2001 From: "xiang.wu1" Date: Tue, 12 Mar 2024 15:53:31 +0800 Subject: [PATCH] hdmitx21: modify send allm vsif method [1/1] PD#SWPL-159832 Problem: VSIF send bytes wrong Solution: hdmitx21 requires software calculation, Valid values need to be filled starting from db[1] Verify: s7_bh201 Test: DRM-TX-30, DRM-TX-78, DRM-TX-79, DRM-TX-80, DRM-TX-81 Change-Id: I62d32a0dc6c73b788ad56aaec35277d2447ee7a6 Signed-off-by: xiang.wu1 --- drivers/media/vout/hdmitx21/hw/hdmi_tx_hw.c | 27 +++++++++++++++---- .../media/vout/hdmitx_common/hdmitx_packet.c | 7 ++--- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/drivers/media/vout/hdmitx21/hw/hdmi_tx_hw.c b/drivers/media/vout/hdmitx21/hw/hdmi_tx_hw.c index 8d461044f..4ad13d0c4 100644 --- a/drivers/media/vout/hdmitx21/hw/hdmi_tx_hw.c +++ b/drivers/media/vout/hdmitx21/hw/hdmi_tx_hw.c @@ -640,11 +640,28 @@ static int hdmitx21_calc_formatpara(struct hdmitx_hw_common *tx_hw, static void hdmitx_set_packet(int type, unsigned char *DB, unsigned char *HB) { - if (type == HDMI_INFOFRAME_TYPE_VENDOR2) - hdmi_vend_infoframe2_rawset(HB, DB); - else if (type == HDMI_INFOFRAME_TYPE_VENDOR) - hdmi_vend_infoframe_rawset(HB, DB); - /* add other type here if needed */ + unsigned char vsif_db[28] = {0}; + + switch (type) { + case HDMI_INFOFRAME_TYPE_VENDOR: + case HDMI_INFOFRAME_TYPE_VENDOR2: + if (!HB || !DB) { + if (type == HDMI_INFOFRAME_TYPE_VENDOR2) + hdmi_vend_infoframe2_rawset(NULL, NULL); + else + hdmi_vend_infoframe_rawset(NULL, NULL); + return; + } + /* vsif_db[0] is checksum, requires software calculation */ + memcpy(&vsif_db[1], DB, 27); + if (type == HDMI_INFOFRAME_TYPE_VENDOR2) + hdmi_vend_infoframe2_rawset(HB, vsif_db); + else + hdmi_vend_infoframe_rawset(HB, vsif_db); + break; + default: + break; + } } /* note: if need to check if global_tx_hw not NULL before use it diff --git a/drivers/media/vout/hdmitx_common/hdmitx_packet.c b/drivers/media/vout/hdmitx_common/hdmitx_packet.c index 5a1fa0edf..338c7ca91 100644 --- a/drivers/media/vout/hdmitx_common/hdmitx_packet.c +++ b/drivers/media/vout/hdmitx_common/hdmitx_packet.c @@ -12,7 +12,8 @@ int hdmitx_common_setup_vsif_packet(struct hdmitx_common *tx_comm, u8 hb[3] = {0x81, 0x1, 0}; u8 len = 0; /* hb[2] = len */ u8 vsif_db[28] = {0}; /* to be fulfilled */ - u8 *db = &vsif_db[1]; /* to be fulfilled */ + /* transmission usage, excluding checksum */ + u8 *db = &vsif_db[1]; u32 ieeeoui = 0; u32 vic = 0; struct hdmitx_hw_common *tx_hw = tx_comm->tx_hw; @@ -35,7 +36,7 @@ int hdmitx_common_setup_vsif_packet(struct hdmitx_common *tx_comm, db[4] = vic & 0xf; db[3] = 0x20; hdmitx_hw_cntl_config(tx_hw, CONF_AVI_VIC, 0); - hdmitx_hw_set_packet(tx_hw, HDMI_INFOFRAME_TYPE_VENDOR, vsif_db, hb); + hdmitx_hw_set_packet(tx_hw, HDMI_INFOFRAME_TYPE_VENDOR, db, hb); } else { HDMITX_INFO("skip vsif for non-4k mode.\n"); return -EINVAL; @@ -54,7 +55,7 @@ int hdmitx_common_setup_vsif_packet(struct hdmitx_common *tx_comm, /*reset vic which may be reset by VT_HDMI14_4K.*/ if (hdmitx_edid_get_hdmi14_4k_vic(tx_comm->fmt_para.vic) > 0) hdmitx_hw_cntl_config(tx_hw, CONF_AVI_VIC, tx_comm->fmt_para.vic); - hdmitx_hw_set_packet(tx_hw, HDMI_INFOFRAME_TYPE_VENDOR2, vsif_db, hb); + hdmitx_hw_set_packet(tx_hw, HDMI_INFOFRAME_TYPE_VENDOR2, db, hb); } else { db[4] &= ~(1 << 1); /* clear bit1, ALLM_MODE */ /* 1.When the Source stops transmitting the HF-VSIF,