From: Zongdong Jiao Date: Mon, 25 Nov 2019 14:10:13 +0000 (+0800) Subject: hdmitx: update edid attach after reading once [1/1] X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4f9b15ca22bb81010354db6280f06f05144d0587;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git hdmitx: update edid attach after reading once [1/1] PD#SWPL-17476 Problem: After kernel boots up, there will no edid info for vinfo Solution: Need update edid attach after reading once In kernel init, hdmitx / vout / edid with attach once time Normal replug, plugin / edid / uevent / mode setting / attach Also, init DRM_DB[0] data. Verify: G12/U212 Change-Id: I188f0972c882a17efcbc568ef7d0db861b9b6c0a Signed-off-by: Zongdong Jiao (cherry picked from commit 1c185cb0c069638c6391f424637f57abdaf99570) --- diff --git a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c index 966cbd9712fe..f28870301a3a 100644 --- a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c +++ b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c @@ -1323,6 +1323,17 @@ static void hdr_work_func(struct work_struct *work) pr_info("%s[%d]\n", __func__, __LINE__); \ } while (0) +/* Init DRM_DB[0] from Uboot status */ +static void init_drm_db0(struct hdmitx_dev *hdev, unsigned char *dat) +{ + static int once_flag = 1; + + if (once_flag) { + once_flag = 0; + *dat = hdev->hwop.getstate(hdev, STAT_HDR_TYPE, 0); + } +} + #define GET_LOW8BIT(a) ((a) & 0xff) #define GET_HIGH8BIT(a) (((a) >> 8) & 0xff) static void hdmitx_set_drm_pkt(struct master_display_info_s *data) @@ -1332,6 +1343,7 @@ static void hdmitx_set_drm_pkt(struct master_display_info_s *data) static unsigned char DRM_DB[26] = {0x0}; hdmi_debug(); + init_drm_db0(hdev, &DRM_DB[0]); if (hdr_status_pos == 4) { /* zero hdr10+ VSIF being sent - disable it */ pr_info("hdmitx_set_drm_pkt: disable hdr10+ zero vsif\n"); @@ -4233,6 +4245,7 @@ static int hdmitx_notify_callback_a(struct notifier_block *block, static void hdmitx_get_edid(struct hdmitx_dev *hdev) { + static int once_flag = 1; mutex_lock(&getedid_mutex); /* TODO hdmitx_edid_ram_buffer_clear(hdev); */ hdev->hwop.cntlddc(hdev, DDC_RESET_EDID, 0); @@ -4257,7 +4270,10 @@ static void hdmitx_get_edid(struct hdmitx_dev *hdev) memset(dv, 0, sizeof(struct dv_info)); pr_info("clear dv_info\n"); } - + if (once_flag) { + once_flag = 0; + edidinfo_attach_to_vinfo(hdev); + } mutex_unlock(&getedid_mutex); } diff --git a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hw/hdmi_tx_hw.c b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hw/hdmi_tx_hw.c index e50d71f1f104..840e4c078787 100644 --- a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hw/hdmi_tx_hw.c +++ b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hw/hdmi_tx_hw.c @@ -5296,6 +5296,8 @@ static int hdmitx_get_state(struct hdmitx_dev *hdev, unsigned int cmd, return (int)get_vic_from_pkt(); case STAT_VIDEO_CLK: break; + case STAT_HDR_TYPE: + return hdmitx_rd_reg(HDMITX_DWC_FC_DRM_PB00) & 0xff; default: break; } diff --git a/include/linux/amlogic/media/vout/hdmi_tx/hdmi_tx_module.h b/include/linux/amlogic/media/vout/hdmi_tx/hdmi_tx_module.h index 714a7392b5d9..5b0c5acf7ba5 100644 --- a/include/linux/amlogic/media/vout/hdmi_tx/hdmi_tx_module.h +++ b/include/linux/amlogic/media/vout/hdmi_tx/hdmi_tx_module.h @@ -610,6 +610,8 @@ struct hdmitx_dev { #define STAT_AUDIO_CHANNEL (CMD_STAT_OFFSET + 0x11) #define STAT_AUDIO_CLK_STABLE (CMD_STAT_OFFSET + 0x12) #define STAT_AUDIO_PACK (CMD_STAT_OFFSET + 0x13) +#define STAT_HDR_TYPE (CMD_STAT_OFFSET + 0x20) + /* HDMI LOG */ #define HDMI_LOG_HDCP (1 << 0)