From: Zongdong Jiao Date: Fri, 25 Oct 2019 03:29:53 +0000 (+0800) Subject: hdmitx: sync HDR/VSIF from A [1/1] X-Git-Tag: hardkernel-4.9.236-104~484 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1feca9b8a596dde439bb9c5722a959477aebcc5f;p=platform%2Fkernel%2Flinux-amlogic.git hdmitx: sync HDR/VSIF from A [1/1] PD#SWPL-13206 Problem: Need to sync HDR/HLG/DV callback Solution: Sync HDR/HLG/DV callback Verify: G12/U212 Change-Id: Ibe93c3e538ad2f3cbb254c4ce731473b6ac1562b Signed-off-by: Zongdong Jiao --- diff --git a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_audio.c b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_audio.c index 1357960..f50de3b 100644 --- a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_audio.c +++ b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_audio.c @@ -227,12 +227,12 @@ int hdmitx_set_audio(struct hdmitx_dev *hdmitx_device, AUD_DB[i] = 0; for (i = 0; i < (24*2); i++) CHAN_STAT_BUF[i] = 0; - if (hdmitx_device->HWOp.SetAudMode(hdmitx_device, - audio_param) >= 0) { + if (hdmitx_device->hwop.setaudmode(hdmitx_device, + audio_param) >= 0) { hdmi_tx_construct_aud_packet(audio_param, AUD_DB, CHAN_STAT_BUF, hdmi_ch); - hdmitx_device->HWOp.SetAudioInfoFrame(AUD_DB, CHAN_STAT_BUF); + hdmitx_device->hwop.setaudioinfoframe(AUD_DB, CHAN_STAT_BUF); ret = 0; } return ret; diff --git a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c index 4755f0e..2ecfc5f 100644 --- a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c +++ b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c @@ -88,7 +88,7 @@ static unsigned char __nosavedata edid_checkvalue[4] = {0}; static unsigned int hdmitx_edid_check_valid_blocks(unsigned char *buf); -static void Edid_DTD_parsing(struct rx_cap *pRXCap, unsigned char *data); +static void Edid_DTD_parsing(struct rx_cap *prxcap, unsigned char *data); static void hdmitx_edid_set_default_aud(struct hdmitx_dev *hdev); static int xtochar(int num, unsigned char *checksum) @@ -107,7 +107,7 @@ static int xtochar(int num, unsigned char *checksum) } static void edid_save_checkvalue(unsigned char *buf, unsigned int block_cnt, - struct rx_cap *RXCap) + struct rx_cap *rxcap) { unsigned int i, length, max; @@ -122,11 +122,11 @@ static void edid_save_checkvalue(unsigned char *buf, unsigned int block_cnt, for (i = 0; i < max; i++) edid_checkvalue[i] = *(buf+(i+1)*128-1); - RXCap->chksum[0] = '0'; - RXCap->chksum[1] = 'x'; + rxcap->chksum[0] = '0'; + rxcap->chksum[1] = 'x'; for (i = 0; i < 4; i++) - xtochar(i, &RXCap->chksum[2 * i + 2]); + xtochar(i, &rxcap->chksum[2 * i + 2]); } static int Edid_DecodeHeader(struct hdmitx_info *info, unsigned char *buff) @@ -143,8 +143,8 @@ static int Edid_DecodeHeader(struct hdmitx_info *info, unsigned char *buff) return ret; } -static void Edid_ParsingIDManufacturerName(struct rx_cap *pRXCap, - unsigned char *data) +static void Edid_ParsingIDManufacturerName(struct rx_cap *prxcap, + unsigned char *data) { int i; unsigned char uppercase[26] = { 0 }; @@ -163,75 +163,75 @@ static void Edid_ParsingIDManufacturerName(struct rx_cap *pRXCap, || ((brand[2] > 26) || (brand[2] == 0))) return; for (i = 0; i < 3; i++) - pRXCap->IDManufacturerName[i] = uppercase[brand[i] - 1]; + prxcap->IDManufacturerName[i] = uppercase[brand[i] - 1]; } -static void Edid_ParsingIDProductCode(struct rx_cap *pRXCap, - unsigned char *data) +static void Edid_ParsingIDProductCode(struct rx_cap *prxcap, + unsigned char *data) { if (data == NULL) return; - pRXCap->IDProductCode[0] = data[1]; - pRXCap->IDProductCode[1] = data[0]; + prxcap->IDProductCode[0] = data[1]; + prxcap->IDProductCode[1] = data[0]; } -static void Edid_ParsingIDSerialNumber(struct rx_cap *pRXCap, - unsigned char *data) +static void Edid_ParsingIDSerialNumber(struct rx_cap *prxcap, + unsigned char *data) { int i; if (data != NULL) for (i = 0; i < 4; i++) - pRXCap->IDSerialNumber[i] = data[3-i]; + prxcap->IDSerialNumber[i] = data[3 - i]; } /* store the idx of vesa_timing[32], which is 0 */ -static void store_vesa_idx(struct rx_cap *pRXCap, enum hdmi_vic vesa_timing) +static void store_vesa_idx(struct rx_cap *prxcap, enum hdmi_vic vesa_timing) { int i; for (i = 0; i < VESA_MAX_TIMING; i++) { - if (!pRXCap->vesa_timing[i]) { - pRXCap->vesa_timing[i] = vesa_timing; + if (!prxcap->vesa_timing[i]) { + prxcap->vesa_timing[i] = vesa_timing; break; } - if (pRXCap->vesa_timing[i] == vesa_timing) + if (prxcap->vesa_timing[i] == vesa_timing) break; } pr_info("hdmitx: reach vesa idx MAX\n"); } -static void Edid_EstablishedTimings(struct rx_cap *pRXCap, unsigned char *data) +static void Edid_EstablishedTimings(struct rx_cap *prxcap, unsigned char *data) { if (data[0] & (1 << 5)) - store_vesa_idx(pRXCap, HDMIV_640x480p60hz); + store_vesa_idx(prxcap, HDMIV_640x480p60hz); if (data[0] & (1 << 0)) - store_vesa_idx(pRXCap, HDMIV_800x600p60hz); + store_vesa_idx(prxcap, HDMIV_800x600p60hz); if (data[1] & (1 << 3)) - store_vesa_idx(pRXCap, HDMIV_1024x768p60hz); + store_vesa_idx(prxcap, HDMIV_1024x768p60hz); } -static void Edid_StandardTimingIII(struct rx_cap *pRXCap, unsigned char *data) +static void Edid_StandardTimingIII(struct rx_cap *prxcap, unsigned char *data) { if (data[0] & (1 << 0)) - store_vesa_idx(pRXCap, HDMIV_1152x864p75hz); + store_vesa_idx(prxcap, HDMIV_1152x864p75hz); if (data[1] & (1 << 6)) - store_vesa_idx(pRXCap, HDMIV_1280x768p60hz); + store_vesa_idx(prxcap, HDMIV_1280x768p60hz); if (data[1] & (1 << 2)) - store_vesa_idx(pRXCap, HDMIV_1280x960p60hz); + store_vesa_idx(prxcap, HDMIV_1280x960p60hz); if (data[1] & (1 << 1)) - store_vesa_idx(pRXCap, HDMIV_1280x1024p60hz); + store_vesa_idx(prxcap, HDMIV_1280x1024p60hz); if (data[2] & (1 << 7)) - store_vesa_idx(pRXCap, HDMIV_1360x768p60hz); + store_vesa_idx(prxcap, HDMIV_1360x768p60hz); if (data[2] & (1 << 1)) - store_vesa_idx(pRXCap, HDMIV_1400x1050p60hz); + store_vesa_idx(prxcap, HDMIV_1400x1050p60hz); if (data[3] & (1 << 5)) - store_vesa_idx(pRXCap, HDMIV_1680x1050p60hz); + store_vesa_idx(prxcap, HDMIV_1680x1050p60hz); if (data[3] & (1 << 2)) - store_vesa_idx(pRXCap, HDMIV_1600x1200p60hz); + store_vesa_idx(prxcap, HDMIV_1600x1200p60hz); if (data[4] & (1 << 0)) - store_vesa_idx(pRXCap, HDMIV_1920x1200p60hz); + store_vesa_idx(prxcap, HDMIV_1920x1200p60hz); } static void calc_timing(unsigned char *data, struct vesa_standard_timing *t) @@ -263,8 +263,8 @@ static void calc_timing(unsigned char *data, struct vesa_standard_timing *t) } -static void Edid_StandardTiming(struct rx_cap *pRXCap, unsigned char *data, - int max_num) +static void Edid_StandardTiming(struct rx_cap *prxcap, unsigned char *data, + int max_num) { int i; struct vesa_standard_timing timing; @@ -273,21 +273,21 @@ static void Edid_StandardTiming(struct rx_cap *pRXCap, unsigned char *data, memset(&timing, 0, sizeof(struct vesa_standard_timing)); calc_timing(&data[i * 2], &timing); if (timing.vesa_timing) - store_vesa_idx(pRXCap, timing.vesa_timing); + store_vesa_idx(prxcap, timing.vesa_timing); } } -static void Edid_ReceiverProductNameParse(struct rx_cap *pRXCap, - unsigned char *data) +static void Edid_ReceiverProductNameParse(struct rx_cap *prxcap, + unsigned char *data) { int i = 0; /* some Display Product name end with 0x20, not 0x0a */ while ((data[i] != 0x0a) && (data[i] != 0x20) && (i < 13)) { - pRXCap->ReceiverProductName[i] = data[i]; + prxcap->ReceiverProductName[i] = data[i]; i++; } - pRXCap->ReceiverProductName[i] = '\0'; + prxcap->ReceiverProductName[i] = '\0'; } void Edid_DecodeStandardTiming(struct hdmitx_info *info, @@ -356,20 +356,20 @@ static void set_vsdb_phy_addr(struct hdmitx_dev *hdev, hdmitx_event_notify(HDMITX_PHY_ADDR_VALID, &phy_addr); } -static void set_vsdb_dc_cap(struct rx_cap *pRXCap) +static void set_vsdb_dc_cap(struct rx_cap *prxcap) { - pRXCap->dc_y444 = !!(pRXCap->ColorDeepSupport & (1 << 3)); - pRXCap->dc_30bit = !!(pRXCap->ColorDeepSupport & (1 << 4)); - pRXCap->dc_36bit = !!(pRXCap->ColorDeepSupport & (1 << 5)); - pRXCap->dc_48bit = !!(pRXCap->ColorDeepSupport & (1 << 6)); + prxcap->dc_y444 = !!(prxcap->ColorDeepSupport & (1 << 3)); + prxcap->dc_30bit = !!(prxcap->ColorDeepSupport & (1 << 4)); + prxcap->dc_36bit = !!(prxcap->ColorDeepSupport & (1 << 5)); + prxcap->dc_48bit = !!(prxcap->ColorDeepSupport & (1 << 6)); } -static void set_vsdb_dc_420_cap(struct rx_cap *pRXCap, - unsigned char *edid_offset) +static void set_vsdb_dc_420_cap(struct rx_cap *prxcap, + unsigned char *edid_offset) { - pRXCap->dc_30bit_420 = !!(edid_offset[6] & (1 << 0)); - pRXCap->dc_36bit_420 = !!(edid_offset[6] & (1 << 1)); - pRXCap->dc_48bit_420 = !!(edid_offset[6] & (1 << 2)); + prxcap->dc_30bit_420 = !!(edid_offset[6] & (1 << 0)); + prxcap->dc_36bit_420 = !!(edid_offset[6] & (1 << 1)); + prxcap->dc_48bit_420 = !!(edid_offset[6] & (1 << 2)); } /* Special FBC check */ @@ -859,11 +859,11 @@ static void Edid_ParsingSpeakerDATABlock(struct hdmitx_info *info, } } -static void Edid_ParsingVendSpec(struct rx_cap *pRXCap, - unsigned char *buf) +static void Edid_ParsingVendSpec(struct rx_cap *prxcap, + unsigned char *buf) { - struct dv_info *dv = &pRXCap->dv_info; - struct hdr10_plus_info *hdr10_plus = &pRXCap->hdr10plus_info; + struct dv_info *dv = &prxcap->dv_info; + struct hdr10_plus_info *hdr10_plus = &prxcap->hdr10plus_info; unsigned char *dat = buf; unsigned char pos = 0; unsigned int ieeeoui = 0; @@ -941,6 +941,8 @@ static void Edid_ParsingVendSpec(struct rx_cap *pRXCap, dv->dm_major_ver = dat[pos] >> 4; dv->dm_minor_ver = dat[pos] & 0xf; pos++; + pr_info("v0 VSVDB: len=%d, sup_2160p60hz=%d\n", + dv->length, dv->sup_2160p60hz); } else dv->block_flag = ERROR_LENGTH; } @@ -970,6 +972,8 @@ static void Edid_ParsingVendSpec(struct rx_cap *pRXCap, pos++; dv->Rx = 0xA0 | (dat[pos] >> 3); pos++; + pr_info("v1 VSVDB: len=%d, sup_2160p60hz=%d, low_latency=%d\n", + dv->length, dv->sup_2160p60hz, dv->low_latency); } else if (dv->length == 0x0E) { dv->dm_version = (dat[pos] >> 2) & 0x7; dv->sup_yuv422_12bit = dat[pos] & 0x1; @@ -987,12 +991,18 @@ static void Edid_ParsingVendSpec(struct rx_cap *pRXCap, dv->Gy = dat[pos++]; dv->Bx = dat[pos++]; dv->By = dat[pos++]; + pr_info("v1 VSVDB: len=%d, sup_2160p60hz=%d\n", + dv->length, dv->sup_2160p60hz); } else dv->block_flag = ERROR_LENGTH; } if (dv->ver == 2) { - if ((dv->length == 0xB) || (dv->length == 0xC) - || (dv->length == 0xF)) { + /* v2 VSVDB length could be greater than 0xB + * and should not be treated as unrecognized + * block. Instead, we should parse it as a regular + * v2 VSVDB using just the remaining 11 bytes here + */ + if (dv->length >= 0x0B) { dv->sup_2160p60hz = 0x1;/*default*/ dv->dm_version = (dat[pos] >> 2) & 0x7; dv->sup_yuv422_12bit = dat[pos] & 0x1; @@ -1017,6 +1027,8 @@ static void Edid_ParsingVendSpec(struct rx_cap *pRXCap, dv->Ry = 0x40 | (dat[pos] >> 3); dv->By = 0x08 | (dat[pos] & 0x7); pos++; + pr_info("v2 VSVDB: len=%d, sup_2160p60hz=%d, Interface=%d\n", + dv->length, dv->sup_2160p60hz, dv->Interface); } else dv->block_flag = ERROR_LENGTH; } @@ -1026,8 +1038,8 @@ static void Edid_ParsingVendSpec(struct rx_cap *pRXCap, } /* ----------------------------------------------------------- */ -static int Edid_ParsingY420VDBBlock(struct rx_cap *pRXCap, - unsigned char *buf) +static int Edid_ParsingY420VDBBlock(struct rx_cap *prxcap, + unsigned char *buf) { unsigned char tag = 0, ext_tag = 0, data_end = 0; unsigned int pos = 0; @@ -1043,10 +1055,10 @@ static int Edid_ParsingY420VDBBlock(struct rx_cap *pRXCap, pos++; while (pos < data_end) { - if (pRXCap->VIC_count < VIC_MAX_NUM) { - for (i = 0; i < pRXCap->VIC_count; i++) { - if (pRXCap->VIC[i] == buf[pos]) { - pRXCap->VIC[i] = + if (prxcap->VIC_count < VIC_MAX_NUM) { + for (i = 0; i < prxcap->VIC_count; i++) { + if (prxcap->VIC[i] == buf[pos]) { + prxcap->VIC[i] = HDMITX_VIC420_OFFSET + buf[pos]; found = 1; /* Here we do not break,because @@ -1056,9 +1068,9 @@ static int Edid_ParsingY420VDBBlock(struct rx_cap *pRXCap, } } if (found == 0) { - pRXCap->VIC[pRXCap->VIC_count] = + prxcap->VIC[prxcap->VIC_count] = HDMITX_VIC420_OFFSET + buf[pos]; - pRXCap->VIC_count++; + prxcap->VIC_count++; } } pos++; @@ -1071,42 +1083,44 @@ INVALID_Y420VDB: return -1; } -static int Edid_ParsingDRMStaticBlock(struct rx_cap *pRXCap, - unsigned char *buf) +static int Edid_ParsingDRMStaticBlock(struct rx_cap *prxcap, + unsigned char *buf) { unsigned char tag = 0, ext_tag = 0, data_end = 0; unsigned int pos = 0; tag = (buf[pos] >> 5) & 0x7; data_end = (buf[pos] & 0x1f); + memset(prxcap->hdr_rawdata, 0, 7); + memcpy(prxcap->hdr_rawdata, buf, data_end + 1); pos++; ext_tag = buf[pos]; if ((tag != HDMI_EDID_BLOCK_TYPE_EXTENDED_TAG) || (ext_tag != EXTENSION_DRM_STATIC_TAG)) goto INVALID_DRM_STATIC; pos++; - pRXCap->hdr_sup_eotf_sdr = !!(buf[pos] & (0x1 << 0)); - pRXCap->hdr_sup_eotf_hdr = !!(buf[pos] & (0x1 << 1)); - pRXCap->hdr_sup_eotf_smpte_st_2084 = !!(buf[pos] & (0x1 << 2)); - pRXCap->hdr_sup_eotf_hlg = !!(buf[pos] & (0x1 << 3)); + prxcap->hdr_sup_eotf_sdr = !!(buf[pos] & (0x1 << 0)); + prxcap->hdr_sup_eotf_hdr = !!(buf[pos] & (0x1 << 1)); + prxcap->hdr_sup_eotf_smpte_st_2084 = !!(buf[pos] & (0x1 << 2)); + prxcap->hdr_sup_eotf_hlg = !!(buf[pos] & (0x1 << 3)); pos++; - pRXCap->hdr_sup_SMD_type1 = !!(buf[pos] & (0x1 << 0)); + prxcap->hdr_sup_SMD_type1 = !!(buf[pos] & (0x1 << 0)); pos++; if (data_end == 3) return 0; if (data_end == 4) { - pRXCap->hdr_lum_max = buf[pos]; + prxcap->hdr_lum_max = buf[pos]; return 0; } if (data_end == 5) { - pRXCap->hdr_lum_max = buf[pos]; - pRXCap->hdr_lum_avg = buf[pos + 1]; + prxcap->hdr_lum_max = buf[pos]; + prxcap->hdr_lum_avg = buf[pos + 1]; return 0; } if (data_end == 6) { - pRXCap->hdr_lum_max = buf[pos]; - pRXCap->hdr_lum_avg = buf[pos + 1]; - pRXCap->hdr_lum_min = buf[pos + 2]; + prxcap->hdr_lum_max = buf[pos]; + prxcap->hdr_lum_avg = buf[pos + 1]; + prxcap->hdr_lum_min = buf[pos + 2]; return 0; } return 0; @@ -1115,8 +1129,8 @@ INVALID_DRM_STATIC: return -1; } -static int Edid_ParsingDRMDynamicBlock(struct rx_cap *pRXCap, - unsigned char *buf) +static int Edid_ParsingDRMDynamicBlock(struct rx_cap *prxcap, + unsigned char *buf) { unsigned char tag = 0, ext_tag = 0, data_end = 0; unsigned int pos = 0; @@ -1155,12 +1169,12 @@ static int Edid_ParsingDRMDynamicBlock(struct rx_cap *pRXCap, num = 0; break; } - pRXCap->hdr_dynamic_info[num].hd_len = type_length; - pRXCap->hdr_dynamic_info[num].type = type; - pRXCap->hdr_dynamic_info[num].support_flags = buf[pos]; + prxcap->hdr_dynamic_info[num].hd_len = type_length; + prxcap->hdr_dynamic_info[num].type = type; + prxcap->hdr_dynamic_info[num].support_flags = buf[pos]; pos++; for (i = 0; i < type_length - 3; i++) { - pRXCap->hdr_dynamic_info[num].optional_fields[i] + prxcap->hdr_dynamic_info[num].optional_fields[i] = buf[pos]; pos++; } @@ -1173,7 +1187,7 @@ INVALID_DRM_DYNAMIC: return -1; } -static int Edid_ParsingVFPDB(struct rx_cap *pRXCap, unsigned char *buf) +static int Edid_ParsingVFPDB(struct rx_cap *prxcap, unsigned char *buf) { unsigned int len = buf[0] & 0x1f; enum hdmi_vic svr = HDMI_Unknown; @@ -1186,15 +1200,15 @@ static int Edid_ParsingVFPDB(struct rx_cap *pRXCap, unsigned char *buf) svr = buf[2]; if (((svr >= 1) && (svr <= 127)) || ((svr >= 193) && (svr <= 253))) { - pRXCap->flag_vfpdb = 1; - pRXCap->preferred_mode = svr; - pr_info("preferred mode 0 srv %d\n", pRXCap->preferred_mode); + prxcap->flag_vfpdb = 1; + prxcap->preferred_mode = svr; + pr_info("preferred mode 0 srv %d\n", prxcap->preferred_mode); return 1; } if ((svr >= 129) && (svr <= 144)) { - pRXCap->flag_vfpdb = 1; - pRXCap->preferred_mode = pRXCap->dtd[svr - 129].vic; - pr_info("preferred mode 0 dtd %d\n", pRXCap->preferred_mode); + prxcap->flag_vfpdb = 1; + prxcap->preferred_mode = prxcap->dtd[svr - 129].vic; + pr_info("preferred mode 0 dtd %d\n", prxcap->preferred_mode); return 1; } return 0; @@ -1247,8 +1261,8 @@ INVALID_Y420CMDB: static int Edid_Y420CMDB_fill_all_vic(struct hdmitx_dev *hdmitx_device) { - struct rx_cap *rxcap = &(hdmitx_device->RXCap); - struct hdmitx_info *info = &(hdmitx_device->hdmi_info); + struct rx_cap *rxcap = &hdmitx_device->rxcap; + struct hdmitx_info *info = &hdmitx_device->hdmi_info; unsigned int count = rxcap->VIC_count; unsigned int a, b; @@ -1274,8 +1288,8 @@ static int Edid_Y420CMDB_fill_all_vic(struct hdmitx_dev *hdmitx_device) static int Edid_Y420CMDB_PostProcess(struct hdmitx_dev *hdmitx_device) { unsigned int i = 0, j = 0, valid = 0; - struct rx_cap *rxcap = &(hdmitx_device->RXCap); - struct hdmitx_info *info = &(hdmitx_device->hdmi_info); + struct rx_cap *rxcap = &hdmitx_device->rxcap; + struct hdmitx_info *info = &hdmitx_device->hdmi_info; unsigned char *p = NULL; if (info->y420_all_vic == 1) @@ -1316,7 +1330,7 @@ int Edid_ParsingCEADataBlockCollection(struct hdmitx_dev *hdmitx_device, int temp_addr; int len; struct hdmitx_info *info = &(hdmitx_device->hdmi_info); - struct rx_cap *pRXCap = &hdmitx_device->RXCap; + struct rx_cap *prxcap = &hdmitx_device->rxcap; /* Byte number offset d where Detailed Timing data begins */ D = buff[2]; @@ -1331,11 +1345,11 @@ int Edid_ParsingCEADataBlockCollection(struct hdmitx_dev *hdmitx_device, Edid_ParsingVideoDATABlock(info, buff, Addr + 1, (Data & 0x1F)); len = (Data & 0x1f) + 1; - if ((pRXCap->vsd.len + len) > MAX_RAW_LEN) + if ((prxcap->vsd.len + len) > MAX_RAW_LEN) break; - memcpy(&pRXCap->vsd.raw[pRXCap->vsd.len], - &buff[AddrTag], len); - pRXCap->vsd.len += len; + memcpy(&prxcap->vsd.raw[prxcap->vsd.len], + &buff[AddrTag], len); + prxcap->vsd.len += len; } break; @@ -1345,11 +1359,11 @@ int Edid_ParsingCEADataBlockCollection(struct hdmitx_dev *hdmitx_device, Edid_ParsingAudioDATABlock(info, buff, Addr + 1, (Data & 0x1F)); len = (Data & 0x1f) + 1; - if ((pRXCap->asd.len + len) > MAX_RAW_LEN) + if ((prxcap->asd.len + len) > MAX_RAW_LEN) break; - memcpy(&pRXCap->asd.raw[pRXCap->asd.len], - &buff[AddrTag], len); - pRXCap->asd.len += len; + memcpy(&prxcap->asd.raw[prxcap->asd.len], + &buff[AddrTag], len); + prxcap->asd.len += len; break; case SPEAKER_TAG: @@ -1389,8 +1403,8 @@ int Edid_ParsingCEADataBlockCollection(struct hdmitx_dev *hdmitx_device, /* ----------------------------------------------------------- */ /* parse Sink 3D information */ -static int hdmitx_edid_3d_parse(struct rx_cap *pRXCap, unsigned char *dat, - unsigned int size) +static int hdmitx_edid_3d_parse(struct rx_cap *prxcap, unsigned char *dat, + unsigned int size) { int j = 0; unsigned int base = 0; @@ -1401,24 +1415,25 @@ static int hdmitx_edid_3d_parse(struct rx_cap *pRXCap, unsigned char *dat, if (dat[base] & (1 << 6)) pos += 2; if (dat[base] & (1 << 5)) { - pRXCap->threeD_present = dat[pos] >> 7; - pRXCap->threeD_Multi_present = (dat[pos] >> 5) & 0x3; + prxcap->threeD_present = dat[pos] >> 7; + prxcap->threeD_Multi_present = (dat[pos] >> 5) & 0x3; pos += 1; - pRXCap->hdmi_vic_LEN = dat[pos] >> 5; - pRXCap->HDMI_3D_LEN = dat[pos] & 0x1f; - pos += pRXCap->hdmi_vic_LEN + 1; + prxcap->hdmi_vic_LEN = dat[pos] >> 5; + prxcap->HDMI_3D_LEN = dat[pos] & 0x1f; + pos += prxcap->hdmi_vic_LEN + 1; - if (pRXCap->threeD_Multi_present == 0x01) { - pRXCap->threeD_Structure_ALL_15_0 = + if (prxcap->threeD_Multi_present == 0x01) { + prxcap->threeD_Structure_ALL_15_0 = (dat[pos] << 8) + dat[pos+1]; - pRXCap->threeD_MASK_15_0 = 0; + prxcap->threeD_MASK_15_0 = 0; pos += 2; } - if (pRXCap->threeD_Multi_present == 0x02) { - pRXCap->threeD_Structure_ALL_15_0 = + if (prxcap->threeD_Multi_present == 0x02) { + prxcap->threeD_Structure_ALL_15_0 = (dat[pos] << 8) + dat[pos+1]; pos += 2; - pRXCap->threeD_MASK_15_0 = (dat[pos] << 8) + dat[pos+1]; + prxcap->threeD_MASK_15_0 = + (dat[pos] << 8) + dat[pos + 1]; pos += 2; } } @@ -1426,49 +1441,49 @@ static int hdmitx_edid_3d_parse(struct rx_cap *pRXCap, unsigned char *dat, if ((dat[pos] & 0xf) < 0x8) { /* frame packing */ if ((dat[pos] & 0xf) == T3D_FRAME_PACKING) - pRXCap->support_3d_format[pRXCap->VIC[((dat[pos] + prxcap->support_3d_format[prxcap->VIC[((dat[pos] & 0xf0) >> 4)]].frame_packing = 1; /* top and bottom */ if ((dat[pos] & 0xf) == T3D_TAB) - pRXCap->support_3d_format[pRXCap->VIC[((dat[pos] + prxcap->support_3d_format[prxcap->VIC[((dat[pos] & 0xf0) >> 4)]].top_and_bottom = 1; pos += 1; } else { /* SidebySide */ if ((dat[pos] & 0xf) == T3D_SBS_HALF) if ((dat[pos+1] >> 4) < 0xb) - pRXCap->support_3d_format[pRXCap->VIC[ + prxcap->support_3d_format[prxcap->VIC[ ((dat[pos] & 0xf0) >> 4)]] .side_by_side = 1; pos += 2; } } - if (pRXCap->threeD_MASK_15_0 == 0) { - for (j = 0; (j < 16) && (j < pRXCap->VIC_count); j++) { - pRXCap->support_3d_format[pRXCap->VIC[j]].frame_packing + if (prxcap->threeD_MASK_15_0 == 0) { + for (j = 0; (j < 16) && (j < prxcap->VIC_count); j++) { + prxcap->support_3d_format[prxcap->VIC[j]].frame_packing = 1; - pRXCap->support_3d_format[pRXCap->VIC[j]].top_and_bottom + prxcap->support_3d_format[prxcap->VIC[j]].top_and_bottom = 1; - pRXCap->support_3d_format[pRXCap->VIC[j]].side_by_side + prxcap->support_3d_format[prxcap->VIC[j]].side_by_side = 1; } } else { for (j = 0; j < 16; j++) { - if (((pRXCap->threeD_MASK_15_0) >> j) & 0x1) { + if (((prxcap->threeD_MASK_15_0) >> j) & 0x1) { /* frame packing */ - if (pRXCap->threeD_Structure_ALL_15_0 + if (prxcap->threeD_Structure_ALL_15_0 & (1 << 0)) - pRXCap->support_3d_format[pRXCap-> + prxcap->support_3d_format[prxcap-> VIC[j]].frame_packing = 1; /* top and bottom */ - if (pRXCap->threeD_Structure_ALL_15_0 + if (prxcap->threeD_Structure_ALL_15_0 & (1 << 6)) - pRXCap->support_3d_format[pRXCap-> + prxcap->support_3d_format[prxcap-> VIC[j]].top_and_bottom = 1; /* top and bottom */ - if (pRXCap->threeD_Structure_ALL_15_0 + if (prxcap->threeD_Structure_ALL_15_0 & (1 << 8)) - pRXCap->support_3d_format[pRXCap-> + prxcap->support_3d_format[prxcap-> VIC[j]].side_by_side = 1; } } @@ -1477,8 +1492,8 @@ static int hdmitx_edid_3d_parse(struct rx_cap *pRXCap, unsigned char *dat, } /* parse Sink 4k2k information */ -static void hdmitx_edid_4k2k_parse(struct rx_cap *pRXCap, unsigned char *dat, - unsigned int size) +static void hdmitx_edid_4k2k_parse(struct rx_cap *prxcap, unsigned char *dat, + unsigned int size) { if ((size > 4) || (size == 0)) { pr_info(EDID @@ -1488,94 +1503,94 @@ static void hdmitx_edid_4k2k_parse(struct rx_cap *pRXCap, unsigned char *dat, } while (size--) { if (*dat == 1) - pRXCap->VIC[pRXCap->VIC_count] = HDMI_4k2k_30; + prxcap->VIC[prxcap->VIC_count] = HDMI_4k2k_30; else if (*dat == 2) - pRXCap->VIC[pRXCap->VIC_count] = HDMI_4k2k_25; + prxcap->VIC[prxcap->VIC_count] = HDMI_4k2k_25; else if (*dat == 3) - pRXCap->VIC[pRXCap->VIC_count] = HDMI_4k2k_24; + prxcap->VIC[prxcap->VIC_count] = HDMI_4k2k_24; else if (*dat == 4) - pRXCap->VIC[pRXCap->VIC_count] = HDMI_4k2k_smpte_24; + prxcap->VIC[prxcap->VIC_count] = HDMI_4k2k_smpte_24; else ; dat++; - pRXCap->VIC_count++; + prxcap->VIC_count++; } } -static void get_latency(struct rx_cap *pRXCap, unsigned char *val) +static void get_latency(struct rx_cap *prxcap, unsigned char *val) { if (val[0] == 0) - pRXCap->vLatency = LATENCY_INVALID_UNKNOWN; + prxcap->vLatency = LATENCY_INVALID_UNKNOWN; else if (val[0] == 0xFF) - pRXCap->vLatency = LATENCY_NOT_SUPPORT; + prxcap->vLatency = LATENCY_NOT_SUPPORT; else - pRXCap->vLatency = (val[0] - 1) * 2; + prxcap->vLatency = (val[0] - 1) * 2; if (val[1] == 0) - pRXCap->aLatency = LATENCY_INVALID_UNKNOWN; + prxcap->aLatency = LATENCY_INVALID_UNKNOWN; else if (val[1] == 0xFF) - pRXCap->aLatency = LATENCY_NOT_SUPPORT; + prxcap->aLatency = LATENCY_NOT_SUPPORT; else - pRXCap->aLatency = (val[1] - 1) * 2; + prxcap->aLatency = (val[1] - 1) * 2; } -static void get_ilatency(struct rx_cap *pRXCap, unsigned char *val) +static void get_ilatency(struct rx_cap *prxcap, unsigned char *val) { if (val[0] == 0) - pRXCap->i_vLatency = LATENCY_INVALID_UNKNOWN; + prxcap->i_vLatency = LATENCY_INVALID_UNKNOWN; else if (val[0] == 0xFF) - pRXCap->i_vLatency = LATENCY_NOT_SUPPORT; + prxcap->i_vLatency = LATENCY_NOT_SUPPORT; else - pRXCap->i_vLatency = val[0] * 2 - 1; + prxcap->i_vLatency = val[0] * 2 - 1; if (val[1] == 0) - pRXCap->i_aLatency = LATENCY_INVALID_UNKNOWN; + prxcap->i_aLatency = LATENCY_INVALID_UNKNOWN; else if (val[1] == 0xFF) - pRXCap->i_aLatency = LATENCY_NOT_SUPPORT; + prxcap->i_aLatency = LATENCY_NOT_SUPPORT; else - pRXCap->i_aLatency = val[1] * 2 - 1; + prxcap->i_aLatency = val[1] * 2 - 1; } static int hdmitx_edid_block_parse(struct hdmitx_dev *hdmitx_device, - unsigned char *BlockBuf) + unsigned char *blockbuf) { - unsigned char offset, End; + unsigned char offset, end; unsigned char count; unsigned char tag; int i, tmp, idx; unsigned char *vfpdb_offset = NULL; - struct rx_cap *pRXCap = &(hdmitx_device->RXCap); + struct rx_cap *prxcap = &hdmitx_device->rxcap; unsigned int aud_flag = 0; - if (BlockBuf[0] != 0x02) + if (blockbuf[0] != 0x02) return -1; /* not a CEA BLOCK. */ - End = BlockBuf[2]; /* CEA description. */ - pRXCap->native_Mode = BlockBuf[3]; - pRXCap->number_of_dtd += BlockBuf[3] & 0xf; + end = blockbuf[2]; /* CEA description. */ + prxcap->native_Mode = blockbuf[3]; + prxcap->number_of_dtd += blockbuf[3] & 0xf; - pRXCap->native_VIC = 0xff; + prxcap->native_VIC = 0xff; Edid_Y420CMDB_Reset(&(hdmitx_device->hdmi_info)); - for (offset = 4 ; offset < End ; ) { - tag = BlockBuf[offset] >> 5; - count = BlockBuf[offset] & 0x1f; + for (offset = 4 ; offset < end ; ) { + tag = blockbuf[offset] >> 5; + count = blockbuf[offset] & 0x1f; switch (tag) { case HDMI_EDID_BLOCK_TYPE_AUDIO: aud_flag = 1; tmp = count / 3; - idx = pRXCap->AUD_count; - pRXCap->AUD_count += tmp; + idx = prxcap->AUD_count; + prxcap->AUD_count += tmp; offset++; for (i = 0 ; i < tmp; i++) { - pRXCap->RxAudioCap[idx + i].audio_format_code = - (BlockBuf[offset + i * 3]>>3)&0xf; - pRXCap->RxAudioCap[idx + i].channel_num_max = - BlockBuf[offset + i * 3]&0x7; - pRXCap->RxAudioCap[idx + i].freq_cc = - BlockBuf[offset + i * 3 + 1]&0x7f; - pRXCap->RxAudioCap[idx + i].cc3 = - BlockBuf[offset + i * 3 + 2]; + prxcap->RxAudioCap[idx + i].audio_format_code = + (blockbuf[offset + i * 3] >> 3) & 0xf; + prxcap->RxAudioCap[idx + i].channel_num_max = + blockbuf[offset + i * 3] & 0x7; + prxcap->RxAudioCap[idx + i].freq_cc = + blockbuf[offset + i * 3 + 1] & 0x7f; + prxcap->RxAudioCap[idx + i].cc3 = + blockbuf[offset + i * 3 + 2]; } offset += count; break; @@ -1585,81 +1600,81 @@ static int hdmitx_edid_block_parse(struct hdmitx_dev *hdmitx_device, for (i = 0 ; i < count ; i++) { unsigned char VIC; - VIC = BlockBuf[offset + i] & (~0x80); - pRXCap->VIC[pRXCap->VIC_count] = VIC; - if (BlockBuf[offset + i] & 0x80) - pRXCap->native_VIC = VIC; - pRXCap->VIC_count++; + VIC = blockbuf[offset + i] & (~0x80); + prxcap->VIC[prxcap->VIC_count] = VIC; + if (blockbuf[offset + i] & 0x80) + prxcap->native_VIC = VIC; + prxcap->VIC_count++; } offset += count; break; case HDMI_EDID_BLOCK_TYPE_VENDER: offset++; - if ((BlockBuf[offset] == 0x03) && - (BlockBuf[offset+1] == 0x0c) && - (BlockBuf[offset+2] == 0x00)) { - pRXCap->ieeeoui = HDMI_IEEEOUI; - pRXCap->ColorDeepSupport = - (count > 5) ? BlockBuf[offset+5] : 0; - set_vsdb_dc_cap(pRXCap); - pRXCap->Max_TMDS_Clock1 = - (count > 6) ? BlockBuf[offset+6] : 0; + if ((blockbuf[offset] == 0x03) && + (blockbuf[offset + 1] == 0x0c) && + (blockbuf[offset + 2] == 0x00)) { + prxcap->ieeeoui = HDMI_IEEEOUI; + prxcap->ColorDeepSupport = + (count > 5) ? blockbuf[offset + 5] : 0; + set_vsdb_dc_cap(prxcap); + prxcap->Max_TMDS_Clock1 = + (count > 6) ? blockbuf[offset + 6] : 0; if (count > 7) { - tmp = BlockBuf[offset+7]; + tmp = blockbuf[offset + 7]; idx = offset + 8; if (tmp & (1<<6)) { unsigned char val[2]; - val[0] = BlockBuf[idx]; - val[1] = BlockBuf[idx + 1]; - get_latency(pRXCap, val); + val[0] = blockbuf[idx]; + val[1] = blockbuf[idx + 1]; + get_latency(prxcap, val); idx += 2; } if (tmp & (1<<7)) { unsigned char val[2]; - val[0] = BlockBuf[idx]; - val[1] = BlockBuf[idx + 1]; - get_ilatency(pRXCap, val); + val[0] = blockbuf[idx]; + val[1] = blockbuf[idx + 1]; + get_ilatency(prxcap, val); idx += 2; } if (tmp & (1<<5)) { idx += 1; /* valid 4k */ - if (BlockBuf[idx] & 0xe0) { + if (blockbuf[idx] & 0xe0) { hdmitx_edid_4k2k_parse( - pRXCap, - &BlockBuf[idx + 1], - BlockBuf[idx] >> 5); + prxcap, + &blockbuf[idx + 1], + blockbuf[idx] >> 5); } /* valid 3D */ - if (BlockBuf[idx-1] & 0xe0) { + if (blockbuf[idx - 1] & 0xe0) { hdmitx_edid_3d_parse( - pRXCap, - &BlockBuf[offset+7], + prxcap, + &blockbuf[offset + 7], count - 7); } } } - } else if ((BlockBuf[offset] == 0xd8) && - (BlockBuf[offset+1] == 0x5d) && - (BlockBuf[offset+2] == 0xc4)) { - pRXCap->hf_ieeeoui = HF_IEEEOUI; - pRXCap->Max_TMDS_Clock2 = BlockBuf[offset+4]; - pRXCap->scdc_present = - !!(BlockBuf[offset+5] & (1 << 7)); - pRXCap->scdc_rr_capable = - !!(BlockBuf[offset+5] & (1 << 6)); - pRXCap->lte_340mcsc_scramble = - !!(BlockBuf[offset+5] & (1 << 3)); - set_vsdb_dc_420_cap(&hdmitx_device->RXCap, - &BlockBuf[offset]); + } else if ((blockbuf[offset] == 0xd8) && + (blockbuf[offset + 1] == 0x5d) && + (blockbuf[offset + 2] == 0xc4)) { + prxcap->hf_ieeeoui = HF_IEEEOUI; + prxcap->Max_TMDS_Clock2 = blockbuf[offset + 4]; + prxcap->scdc_present = + !!(blockbuf[offset + 5] & (1 << 7)); + prxcap->scdc_rr_capable = + !!(blockbuf[offset + 5] & (1 << 6)); + prxcap->lte_340mcsc_scramble = + !!(blockbuf[offset + 5] & (1 << 3)); + set_vsdb_dc_420_cap(&hdmitx_device->rxcap, + &blockbuf[offset]); if (count > 7) { - unsigned char b7 = BlockBuf[offset+7]; + unsigned char b7 = blockbuf[offset + 7]; - pRXCap->allm = !!(b7 & (1 << 1)); + prxcap->allm = !!(b7 & (1 << 1)); } } @@ -1668,7 +1683,7 @@ static int hdmitx_edid_block_parse(struct hdmitx_dev *hdmitx_device, case HDMI_EDID_BLOCK_TYPE_SPEAKER: offset++; - pRXCap->RxSpeakerAllocation = BlockBuf[offset]; + prxcap->RxSpeakerAllocation = blockbuf[offset]; offset += count; break; @@ -1680,26 +1695,28 @@ static int hdmitx_edid_block_parse(struct hdmitx_dev *hdmitx_device, case HDMI_EDID_BLOCK_TYPE_EXTENDED_TAG: { unsigned char ext_tag = 0; + unsigned char *t = NULL; + unsigned char v = 0; - ext_tag = BlockBuf[offset+1]; + ext_tag = blockbuf[offset + 1]; switch (ext_tag) { case EXTENSION_VENDOR_SPECIFIC: - Edid_ParsingVendSpec(pRXCap, - &BlockBuf[offset]); + t = &blockbuf[offset]; + Edid_ParsingVendSpec(prxcap, t); break; case EXTENSION_COLORMETRY_TAG: - pRXCap->colorimetry_data = - BlockBuf[offset + 2]; + prxcap->colorimetry_data = + blockbuf[offset + 2]; break; case EXTENSION_DRM_STATIC_TAG: - Edid_ParsingDRMStaticBlock(pRXCap, - &BlockBuf[offset]); - rx_set_hdr_lumi(&BlockBuf[offset], - (BlockBuf[offset] & 0x1f) + 1); + t = &blockbuf[offset]; + Edid_ParsingDRMStaticBlock(prxcap, t); + v = (blockbuf[offset] & 0x1f) + 1; + rx_set_hdr_lumi(&blockbuf[offset], v); break; case EXTENSION_DRM_DYNAMIC_TAG: - Edid_ParsingDRMDynamicBlock(pRXCap, - &BlockBuf[offset]); + t = &blockbuf[offset]; + Edid_ParsingDRMDynamicBlock(prxcap, t); break; case EXTENSION_VFPDB_TAG: /* Just record VFPDB offset address, call Edid_ParsingVFPDB() after DTD @@ -1707,16 +1724,16 @@ static int hdmitx_edid_block_parse(struct hdmitx_dev *hdmitx_device, * SVR >=129 and SVR <=144, Interpret as the Kth DTD in the EDID, * where K = SVR – 128 (for K=1 to 16) */ - vfpdb_offset = &BlockBuf[offset]; + vfpdb_offset = &blockbuf[offset]; break; case EXTENSION_Y420_VDB_TAG: - Edid_ParsingY420VDBBlock(pRXCap, - &BlockBuf[offset]); + t = &blockbuf[offset]; + Edid_ParsingY420VDBBlock(prxcap, t); break; case EXTENSION_Y420_CMDB_TAG: Edid_ParsingY420CMDBBlock( &(hdmitx_device->hdmi_info), - &BlockBuf[offset]); + &blockbuf[offset]); break; default: break; @@ -1744,43 +1761,43 @@ static int hdmitx_edid_block_parse(struct hdmitx_dev *hdmitx_device, hdmitx_edid_set_default_aud(hdmitx_device); Edid_Y420CMDB_PostProcess(hdmitx_device); - hdmitx_device->vic_count = pRXCap->VIC_count; + hdmitx_device->vic_count = prxcap->VIC_count; - idx = BlockBuf[3] & 0xf; + idx = blockbuf[3] & 0xf; for (i = 0; i < idx; i++) - Edid_DTD_parsing(pRXCap, &BlockBuf[BlockBuf[2] + i * 18]); + Edid_DTD_parsing(prxcap, &blockbuf[blockbuf[2] + i * 18]); if (vfpdb_offset) - Edid_ParsingVFPDB(pRXCap, vfpdb_offset); + Edid_ParsingVFPDB(prxcap, vfpdb_offset); return 0; } static void hdmitx_edid_set_default_aud(struct hdmitx_dev *hdev) { - struct rx_cap *pRXCap = &(hdev->RXCap); + struct rx_cap *prxcap = &hdev->rxcap; /* if AUD_count not equal to 0, no need default value */ - if (pRXCap->AUD_count) + if (prxcap->AUD_count) return; - pRXCap->AUD_count = 1; - pRXCap->RxAudioCap[0].audio_format_code = 1; /* PCM */ - pRXCap->RxAudioCap[0].channel_num_max = 1; /* 2ch */ - pRXCap->RxAudioCap[0].freq_cc = 7; /* 32/44.1/48 kHz */ - pRXCap->RxAudioCap[0].cc3 = 1; /* 16bit */ + prxcap->AUD_count = 1; + prxcap->RxAudioCap[0].audio_format_code = 1; /* PCM */ + prxcap->RxAudioCap[0].channel_num_max = 1; /* 2ch */ + prxcap->RxAudioCap[0].freq_cc = 7; /* 32/44.1/48 kHz */ + prxcap->RxAudioCap[0].cc3 = 1; /* 16bit */ } /* add default VICs for DVI case */ static void hdmitx_edid_set_default_vic(struct hdmitx_dev *hdmitx_device) { - struct rx_cap *pRXCap = &(hdmitx_device->RXCap); + struct rx_cap *prxcap = &hdmitx_device->rxcap; - pRXCap->VIC_count = 0x3; - pRXCap->VIC[0] = HDMI_720x480p60_16x9; - pRXCap->VIC[1] = HDMI_1280x720p60_16x9; - pRXCap->VIC[2] = HDMI_1920x1080p60_16x9; - pRXCap->native_VIC = HDMI_720x480p60_16x9; - hdmitx_device->vic_count = pRXCap->VIC_count; + prxcap->VIC_count = 0x3; + prxcap->VIC[0] = HDMI_720x480p60_16x9; + prxcap->VIC[1] = HDMI_1280x720p60_16x9; + prxcap->VIC[2] = HDMI_1920x1080p60_16x9; + prxcap->native_VIC = HDMI_720x480p60_16x9; + hdmitx_device->vic_count = prxcap->VIC_count; pr_info(EDID "set default vic\n"); } @@ -1932,8 +1949,8 @@ int check_dvi_hdmi_edid_valid(unsigned char *buf) return 1; } -static void Edid_ManufactureDateParse(struct rx_cap *pRXCap, - unsigned char *data) +static void Edid_ManufactureDateParse(struct rx_cap *prxcap, + unsigned char *data) { if (data == NULL) return; @@ -1945,21 +1962,21 @@ static void Edid_ManufactureDateParse(struct rx_cap *pRXCap, * 0xff: model year is specified */ if ((data[0] == 0) || ((data[0] >= 0x37) && (data[0] <= 0xfe))) - pRXCap->manufacture_week = 0; + prxcap->manufacture_week = 0; else - pRXCap->manufacture_week = data[0]; + prxcap->manufacture_week = data[0]; /* year: * 0x0~0xf: reserved * 0x10~0xff: year of manufacture, * or model year(if specified by week=0xff) */ - pRXCap->manufacture_year = + prxcap->manufacture_year = (data[1] <= 0xf)?0:data[1]; } -static void Edid_VersionParse(struct rx_cap *pRXCap, - unsigned char *data) +static void Edid_VersionParse(struct rx_cap *prxcap, + unsigned char *data) { if (data == NULL) return; @@ -1968,13 +1985,13 @@ static void Edid_VersionParse(struct rx_cap *pRXCap, * 0x1: edid version 1 * 0x0,0x2~0xff: reserved */ - pRXCap->edid_version = (data[0] == 0x1)?1:0; + prxcap->edid_version = (data[0] == 0x1) ? 1 : 0; /* * 0x0~0x4: revision number * 0x5~0xff: reserved */ - pRXCap->edid_revision = (data[1] < 0x5)?data[1]:0; + prxcap->edid_revision = (data[1] < 0x5) ? data[1] : 0; } static void Edid_PhyscialSizeParse(struct rx_cap *pRxCap, @@ -2016,10 +2033,10 @@ static void dump_dtd_info(struct dtd *t) PR(v_sync); } -static void Edid_DTD_parsing(struct rx_cap *pRXCap, unsigned char *data) +static void Edid_DTD_parsing(struct rx_cap *prxcap, unsigned char *data) { struct hdmi_format_para *para = NULL; - struct dtd *t = &pRXCap->dtd[pRXCap->dtd_idx]; + struct dtd *t = &prxcap->dtd[prxcap->dtd_idx]; memset(t, 0, sizeof(struct dtd)); t->pixel_clock = data[0] + (data[1] << 8); @@ -2058,26 +2075,26 @@ next: para = hdmi_match_dtd_paras(t); if (para) { t->vic = para->vic; - pRXCap->preferred_mode = pRXCap->dtd[0].vic; /* Select dtd0 */ + prxcap->preferred_mode = prxcap->dtd[0].vic; /* Select dtd0 */ pr_info(EDID "get dtd%d vic: %d\n", - pRXCap->dtd_idx, para->vic); - pRXCap->dtd_idx++; + prxcap->dtd_idx, para->vic); + prxcap->dtd_idx++; } else dump_dtd_info(t); } -static void edid_check_pcm_declare(struct rx_cap *pRXCap) +static void edid_check_pcm_declare(struct rx_cap *prxcap) { int idx_pcm = 0; int i; - if (!pRXCap->AUD_count) + if (!prxcap->AUD_count) return; /* Try to find more than 1 PCMs, RxAudioCap[0] is always basic audio */ - for (i = 1; i < pRXCap->AUD_count; i++) { - if (pRXCap->RxAudioCap[i].audio_format_code == - pRXCap->RxAudioCap[0].audio_format_code) { + for (i = 1; i < prxcap->AUD_count; i++) { + if (prxcap->RxAudioCap[i].audio_format_code == + prxcap->RxAudioCap[0].audio_format_code) { idx_pcm = i; break; } @@ -2085,56 +2102,73 @@ static void edid_check_pcm_declare(struct rx_cap *pRXCap) /* Remove basic audio */ if (idx_pcm) { - for (i = 0; i < pRXCap->AUD_count - 1; i++) - memcpy(&pRXCap->RxAudioCap[i], - &pRXCap->RxAudioCap[i + 1], - sizeof(struct rx_audiocap)); + for (i = 0; i < prxcap->AUD_count - 1; i++) + memcpy(&prxcap->RxAudioCap[i], + &prxcap->RxAudioCap[i + 1], + sizeof(struct rx_audiocap)); /* Clear the last audio declaration */ - memset(&pRXCap->RxAudioCap[i], 0, sizeof(struct rx_audiocap)); - pRXCap->AUD_count--; + memset(&prxcap->RxAudioCap[i], 0, sizeof(struct rx_audiocap)); + prxcap->AUD_count--; } } -static void hdrinfo_to_vinfo(struct vinfo_s *info, struct rx_cap *pRXCap) +static void hdrinfo_to_vinfo(struct vinfo_s *info, struct rx_cap *prxcap) { unsigned int k, l; /*static hdr*/ info->hdr_info.hdr_support = - (pRXCap->hdr_sup_eotf_sdr << 0) | - (pRXCap->hdr_sup_eotf_hdr << 1) | - (pRXCap->hdr_sup_eotf_smpte_st_2084 << 2) | - (pRXCap->hdr_sup_eotf_hlg << 3); + (prxcap->hdr_sup_eotf_sdr << 0) | + (prxcap->hdr_sup_eotf_hdr << 1) | + (prxcap->hdr_sup_eotf_smpte_st_2084 << 2) | + (prxcap->hdr_sup_eotf_hlg << 3); + memcpy(info->hdr_info.rawdata, prxcap->hdr_rawdata, 7); /*dynamic hdr*/ for (l = 0; l < 4; l++) { - if (pRXCap->hdr_dynamic_info[l].type == 0) { + if (prxcap->hdr_dynamic_info[l].type == 0) { memset(&info->hdr_info.dynamic_info[l], 0, sizeof(struct hdr_dynamic)); continue; } info->hdr_info.dynamic_info[l].type = - pRXCap->hdr_dynamic_info[l].type; + prxcap->hdr_dynamic_info[l].type; info->hdr_info.dynamic_info[l].of_len = - pRXCap->hdr_dynamic_info[l].hd_len - 3; + prxcap->hdr_dynamic_info[l].hd_len - 3; info->hdr_info.dynamic_info[l].support_flags = - pRXCap->hdr_dynamic_info[l].support_flags; - for (k = 0; k < (pRXCap->hdr_dynamic_info[l].hd_len - 3); k++) { + prxcap->hdr_dynamic_info[l].support_flags; + for (k = 0; k < (prxcap->hdr_dynamic_info[l].hd_len - 3); k++) { info->hdr_info.dynamic_info[l].optional_fields[k] = - pRXCap->hdr_dynamic_info[l].optional_fields[k]; + prxcap->hdr_dynamic_info[l].optional_fields[k]; } } /*hdr 10+*/ - memcpy(&(info->hdr_info.hdr10plus_info), - &(pRXCap->hdr10plus_info), sizeof(struct hdr10_plus_info)); + memcpy(&info->hdr_info.hdr10plus_info, + &prxcap->hdr10plus_info, sizeof(struct hdr10_plus_info)); info->hdr_info.colorimetry_support = - pRXCap->colorimetry_data; - info->hdr_info.lumi_max = pRXCap->hdr_lum_max; - info->hdr_info.lumi_avg = pRXCap->hdr_lum_avg; - info->hdr_info.lumi_min = pRXCap->hdr_lum_min; + prxcap->colorimetry_data; + info->hdr_info.lumi_max = prxcap->hdr_lum_max; + info->hdr_info.lumi_avg = prxcap->hdr_lum_avg; + info->hdr_info.lumi_min = prxcap->hdr_lum_min; pr_info(EDID "update rx hdr info %x at edid parsing\n", info->hdr_info.hdr_support); } +static bool is_4k60_supported(struct rx_cap *prxcap) +{ + int i = 0; + + if (!prxcap) + return false; + + for (i = 0; (i < prxcap->VIC_count) && (i < VIC_MAX_NUM); i++) { + if (((prxcap->VIC[i] & 0xff) == HDMI_3840x2160p50_16x9) || + ((prxcap->VIC[i] & 0xff) == HDMI_3840x2160p60_16x9)) { + return true; + } + } + return false; +} + static void rxlatency_to_vinfo(struct vinfo_s *info, struct rx_cap *rx) { if (!info || !rx) @@ -2145,8 +2179,9 @@ static void rxlatency_to_vinfo(struct vinfo_s *info, struct rx_cap *rx) info->rx_latency.i_aLatency = rx->i_aLatency; } -static void Edid_Descriptor_PMT(struct rx_cap *pRXCap, - struct vesa_standard_timing *t, unsigned char *data) +static void Edid_Descriptor_PMT(struct rx_cap *prxcap, + struct vesa_standard_timing *t, + unsigned char *data) { struct hdmi_format_para *para = NULL; @@ -2157,15 +2192,16 @@ static void Edid_Descriptor_PMT(struct rx_cap *pRXCap, t->vblank = data[6] + ((data[7] & 0xf) << 8); para = hdmi_get_vesa_paras(t); if (para && ((para->vic) < (HDMI_3840x2160p60_64x27 + 1))) { - pRXCap->native_VIC = para->vic; + prxcap->native_VIC = para->vic; pr_info("hdmitx: get PMT vic: %d\n", para->vic); } if (para && ((para->vic) >= HDMITX_VESA_OFFSET)) - store_vesa_idx(pRXCap, para->vic); + store_vesa_idx(prxcap, para->vic); } -static void Edid_Descriptor_PMT2(struct rx_cap *pRXCap, - struct vesa_standard_timing *t, unsigned char *data) +static void Edid_Descriptor_PMT2(struct rx_cap *prxcap, + struct vesa_standard_timing *t, + unsigned char *data) { struct hdmi_format_para *para = NULL; @@ -2176,11 +2212,12 @@ static void Edid_Descriptor_PMT2(struct rx_cap *pRXCap, t->vblank = data[6] + ((data[7] & 0xf) << 8); para = hdmi_get_vesa_paras(t); if (para && ((para->vic) >= HDMITX_VESA_OFFSET)) - store_vesa_idx(pRXCap, para->vic); + store_vesa_idx(prxcap, para->vic); } -static void Edid_CVT_timing_3bytes(struct rx_cap *pRXCap, - struct vesa_standard_timing *t, const unsigned char *data) +static void Edid_CVT_timing_3bytes(struct rx_cap *prxcap, + struct vesa_standard_timing *t, + const unsigned char *data) { struct hdmi_format_para *para = NULL; @@ -2220,16 +2257,16 @@ static void Edid_CVT_timing_3bytes(struct rx_cap *pRXCap, t->vesa_timing = para->vic; } -static void Edid_CVT_timing(struct rx_cap *pRXCap, unsigned char *data) +static void Edid_CVT_timing(struct rx_cap *prxcap, unsigned char *data) { int i; struct vesa_standard_timing t; for (i = 0; i < 4; i++) { memset(&t, 0, sizeof(struct vesa_standard_timing)); - Edid_CVT_timing_3bytes(pRXCap, &t, &data[i * 3]); + Edid_CVT_timing_3bytes(prxcap, &t, &data[i * 3]); if (t.vesa_timing) - store_vesa_idx(pRXCap, t.vesa_timing); + store_vesa_idx(prxcap, t.vesa_timing); } } @@ -2241,9 +2278,10 @@ int hdmitx_edid_parse(struct hdmitx_dev *hdmitx_device) unsigned char *EDID_buf; int i, j, ret_val; int idx[4]; - struct rx_cap *pRXCap = &(hdmitx_device->RXCap); - struct dv_info *dv = &(hdmitx_device->RXCap.dv_info); + struct rx_cap *prxcap = &hdmitx_device->rxcap; + struct dv_info *dv = &hdmitx_device->rxcap.dv_info; struct vinfo_s *info = NULL; + unsigned int max_tmds_clk = 0; if (check_dvi_hdmi_edid_valid(hdmitx_device->EDID_buf)) { EDID_buf = hdmitx_device->EDID_buf; @@ -2273,25 +2311,25 @@ int hdmitx_edid_parse(struct hdmitx_dev *hdmitx_device) if (CheckSum != 0) pr_info(EDID "PLUGIN_DVI_OUT\n"); - Edid_ParsingIDManufacturerName(&hdmitx_device->RXCap, &EDID_buf[8]); - Edid_ParsingIDProductCode(&hdmitx_device->RXCap, &EDID_buf[0x0A]); - Edid_ParsingIDSerialNumber(&hdmitx_device->RXCap, &EDID_buf[0x0C]); + Edid_ParsingIDManufacturerName(&hdmitx_device->rxcap, &EDID_buf[8]); + Edid_ParsingIDProductCode(&hdmitx_device->rxcap, &EDID_buf[0x0A]); + Edid_ParsingIDSerialNumber(&hdmitx_device->rxcap, &EDID_buf[0x0C]); - Edid_EstablishedTimings(&hdmitx_device->RXCap, &EDID_buf[0x23]); - Edid_StandardTiming(&hdmitx_device->RXCap, &EDID_buf[0x26], 8); + Edid_EstablishedTimings(&hdmitx_device->rxcap, &EDID_buf[0x23]); + Edid_StandardTiming(&hdmitx_device->rxcap, &EDID_buf[0x26], 8); - Edid_ManufactureDateParse(&hdmitx_device->RXCap, &EDID_buf[16]); + Edid_ManufactureDateParse(&hdmitx_device->rxcap, &EDID_buf[16]); - Edid_VersionParse(&hdmitx_device->RXCap, &EDID_buf[18]); + Edid_VersionParse(&hdmitx_device->rxcap, &EDID_buf[18]); - Edid_PhyscialSizeParse(&hdmitx_device->RXCap, &EDID_buf[21]); + Edid_PhyscialSizeParse(&hdmitx_device->rxcap, &EDID_buf[21]); Edid_DecodeStandardTiming(&hdmitx_device->hdmi_info, &EDID_buf[26], 8); Edid_ParseCEADetailedTimingDescriptors(&hdmitx_device->hdmi_info, 4, 0x36, &EDID_buf[0]); BlockCount = EDID_buf[0x7E]; - hdmitx_device->RXCap.blk0_chksum = EDID_buf[0x7F]; + hdmitx_device->rxcap.blk0_chksum = EDID_buf[0x7F]; if (BlockCount == 0) { pr_info(EDID "EDID BlockCount=0\n"); @@ -2310,24 +2348,24 @@ int hdmitx_edid_parse(struct hdmitx_dev *hdmitx_device) pr_info(EDID "edid blk0 checksum:%d ext_flag:%d\n", CheckSum, EDID_buf[0x7e]); if ((CheckSum & 0xff) == 0) - hdmitx_device->RXCap.ieeeoui = 0; + hdmitx_device->rxcap.ieeeoui = 0; else - hdmitx_device->RXCap.ieeeoui = HDMI_IEEEOUI; + hdmitx_device->rxcap.ieeeoui = HDMI_IEEEOUI; if (zero_numbers > 120) - hdmitx_device->RXCap.ieeeoui = HDMI_IEEEOUI; + hdmitx_device->rxcap.ieeeoui = HDMI_IEEEOUI; return 0; /* do nothing. */ } /* Note: some DVI monitor have more than 1 block */ if ((BlockCount == 1) && (EDID_buf[0x81] == 1)) { - hdmitx_device->RXCap.ieeeoui = 0; - hdmitx_device->RXCap.VIC_count = 0x3; - hdmitx_device->RXCap.VIC[0] = HDMI_720x480p60_16x9; - hdmitx_device->RXCap.VIC[1] = HDMI_1280x720p60_16x9; - hdmitx_device->RXCap.VIC[2] = HDMI_1920x1080p60_16x9; - hdmitx_device->RXCap.native_VIC = HDMI_720x480p60_16x9; - hdmitx_device->vic_count = hdmitx_device->RXCap.VIC_count; + hdmitx_device->rxcap.ieeeoui = 0; + hdmitx_device->rxcap.VIC_count = 0x3; + hdmitx_device->rxcap.VIC[0] = HDMI_720x480p60_16x9; + hdmitx_device->rxcap.VIC[1] = HDMI_1280x720p60_16x9; + hdmitx_device->rxcap.VIC[2] = HDMI_1920x1080p60_16x9; + hdmitx_device->rxcap.native_VIC = HDMI_720x480p60_16x9; + hdmitx_device->vic_count = hdmitx_device->rxcap.VIC_count; pr_info(EDID "set default vic\n"); return 0; } else if (BlockCount > EDID_MAX_BLOCK) { @@ -2363,7 +2401,61 @@ int hdmitx_edid_parse(struct hdmitx_dev *hdmitx_device) hdmitx_edid_block_parse(hdmitx_device, &(EDID_buf[i*128])); } - edid_check_pcm_declare(&hdmitx_device->RXCap); + + /* EDID parsing complete - check if 4k60/50 DV can be truly supported */ + dv = &prxcap->dv_info; + if ((dv->ieeeoui == DV_IEEE_OUI) && (dv->ver <= 2)) { + /* check max tmds rate to determine if 4k60 DV can truly be + * supported. + */ + if (prxcap->Max_TMDS_Clock2) { + max_tmds_clk = prxcap->Max_TMDS_Clock2 * 5; + } else { + /* Default min is 74.25 / 5 */ + if (prxcap->Max_TMDS_Clock1 < 0xf) + prxcap->Max_TMDS_Clock1 = 0x1e; + max_tmds_clk = prxcap->Max_TMDS_Clock1 * 5; + } + if (dv->ver == 0) + dv->sup_2160p60hz = dv->sup_2160p60hz && + (max_tmds_clk >= 594); + + if ((dv->ver == 1) && (dv->length == 0xB)) { + if (dv->low_latency == 0x00) { + /*standard mode */ + dv->sup_2160p60hz = dv->sup_2160p60hz && + (max_tmds_clk >= 594); + } else if (dv->low_latency == 0x01) { + /* both standard and LL are supported. 4k60 LL + * DV support should/can be determined using + * video formats supported inthe E-EDID as flag + * sup_2160p60hz might not be set. + */ + if ((dv->sup_2160p60hz || + is_4k60_supported(prxcap)) && + (max_tmds_clk >= 594)) + dv->sup_2160p60hz = 1; + else + dv->sup_2160p60hz = 0; + } + } + + if ((dv->ver == 1) && (dv->length == 0xE)) + dv->sup_2160p60hz = dv->sup_2160p60hz && + (max_tmds_clk >= 594); + + if (dv->ver == 2) { + /* 4k60 DV support should be determined using video + * formats supported in the EEDID as flag sup_2160p60hz + * is not applicable for VSVDB V2. + */ + if (is_4k60_supported(prxcap) && (max_tmds_clk >= 594)) + dv->sup_2160p60hz = 1; + else + dv->sup_2160p60hz = 0; + } + } + edid_check_pcm_declare(&hdmitx_device->rxcap); /* * Because DTDs are not able to represent some Video Formats, which can be * represented as SVDs and might be preferred by Sinks, the first DTD in the @@ -2372,11 +2464,11 @@ int hdmitx_edid_parse(struct hdmitx_dev *hdmitx_device) * DTDs defining Native Video Formats in the whole EDID is zero, the first * SVD shall take precedence. */ - if (!pRXCap->flag_vfpdb && (pRXCap->preferred_mode != pRXCap->VIC[0]) && - (pRXCap->number_of_dtd == 0)) { + if (!prxcap->flag_vfpdb && (prxcap->preferred_mode != prxcap->VIC[0]) && + (prxcap->number_of_dtd == 0)) { pr_info(EDID "change preferred_mode from %d to %d\n", - pRXCap->preferred_mode, pRXCap->VIC[0]); - pRXCap->preferred_mode = pRXCap->VIC[0]; + prxcap->preferred_mode, prxcap->VIC[0]); + prxcap->preferred_mode = prxcap->VIC[0]; } idx[0] = EDID_DETAILED_TIMING_DES_BLOCK0_POS; @@ -2389,28 +2481,28 @@ int hdmitx_edid_parse(struct hdmitx_dev *hdmitx_device) memset(&t, 0, sizeof(struct vesa_standard_timing)); if (i == 0) - Edid_Descriptor_PMT(pRXCap, &t, - &EDID_buf[idx[i]]); + Edid_Descriptor_PMT(prxcap, &t, + &EDID_buf[idx[i]]); if (i == 1) - Edid_Descriptor_PMT2(pRXCap, &t, - &EDID_buf[idx[i]]); + Edid_Descriptor_PMT2(prxcap, &t, + &EDID_buf[idx[i]]); continue; } switch (EDID_buf[idx[i] + 3]) { case TAG_STANDARD_TIMINGS: - Edid_StandardTiming(pRXCap, &EDID_buf[idx[i] + 5], 6); + Edid_StandardTiming(prxcap, &EDID_buf[idx[i] + 5], 6); break; case TAG_CVT_TIMING_CODES: - Edid_CVT_timing(pRXCap, &EDID_buf[idx[i] + 6]); + Edid_CVT_timing(prxcap, &EDID_buf[idx[i] + 6]); break; case TAG_ESTABLISHED_TIMING_III: - Edid_StandardTimingIII(pRXCap, &EDID_buf[idx[i] + 6]); + Edid_StandardTimingIII(prxcap, &EDID_buf[idx[i] + 6]); break; case TAG_RANGE_LIMITS: break; case TAG_DISPLAY_PRODUCT_NAME_STRING: - Edid_ReceiverProductNameParse(pRXCap, - &EDID_buf[idx[i] + 5]); + Edid_ReceiverProductNameParse(prxcap, + &EDID_buf[idx[i] + 5]); break; default: break; @@ -2418,57 +2510,57 @@ int hdmitx_edid_parse(struct hdmitx_dev *hdmitx_device) } if (hdmitx_edid_search_IEEEOUI(&EDID_buf[128])) { - pRXCap->ieeeoui = HDMI_IEEEOUI; + prxcap->ieeeoui = HDMI_IEEEOUI; pr_info(EDID "find IEEEOUT\n"); } else { - pRXCap->ieeeoui = 0x0; + prxcap->ieeeoui = 0x0; pr_info(EDID "not find IEEEOUT\n"); } - if ((pRXCap->ieeeoui != HDMI_IEEEOUI) || (pRXCap->ieeeoui == 0x0) || - (pRXCap->VIC_count == 0)) + if ((prxcap->ieeeoui != HDMI_IEEEOUI) || (prxcap->ieeeoui == 0x0) || + (prxcap->VIC_count == 0)) hdmitx_edid_set_default_vic(hdmitx_device); /* strictly DVI device judgement */ /* valid EDID & no audio tag & no IEEEOUI */ if (edid_check_valid(&EDID_buf[0]) && !hdmitx_edid_search_IEEEOUI(&EDID_buf[128])) { - pRXCap->ieeeoui = 0x0; + prxcap->ieeeoui = 0x0; pr_info(EDID "sink is DVI device\n"); } else - pRXCap->ieeeoui = HDMI_IEEEOUI; + prxcap->ieeeoui = HDMI_IEEEOUI; if (edid_zero_data(EDID_buf)) - pRXCap->ieeeoui = HDMI_IEEEOUI; + prxcap->ieeeoui = HDMI_IEEEOUI; - if ((!pRXCap->AUD_count) && (!pRXCap->ieeeoui)) + if ((!prxcap->AUD_count) && (!prxcap->ieeeoui)) hdmitx_edid_set_default_aud(hdmitx_device); - edid_save_checkvalue(EDID_buf, BlockCount + 1, pRXCap); + edid_save_checkvalue(EDID_buf, BlockCount + 1, prxcap); i = hdmitx_edid_dump(hdmitx_device, (char *)(hdmitx_device->tmp_buf), HDMI_TMP_BUF_SIZE); hdmitx_device->tmp_buf[i] = 0; if (!hdmitx_edid_check_valid_blocks(&EDID_buf[0])) { - pRXCap->ieeeoui = HDMI_IEEEOUI; + prxcap->ieeeoui = HDMI_IEEEOUI; pr_info(EDID "Invalid edid, consider RX as HDMI device\n"); } /* update RX HDR information */ info = get_current_vinfo(); if (info) { /*update hdmi checksum to vout*/ - memcpy(info->hdmichecksum, pRXCap->chksum, 10); + memcpy(info->hdmichecksum, prxcap->chksum, 10); if (!((strncmp(info->name, "480cvbs", 7) == 0) || (strncmp(info->name, "576cvbs", 7) == 0) || (strncmp(info->name, "null", 4) == 0))) { - hdrinfo_to_vinfo(info, pRXCap); - rxlatency_to_vinfo(info, pRXCap); + hdrinfo_to_vinfo(info, prxcap); + rxlatency_to_vinfo(info, prxcap); } } /* if sup_2160p60hz of dv is true, check the MAX_TMDS*/ if (dv->sup_2160p60hz) { - if (pRXCap->Max_TMDS_Clock2 * 5 < 590) { + if (prxcap->Max_TMDS_Clock2 * 5 < 590) { dv->sup_2160p60hz = 0; pr_info(EDID "clear sup_2160p60hz\n"); } @@ -2629,8 +2721,8 @@ bool hdmitx_edid_check_valid_mode(struct hdmitx_dev *hdev, struct hdmi_format_para *para) { bool valid = 0; - struct rx_cap *pRXCap = NULL; - const struct dv_info *dv = &(hdev->RXCap.dv_info); + struct rx_cap *prxcap = NULL; + const struct dv_info *dv = &hdev->rxcap.dv_info; unsigned int rx_max_tmds_clk = 0; unsigned int calc_tmds_clk = 0; int i = 0; @@ -2667,30 +2759,30 @@ bool hdmitx_edid_check_valid_mode(struct hdmitx_dev *hdev, break; } - pRXCap = &(hdev->RXCap); + prxcap = &hdev->rxcap; /* DVI case, only 8bit */ - if (pRXCap->ieeeoui != HDMI_IEEEOUI) { + if (prxcap->ieeeoui != HDMI_IEEEOUI) { if (para->cd != COLORDEPTH_24B) return 0; } /* target mode is not contained at RX SVD */ - for (i = 0; (i < pRXCap->VIC_count) && (i < VIC_MAX_NUM); i++) { - if ((para->vic & 0xff) == (pRXCap->VIC[i] & 0xff)) + for (i = 0; (i < prxcap->VIC_count) && (i < VIC_MAX_NUM); i++) { + if ((para->vic & 0xff) == (prxcap->VIC[i] & 0xff)) svd_flag = 1; } if (svd_flag == 0) return 0; /* Get RX Max_TMDS_Clock */ - if (pRXCap->Max_TMDS_Clock2) - rx_max_tmds_clk = pRXCap->Max_TMDS_Clock2 * 5; - else { + if (prxcap->Max_TMDS_Clock2) { + rx_max_tmds_clk = prxcap->Max_TMDS_Clock2 * 5; + } else { /* Default min is 74.25 / 5 */ - if (pRXCap->Max_TMDS_Clock1 < 0xf) - pRXCap->Max_TMDS_Clock1 = 0x1e; - rx_max_tmds_clk = pRXCap->Max_TMDS_Clock1 * 5; + if (prxcap->Max_TMDS_Clock1 < 0xf) + prxcap->Max_TMDS_Clock1 = 0x1e; + rx_max_tmds_clk = prxcap->Max_TMDS_Clock1 * 5; } calc_tmds_clk = para->tmds_clk; @@ -2723,12 +2815,12 @@ bool hdmitx_edid_check_valid_mode(struct hdmitx_dev *hdev, if (para->cs == COLORSPACE_YUV444) { /* Rx may not support Y444 */ - if (!(pRXCap->native_Mode & (1 << 5))) + if (!(prxcap->native_Mode & (1 << 5))) return 0; - if ((pRXCap->dc_y444 && pRXCap->dc_30bit) + if ((prxcap->dc_y444 && prxcap->dc_30bit) || (dv->sup_10b_12b_444 == 0x1)) rx_y444_max_dc = COLORDEPTH_30B; - if ((pRXCap->dc_y444 && pRXCap->dc_36bit) + if ((prxcap->dc_y444 && prxcap->dc_36bit) || (dv->sup_10b_12b_444 == 0x2)) rx_y444_max_dc = COLORDEPTH_36B; if (para->cd <= rx_y444_max_dc) @@ -2739,11 +2831,11 @@ bool hdmitx_edid_check_valid_mode(struct hdmitx_dev *hdev, } if (para->cs == COLORSPACE_YUV422) { /* Rx may not support Y422 */ - if (!(pRXCap->native_Mode & (1 << 4))) + if (!(prxcap->native_Mode & (1 << 4))) return 0; - if (pRXCap->dc_y444 && pRXCap->dc_30bit) + if (prxcap->dc_y444 && prxcap->dc_30bit) rx_y422_max_dc = COLORDEPTH_30B; - if ((pRXCap->dc_y444 && pRXCap->dc_36bit) + if ((prxcap->dc_y444 && prxcap->dc_36bit) || (dv->sup_yuv422_12bit)) rx_y422_max_dc = COLORDEPTH_36B; if (para->cd <= rx_y422_max_dc) @@ -2754,9 +2846,9 @@ bool hdmitx_edid_check_valid_mode(struct hdmitx_dev *hdev, } if (para->cs == COLORSPACE_RGB444) { /* Always assume RX supports RGB444 */ - if ((pRXCap->dc_30bit) || (dv->sup_10b_12b_444 == 0x1)) + if ((prxcap->dc_30bit) || (dv->sup_10b_12b_444 == 0x1)) rx_rgb_max_dc = COLORDEPTH_30B; - if ((pRXCap->dc_36bit) || (dv->sup_10b_12b_444 == 0x2)) + if ((prxcap->dc_36bit) || (dv->sup_10b_12b_444 == 0x2)) rx_rgb_max_dc = COLORDEPTH_36B; if (para->cd <= rx_rgb_max_dc) valid = 1; @@ -2767,9 +2859,9 @@ bool hdmitx_edid_check_valid_mode(struct hdmitx_dev *hdev, if (para->cs == COLORSPACE_YUV420) { if (!is_rx_support_y420(hdev)) return 0; - if (pRXCap->dc_30bit_420) + if (prxcap->dc_30bit_420) rx_y420_max_dc = COLORDEPTH_30B; - if (pRXCap->dc_36bit_420) + if (prxcap->dc_36bit_420) rx_y420_max_dc = COLORDEPTH_36B; if (para->cd <= rx_y420_max_dc) valid = 1; @@ -2786,17 +2878,17 @@ bool hdmitx_edid_check_valid_mode(struct hdmitx_dev *hdev, enum hdmi_vic hdmitx_edid_get_VIC(struct hdmitx_dev *hdev, const char *disp_mode, char force_flag) { - struct rx_cap *pRXCap = &(hdev->RXCap); + struct rx_cap *prxcap = &hdev->rxcap; int j; enum hdmi_vic vic = hdmitx_edid_vic_tab_map_vic(disp_mode); if (vic != HDMI_Unknown) { if (force_flag == 0) { - for (j = 0 ; j < pRXCap->VIC_count ; j++) { - if (pRXCap->VIC[j] == vic) + for (j = 0 ; j < prxcap->VIC_count ; j++) { + if (prxcap->VIC[j] == vic) break; } - if (j >= pRXCap->VIC_count) + if (j >= prxcap->VIC_count) vic = HDMI_Unknown; } } @@ -2805,9 +2897,9 @@ enum hdmi_vic hdmitx_edid_get_VIC(struct hdmitx_dev *hdev, const char *hdmitx_edid_get_native_VIC(struct hdmitx_dev *hdmitx_device) { - struct rx_cap *pRXCap = &(hdmitx_device->RXCap); + struct rx_cap *prxcap = &hdmitx_device->rxcap; - return hdmitx_edid_vic_to_string(pRXCap->native_VIC); + return hdmitx_edid_vic_to_string(prxcap->native_VIC); } /* Clear HDMI Hardware Module EDID RAM and EDID Buffer */ @@ -2816,7 +2908,7 @@ void hdmitx_edid_ram_buffer_clear(struct hdmitx_dev *hdmitx_device) unsigned int i = 0; /* Clear HDMI Hardware Module EDID RAM */ - hdmitx_device->HWOp.CntlDDC(hdmitx_device, DDC_EDID_CLEAR_RAM, 0); + hdmitx_device->hwop.cntlddc(hdmitx_device, DDC_EDID_CLEAR_RAM, 0); /* Clear EDID Buffer */ for (i = 0; i < EDID_MAX_BLOCK*128; i++) @@ -2829,14 +2921,14 @@ void hdmitx_edid_ram_buffer_clear(struct hdmitx_dev *hdmitx_device) void hdmitx_edid_clear(struct hdmitx_dev *hdmitx_device) { char tmp[2] = {0}; - struct rx_cap *pRXCap = &(hdmitx_device->RXCap); + struct rx_cap *prxcap = &hdmitx_device->rxcap; - memset(pRXCap, 0, sizeof(struct rx_cap)); + memset(prxcap, 0, sizeof(struct rx_cap)); /* Note: in most cases, we think that rx is tv and the default * IEEEOUI is HDMI Identifier */ - pRXCap->ieeeoui = HDMI_IEEEOUI; + prxcap->ieeeoui = HDMI_IEEEOUI; hdmitx_device->vic_count = 0; hdmitx_device->hdmi_info.vsdb_phy_addr.a = 0; @@ -2948,40 +3040,40 @@ int hdmitx_edid_dump(struct hdmitx_dev *hdmitx_device, char *buffer, int buffer_len) { int i, pos = 0; - struct rx_cap *pRXCap = &(hdmitx_device->RXCap); + struct rx_cap *prxcap = &hdmitx_device->rxcap; pos += snprintf(buffer+pos, buffer_len-pos, - "Rx Manufacturer Name: %s\n", pRXCap->IDManufacturerName); + "Rx Manufacturer Name: %s\n", prxcap->IDManufacturerName); pos += snprintf(buffer+pos, buffer_len-pos, "Rx Product Code: %02x%02x\n", - pRXCap->IDProductCode[0], - pRXCap->IDProductCode[1]); + prxcap->IDProductCode[0], + prxcap->IDProductCode[1]); pos += snprintf(buffer+pos, buffer_len-pos, "Rx Serial Number: %02x%02x%02x%02x\n", - pRXCap->IDSerialNumber[0], - pRXCap->IDSerialNumber[1], - pRXCap->IDSerialNumber[2], - pRXCap->IDSerialNumber[3]); + prxcap->IDSerialNumber[0], + prxcap->IDSerialNumber[1], + prxcap->IDSerialNumber[2], + prxcap->IDSerialNumber[3]); pos += snprintf(buffer+pos, buffer_len-pos, - "Rx Product Name: %s\n", pRXCap->ReceiverProductName); + "Rx Product Name: %s\n", prxcap->ReceiverProductName); pos += snprintf(buffer+pos, buffer_len-pos, - "Manufacture Week: %d\n", pRXCap->manufacture_week); + "Manufacture Week: %d\n", prxcap->manufacture_week); pos += snprintf(buffer+pos, buffer_len-pos, - "Manufacture Year: %d\n", pRXCap->manufacture_year+1990); + "Manufacture Year: %d\n", prxcap->manufacture_year + 1990); pos += snprintf(buffer+pos, buffer_len-pos, "Physcial size(cm): %d x %d\n", - pRXCap->physcial_weight, pRXCap->physcial_height); + prxcap->physcial_weight, prxcap->physcial_height); pos += snprintf(buffer+pos, buffer_len-pos, "EDID Version: %d.%d\n", - pRXCap->edid_version, pRXCap->edid_revision); + prxcap->edid_version, prxcap->edid_revision); pos += snprintf(buffer+pos, buffer_len-pos, "EDID block number: 0x%x\n", hdmitx_device->EDID_buf[0x7e]); pos += snprintf(buffer+pos, buffer_len-pos, - "blk0 chksum: 0x%02x\n", pRXCap->blk0_chksum); + "blk0 chksum: 0x%02x\n", prxcap->blk0_chksum); pos += snprintf(buffer+pos, buffer_len-pos, "Source Physical Address[a.b.c.d]: %x.%x.%x.%x\n", @@ -2992,106 +3084,106 @@ int hdmitx_edid_dump(struct hdmitx_dev *hdmitx_device, char *buffer, pos += snprintf(buffer+pos, buffer_len-pos, "native Mode %x, VIC (native %d):\n", - pRXCap->native_Mode, pRXCap->native_VIC); + prxcap->native_Mode, prxcap->native_VIC); pos += snprintf(buffer+pos, buffer_len-pos, - "ColorDeepSupport %x\n", pRXCap->ColorDeepSupport); + "ColorDeepSupport %x\n", prxcap->ColorDeepSupport); - for (i = 0 ; i < pRXCap->VIC_count ; i++) { + for (i = 0 ; i < prxcap->VIC_count ; i++) { pos += snprintf(buffer+pos, buffer_len-pos, "%d ", - pRXCap->VIC[i]); + prxcap->VIC[i]); } pos += snprintf(buffer+pos, buffer_len-pos, "\n"); pos += snprintf(buffer+pos, buffer_len-pos, "Audio {format, channel, freq, cce}\n"); - for (i = 0; i < pRXCap->AUD_count; i++) { + for (i = 0; i < prxcap->AUD_count; i++) { pos += snprintf(buffer+pos, buffer_len-pos, "{%d, %d, %x, %x}\n", - pRXCap->RxAudioCap[i].audio_format_code, - pRXCap->RxAudioCap[i].channel_num_max, - pRXCap->RxAudioCap[i].freq_cc, - pRXCap->RxAudioCap[i].cc3); + prxcap->RxAudioCap[i].audio_format_code, + prxcap->RxAudioCap[i].channel_num_max, + prxcap->RxAudioCap[i].freq_cc, + prxcap->RxAudioCap[i].cc3); } pos += snprintf(buffer+pos, buffer_len-pos, - "Speaker Allocation: %x\n", pRXCap->RxSpeakerAllocation); + "Speaker Allocation: %x\n", prxcap->RxSpeakerAllocation); pos += snprintf(buffer+pos, buffer_len-pos, "Vendor: 0x%x ( %s device)\n", - pRXCap->ieeeoui, (pRXCap->ieeeoui)?"HDMI":"DVI"); + prxcap->ieeeoui, (prxcap->ieeeoui) ? "HDMI" : "DVI"); pos += snprintf(buffer+pos, buffer_len-pos, - "MaxTMDSClock1 %d MHz\n", pRXCap->Max_TMDS_Clock1 * 5); + "MaxTMDSClock1 %d MHz\n", prxcap->Max_TMDS_Clock1 * 5); - if (pRXCap->hf_ieeeoui) { + if (prxcap->hf_ieeeoui) { pos += snprintf(buffer+pos, buffer_len-pos, "Vendor2: 0x%x\n", - pRXCap->hf_ieeeoui); + prxcap->hf_ieeeoui); pos += snprintf(buffer+pos, buffer_len-pos, - "MaxTMDSClock2 %d MHz\n", pRXCap->Max_TMDS_Clock2 * 5); + "MaxTMDSClock2 %d MHz\n", prxcap->Max_TMDS_Clock2 * 5); } - if (pRXCap->allm) + if (prxcap->allm) pos += snprintf(buffer+pos, buffer_len-pos, "ALLM: %x\n", - pRXCap->allm); + prxcap->allm); pos += snprintf(buffer+pos, buffer_len-pos, "vLatency: "); - if (pRXCap->vLatency == LATENCY_INVALID_UNKNOWN) + if (prxcap->vLatency == LATENCY_INVALID_UNKNOWN) pos += snprintf(buffer+pos, buffer_len-pos, " Invalid/Unknown\n"); - else if (pRXCap->vLatency == LATENCY_NOT_SUPPORT) + else if (prxcap->vLatency == LATENCY_NOT_SUPPORT) pos += snprintf(buffer+pos, buffer_len-pos, " UnSupported\n"); else pos += snprintf(buffer+pos, buffer_len-pos, - " %d\n", pRXCap->vLatency); + " %d\n", prxcap->vLatency); pos += snprintf(buffer+pos, buffer_len-pos, "aLatency: "); - if (pRXCap->aLatency == LATENCY_INVALID_UNKNOWN) + if (prxcap->aLatency == LATENCY_INVALID_UNKNOWN) pos += snprintf(buffer+pos, buffer_len-pos, " Invalid/Unknown\n"); - else if (pRXCap->aLatency == LATENCY_NOT_SUPPORT) + else if (prxcap->aLatency == LATENCY_NOT_SUPPORT) pos += snprintf(buffer+pos, buffer_len-pos, " UnSupported\n"); else pos += snprintf(buffer+pos, buffer_len-pos, " %d\n", - pRXCap->aLatency); + prxcap->aLatency); pos += snprintf(buffer+pos, buffer_len-pos, "i_vLatency: "); - if (pRXCap->i_vLatency == LATENCY_INVALID_UNKNOWN) + if (prxcap->i_vLatency == LATENCY_INVALID_UNKNOWN) pos += snprintf(buffer+pos, buffer_len-pos, " Invalid/Unknown\n"); - else if (pRXCap->i_vLatency == LATENCY_NOT_SUPPORT) + else if (prxcap->i_vLatency == LATENCY_NOT_SUPPORT) pos += snprintf(buffer+pos, buffer_len-pos, " UnSupported\n"); else pos += snprintf(buffer+pos, buffer_len-pos, " %d\n", - pRXCap->i_vLatency); + prxcap->i_vLatency); pos += snprintf(buffer+pos, buffer_len-pos, "i_aLatency: "); - if (pRXCap->i_aLatency == LATENCY_INVALID_UNKNOWN) + if (prxcap->i_aLatency == LATENCY_INVALID_UNKNOWN) pos += snprintf(buffer+pos, buffer_len-pos, " Invalid/Unknown\n"); - else if (pRXCap->i_aLatency == LATENCY_NOT_SUPPORT) + else if (prxcap->i_aLatency == LATENCY_NOT_SUPPORT) pos += snprintf(buffer+pos, buffer_len-pos, " UnSupported\n"); else pos += snprintf(buffer+pos, buffer_len-pos, " %d\n", - pRXCap->i_aLatency); + prxcap->i_aLatency); - if (pRXCap->colorimetry_data) + if (prxcap->colorimetry_data) pos += snprintf(buffer+pos, buffer_len-pos, - "ColorMetry: 0x%x\n", pRXCap->colorimetry_data); + "ColorMetry: 0x%x\n", prxcap->colorimetry_data); pos += snprintf(buffer+pos, buffer_len-pos, "SCDC: %x\n", - pRXCap->scdc_present); + prxcap->scdc_present); pos += snprintf(buffer+pos, buffer_len-pos, "RR_Cap: %x\n", - pRXCap->scdc_rr_capable); + prxcap->scdc_rr_capable); pos += snprintf(buffer+pos, buffer_len-pos, "LTE_340M_Scramble: %x\n", - pRXCap->lte_340mcsc_scramble); + prxcap->lte_340mcsc_scramble); - if (pRXCap->dv_info.ieeeoui == 0x00d046) + if (prxcap->dv_info.ieeeoui == 0x00d046) pos += snprintf(buffer+pos, buffer_len-pos, - " DolbyVision%d", pRXCap->dv_info.ver); - if (pRXCap->hdr_sup_eotf_smpte_st_2084) + " DolbyVision%d", prxcap->dv_info.ver); + if (prxcap->hdr_sup_eotf_smpte_st_2084) pos += snprintf(buffer+pos, buffer_len-pos, " HDR"); - if (pRXCap->dc_y444 || pRXCap->dc_30bit || pRXCap->dc_30bit_420) + if (prxcap->dc_y444 || prxcap->dc_30bit || prxcap->dc_30bit_420) pos += snprintf(buffer+pos, buffer_len-pos, " DeepColor"); pos += snprintf(buffer+pos, buffer_len-pos, "\n"); diff --git a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_hdcp.c b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_hdcp.c index 423b46a..3e69b3fd 100644 --- a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_hdcp.c +++ b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_hdcp.c @@ -59,8 +59,7 @@ unsigned int hdcp_get_downstream_ver(void) struct hdmitx_dev *hdev = get_hdmitx_device(); /* if TX don't have HDCP22 key, skip RX hdcp22 ver */ - if (hdev->HWOp.CntlDDC(hdev, - DDC_HDCP_22_LSTORE, 0) == 0) + if (hdev->hwop.cntlddc(hdev, DDC_HDCP_22_LSTORE, 0) == 0) if (hdcp_rd_hdcp22_ver()) ret = 22; else @@ -95,10 +94,10 @@ static void _hdcp_do_work(struct work_struct *work) container_of(work, struct hdmitx_dev, work_do_hdcp.work); if (hdev->hdcp_mode == 2) { - /* hdev->HWOp.CntlMisc(hdev, MISC_HDCP_CLKDIS, 1); */ + /* hdev->hwop.cntlmisc(hdev, MISC_HDCP_CLKDIS, 1); */ /* schedule_delayed_work(&hdev->work_do_hdcp, HZ / 50); */ } else - hdev->HWOp.CntlMisc(hdev, MISC_HDCP_CLKDIS, 0); + hdev->hwop.cntlmisc(hdev, MISC_HDCP_CLKDIS, 0); } void hdmitx_hdcp_do_work(struct hdmitx_dev *hdev) @@ -112,7 +111,7 @@ static int hdmitx_hdcp_task(void *data) INIT_DELAYED_WORK(&hdev->work_do_hdcp, _hdcp_do_work); while (hdev->hpd_event != 0xff) { - hdmi_authenticated = hdev->HWOp.CntlDDC(hdev, + hdmi_authenticated = hdev->hwop.cntlddc(hdev, DDC_HDCP_GET_AUTH, 0); hdmitx_hdcp_status(hdmi_authenticated); msleep_interruptible(200); 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 b364e16a..2725281 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 @@ -90,7 +90,7 @@ static struct hdmitx_dev hdmitx_device = { }; struct vout_device_s hdmitx_vdev = { - .dv_info = &(hdmitx_device.RXCap.dv_info), + .dv_info = &hdmitx_device.rxcap.dv_info, .fresh_tx_hdr_pkt = hdmitx_set_drm_pkt, .fresh_tx_vsif_pkt = hdmitx_set_vsif_pkt, .fresh_tx_hdr10plus_pkt = hdmitx_set_hdr10plus_pkt, @@ -112,6 +112,17 @@ struct extcon_dev *hdmitx_extcon_rxsense; struct extcon_dev *hdmitx_extcon_hdcp; struct extcon_dev *hdmitx_extcon_cedst; +/* There are 3 callback functions for front HDR/DV/HDR10+ modules to notify + * hdmi drivers to send out related HDMI infoframe + * hdmitx_set_drm_pkt() is for HDR 2084 SMPTE, HLG, etc. + * hdmitx_set_vsif_pkt() is for DV + * hdmitx_set_hdr10plus_pkt is for HDR10+ + * Front modules may call the 2nd, and next call the 1st, and the realted flags + * are remained the same. So, add hdr_status_pos and place it in the above 3 + * functions to record the position. + */ +int hdr_status_pos; + static inline void hdmitx_notify_hpd(int hpd) { if (hpd) @@ -128,18 +139,18 @@ static void hdmitx_early_suspend(struct early_suspend *h) phdmi->ready = 0; phdmi->hpd_lock = 1; msleep(20); - phdmi->HWOp.CntlMisc(phdmi, MISC_AVMUTE_OP, SET_AVMUTE); + phdmi->hwop.cntlmisc(phdmi, MISC_AVMUTE_OP, SET_AVMUTE); mdelay(100); pr_info(SYS "HDMITX: early suspend\n"); - phdmi->HWOp.Cntl((struct hdmitx_dev *)h->param, + phdmi->hwop.cntl((struct hdmitx_dev *)h->param, HDMITX_EARLY_SUSPEND_RESUME_CNTL, HDMITX_EARLY_SUSPEND); phdmi->cur_VIC = HDMI_Unknown; phdmi->output_blank_flag = 0; - phdmi->HWOp.CntlDDC(phdmi, DDC_HDCP_MUX_INIT, 1); - phdmi->HWOp.CntlDDC(phdmi, DDC_HDCP_OP, HDCP14_OFF); + phdmi->hwop.cntlddc(phdmi, DDC_HDCP_MUX_INIT, 1); + phdmi->hwop.cntlddc(phdmi, DDC_HDCP_OP, HDCP14_OFF); extcon_set_state_sync(hdmitx_extcon_power, EXTCON_DISP_HDMI, 0); - phdmi->HWOp.CntlConfig(&hdmitx_device, CONF_CLR_AVI_PACKET, 0); - phdmi->HWOp.CntlConfig(&hdmitx_device, CONF_CLR_VSDB_PACKET, 0); + phdmi->hwop.cntlconfig(&hdmitx_device, CONF_CLR_AVI_PACKET, 0); + phdmi->hwop.cntlconfig(&hdmitx_device, CONF_CLR_VSDB_PACKET, 0); /*close vpu clk*/ if (phdmi->hdmitx_clk_tree.hdmi_clk_vapb != NULL) clk_disable_unprepare(phdmi->hdmitx_clk_tree.hdmi_clk_vapb); @@ -170,12 +181,12 @@ static void hdmitx_late_resume(struct early_suspend *h) clk_prepare_enable(phdmi->hdmitx_clk_tree.hdmi_clk_vpu); if (info && (hdmitx_is_hdmi_vmode(info->name) == 1)) - phdmi->HWOp.CntlMisc(&hdmitx_device, MISC_HPLL_FAKE, 0); + phdmi->hwop.cntlmisc(&hdmitx_device, MISC_HPLL_FAKE, 0); phdmi->hpd_lock = 0; /* update status for hpd and switch/state */ - hdmitx_device.hpd_state = !!(hdmitx_device.HWOp.CntlMisc(&hdmitx_device, + hdmitx_device.hpd_state = !!(hdmitx_device.hwop.cntlmisc(&hdmitx_device, MISC_HPD_GPI_ST, 0)); pr_info("hdmitx hpd state: %d\n", hdmitx_device.hpd_state); @@ -185,7 +196,7 @@ static void hdmitx_late_resume(struct early_suspend *h) if (hdmitx_device.hpd_state) hdmitx_get_edid(phdmi); - hdmitx_device.HWOp.CntlConfig(&hdmitx_device, + hdmitx_device.hwop.cntlconfig(&hdmitx_device, CONF_AUDIO_MUTE_OP, AUDIO_MUTE); set_disp_mode_auto(); @@ -196,7 +207,7 @@ static void hdmitx_late_resume(struct early_suspend *h) hdmitx_device.hpd_state); pr_info("amhdmitx: late resume module %d\n", __LINE__); - phdmi->HWOp.Cntl((struct hdmitx_dev *)h->param, + phdmi->hwop.cntl((struct hdmitx_dev *)h->param, HDMITX_EARLY_SUSPEND_RESUME_CNTL, HDMITX_LATE_RESUME); pr_info(SYS "late resume\n"); } @@ -208,10 +219,10 @@ static int hdmitx_reboot_notifier(struct notifier_block *nb, struct hdmitx_dev *hdev = container_of(nb, struct hdmitx_dev, nb); hdev->ready = 0; - hdev->HWOp.CntlMisc(hdev, MISC_AVMUTE_OP, SET_AVMUTE); + hdev->hwop.cntlmisc(hdev, MISC_AVMUTE_OP, SET_AVMUTE); mdelay(100); - hdev->HWOp.CntlMisc(hdev, MISC_TMDS_PHY_OP, TMDS_PHY_DISABLE); - hdev->HWOp.Cntl(hdev, HDMITX_EARLY_SUSPEND_RESUME_CNTL, + hdev->hwop.cntlmisc(hdev, MISC_TMDS_PHY_OP, TMDS_PHY_DISABLE); + hdev->hwop.cntl(hdev, HDMITX_EARLY_SUSPEND_RESUME_CNTL, HDMITX_EARLY_SUSPEND); return NOTIFY_OK; @@ -276,7 +287,7 @@ static int set_disp_mode(const char *mode) hdmitx_device.cur_VIC = HDMI_Unknown; ret = hdmitx_set_display(&hdmitx_device, vic); if (ret >= 0) { - hdmitx_device.HWOp.Cntl(&hdmitx_device, + hdmitx_device.hwop.cntl(&hdmitx_device, HDMITX_AVMUTE_CNTL, AVMUTE_CLEAR); hdmitx_device.cur_VIC = vic; hdmitx_device.audio_param_update_flag = 1; @@ -291,8 +302,8 @@ static int set_disp_mode(const char *mode) hdmitx_edid_clear(&hdmitx_device); hdmitx_device.mux_hpd_if_pin_high_flag = 0; } - if (hdmitx_device.HWOp.Cntl) { - hdmitx_device.HWOp.Cntl(&hdmitx_device, + if (hdmitx_device.hwop.cntl) { + hdmitx_device.hwop.cntl(&hdmitx_device, HDMITX_HWCMD_TURNOFF_HDMIHW, (hdmitx_device.hpdmode == 2)?1:0); } @@ -304,16 +315,16 @@ static void hdmitx_pre_display_init(void) { hdmitx_device.cur_VIC = HDMI_Unknown; hdmitx_device.auth_process_timer = AUTH_PROCESS_TIME; - hdmitx_device.HWOp.CntlConfig(&hdmitx_device, + hdmitx_device.hwop.cntlconfig(&hdmitx_device, CONF_AUDIO_MUTE_OP, AUDIO_MUTE); - hdmitx_device.HWOp.CntlDDC(&hdmitx_device, DDC_HDCP_MUX_INIT, 1); - hdmitx_device.HWOp.CntlDDC(&hdmitx_device, DDC_HDCP_OP, HDCP14_OFF); + hdmitx_device.hwop.cntlddc(&hdmitx_device, DDC_HDCP_MUX_INIT, 1); + hdmitx_device.hwop.cntlddc(&hdmitx_device, DDC_HDCP_OP, HDCP14_OFF); /* msleep(10); */ - hdmitx_device.HWOp.CntlMisc(&hdmitx_device, MISC_TMDS_PHY_OP, + hdmitx_device.hwop.cntlmisc(&hdmitx_device, MISC_TMDS_PHY_OP, TMDS_PHY_DISABLE); - hdmitx_device.HWOp.CntlConfig(&hdmitx_device, + hdmitx_device.hwop.cntlconfig(&hdmitx_device, CONF_CLR_AVI_PACKET, 0); - hdmitx_device.HWOp.CntlConfig(&hdmitx_device, + hdmitx_device.hwop.cntlconfig(&hdmitx_device, CONF_CLR_VSDB_PACKET, 0); } @@ -368,8 +379,8 @@ static void hdmi_physcial_size_update(struct hdmitx_dev *hdev) } if (info->mode == VMODE_HDMI) { - width = hdev->RXCap.physcial_weight; - height = hdev->RXCap.physcial_height; + width = hdev->rxcap.physcial_weight; + height = hdev->rxcap.physcial_height; if ((width == 0) || (height == 0)) { info->screen_real_width = info->aspect_ratio_num; info->screen_real_height = info->aspect_ratio_den; @@ -388,37 +399,37 @@ static void hdrinfo_to_vinfo(struct vinfo_s *info, struct hdmitx_dev *hdev) { unsigned int i, j; /*static hdr*/ - info->hdr_info.hdr_support = (hdev->RXCap.hdr_sup_eotf_sdr << 0) - | (hdev->RXCap.hdr_sup_eotf_hdr << 1) - | (hdev->RXCap.hdr_sup_eotf_smpte_st_2084 << 2) - | (hdev->RXCap.hdr_sup_eotf_hlg << 3); + info->hdr_info.hdr_support = (hdev->rxcap.hdr_sup_eotf_sdr << 0) + | (hdev->rxcap.hdr_sup_eotf_hdr << 1) + | (hdev->rxcap.hdr_sup_eotf_smpte_st_2084 << 2) + | (hdev->rxcap.hdr_sup_eotf_hlg << 3); /*dynamic hdr*/ for (i = 0; i < 4; i++) { - if (hdev->RXCap.hdr_dynamic_info[i].type == 0) { + if (hdev->rxcap.hdr_dynamic_info[i].type == 0) { memset(&info->hdr_info.dynamic_info[i], 0, sizeof(struct hdr_dynamic)); continue; } info->hdr_info.dynamic_info[i].type = - hdev->RXCap.hdr_dynamic_info[i].type; + hdev->rxcap.hdr_dynamic_info[i].type; info->hdr_info.dynamic_info[i].of_len = - hdev->RXCap.hdr_dynamic_info[i].hd_len - 3; + hdev->rxcap.hdr_dynamic_info[i].hd_len - 3; info->hdr_info.dynamic_info[i].support_flags = - hdev->RXCap.hdr_dynamic_info[i].support_flags; + hdev->rxcap.hdr_dynamic_info[i].support_flags; - for (j = 0; j < hdev->RXCap.hdr_dynamic_info[i].hd_len - 3; j++) + for (j = 0; j < hdev->rxcap.hdr_dynamic_info[i].hd_len - 3; j++) info->hdr_info.dynamic_info[i].optional_fields[j] = - hdev->RXCap.hdr_dynamic_info[i].optional_fields[j]; + hdev->rxcap.hdr_dynamic_info[i].optional_fields[j]; } /*hdr 10+*/ - memcpy(&(info->hdr_info.hdr10plus_info), - &(hdev->RXCap.hdr10plus_info), sizeof(struct hdr10_plus_info)); + memcpy(&info->hdr_info.hdr10plus_info, + &hdev->rxcap.hdr10plus_info, sizeof(struct hdr10_plus_info)); info->hdr_info.colorimetry_support = - hdev->RXCap.colorimetry_data; - info->hdr_info.lumi_max = hdev->RXCap.hdr_lum_max; - info->hdr_info.lumi_avg = hdev->RXCap.hdr_lum_avg; - info->hdr_info.lumi_min = hdev->RXCap.hdr_lum_min; + hdev->rxcap.colorimetry_data; + info->hdr_info.lumi_max = hdev->rxcap.hdr_lum_max; + info->hdr_info.lumi_avg = hdev->rxcap.hdr_lum_avg; + info->hdr_info.lumi_min = hdev->rxcap.hdr_lum_min; pr_info(SYS "update rx hdr info %x\n", info->hdr_info.hdr_support); } @@ -443,7 +454,7 @@ static int set_disp_mode_auto(void) unsigned char mode[32]; enum hdmi_vic vic = HDMI_Unknown; /* vic_ready got from IP */ - enum hdmi_vic vic_ready = hdev->HWOp.GetState( + enum hdmi_vic vic_ready = hdev->hwop.getstate( hdev, STAT_VIDEO_VIC, 0); memset(mode, 0, sizeof(mode)); @@ -457,13 +468,13 @@ static int set_disp_mode_auto(void) pr_info(SYS "get current mode: %s\n", info->name); /*update hdmi checksum to vout*/ - memcpy(info->hdmichecksum, hdev->RXCap.chksum, 10); + memcpy(info->hdmichecksum, hdev->rxcap.chksum, 10); if (!((strncmp(info->name, "480cvbs", 7) == 0) || (strncmp(info->name, "576cvbs", 7) == 0) || (strncmp(info->name, "null", 4) == 0))) { hdrinfo_to_vinfo(info, hdev); - rxlatency_to_vinfo(info, &hdev->RXCap); + rxlatency_to_vinfo(info, &hdev->rxcap); } hdmi_physcial_size_update(hdev); @@ -478,9 +489,9 @@ static int set_disp_mode_auto(void) (strncmp(info->name, "panel", 5) == 0) || (strncmp(info->name, "null", 4) == 0)) { pr_info(SYS "%s not valid hdmi mode\n", info->name); - hdev->HWOp.CntlConfig(hdev, CONF_CLR_AVI_PACKET, 0); - hdev->HWOp.CntlConfig(hdev, CONF_CLR_VSDB_PACKET, 0); - hdev->HWOp.CntlMisc(hdev, MISC_TMDS_PHY_OP, TMDS_PHY_DISABLE); + hdev->hwop.cntlconfig(hdev, CONF_CLR_AVI_PACKET, 0); + hdev->hwop.cntlconfig(hdev, CONF_CLR_VSDB_PACKET, 0); + hdev->hwop.cntlmisc(hdev, MISC_TMDS_PHY_OP, TMDS_PHY_DISABLE); hdev->para = hdmi_get_fmt_name("invalid", hdev->fmt_attr); if (hdev->cedst_policy) cancel_delayed_work(&hdev->work_cedst); @@ -533,17 +544,17 @@ static int set_disp_mode_auto(void) if ((vic_ready != HDMI_Unknown) && (vic_ready == vic)) { pr_info(SYS "[%s] ALREADY init VIC = %d\n", __func__, vic); - if (hdev->RXCap.ieeeoui == 0) { + if (hdev->rxcap.ieeeoui == 0) { /* DVI case judgement. In uboot, directly output HDMI * mode */ - hdev->HWOp.CntlConfig(hdev, CONF_HDMI_DVI_MODE, + hdev->hwop.cntlconfig(hdev, CONF_HDMI_DVI_MODE, DVI_MODE); pr_info(SYS "change to DVI mode\n"); - } else if ((hdev->RXCap.ieeeoui == 0xc03) && - (hdev->HWOp.CntlConfig(hdev, CONF_GET_HDMI_DVI_MODE, 0) + } else if ((hdev->rxcap.ieeeoui == 0xc03) && + (hdev->hwop.cntlconfig(hdev, CONF_GET_HDMI_DVI_MODE, 0) == DVI_MODE)) { - hdev->HWOp.CntlConfig(hdev, CONF_HDMI_DVI_MODE, + hdev->hwop.cntlconfig(hdev, CONF_HDMI_DVI_MODE, HDMI_MODE); pr_info(SYS "change to HDMI mode\n"); } @@ -560,7 +571,7 @@ static int set_disp_mode_auto(void) ret = hdmitx_set_display(hdev, vic); if (ret >= 0) { - hdev->HWOp.Cntl(hdev, HDMITX_AVMUTE_CNTL, AVMUTE_CLEAR); + hdev->hwop.cntl(hdev, HDMITX_AVMUTE_CNTL, AVMUTE_CLEAR); hdev->cur_VIC = vic; hdev->audio_param_update_flag = 1; hdev->auth_process_timer = AUTH_PROCESS_TIME; @@ -575,7 +586,7 @@ static int set_disp_mode_auto(void) } /* If current display is NOT panel, needn't TURNOFF_HDMIHW */ if (strncmp(mode, "panel", 5) == 0) { - hdev->HWOp.Cntl(hdev, HDMITX_HWCMD_TURNOFF_HDMIHW, + hdev->hwop.cntl(hdev, HDMITX_HWCMD_TURNOFF_HDMIHW, (hdev->hpdmode == 2)?1:0); } } @@ -675,7 +686,7 @@ static ssize_t show_swap(struct device *dev, int i = 0; int n = 0; struct hdmitx_dev *hdev = &hdmitx_device; - struct rx_cap *pRXCap = &hdev->RXCap; + struct rx_cap *prxcap = &hdev->rxcap; struct hdcprp14_topo *topo14 = &hdev->topo_info->topo.topo14; mutex_lock(&mutex_swap); @@ -688,14 +699,14 @@ static ssize_t show_swap(struct device *dev, /* VSD: Video Short Descriptor */ if (strstr(tmp_swap, "edid.vsd")) - for (i = 0; i < pRXCap->vsd.len; i++) + for (i = 0; i < prxcap->vsd.len; i++) n += snprintf(buf + n, PAGE_SIZE - n, "%02x", - pRXCap->vsd.raw[i]); + prxcap->vsd.raw[i]); /* ASD: Audio Short Descriptor */ if (strstr(tmp_swap, "edid.asd")) - for (i = 0; i < pRXCap->asd.len; i++) + for (i = 0; i < prxcap->asd.len; i++) n += snprintf(buf + n, PAGE_SIZE - n, "%02x", - pRXCap->asd.raw[i]); + prxcap->asd.raw[i]); /* CEC: Physical Address */ if (strstr(tmp_swap, "edid.cec")) n += snprintf(buf + n, PAGE_SIZE - n, "%x%x%x%x", @@ -1038,7 +1049,7 @@ static ssize_t show_hdcp_repeater(struct device *dev, struct hdmitx_dev *hdev = &hdmitx_device; if (hdev->hdcp_mode == 1) - hdev->hdcp_bcaps_repeater = hdev->HWOp.CntlDDC(hdev, + hdev->hdcp_bcaps_repeater = hdev->hwop.cntlddc(hdev, DDC_HDCP14_GET_BCAPS_RP, 0); pos += snprintf(buf+pos, PAGE_SIZE, "%d\n", hdev->hdcp_bcaps_repeater); @@ -1079,7 +1090,7 @@ static ssize_t show_hdcp_topo_info(struct device *dev, if (hdev->hdcp_mode == 1) { memset(topoinfo, 0, sizeof(struct hdcprp_topo)); - hdev->HWOp.CntlDDC(hdev, DDC_HDCP14_GET_TOPO_INFO, + hdev->hwop.cntlddc(hdev, DDC_HDCP14_GET_TOPO_INFO, (unsigned long)&topoinfo->topo.topo14); } @@ -1168,7 +1179,7 @@ static ssize_t store_hdcp22_type(struct device *dev, hdev->hdcp22_type = type; pr_info("hdmitx: set hdcp22 content type %d\n", type); - hdev->HWOp.CntlDDC(hdev, DDC_HDCP_SET_TOPO_INFO, type); + hdev->hwop.cntlddc(hdev, DDC_HDCP_SET_TOPO_INFO, type); return count; } @@ -1187,10 +1198,10 @@ void hdmitx_audio_mute_op(unsigned int flag) { hdmitx_device.tx_aud_cfg = flag; if (flag == 0) - hdmitx_device.HWOp.CntlConfig(&hdmitx_device, + hdmitx_device.hwop.cntlconfig(&hdmitx_device, CONF_AUDIO_MUTE_OP, AUDIO_MUTE); else - hdmitx_device.HWOp.CntlConfig(&hdmitx_device, + hdmitx_device.hwop.cntlconfig(&hdmitx_device, CONF_AUDIO_MUTE_OP, AUDIO_UNMUTE); } EXPORT_SYMBOL(hdmitx_audio_mute_op); @@ -1198,10 +1209,10 @@ EXPORT_SYMBOL(hdmitx_audio_mute_op); void hdmitx_video_mute_op(unsigned int flag) { if (flag == 0) - hdmitx_device.HWOp.CntlConfig(&hdmitx_device, + hdmitx_device.hwop.cntlconfig(&hdmitx_device, CONF_VIDEO_MUTE_OP, VIDEO_MUTE); else - hdmitx_device.HWOp.CntlConfig(&hdmitx_device, + hdmitx_device.hwop.cntlconfig(&hdmitx_device, CONF_VIDEO_MUTE_OP, VIDEO_UNMUTE); } EXPORT_SYMBOL(hdmitx_video_mute_op); @@ -1236,18 +1247,28 @@ static void hdr_work_func(struct work_struct *work) unsigned char DRM_HB[3] = {0x87, 0x1, 26}; unsigned char DRM_DB[26] = {0x0}; - hdev->HWOp.SetPacket(HDMI_PACKET_DRM, DRM_DB, DRM_HB); - hdmitx_device.HWOp.CntlConfig(&hdmitx_device, + pr_info("hdr_work_func: send zero DRM\n"); + hdev->hwop.setpacket(HDMI_PACKET_DRM, DRM_DB, DRM_HB); + hdmitx_device.hwop.cntlconfig(&hdmitx_device, CONF_AVI_BT2020, hdev->colormetry); msleep(1500);/*delay 1.5s*/ - if (hdev->hdr_transfer_feature != T_BT709 || - hdev->hdr_color_feature != C_BT709) - return; - - hdev->HWOp.SetPacket(HDMI_PACKET_DRM, NULL, NULL); - hdev->hdmi_current_hdr_mode = 0; - hdmitx_sdr_hdr_uevent(hdev); + /* disable DRM packets completely ONLY if hdr transfer + * feature and color feature still demand SDR. + */ + if (hdr_status_pos == 4) { + /* zero hdr10+ VSIF being sent - disable it */ + pr_info("hdr_work_func: disable hdr10+ vsif\n"); + hdev->hwop.setpacket(HDMI_PACKET_VEND, NULL, NULL); + hdr_status_pos = 0; + } + if (hdev->hdr_transfer_feature == T_BT709 && + hdev->hdr_color_feature == C_BT709) { + pr_info("hdr_work_func: disable DRM\n"); + hdev->hwop.setpacket(HDMI_PACKET_DRM, NULL, NULL); + hdev->hdmi_current_hdr_mode = 0; + hdmitx_sdr_hdr_uevent(hdev); + } } else { hdmitx_sdr_hdr_uevent(hdev); } @@ -1259,7 +1280,14 @@ static void hdmitx_set_drm_pkt(struct master_display_info_s *data) { struct hdmitx_dev *hdev = &hdmitx_device; unsigned char DRM_HB[3] = {0x87, 0x1, 26}; - unsigned char DRM_DB[26] = {0x0}; + static unsigned char DRM_DB[26] = {0x0}; + + if (hdr_status_pos == 4) { + /* zero hdr10+ VSIF being sent - disable it */ + pr_info("hdmitx_set_drm_pkt: disable hdr10+ zero vsif\n"); + hdev->hwop.setpacket(HDMI_PACKET_VEND, NULL, NULL); + hdr_status_pos = 0; + } /* *hdr_color_feature: bit 23-16: color_primaries @@ -1272,14 +1300,33 @@ static void hdmitx_set_drm_pkt(struct master_display_info_s *data) hdev->hdr_color_feature = (data->features >> 16) & 0xff; hdev->colormetry = (data->features >> 30) & 0x1; } - if ((!data) || (!(hdev->RXCap.hdr_sup_eotf_smpte_st_2084) && - !(hdev->RXCap.hdr_sup_eotf_hdr) && - !(hdev->RXCap.hdr_sup_eotf_sdr) && - !(hdev->RXCap.hdr_sup_eotf_hlg))) { + + if ((hdr_status_pos != 1) && (hdr_status_pos != 3)) + pr_info("hdmitx_set_drm_pkt: tf=%d, cf=%d, colormetry=%d\n", + hdev->hdr_transfer_feature, hdev->hdr_color_feature, + hdev->colormetry); + hdr_status_pos = 1; + + /* hdr10+ content on a hdr10 sink case */ + if (hdev->hdr_transfer_feature == 0x30) { + if ((hdev->rxcap.hdr10plus_info.ieeeoui + != 0x90848B) || + (hdev->rxcap.hdr10plus_info.application_version + != 1)) { + hdev->hdr_transfer_feature = T_SMPTE_ST_2084; + pr_info("hdmitx_set_drm_pkt: HDR10+ not supported, treat as hdr10\n"); + } + } + + if ((!data) || (!(hdev->rxcap.hdr_sup_eotf_smpte_st_2084) && + !(hdev->rxcap.hdr_sup_eotf_hdr) && + !(hdev->rxcap.hdr_sup_eotf_sdr) && + !(hdev->rxcap.hdr_sup_eotf_hlg))) { DRM_HB[1] = 0; DRM_HB[2] = 0; - hdmitx_device.HWOp.SetPacket(HDMI_PACKET_DRM, NULL, NULL); - hdmitx_device.HWOp.CntlConfig(&hdmitx_device, + DRM_DB[0] = 0; + hdmitx_device.hwop.setpacket(HDMI_PACKET_DRM, NULL, NULL); + hdmitx_device.hwop.cntlconfig(&hdmitx_device, CONF_AVI_BT2020, hdev->colormetry); return; } @@ -1287,7 +1334,13 @@ static void hdmitx_set_drm_pkt(struct master_display_info_s *data) /*SDR*/ if (hdev->hdr_transfer_feature == T_BT709 && hdev->hdr_color_feature == C_BT709) { - schedule_work(&hdev->work_hdr); + /* send zero drm only for HDR->SDR transition */ + if ((DRM_DB[0] == 0x02) || (DRM_DB[0] == 0x03)) { + pr_info("hdmitx_set_drm_pkt: HDR->SDR, DRM_DB[0]=%d\n", + DRM_DB[0]); + schedule_work(&hdev->work_hdr); + DRM_DB[0] = 0; + } return; } @@ -1321,21 +1374,21 @@ static void hdmitx_set_drm_pkt(struct master_display_info_s *data) if (hdev->hdr_transfer_feature == T_BT709 && hdev->hdr_color_feature == C_BT2020) { if (hdev->sdr_hdr_feature == 0) { - hdmitx_device.HWOp.SetPacket(HDMI_PACKET_DRM, + hdmitx_device.hwop.setpacket(HDMI_PACKET_DRM, NULL, NULL); - hdmitx_device.HWOp.CntlConfig(&hdmitx_device, + hdmitx_device.hwop.cntlconfig(&hdmitx_device, CONF_AVI_BT2020, SET_AVI_BT2020); } else if (hdev->sdr_hdr_feature == 1) { memset(DRM_DB, 0, sizeof(DRM_DB)); - hdev->HWOp.SetPacket(HDMI_PACKET_DRM, + hdev->hwop.setpacket(HDMI_PACKET_DRM, DRM_DB, DRM_HB); - hdev->HWOp.CntlConfig(&hdmitx_device, + hdev->hwop.cntlconfig(&hdmitx_device, CONF_AVI_BT2020, SET_AVI_BT2020); } else { DRM_DB[0] = 0x02; /* SMPTE ST 2084 */ - hdmitx_device.HWOp.SetPacket(HDMI_PACKET_DRM, + hdmitx_device.hwop.setpacket(HDMI_PACKET_DRM, DRM_DB, DRM_HB); - hdmitx_device.HWOp.CntlConfig(&hdmitx_device, + hdmitx_device.hwop.cntlconfig(&hdmitx_device, CONF_AVI_BT2020, SET_AVI_BT2020); } return; @@ -1345,7 +1398,7 @@ static void hdmitx_set_drm_pkt(struct master_display_info_s *data) hdev->hdmi_current_hdr_mode = 0; /* SMPTE ST 2084 and (BT2020 or NON_STANDARD) */ - if (hdev->RXCap.hdr_sup_eotf_smpte_st_2084) { + if (hdev->rxcap.hdr_sup_eotf_smpte_st_2084) { if (hdev->hdr_transfer_feature == T_SMPTE_ST_2084 && hdev->hdr_color_feature == C_BT2020) hdev->hdmi_current_hdr_mode = 1; @@ -1355,7 +1408,7 @@ static void hdmitx_set_drm_pkt(struct master_display_info_s *data) } /*HLG and BT2020*/ - if (hdev->RXCap.hdr_sup_eotf_hlg) { + if (hdev->rxcap.hdr_sup_eotf_hlg) { if (hdev->hdr_color_feature == C_BT2020 && (hdev->hdr_transfer_feature == T_BT2020_10 || hdev->hdr_transfer_feature == T_HLG)) @@ -1366,32 +1419,32 @@ static void hdmitx_set_drm_pkt(struct master_display_info_s *data) case 1: /*standard HDR*/ DRM_DB[0] = 0x02; /* SMPTE ST 2084 */ - hdmitx_device.HWOp.SetPacket(HDMI_PACKET_DRM, + hdmitx_device.hwop.setpacket(HDMI_PACKET_DRM, DRM_DB, DRM_HB); - hdmitx_device.HWOp.CntlConfig(&hdmitx_device, + hdmitx_device.hwop.cntlconfig(&hdmitx_device, CONF_AVI_BT2020, SET_AVI_BT2020); break; case 2: /*non standard*/ DRM_DB[0] = 0x02; /* no standard SMPTE ST 2084 */ - hdmitx_device.HWOp.SetPacket(HDMI_PACKET_DRM, + hdmitx_device.hwop.setpacket(HDMI_PACKET_DRM, DRM_DB, DRM_HB); - hdmitx_device.HWOp.CntlConfig(&hdmitx_device, + hdmitx_device.hwop.cntlconfig(&hdmitx_device, CONF_AVI_BT2020, CLR_AVI_BT2020); break; case 3: /*HLG*/ DRM_DB[0] = 0x03;/* HLG is 0x03 */ - hdmitx_device.HWOp.SetPacket(HDMI_PACKET_DRM, + hdmitx_device.hwop.setpacket(HDMI_PACKET_DRM, DRM_DB, DRM_HB); - hdmitx_device.HWOp.CntlConfig(&hdmitx_device, + hdmitx_device.hwop.cntlconfig(&hdmitx_device, CONF_AVI_BT2020, SET_AVI_BT2020); break; case 0: default: /*other case*/ - hdmitx_device.HWOp.SetPacket(HDMI_PACKET_DRM, NULL, NULL); - hdmitx_device.HWOp.CntlConfig(&hdmitx_device, + hdmitx_device.hwop.setpacket(HDMI_PACKET_DRM, NULL, NULL); + hdmitx_device.hwop.cntlconfig(&hdmitx_device, CONF_AVI_BT2020, CLR_AVI_BT2020); break; } @@ -1408,12 +1461,13 @@ static void update_current_para(struct hdmitx_dev *hdev) unsigned char mode[32]; info = hdmitx_get_current_vinfo(); - if (!info) + if (info == NULL) return; - strncpy(mode, info->name, sizeof(mode)); + memset(mode, 0, sizeof(mode)); + strncpy(mode, info->name, sizeof(mode) - 1); if (strstr(hdev->fmt_attr, "420")) { - if (!strstr(mode, "420")) + if (strstr(mode, "420") == NULL) strncat(mode, "420", 3); } hdev->para = hdmi_get_fmt_name(mode, hdev->fmt_attr); @@ -1433,26 +1487,29 @@ static void hdmitx_set_vsif_pkt(enum eotf_type type, static enum eotf_type ltype = EOTF_T_NULL; static uint8_t ltmode = -1; - if ((hdev->ready == 0) || (hdev->RXCap.dv_info.ieeeoui + if ((hdev->ready == 0) || (hdev->rxcap.dv_info.ieeeoui != DV_IEEE_OUI)) { ltype = EOTF_T_NULL; ltmode = -1; return; } - if ((hdev->chip_type) < MESON_CPU_ID_GXL) { pr_info("hdmitx: not support DolbyVision\n"); return; } + if (hdr_status_pos != 2) + pr_info("hdmitx_set_vsif_pkt: type = %d\n", type); + hdr_status_pos = 2; hdev->hdmi_current_eotf_type = type; hdev->hdmi_current_tunnel_mode = tunnel_mode; /*ver0 and ver1_15 and ver1_12bit with ll= 0 use hdmi 1.4b VSIF*/ - if ((hdev->RXCap.dv_info.ver == 0) || ((hdev->RXCap.dv_info.ver == 1) - && (hdev->RXCap.dv_info.length == 0xE)) - || ((hdev->RXCap.dv_info.ver == 1) - && (hdev->RXCap.dv_info.length == 0xB) - && (hdev->RXCap.dv_info.low_latency == 0))) { + if ((hdev->rxcap.dv_info.ver == 0) || + ((hdev->rxcap.dv_info.ver == 1) && + (hdev->rxcap.dv_info.length == 0xE)) || + ((hdev->rxcap.dv_info.ver == 1) && + (hdev->rxcap.dv_info.length == 0xB) && + (hdev->rxcap.dv_info.low_latency == 0))) { if ((vic == HDMI_3840x2160p30_16x9) || (vic == HDMI_3840x2160p25_16x9) || (vic == HDMI_3840x2160p24_16x9) || @@ -1492,63 +1549,56 @@ static void hdmitx_set_vsif_pkt(enum eotf_type type, } if (type == EOTF_T_DOLBYVISION) { /*first disable drm package*/ - hdmitx_device.HWOp.SetPacket(HDMI_PACKET_DRM, + hdmitx_device.hwop.setpacket(HDMI_PACKET_DRM, NULL, NULL); - hdev->HWOp.SetPacket(HDMI_PACKET_VEND, VEN_DB1, VEN_HB); - hdev->HWOp.CntlConfig(hdev, CONF_AVI_BT2020, + hdev->hwop.setpacket(HDMI_PACKET_VEND, VEN_DB1, VEN_HB); + hdev->hwop.cntlconfig(hdev, CONF_AVI_BT2020, CLR_AVI_BT2020);/*BT709*/ if (tunnel_mode == RGB_8BIT) { - hdev->HWOp.CntlConfig(hdev, + hdev->hwop.cntlconfig(hdev, CONF_AVI_RGBYCC_INDIC, COLORSPACE_RGB444); - hdev->HWOp.CntlConfig(hdev, CONF_AVI_Q01, + hdev->hwop.cntlconfig(hdev, CONF_AVI_Q01, RGB_RANGE_FUL); } else { - hdev->HWOp.CntlConfig(hdev, + hdev->hwop.cntlconfig(hdev, CONF_AVI_RGBYCC_INDIC, COLORSPACE_YUV422); - hdev->HWOp.CntlConfig(hdev, CONF_AVI_YQ01, + hdev->hwop.cntlconfig(hdev, CONF_AVI_YQ01, YCC_RANGE_FUL); } } else { if (hdmi_vic_4k_flag) - hdev->HWOp.SetPacket( + hdev->hwop.setpacket( HDMI_PACKET_VEND, VEN_DB1, VEN_HB); else - hdev->HWOp.SetPacket( + hdev->hwop.setpacket( HDMI_PACKET_VEND, NULL, NULL); if (signal_sdr) { pr_info("hdmitx: H14b VSIF, switching signal to SDR\n"); update_current_para(hdev); - hdev->HWOp.CntlConfig(hdev, + hdev->hwop.cntlconfig(hdev, CONF_AVI_RGBYCC_INDIC, hdev->para->cs); - hdev->HWOp.CntlConfig(hdev, + hdev->hwop.cntlconfig(hdev, CONF_AVI_Q01, RGB_RANGE_DEFAULT); - hdev->HWOp.CntlConfig(hdev, + hdev->hwop.cntlconfig(hdev, CONF_AVI_YQ01, YCC_RANGE_LIM); - hdev->HWOp.CntlConfig(hdev, CONF_AVI_BT2020, + hdev->hwop.cntlconfig(hdev, CONF_AVI_BT2020, CLR_AVI_BT2020);/*BT709*/ } } } /*ver1_12 with low_latency = 1 and ver2 use Dolby VSIF*/ - if ((hdev->RXCap.dv_info.ver == 2) || ((hdev->RXCap.dv_info.ver == 1) - && (hdev->RXCap.dv_info.length == 0xB) - && (hdev->RXCap.dv_info.low_latency == 1)) - || (type == EOTF_T_LL_MODE)) { - + if ((hdev->rxcap.dv_info.ver == 2) || + ((hdev->rxcap.dv_info.ver == 1) && + (hdev->rxcap.dv_info.length == 0xB) && + (hdev->rxcap.dv_info.low_latency == 1)) || + (type == EOTF_T_LL_MODE)) { if (data == NULL) data = ¶ len = 0x1b; - /*4k vsif package */ - if ((vic == HDMI_3840x2160p30_16x9) || - (vic == HDMI_3840x2160p25_16x9) || - (vic == HDMI_3840x2160p24_16x9) || - (vic == HDMI_4096x2160p24_256x135)) - hdmi_vic_4k_flag = 1; - switch (type) { case EOTF_T_DOLBYVISION: case EOTF_T_LL_MODE: @@ -1558,7 +1608,6 @@ static void hdmitx_set_vsif_pkt(enum eotf_type type, case EOTF_T_SDR: case EOTF_T_NULL: default: - hdev->dv_src_feature = 0; break; } @@ -1579,80 +1628,74 @@ static void hdmitx_set_vsif_pkt(enum eotf_type type, /*Dolby Vision standard case*/ if (type == EOTF_T_DOLBYVISION) { /*first disable drm package*/ - hdmitx_device.HWOp.SetPacket(HDMI_PACKET_DRM, + hdmitx_device.hwop.setpacket(HDMI_PACKET_DRM, NULL, NULL); - hdev->HWOp.SetPacket(HDMI_PACKET_VEND, VEN_DB2, VEN_HB); - hdev->HWOp.CntlConfig(hdev, CONF_AVI_BT2020, + hdev->hwop.setpacket(HDMI_PACKET_VEND, VEN_DB2, VEN_HB); + hdev->hwop.cntlconfig(hdev, CONF_AVI_BT2020, CLR_AVI_BT2020);/*BT709*/ if (tunnel_mode == RGB_8BIT) {/*RGB444*/ - hdev->HWOp.CntlConfig(hdev, + hdev->hwop.cntlconfig(hdev, CONF_AVI_RGBYCC_INDIC, COLORSPACE_RGB444); - hdev->HWOp.CntlConfig(hdev, CONF_AVI_Q01, + hdev->hwop.cntlconfig(hdev, CONF_AVI_Q01, RGB_RANGE_FUL); } else {/*YUV422*/ - hdev->HWOp.CntlConfig(hdev, + hdev->hwop.cntlconfig(hdev, CONF_AVI_RGBYCC_INDIC, COLORSPACE_YUV422); - hdev->HWOp.CntlConfig(hdev, CONF_AVI_YQ01, + hdev->hwop.cntlconfig(hdev, CONF_AVI_YQ01, YCC_RANGE_FUL); } } /*Dolby Vision low-latency case*/ else if (type == EOTF_T_LL_MODE) { /*first disable drm package*/ - hdmitx_device.HWOp.SetPacket(HDMI_PACKET_DRM, + hdmitx_device.hwop.setpacket(HDMI_PACKET_DRM, NULL, NULL); - hdev->HWOp.SetPacket(HDMI_PACKET_VEND, VEN_DB2, VEN_HB); - if (hdev->RXCap.colorimetry_data & 0xe0) + hdev->hwop.setpacket(HDMI_PACKET_VEND, VEN_DB2, VEN_HB); + if (hdev->rxcap.colorimetry_data & 0xe0) /*if RX support BT2020, then output BT2020*/ - hdev->HWOp.CntlConfig(hdev, CONF_AVI_BT2020, + hdev->hwop.cntlconfig(hdev, CONF_AVI_BT2020, SET_AVI_BT2020);/*BT2020*/ else - hdev->HWOp.CntlConfig(hdev, CONF_AVI_BT2020, + hdev->hwop.cntlconfig(hdev, CONF_AVI_BT2020, CLR_AVI_BT2020);/*BT709*/ if (tunnel_mode == RGB_10_12BIT) {/*10/12bit RGB444*/ - hdev->HWOp.CntlConfig(hdev, + hdev->hwop.cntlconfig(hdev, CONF_AVI_RGBYCC_INDIC, COLORSPACE_RGB444); - hdev->HWOp.CntlConfig(hdev, CONF_AVI_Q01, + hdev->hwop.cntlconfig(hdev, CONF_AVI_Q01, RGB_RANGE_LIM); } else if (tunnel_mode == YUV444_10_12BIT) { /*10/12bit YUV444*/ - hdev->HWOp.CntlConfig(hdev, + hdev->hwop.cntlconfig(hdev, CONF_AVI_RGBYCC_INDIC, COLORSPACE_YUV444); - hdev->HWOp.CntlConfig(hdev, CONF_AVI_YQ01, + hdev->hwop.cntlconfig(hdev, CONF_AVI_YQ01, YCC_RANGE_LIM); } else {/*YUV422*/ - hdev->HWOp.CntlConfig(hdev, + hdev->hwop.cntlconfig(hdev, CONF_AVI_RGBYCC_INDIC, COLORSPACE_YUV422); - hdev->HWOp.CntlConfig(hdev, CONF_AVI_YQ01, + hdev->hwop.cntlconfig(hdev, CONF_AVI_YQ01, YCC_RANGE_LIM); } } /*SDR case*/ else { - if (hdmi_vic_4k_flag) { - VEN_DB1[0] = 0x03; - VEN_DB1[1] = 0x0c; - VEN_DB1[2] = 0x00; - hdev->HWOp.SetPacket( - HDMI_PACKET_VEND, VEN_DB2, VEN_HB); - } else - hdev->HWOp.SetPacket( - HDMI_PACKET_VEND, NULL, NULL); - + pr_info("hdmitx: Dolby VSIF, VEN_DB2[3]) = %d\n", + VEN_DB2[3]); + hdev->hwop.setpacket( + HDMI_PACKET_VEND, VEN_DB2, VEN_HB); if (signal_sdr) { pr_info("hdmitx: Dolby VSIF, switching signal to SDR\n"); - hdev->HWOp.CntlConfig(hdev, + hdev->hwop.cntlconfig(hdev, CONF_AVI_RGBYCC_INDIC, hdev->para->cs); - hdev->HWOp.CntlConfig(hdev, + hdev->hwop.cntlconfig(hdev, CONF_AVI_Q01, RGB_RANGE_DEFAULT); - hdev->HWOp.CntlConfig(hdev, + hdev->hwop.cntlconfig(hdev, CONF_AVI_YQ01, YCC_RANGE_LIM); - hdev->HWOp.CntlConfig(hdev, CONF_AVI_BT2020, + hdev->hwop.cntlconfig(hdev, CONF_AVI_BT2020, CLR_AVI_BT2020);/*BT709*/ } } @@ -1665,13 +1708,30 @@ static void hdmitx_set_hdr10plus_pkt(unsigned int flag, unsigned char VEN_HB[3] = {0x81, 0x01, 0x1b}; unsigned char VEN_DB[27] = {0x00}; + if (flag == HDR10_PLUS_ZERO_VSIF) { + /* needed during hdr10+ to sdr transition */ + pr_info("hdmitx_set_hdr10plus_pkt: zero vsif\n"); + hdev->hwop.setpacket(HDMI_PACKET_VEND, VEN_DB, VEN_HB); + hdev->hwop.cntlconfig(hdev, CONF_AVI_BT2020, + CLR_AVI_BT2020); + hdev->hdr10plus_feature = 0; + hdr_status_pos = 4; + return; + } + if ((!data) || (!flag)) { - hdev->HWOp.SetPacket(HDMI_PACKET_VEND, NULL, NULL); - hdev->HWOp.CntlConfig(hdev, CONF_AVI_BT2020, + pr_info("hdmitx_set_hdr10plus_pkt: null vsif\n"); + hdev->hwop.setpacket(HDMI_PACKET_VEND, NULL, NULL); + hdev->hwop.cntlconfig(hdev, CONF_AVI_BT2020, CLR_AVI_BT2020); + hdev->hdr10plus_feature = 0; return; } + if (hdev->hdr10plus_feature != 1) + pr_info("hdmitx_set_hdr10plus_pkt: flag = %d\n", flag); + hdev->hdr10plus_feature = 1; + hdr_status_pos = 3; VEN_DB[0] = 0x8b; VEN_DB[1] = 0x84; VEN_DB[2] = 0x90; @@ -1705,8 +1765,8 @@ static void hdmitx_set_hdr10plus_pkt(unsigned int flag, VEN_DB[26] = ((data->graphics_overlay_flag & 0x1) << 7)| ((data->no_delay_flag & 0x1) << 6); - hdev->HWOp.SetPacket(HDMI_PACKET_VEND, VEN_DB, VEN_HB); - hdev->HWOp.CntlConfig(hdev, CONF_AVI_BT2020, + hdev->hwop.setpacket(HDMI_PACKET_VEND, VEN_DB, VEN_HB); + hdev->hwop.cntlconfig(hdev, CONF_AVI_BT2020, SET_AVI_BT2020); } @@ -1829,8 +1889,8 @@ static void hdmitx_set_emp_pkt(unsigned char *data, unsigned int type, phys_ptr = virt_to_phys(virt_ptr_align32bit); pr_info("emp_pkt phys_ptr: %lx\n", phys_ptr); - hdev->HWOp.CntlConfig(hdev, CONF_EMP_NUMBER, number); - hdev->HWOp.CntlConfig(hdev, CONF_EMP_PHY_ADDR, phys_ptr); + hdev->hwop.cntlconfig(hdev, CONF_EMP_NUMBER, number); + hdev->hwop.cntlconfig(hdev, CONF_EMP_PHY_ADDR, phys_ptr); } /*config attr*/ @@ -2181,7 +2241,7 @@ static ssize_t store_vid_mute(struct device *dev, static ssize_t store_debug(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - hdmitx_device.HWOp.DebugFun(&hdmitx_device, buf); + hdmitx_device.hwop.debugfun(&hdmitx_device, buf); return count; } @@ -2337,10 +2397,10 @@ static ssize_t show_preferred_mode(struct device *dev, struct device_attribute *attr, char *buf) { int pos = 0; - struct rx_cap *pRXCap = &hdmitx_device.RXCap; + struct rx_cap *prxcap = &hdmitx_device.rxcap; pos += snprintf(buf+pos, PAGE_SIZE, "%s\n", - hdmitx_edid_vic_to_string(pRXCap->preferred_mode)); + hdmitx_edid_vic_to_string(prxcap->preferred_mode)); return pos; } @@ -2357,7 +2417,7 @@ static ssize_t show_vesa_cap(struct device *dev, { int i; struct hdmi_format_para *para = NULL; - enum hdmi_vic *vesa_t = &hdmitx_device.RXCap.vesa_timing[0]; + enum hdmi_vic *vesa_t = &hdmitx_device.rxcap.vesa_timing[0]; int pos = 0; for (i = 0; vesa_t[i] && i < VESA_MAX_TIMING; i++) { @@ -2399,25 +2459,25 @@ static ssize_t show_disp_cap_3d(struct device *dev, continue; vic = hdmitx_edid_get_VIC(&hdmitx_device, disp_mode_t[i], 0); - for (j = 0; j < hdmitx_device.RXCap.VIC_count; j++) { - if (vic == hdmitx_device.RXCap.VIC[j]) + for (j = 0; j < hdmitx_device.rxcap.VIC_count; j++) { + if (vic == hdmitx_device.rxcap.VIC[j]) break; } pos += snprintf(buf+pos, PAGE_SIZE, "\n%s ", disp_mode_t[i]); - if (local_support_3dfp(vic) - && (hdmitx_device.RXCap.support_3d_format[ - hdmitx_device.RXCap.VIC[j]].frame_packing == 1)) { + if (local_support_3dfp(vic) && + (hdmitx_device.rxcap.support_3d_format[ + hdmitx_device.rxcap.VIC[j]].frame_packing == 1)) { pos += snprintf(buf+pos, PAGE_SIZE, "FramePacking "); } - if (hdmitx_device.RXCap.support_3d_format[ - hdmitx_device.RXCap.VIC[j]].top_and_bottom == 1) { + if (hdmitx_device.rxcap.support_3d_format[ + hdmitx_device.rxcap.VIC[j]].top_and_bottom == 1) { pos += snprintf(buf+pos, PAGE_SIZE, "TopBottom "); } - if (hdmitx_device.RXCap.support_3d_format[ - hdmitx_device.RXCap.VIC[j]].side_by_side == 1) { + if (hdmitx_device.rxcap.support_3d_format[ + hdmitx_device.rxcap.VIC[j]].side_by_side == 1) { pos += snprintf(buf+pos, PAGE_SIZE, "SidebySide "); } @@ -2427,15 +2487,15 @@ static ssize_t show_disp_cap_3d(struct device *dev, return pos; } -static void _show_pcm_ch(struct rx_cap *pRXCap, int i, - int *ppos, char *buf) +static void _show_pcm_ch(struct rx_cap *prxcap, int i, + int *ppos, char *buf) { const char * const aud_sample_size[] = {"ReferToStreamHeader", "16", "20", "24", NULL}; int j = 0; for (j = 0; j < 3; j++) { - if (pRXCap->RxAudioCap[i].cc3 & (1 << j)) + if (prxcap->RxAudioCap[i].cc3 & (1 << j)) *ppos += snprintf(buf + *ppos, PAGE_SIZE, "%s/", aud_sample_size[j+1]); } @@ -2455,27 +2515,27 @@ static ssize_t show_aud_cap(struct device *dev, static const char * const aud_sampling_frequency[] = { "ReferToStreamHeader", "32", "44.1", "48", "88.2", "96", "176.4", "192", NULL}; - struct rx_cap *pRXCap = &(hdmitx_device.RXCap); + struct rx_cap *prxcap = &hdmitx_device.rxcap; pos += snprintf(buf + pos, PAGE_SIZE, "CodingType MaxChannels SamplingFreq SampleSize\n"); - for (i = 0; i < pRXCap->AUD_count; i++) { + for (i = 0; i < prxcap->AUD_count; i++) { pos += snprintf(buf + pos, PAGE_SIZE, "%s", - aud_ct[pRXCap->RxAudioCap[i].audio_format_code]); - if ((pRXCap->RxAudioCap[i].audio_format_code == CT_DOLBY_D) && - (pRXCap->RxAudioCap[i].cc3 & 1)) + aud_ct[prxcap->RxAudioCap[i].audio_format_code]); + if ((prxcap->RxAudioCap[i].audio_format_code == CT_DOLBY_D) && + (prxcap->RxAudioCap[i].cc3 & 1)) pos += snprintf(buf + pos, PAGE_SIZE, "/ATMOS"); pos += snprintf(buf + pos, PAGE_SIZE, ", %d ch, ", - pRXCap->RxAudioCap[i].channel_num_max + 1); + prxcap->RxAudioCap[i].channel_num_max + 1); for (j = 0; j < 7; j++) { - if (pRXCap->RxAudioCap[i].freq_cc & (1 << j)) + if (prxcap->RxAudioCap[i].freq_cc & (1 << j)) pos += snprintf(buf + pos, PAGE_SIZE, "%s/", aud_sampling_frequency[j+1]); } pos += snprintf(buf + pos - 1, PAGE_SIZE, " kHz, "); - switch (pRXCap->RxAudioCap[i].audio_format_code) { + switch (prxcap->RxAudioCap[i].audio_format_code) { case CT_PCM: - _show_pcm_ch(pRXCap, i, &pos, buf); + _show_pcm_ch(prxcap, i, &pos, buf); break; case CT_AC_3: case CT_MPEG1: @@ -2487,14 +2547,14 @@ static ssize_t show_aud_cap(struct device *dev, case CT_ONE_BIT_AUDIO: pos += snprintf(buf + pos, PAGE_SIZE, "MaxBitRate %dkHz\n", - pRXCap->RxAudioCap[i].cc3 * 8); + prxcap->RxAudioCap[i].cc3 * 8); break; case CT_DOLBY_D: case CT_DTS_HD: case CT_MAT: case CT_DST: pos += snprintf(buf + pos, PAGE_SIZE, "DepVaule 0x%x\n", - pRXCap->RxAudioCap[i].cc3); + prxcap->RxAudioCap[i].cc3); break; case CT_WMA: default: @@ -2505,21 +2565,74 @@ static ssize_t show_aud_cap(struct device *dev, } /**/ +static ssize_t show_hdmi_hdr_status(struct device *dev, + struct device_attribute *attr, char *buf) +{ + int pos = 0; + struct hdmitx_dev *hdev = &hdmitx_device; + + /* pos = 3 */ + if ((hdr_status_pos == 3) || (hdev->hdr10plus_feature)) { + pos += snprintf(buf + pos, PAGE_SIZE, "HDR10Plus-VSIF\n"); + return pos; + } + + /* pos = 2 */ + if (hdr_status_pos == 2) { + if (hdev->hdmi_current_eotf_type == EOTF_T_DOLBYVISION) { + pos += snprintf(buf + pos, PAGE_SIZE, + "DolbyVision-Std\n"); + return pos; + } + if (hdev->hdmi_current_eotf_type == EOTF_T_LL_MODE) { + pos += snprintf(buf + pos, PAGE_SIZE, + "DolbyVision-Lowlatency\n"); + return pos; + } + } + + /* pos = 1 */ + if (hdr_status_pos == 1) { + if (hdev->hdr_transfer_feature == T_SMPTE_ST_2084) { + if (hdev->hdr_color_feature == C_BT2020) { + pos += snprintf(buf + pos, PAGE_SIZE, + "HDR10-GAMMA_ST2084\n"); + return pos; + } + pos += snprintf(buf + pos, PAGE_SIZE, "HDR10-others\n"); + return pos; + } + if ((hdev->hdr_color_feature == C_BT2020) && + ((hdev->hdr_transfer_feature == T_BT2020_10) || + (hdev->hdr_transfer_feature == T_HLG))) { + pos += snprintf(buf + pos, PAGE_SIZE, + "HDR10-GAMMA_HLG\n"); + return pos; + } + } + + /* default is SDR */ + pos += snprintf(buf + pos, PAGE_SIZE, "SDR\n"); + + return pos; +} + +/**/ static ssize_t show_dc_cap(struct device *dev, struct device_attribute *attr, char *buf) { enum hdmi_vic vic = HDMI_Unknown; int pos = 0; - struct rx_cap *pRXCap = &(hdmitx_device.RXCap); - const struct dv_info *dv = &(hdmitx_device.RXCap.dv_info); + struct rx_cap *prxcap = &hdmitx_device.rxcap; + const struct dv_info *dv = &hdmitx_device.rxcap.dv_info; #if 0 - if (pRXCap->dc_48bit_420) + if (prxcap->dc_48bit_420) pos += snprintf(buf + pos, PAGE_SIZE, "420,16bit\n"); #endif - if (pRXCap->dc_36bit_420) + if (prxcap->dc_36bit_420) pos += snprintf(buf + pos, PAGE_SIZE, "420,12bit\n"); - if (pRXCap->dc_30bit_420) { + if (prxcap->dc_30bit_420) { pos += snprintf(buf + pos, PAGE_SIZE, "420,10bit\n"); pos += snprintf(buf + pos, PAGE_SIZE, "420,8bit\n"); } else { @@ -2545,38 +2658,38 @@ static ssize_t show_dc_cap(struct device *dev, } } next444: - if (pRXCap->dc_y444) { - if ((pRXCap->dc_36bit) || (dv->sup_10b_12b_444 == 0x2)) + if (prxcap->dc_y444) { + if ((prxcap->dc_36bit) || (dv->sup_10b_12b_444 == 0x2)) pos += snprintf(buf + pos, PAGE_SIZE, "444,12bit\n"); - if ((pRXCap->dc_30bit) || (dv->sup_10b_12b_444 == 0x1)) { + if ((prxcap->dc_30bit) || (dv->sup_10b_12b_444 == 0x1)) { pos += snprintf(buf + pos, PAGE_SIZE, "444,10bit\n"); pos += snprintf(buf + pos, PAGE_SIZE, "444,8bit\n"); } #if 0 - if (pRXCap->dc_48bit) + if (prxcap->dc_48bit) pos += snprintf(buf + pos, PAGE_SIZE, "444,16bit\n"); #endif - if ((pRXCap->dc_36bit) || (dv->sup_yuv422_12bit)) + if ((prxcap->dc_36bit) || (dv->sup_yuv422_12bit)) pos += snprintf(buf + pos, PAGE_SIZE, "422,12bit\n"); - if (pRXCap->dc_30bit) { + if (prxcap->dc_30bit) { pos += snprintf(buf + pos, PAGE_SIZE, "422,10bit\n"); pos += snprintf(buf + pos, PAGE_SIZE, "422,8bit\n"); goto nextrgb; } } else { - if (pRXCap->native_Mode & (1 << 5)) + if (prxcap->native_Mode & (1 << 5)) pos += snprintf(buf + pos, PAGE_SIZE, "444,8bit\n"); - if (pRXCap->native_Mode & (1 << 4)) + if (prxcap->native_Mode & (1 << 4)) pos += snprintf(buf + pos, PAGE_SIZE, "422,8bit\n"); } nextrgb: #if 0 - if (pRXCap->dc_48bit) + if (prxcap->dc_48bit) pos += snprintf(buf + pos, PAGE_SIZE, "rgb,16bit\n"); #endif - if ((pRXCap->dc_36bit) || (dv->sup_10b_12b_444 == 0x2)) + if ((prxcap->dc_36bit) || (dv->sup_10b_12b_444 == 0x2)) pos += snprintf(buf + pos, PAGE_SIZE, "rgb,12bit\n"); - if ((pRXCap->dc_30bit) || (dv->sup_10b_12b_444 == 0x1)) + if ((prxcap->dc_30bit) || (dv->sup_10b_12b_444 == 0x1)) pos += snprintf(buf + pos, PAGE_SIZE, "rgb,10bit\n"); pos += snprintf(buf + pos, PAGE_SIZE, "rgb,8bit\n"); return pos; @@ -2644,9 +2757,9 @@ static ssize_t show_allm_mode(struct device *dev, { int pos = 0; struct hdmitx_dev *hdev = &hdmitx_device; - struct rx_cap *pRXCap = &(hdmitx_device.RXCap); + struct rx_cap *prxcap = &hdmitx_device.rxcap; - if (!pRXCap->allm) { /* Rx not support ALLM */ + if (!prxcap->allm) { /* Rx not support ALLM */ pos += snprintf(buf + pos, PAGE_SIZE, "0\n\r"); return pos; } @@ -2669,18 +2782,18 @@ static ssize_t store_allm_mode(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct hdmitx_dev *hdev = &hdmitx_device; - struct rx_cap *pRXCap = &hdev->RXCap; + struct rx_cap *prxcap = &hdev->rxcap; pr_info("hdmitx: store allm_mode as %s\n", buf); - if (!pRXCap->allm) /* Rx not support ALLM */ + if (!prxcap->allm) /* Rx not support ALLM */ return count; #define CMP_STR(str) (strncmp(buf, str, strlen(str)) == 0) if (CMP_STR("0")) { // disable ALLM hdev->allm_mode = 0; - hdev->HWOp.CntlConfig(hdev, CONF_ALLM_MODE, CLEAR_ALLM_MODE); + hdev->hwop.cntlconfig(hdev, CONF_ALLM_MODE, CLEAR_ALLM_MODE); hdmitx_construct_vsif(hdev, VT_ALLM, 0, NULL); if (is_hdmi14_4k(hdev->cur_VIC)) hdmitx_construct_vsif(hdev, VT_HDMI14_4K, 1, NULL); @@ -2693,19 +2806,19 @@ static ssize_t store_allm_mode(struct device *dev, if (CMP_STR("1") || CMP_STR("game")) { hdev->allm_mode = 1; // enable the default GAME ALLM - hdev->HWOp.CntlConfig(hdev, CONF_ALLM_MODE, SET_ALLM_GAME); + hdev->hwop.cntlconfig(hdev, CONF_ALLM_MODE, SET_ALLM_GAME); } if (CMP_STR("graphics")) { hdev->allm_mode = 2; - hdev->HWOp.CntlConfig(hdev, CONF_ALLM_MODE, SET_ALLM_GRAPHICS); + hdev->hwop.cntlconfig(hdev, CONF_ALLM_MODE, SET_ALLM_GRAPHICS); } if (CMP_STR("photo")) { hdev->allm_mode = 3; - hdev->HWOp.CntlConfig(hdev, CONF_ALLM_MODE, SET_ALLM_PHOTO); + hdev->hwop.cntlconfig(hdev, CONF_ALLM_MODE, SET_ALLM_PHOTO); } if (CMP_STR("cinema")) { hdev->allm_mode = 4; - hdev->HWOp.CntlConfig(hdev, CONF_ALLM_MODE, SET_ALLM_CINEMA); + hdev->hwop.cntlconfig(hdev, CONF_ALLM_MODE, SET_ALLM_CINEMA); } return count; @@ -2717,48 +2830,54 @@ static ssize_t show_hdr_cap(struct device *dev, { int pos = 0; unsigned int i, j; - struct rx_cap *pRXCap = &(hdmitx_device.RXCap); - + struct rx_cap *prxcap = &hdmitx_device.rxcap; + int hdr10plugsupported = 0; + + if ((prxcap->hdr10plus_info.ieeeoui == HDR10_PLUS_IEEE_OUI) && + (prxcap->hdr10plus_info.application_version != 0xFF)) + hdr10plugsupported = 1; + pos += snprintf(buf + pos, PAGE_SIZE, "HDR10Plus Supported: %d\n", + hdr10plugsupported); pos += snprintf(buf + pos, PAGE_SIZE, "HDR Static Metadata:\n"); pos += snprintf(buf + pos, PAGE_SIZE, " Supported EOTF:\n"); pos += snprintf(buf + pos, PAGE_SIZE, " Traditional SDR: %d\n", - pRXCap->hdr_sup_eotf_sdr); + prxcap->hdr_sup_eotf_sdr); pos += snprintf(buf + pos, PAGE_SIZE, " Traditional HDR: %d\n", - pRXCap->hdr_sup_eotf_hdr); + prxcap->hdr_sup_eotf_hdr); pos += snprintf(buf + pos, PAGE_SIZE, " SMPTE ST 2084: %d\n", - pRXCap->hdr_sup_eotf_smpte_st_2084); + prxcap->hdr_sup_eotf_smpte_st_2084); pos += snprintf(buf + pos, PAGE_SIZE, " Hybrif Log-Gamma: %d\n", - pRXCap->hdr_sup_eotf_hlg); + prxcap->hdr_sup_eotf_hlg); pos += snprintf(buf + pos, PAGE_SIZE, " Supported SMD type1: %d\n", - pRXCap->hdr_sup_SMD_type1); + prxcap->hdr_sup_SMD_type1); pos += snprintf(buf + pos, PAGE_SIZE, " Luminance Data\n"); pos += snprintf(buf + pos, PAGE_SIZE, " Max: %d\n", - pRXCap->hdr_lum_max); + prxcap->hdr_lum_max); pos += snprintf(buf + pos, PAGE_SIZE, " Avg: %d\n", - pRXCap->hdr_lum_avg); + prxcap->hdr_lum_avg); pos += snprintf(buf + pos, PAGE_SIZE, " Min: %d\n\n", - pRXCap->hdr_lum_min); + prxcap->hdr_lum_min); pos += snprintf(buf + pos, PAGE_SIZE, "HDR Dynamic Metadata:"); for (i = 0; i < 4; i++) { - if (pRXCap->hdr_dynamic_info[i].type == 0) + if (prxcap->hdr_dynamic_info[i].type == 0) continue; pos += snprintf(buf + pos, PAGE_SIZE, "\n metadata_version: %x\n", - pRXCap->hdr_dynamic_info[i].type); + prxcap->hdr_dynamic_info[i].type); pos += snprintf(buf + pos, PAGE_SIZE, " support_flags: %x\n", - pRXCap->hdr_dynamic_info[i].support_flags); + prxcap->hdr_dynamic_info[i].support_flags); pos += snprintf(buf + pos, PAGE_SIZE, " optional_fields:"); for (j = 0; j < - (pRXCap->hdr_dynamic_info[i].hd_len - 3); j++) + (prxcap->hdr_dynamic_info[i].hd_len - 3); j++) pos += snprintf(buf + pos, PAGE_SIZE, " %x", - pRXCap->hdr_dynamic_info[i].optional_fields[j]); + prxcap->hdr_dynamic_info[i].optional_fields[j]); } pos += snprintf(buf + pos, PAGE_SIZE, "\n\ncolorimetry_data: %x\n", - pRXCap->colorimetry_data); + prxcap->colorimetry_data); return pos; } @@ -2768,7 +2887,7 @@ static ssize_t show_dv_cap(struct device *dev, { int pos = 0; int i; - const struct dv_info *dv = &(hdmitx_device.RXCap.dv_info); + const struct dv_info *dv = &hdmitx_device.rxcap.dv_info; if (dv->ieeeoui != DV_IEEE_OUI) { pos += snprintf(buf + pos, PAGE_SIZE, @@ -2805,16 +2924,16 @@ static ssize_t show_dv_cap(struct device *dev, pos += snprintf(buf + pos, PAGE_SIZE, "2160p%shz: 1\n", dv->sup_2160p60hz ? "60" : "30"); - pos += snprintf(buf + pos, PAGE_SIZE, - "Support mode:\n"); - pos += snprintf(buf + pos, PAGE_SIZE, - " DV_RGB_444_8BIT\n"); - if (dv->sup_yuv422_12bit) pos += snprintf(buf + pos, PAGE_SIZE, - " DV_YCbCr_422_12BIT\n"); - if (dv->low_latency == 0x01) + "Support mode:\n"); pos += snprintf(buf + pos, PAGE_SIZE, - " LL_YCbCr_422_12BIT\n"); + " DV_RGB_444_8BIT\n"); + if (dv->sup_yuv422_12bit) + pos += snprintf(buf + pos, PAGE_SIZE, + " DV_YCbCr_422_12BIT\n"); + if (dv->low_latency == 0x01) + pos += snprintf(buf + pos, PAGE_SIZE, + " LL_YCbCr_422_12BIT\n"); } if (dv->length == 0xE) { @@ -2833,7 +2952,8 @@ static ssize_t show_dv_cap(struct device *dev, if (dv->ver == 2) { pos += snprintf(buf + pos, PAGE_SIZE, "VSVDB Version: V%d\n", dv->ver); - pos += snprintf(buf + pos, PAGE_SIZE, "2160p%shz: 1\n", + pos += snprintf(buf + pos, PAGE_SIZE, + "2160p%shz: 1\n", dv->sup_2160p60hz ? "60" : "30"); pos += snprintf(buf + pos, PAGE_SIZE, "Support mode:\n"); @@ -2935,7 +3055,7 @@ static ssize_t store_avmute(struct device *dev, cmd = SET_AVMUTE; else if ((mask0 == -1) && (mask1 == -1)) cmd = CLR_AVMUTE; - hdmitx_device.HWOp.CntlMisc(&hdmitx_device, MISC_AVMUTE_OP, cmd); + hdmitx_device.hwop.cntlmisc(&hdmitx_device, MISC_AVMUTE_OP, cmd); mutex_unlock(&avmute_mutex); return count; @@ -2948,7 +3068,7 @@ static ssize_t show_avmute(struct device *dev, int ret = 0; int pos = 0; - ret = hdev->HWOp.CntlMisc(hdev, MISC_READ_AVMUTE_OP, 0); + ret = hdev->hwop.cntlmisc(hdev, MISC_READ_AVMUTE_OP, 0); pos += snprintf(buf + pos, PAGE_SIZE, "%d", ret); return pos; @@ -2963,8 +3083,8 @@ static ssize_t store_vic(struct device *dev, struct hdmitx_dev *hdev = &hdmitx_device; if (strncmp(buf, "0", 1) == 0) { - hdev->HWOp.CntlConfig(hdev, CONF_CLR_AVI_PACKET, 0); - hdev->HWOp.CntlConfig(hdev, CONF_CLR_VSDB_PACKET, 0); + hdev->hwop.cntlconfig(hdev, CONF_CLR_AVI_PACKET, 0); + hdev->hwop.cntlconfig(hdev, CONF_CLR_VSDB_PACKET, 0); } return count; @@ -2977,7 +3097,7 @@ static ssize_t show_vic(struct device *dev, enum hdmi_vic vic = HDMI_Unknown; int pos = 0; - vic = hdev->HWOp.GetState(hdev, STAT_VIDEO_VIC, 0); + vic = hdev->hwop.getstate(hdev, STAT_VIDEO_VIC, 0); pos += snprintf(buf + pos, PAGE_SIZE, "%d\n", vic); return pos; @@ -3001,7 +3121,7 @@ static ssize_t store_phy(struct device *dev, else pr_info(SYS "set phy wrong: %s\n", buf); - hdmitx_device.HWOp.CntlMisc(&hdmitx_device, MISC_TMDS_PHY_OP, cmd); + hdmitx_device.hwop.cntlmisc(&hdmitx_device, MISC_TMDS_PHY_OP, cmd); return count; } @@ -3062,7 +3182,7 @@ static ssize_t store_cedst_policy(struct device *dev, hdev->cedst_policy = val; if (val == 1) { /* Auto mode, depends on Rx */ /* check RX scdc_present */ - if (hdev->RXCap.scdc_present) + if (hdev->rxcap.scdc_present) hdev->cedst_policy = 1; else hdev->cedst_policy = 0; @@ -3182,7 +3302,7 @@ static ssize_t show_frac_rate(struct device *dev, static ssize_t store_hdcp_clkdis(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - hdmitx_device.HWOp.CntlMisc(&hdmitx_device, MISC_HDCP_CLKDIS, + hdmitx_device.hwop.cntlmisc(&hdmitx_device, MISC_HDCP_CLKDIS, buf[0] == '1' ? 1 : 0); return count; } @@ -3224,7 +3344,7 @@ static ssize_t store_hdcp_byp(struct device *dev, { pr_info(SYS "store_hdcp_byp\n"); - hdmitx_device.HWOp.CntlMisc(&hdmitx_device, MISC_HDCP_CLKDIS, + hdmitx_device.hwop.cntlmisc(&hdmitx_device, MISC_HDCP_CLKDIS, buf[0] == '1' ? 1 : 0); return count; @@ -3244,11 +3364,11 @@ static ssize_t show_hdcp_lstore(struct device *dev, if (hdmitx_device.lstore < 0x10) { hdmitx_device.lstore = 0; - if (hdmitx_device.HWOp.CntlDDC(&hdmitx_device, - DDC_HDCP_14_LSTORE, 0)) + if (hdmitx_device.hwop.cntlddc(&hdmitx_device, + DDC_HDCP_14_LSTORE, 0)) hdmitx_device.lstore += 1; - if (hdmitx_device.HWOp.CntlDDC(&hdmitx_device, - DDC_HDCP_22_LSTORE, 0)) + if (hdmitx_device.hwop.cntlddc(&hdmitx_device, + DDC_HDCP_22_LSTORE, 0)) hdmitx_device.lstore += 2; } if (hdmitx_device.lstore & 0x1) @@ -3291,11 +3411,11 @@ static ssize_t show_hdcp_rptxlstore(struct device *dev, if (rptxlstore < 0x10) { rptxlstore = 0; - if (hdmitx_device.HWOp.CntlDDC(&hdmitx_device, - DDC_HDCP_14_LSTORE, 0)) + if (hdmitx_device.hwop.cntlddc(&hdmitx_device, + DDC_HDCP_14_LSTORE, 0)) rptxlstore += 1; - if (hdmitx_device.HWOp.CntlDDC(&hdmitx_device, - DDC_HDCP_22_LSTORE, 0)) + if (hdmitx_device.hwop.cntlddc(&hdmitx_device, + DDC_HDCP_22_LSTORE, 0)) rptxlstore += 2; } if (rptxlstore & 0x1) @@ -3338,7 +3458,7 @@ static ssize_t store_div40(struct device *dev, { struct hdmitx_dev *hdev = &hdmitx_device; - hdev->HWOp.CntlDDC(hdev, DDC_SCDC_DIV40_SCRAMB, buf[0] == '1'); + hdev->hwop.cntlddc(hdev, DDC_SCDC_DIV40_SCRAMB, buf[0] == '1'); hdmitx_device.div40 = (buf[0] == '1'); return count; @@ -3372,30 +3492,30 @@ static ssize_t store_hdcp_mode(struct device *dev, /* Issue SW I2C transaction to take advantage of SDA recovery logic */ char tmp[8]; - hdmitx_device.HWOp.CntlDDC(&hdmitx_device, DDC_PIN_MUX_OP, PIN_UNMUX); + hdmitx_device.hwop.cntlddc(&hdmitx_device, DDC_PIN_MUX_OP, PIN_UNMUX); edid_rx_data(0x0, tmp, sizeof(tmp)); - hdmitx_device.HWOp.CntlDDC(&hdmitx_device, DDC_PIN_MUX_OP, PIN_MUX); + hdmitx_device.hwop.cntlddc(&hdmitx_device, DDC_PIN_MUX_OP, PIN_MUX); #endif pr_info(SYS "hdcp: set mode as %s\n", buf); - hdmitx_device.HWOp.CntlDDC(&hdmitx_device, DDC_HDCP_MUX_INIT, 1); - hdmitx_device.HWOp.CntlDDC(&hdmitx_device, DDC_HDCP_GET_AUTH, 0); + hdmitx_device.hwop.cntlddc(&hdmitx_device, DDC_HDCP_MUX_INIT, 1); + hdmitx_device.hwop.cntlddc(&hdmitx_device, DDC_HDCP_GET_AUTH, 0); if (strncmp(buf, "0", 1) == 0) { hdmitx_device.hdcp_mode = 0; - hdmitx_device.HWOp.CntlDDC(&hdmitx_device, + hdmitx_device.hwop.cntlddc(&hdmitx_device, DDC_HDCP_OP, HDCP14_OFF); hdmitx_hdcp_do_work(&hdmitx_device); } if (strncmp(buf, "1", 1) == 0) { hdmitx_device.hdcp_mode = 1; hdmitx_hdcp_do_work(&hdmitx_device); - hdmitx_device.HWOp.CntlDDC(&hdmitx_device, + hdmitx_device.hwop.cntlddc(&hdmitx_device, DDC_HDCP_OP, HDCP14_ON); } if (strncmp(buf, "2", 1) == 0) { hdmitx_device.hdcp_mode = 2; hdmitx_hdcp_do_work(&hdmitx_device); - hdmitx_device.HWOp.CntlDDC(&hdmitx_device, + hdmitx_device.hwop.cntlddc(&hdmitx_device, DDC_HDCP_MUX_INIT, 2); } @@ -3469,14 +3589,14 @@ void direct_hdcptx14_opr(enum rptx_hdcp14_cmd cmd, void *args) switch (cmd) { case RPTX_HDCP14_OFF: hdev->hdcp_mode = 0; - hdev->HWOp.CntlDDC(hdev, DDC_HDCP_OP, HDCP14_OFF); + hdev->hwop.cntlddc(hdev, DDC_HDCP_OP, HDCP14_OFF); break; case RPTX_HDCP14_ON: hdev->hdcp_mode = 1; - hdev->HWOp.CntlDDC(hdev, DDC_HDCP_OP, HDCP14_ON); + hdev->hwop.cntlddc(hdev, DDC_HDCP_OP, HDCP14_ON); break; case RPTX_HDCP14_GET_AUTHST: - rst = hdev->HWOp.CntlDDC(hdev, DDC_HDCP_GET_AUTH, 0); + rst = hdev->hwop.cntlddc(hdev, DDC_HDCP_GET_AUTH, 0); *(int *)args = rst; break; } @@ -3488,7 +3608,7 @@ static ssize_t store_hdcp_ctrl(struct device *dev, { struct hdmitx_dev *hdev = &hdmitx_device; - if (hdev->HWOp.CntlDDC(hdev, DDC_HDCP_14_LSTORE, 0) == 0) + if (hdev->hwop.cntlddc(hdev, DDC_HDCP_14_LSTORE, 0) == 0) return count; /* for repeater */ @@ -3496,10 +3616,10 @@ static ssize_t store_hdcp_ctrl(struct device *dev, dev_warn(dev, "hdmitx20: %s\n", buf); if (strncmp(buf, "rstop", 5) == 0) { if (strncmp(buf+5, "14", 2) == 0) - hdev->HWOp.CntlDDC(hdev, DDC_HDCP_OP, + hdev->hwop.cntlddc(hdev, DDC_HDCP_OP, HDCP14_OFF); if (strncmp(buf+5, "22", 2) == 0) - hdev->HWOp.CntlDDC(hdev, DDC_HDCP_OP, + hdev->hwop.cntlddc(hdev, DDC_HDCP_OP, HDCP22_OFF); hdev->hdcp_mode = 0; hdmitx_hdcp_do_work(hdev); @@ -3510,9 +3630,9 @@ static ssize_t store_hdcp_ctrl(struct device *dev, if (strncmp(buf, "stop", 4) == 0) { dev_warn(dev, "hdmitx20: %s\n", buf); if (strncmp(buf+4, "14", 2) == 0) - hdev->HWOp.CntlDDC(hdev, DDC_HDCP_OP, HDCP14_OFF); + hdev->hwop.cntlddc(hdev, DDC_HDCP_OP, HDCP14_OFF); if (strncmp(buf+4, "22", 2) == 0) - hdev->HWOp.CntlDDC(hdev, DDC_HDCP_OP, HDCP22_OFF); + hdev->hwop.cntlddc(hdev, DDC_HDCP_OP, HDCP22_OFF); hdev->hdcp_mode = 0; hdmitx_hdcp_do_work(hdev); } @@ -3532,7 +3652,7 @@ static ssize_t show_hdcp_ksv_info(struct device *dev, int pos = 0, i; char bksv_buf[5]; - hdmitx_device.HWOp.CntlDDC(&hdmitx_device, DDC_HDCP_GET_BKSV, + hdmitx_device.hwop.cntlddc(&hdmitx_device, DDC_HDCP_GET_BKSV, (unsigned long int)bksv_buf); pos += snprintf(buf+pos, PAGE_SIZE, "HDCP14 BKSV: "); @@ -3568,8 +3688,8 @@ static ssize_t show_hdcp_ver(struct device *dev, } /* if TX don't have HDCP22 key, skip RX hdcp22 ver */ - if (hdmitx_device.HWOp.CntlDDC(&hdmitx_device, - DDC_HDCP_22_LSTORE, 0) == 0) + if (hdmitx_device.hwop.cntlddc(&hdmitx_device, + DDC_HDCP_22_LSTORE, 0) == 0) goto next; /* Detect RX support HDCP22 */ @@ -3605,7 +3725,7 @@ static ssize_t show_rhpd_state(struct device *dev, struct hdmitx_dev *hdev = &hdmitx_device; int st; - st = hdev->HWOp.CntlMisc(hdev, MISC_HPD_GPI_ST, 0); + st = hdev->hwop.cntlmisc(hdev, MISC_HPD_GPI_ST, 0); return snprintf(buf, PAGE_SIZE, "%d", hdev->rhpd_state); } @@ -3653,7 +3773,7 @@ static ssize_t show_support_3d(struct device *dev, int pos = 0; pos += snprintf(buf+pos, PAGE_SIZE, "%d\n", - hdmitx_device.RXCap.threeD_present); + hdmitx_device.rxcap.threeD_present); return pos; } @@ -3672,6 +3792,7 @@ static DEVICE_ATTR(preferred_mode, 0444, show_preferred_mode, NULL); static DEVICE_ATTR(cea_cap, 0444, show_cea_cap, NULL); static DEVICE_ATTR(vesa_cap, 0444, show_vesa_cap, NULL); static DEVICE_ATTR(aud_cap, 0444, show_aud_cap, NULL); +static DEVICE_ATTR(hdmi_hdr_status, 0444, show_hdmi_hdr_status, NULL); static DEVICE_ATTR(hdr_cap, 0444, show_hdr_cap, NULL); static DEVICE_ATTR(dv_cap, 0444, show_dv_cap, NULL); static DEVICE_ATTR(dc_cap, 0444, show_dc_cap, NULL); @@ -3777,9 +3898,9 @@ static int hdmitx_module_disable(enum vmode_e cur_vmod) { struct hdmitx_dev *hdev = &hdmitx_device; - hdev->HWOp.CntlConfig(hdev, CONF_CLR_AVI_PACKET, 0); - hdev->HWOp.CntlConfig(hdev, CONF_CLR_VSDB_PACKET, 0); - hdev->HWOp.CntlMisc(hdev, MISC_TMDS_PHY_OP, TMDS_PHY_DISABLE); + hdev->hwop.cntlconfig(hdev, CONF_CLR_AVI_PACKET, 0); + hdev->hwop.cntlconfig(hdev, CONF_CLR_VSDB_PACKET, 0); + hdev->hwop.cntlmisc(hdev, MISC_TMDS_PHY_OP, TMDS_PHY_DISABLE); hdmitx_disable_clk(hdev); hdev->para = hdmi_get_fmt_name("invalid", hdev->fmt_attr); hdmitx_validate_vmode("null"); @@ -3928,7 +4049,7 @@ static int hdmitx_notify_callback_a(struct notifier_block *block, unsigned long cmd, void *para) { int i, audio_check = 0; - struct rx_cap *pRXCap = &(hdmitx_device.RXCap); + struct rx_cap *prxcap = &hdmitx_device.rxcap; struct snd_pcm_substream *substream = (struct snd_pcm_substream *)para; struct hdmitx_audpara *audio_param = @@ -3966,15 +4087,15 @@ static int hdmitx_notify_callback_a(struct notifier_block *block, if (hdmitx_device.tx_aud_cfg == 2) { pr_info(AUD "auto mode\n"); /* Detect whether Rx is support current audio format */ - for (i = 0; i < pRXCap->AUD_count; i++) { - if (pRXCap->RxAudioCap[i].audio_format_code == cmd) + for (i = 0; i < prxcap->AUD_count; i++) { + if (prxcap->RxAudioCap[i].audio_format_code == cmd) audio_check = 1; } /* sink don't support current audio mode */ if ((!audio_check) && (cmd != CT_PCM)) { pr_info("Sink not support this audio format %lu\n", cmd); - hdmitx_device.HWOp.CntlConfig(&hdmitx_device, + hdmitx_device.hwop.cntlconfig(&hdmitx_device, CONF_AUDIO_MUTE_OP, AUDIO_MUTE); hdmitx_device.audio_param_update_flag = 0; } @@ -4008,17 +4129,17 @@ static void hdmitx_get_edid(struct hdmitx_dev *hdev) { mutex_lock(&getedid_mutex); /* TODO hdmitx_edid_ram_buffer_clear(hdev); */ - hdev->HWOp.CntlDDC(hdev, DDC_RESET_EDID, 0); - hdev->HWOp.CntlDDC(hdev, DDC_PIN_MUX_OP, PIN_MUX); + hdev->hwop.cntlddc(hdev, DDC_RESET_EDID, 0); + hdev->hwop.cntlddc(hdev, DDC_PIN_MUX_OP, PIN_MUX); /* start reading edid frist time */ - hdev->HWOp.CntlDDC(hdev, DDC_EDID_READ_DATA, 0); - hdev->HWOp.CntlDDC(hdev, DDC_EDID_GET_DATA, 0); + hdev->hwop.cntlddc(hdev, DDC_EDID_READ_DATA, 0); + hdev->hwop.cntlddc(hdev, DDC_EDID_GET_DATA, 0); /* If EDID is not correct at first time, then retry */ if (!check_dvi_hdmi_edid_valid(hdev->EDID_buf)) { msleep(100); /* start reading edid second time */ - hdev->HWOp.CntlDDC(hdev, DDC_EDID_READ_DATA, 0); - hdev->HWOp.CntlDDC(hdev, DDC_EDID_GET_DATA, 1); + hdev->hwop.cntlddc(hdev, DDC_EDID_READ_DATA, 0); + hdev->hwop.cntlddc(hdev, DDC_EDID_GET_DATA, 1); } hdmitx_edid_clear(hdev); hdmitx_edid_parse(hdev); @@ -4032,7 +4153,7 @@ static void hdmitx_rxsense_process(struct work_struct *work) struct hdmitx_dev *hdev = container_of((struct delayed_work *)work, struct hdmitx_dev, work_rxsense); - sense = hdev->HWOp.CntlMisc(hdev, MISC_TMDS_RXSENSE, 0); + sense = hdev->hwop.cntlmisc(hdev, MISC_TMDS_RXSENSE, 0); extcon_set_state_sync(hdmitx_extcon_rxsense, EXTCON_DISP_HDMI, sense); queue_delayed_work(hdev->rxsense_wq, &hdev->work_rxsense, HZ); } @@ -4043,7 +4164,7 @@ static void hdmitx_cedst_process(struct work_struct *work) struct hdmitx_dev *hdev = container_of((struct delayed_work *)work, struct hdmitx_dev, work_cedst); - ced = hdev->HWOp.CntlMisc(hdev, MISC_TMDS_CEDST, 0); + ced = hdev->hwop.cntlmisc(hdev, MISC_TMDS_CEDST, 0); /* firstly send as 0, then real ced, A trigger signal */ extcon_set_state_sync(hdmitx_extcon_cedst, EXTCON_DISP_HDMI, 0); extcon_set_state_sync(hdmitx_extcon_cedst, EXTCON_DISP_HDMI, ced); @@ -4066,23 +4187,23 @@ static void hdmitx_hpd_plugin_handler(struct work_struct *work) mutex_lock(&setclk_mutex); pr_info(SYS "plugin\n"); if (hdev->chip_type >= MESON_CPU_ID_G12A) - hdev->HWOp.CntlMisc(hdev, MISC_I2C_RESET, 0); + hdev->hwop.cntlmisc(hdev, MISC_I2C_RESET, 0); hdev->hdmitx_event &= ~HDMI_TX_HPD_PLUGIN; /* start reading E-EDID */ if (hdev->repeater_tx) rx_repeat_hpd_state(1); hdmitx_get_edid(hdev); - hdev->cedst_policy = hdev->cedst_en & hdev->RXCap.scdc_present; + hdev->cedst_policy = hdev->cedst_en & hdev->rxcap.scdc_present; hdmi_physcial_size_update(hdev); - if (hdev->RXCap.ieeeoui != HDMI_IEEEOUI) - hdev->HWOp.CntlConfig(hdev, + if (hdev->rxcap.ieeeoui != HDMI_IEEEOUI) + hdev->hwop.cntlconfig(hdev, CONF_HDMI_DVI_MODE, DVI_MODE); else - hdev->HWOp.CntlConfig(hdev, + hdev->hwop.cntlconfig(hdev, CONF_HDMI_DVI_MODE, HDMI_MODE); mutex_lock(&getedid_mutex); if (hdev->chip_type < MESON_CPU_ID_G12A) - hdev->HWOp.CntlMisc(hdev, MISC_I2C_REACTIVE, 0); + hdev->hwop.cntlmisc(hdev, MISC_I2C_REACTIVE, 0); mutex_unlock(&getedid_mutex); if (hdev->repeater_tx) { if (check_fbc_special(&hdev->EDID_buf[0]) @@ -4090,7 +4211,7 @@ static void hdmitx_hpd_plugin_handler(struct work_struct *work) rx_set_repeater_support(0); else rx_set_repeater_support(1); - hdev->HWOp.CntlDDC(hdev, DDC_HDCP_GET_BKSV, + hdev->hwop.cntlddc(hdev, DDC_HDCP_GET_BKSV, (unsigned long int)bksv_buf); rx_set_receive_hdcp(bksv_buf, 1, 1, 0, 0); } @@ -4129,13 +4250,13 @@ static void hdmitx_hpd_plugout_handler(struct work_struct *work) return; hdev->hdcp_mode = 0; hdev->hdcp_bcaps_repeater = 0; - hdev->HWOp.CntlDDC(hdev, DDC_HDCP_MUX_INIT, 1); - hdev->HWOp.CntlDDC(hdev, DDC_HDCP_OP, HDCP14_OFF); + hdev->hwop.cntlddc(hdev, DDC_HDCP_MUX_INIT, 1); + hdev->hwop.cntlddc(hdev, DDC_HDCP_OP, HDCP14_OFF); mutex_lock(&setclk_mutex); if (hdev->cedst_policy) cancel_delayed_work(&hdev->work_cedst); pr_info(SYS "plugout\n"); - if (!!(hdev->HWOp.CntlMisc(hdev, MISC_HPD_GPI_ST, 0))) { + if (!!(hdev->hwop.cntlmisc(hdev, MISC_HPD_GPI_ST, 0))) { pr_info(SYS "hpd gpio high\n"); hdev->hdmitx_event &= ~HDMI_TX_HPD_PLUGOUT; mutex_unlock(&setclk_mutex); @@ -4147,13 +4268,13 @@ static void hdmitx_hpd_plugout_handler(struct work_struct *work) hdev->ready = 0; if (hdev->repeater_tx) rx_repeat_hpd_state(0); - hdev->HWOp.CntlConfig(hdev, CONF_CLR_AVI_PACKET, 0); - hdev->HWOp.CntlDDC(hdev, DDC_HDCP_MUX_INIT, 1); - hdev->HWOp.CntlDDC(hdev, DDC_HDCP_OP, HDCP14_OFF); - hdev->HWOp.CntlDDC(hdev, DDC_HDCP_SET_TOPO_INFO, 0); - hdev->HWOp.CntlMisc(hdev, MISC_TMDS_PHY_OP, TMDS_PHY_DISABLE); + hdev->hwop.cntlconfig(hdev, CONF_CLR_AVI_PACKET, 0); + hdev->hwop.cntlddc(hdev, DDC_HDCP_MUX_INIT, 1); + hdev->hwop.cntlddc(hdev, DDC_HDCP_OP, HDCP14_OFF); + hdev->hwop.cntlddc(hdev, DDC_HDCP_SET_TOPO_INFO, 0); + hdev->hwop.cntlmisc(hdev, MISC_TMDS_PHY_OP, TMDS_PHY_DISABLE); hdev->hdmitx_event &= ~HDMI_TX_HPD_PLUGOUT; - hdev->HWOp.CntlMisc(hdev, MISC_ESM_RESET, 0); + hdev->hwop.cntlmisc(hdev, MISC_ESM_RESET, 0); clear_rx_vinfo(hdev); rx_edid_physical_addr(0, 0, 0, 0); hdmitx_edid_clear(hdev); @@ -4171,7 +4292,7 @@ static void hdmitx_internal_intr_handler(struct work_struct *work) struct hdmitx_dev *hdev = container_of((struct delayed_work *)work, struct hdmitx_dev, work_internal_intr); - hdev->HWOp.DebugFun(hdev, "dumpintr"); + hdev->hwop.debugfun(hdev, "dumpintr"); } int get_hpd_state(void) @@ -4189,12 +4310,12 @@ EXPORT_SYMBOL(get_hpd_state); /****************************** * hdmitx kernel task *******************************/ -int tv_audio_support(int type, struct rx_cap *pRXCap) +int tv_audio_support(int type, struct rx_cap *prxcap) { int i, audio_check = 0; - for (i = 0; i < pRXCap->AUD_count; i++) { - if (pRXCap->RxAudioCap[i].audio_format_code == type) + for (i = 0; i < prxcap->AUD_count; i++) { + if (prxcap->RxAudioCap[i].audio_format_code == type) audio_check = 1; } return audio_check; @@ -4205,7 +4326,7 @@ static int hdmi_task_handle(void *data) struct vinfo_s *info = NULL; struct hdmitx_dev *hdmitx_device = (struct hdmitx_dev *)data; - hdmitx_extcon_hdmi->state = !!(hdmitx_device->HWOp.CntlMisc( + hdmitx_extcon_hdmi->state = !!(hdmitx_device->hwop.cntlmisc( hdmitx_device, MISC_HPD_GPI_ST, 0)); hdmitx_device->hpd_state = hdmitx_extcon_hdmi->state; hdmitx_notify_hpd(hdmitx_device->hpd_state); @@ -4238,12 +4359,12 @@ static int hdmi_task_handle(void *data) /*Direct Rander Management use another irq*/ if (hdmitx_device->drm_feature == 0) - hdmitx_device->HWOp.SetupIRQ(hdmitx_device); + hdmitx_device->hwop.setupirq(hdmitx_device); /* Trigger HDMITX IRQ*/ - hdmitx_device->HWOp.CntlMisc(hdmitx_device, MISC_HPD_MUX_OP, PIN_MUX); - if (hdmitx_device->HWOp.CntlMisc(hdmitx_device, MISC_HPD_GPI_ST, 0)) - hdmitx_device->HWOp.CntlMisc(hdmitx_device, + hdmitx_device->hwop.cntlmisc(hdmitx_device, MISC_HPD_MUX_OP, PIN_MUX); + if (hdmitx_device->hwop.cntlmisc(hdmitx_device, MISC_HPD_GPI_ST, 0)) + hdmitx_device->hwop.cntlmisc(hdmitx_device, MISC_TRIGGER_HPD, 0); hdmitx_device->hdmi_init = 1; @@ -4866,6 +4987,7 @@ static int amhdmitx_probe(struct platform_device *pdev) ret = device_create_file(dev, &dev_attr_vesa_cap); ret = device_create_file(dev, &dev_attr_disp_cap_3d); ret = device_create_file(dev, &dev_attr_aud_cap); + ret = device_create_file(dev, &dev_attr_hdmi_hdr_status); ret = device_create_file(dev, &dev_attr_hdr_cap); ret = device_create_file(dev, &dev_attr_dv_cap); ret = device_create_file(dev, &dev_attr_aud_ch); @@ -4943,8 +5065,8 @@ static int amhdmitx_remove(struct platform_device *pdev) cancel_work_sync(&hdmitx_device.work_hdr); - if (hdmitx_device.HWOp.UnInit) - hdmitx_device.HWOp.UnInit(&hdmitx_device); + if (hdmitx_device.hwop.uninit) + hdmitx_device.hwop.uninit(&hdmitx_device); hdmitx_device.hpd_event = 0xff; kthread_stop(hdmitx_device.task); vout_unregister_server(&hdmitx_vout_server); @@ -4999,6 +5121,7 @@ static int amhdmitx_remove(struct platform_device *pdev) device_remove_file(dev, &dev_attr_hdmi_repeater_tx); device_remove_file(dev, &dev_attr_hdcp22_base); device_remove_file(dev, &dev_attr_swap); + device_remove_file(dev, &dev_attr_hdmi_hdr_status); cdev_del(&hdmitx_device.cdev); @@ -5014,7 +5137,7 @@ static int amhdmitx_remove(struct platform_device *pdev) static int amhdmitx_suspend(struct platform_device *pdev, pm_message_t state) { - hdmitx_device.HWOp.CntlDDC(&hdmitx_device, + hdmitx_device.hwop.cntlddc(&hdmitx_device, DDC_RESET_HDCP, 0); pr_info("amhdmitx: suspend and reset hdcp\n"); return 0; @@ -5025,7 +5148,7 @@ static int amhdmitx_resume(struct platform_device *pdev) struct hdmitx_dev *hdev = &hdmitx_device; pr_debug("amhdmitx: I2C_REACTIVE\n"); - hdev->HWOp.CntlMisc(hdev, MISC_I2C_REACTIVE, 0); + hdev->hwop.cntlmisc(hdev, MISC_I2C_REACTIVE, 0); return 0; } diff --git a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_video.c b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_video.c index b86b6e2..98276f9 100644 --- a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_video.c +++ b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_video.c @@ -874,9 +874,9 @@ static void hdmi_tx_construct_avi_packet( * HDMI Identifier = HDMI_IEEEOUI 0x000c03 * If not, treated as a DVI Device */ -static int is_dvi_device(struct rx_cap *pRXCap) +static int is_dvi_device(struct rx_cap *prxcap) { - if (pRXCap->ieeeoui != HDMI_IEEEOUI) + if (prxcap->ieeeoui != HDMI_IEEEOUI) return 1; else return 0; @@ -896,7 +896,7 @@ int hdmitx_set_display(struct hdmitx_dev *hdev, enum hdmi_vic VideoCode) for (i = 0; i < 32; i++) AVI_DB[i] = 0; - vic = hdev->HWOp.GetState(hdev, STAT_VIDEO_VIC, 0); + vic = hdev->hwop.getstate(hdev, STAT_VIDEO_VIC, 0); pr_info(VID "already init VIC = %d Now VIC = %d\n", vic, VideoCode); if ((vic != HDMI_Unknown) && (vic == VideoCode)) @@ -909,7 +909,7 @@ int hdmitx_set_display(struct hdmitx_dev *hdev, enum hdmi_vic VideoCode) /* HDMI CT 7-24 Pixel Encoding * YCbCr to YCbCr Sink */ - switch (hdev->RXCap.native_Mode & 0x30) { + switch (hdev->rxcap.native_Mode & 0x30) { case 0x20:/*bit5==1, then support YCBCR444 + RGB*/ case 0x30: param->color = COLORSPACE_YUV444; @@ -943,19 +943,19 @@ int hdmitx_set_display(struct hdmitx_dev *hdev, enum hdmi_vic VideoCode) pr_info("hdmitx: VESA only support RGB format\n"); } - if (hdev->HWOp.SetDispMode(hdev) >= 0) { + if (hdev->hwop.setdispmode(hdev) >= 0) { /* HDMI CT 7-33 DVI Sink, no HDMI VSDB nor any * other VSDB, No GB or DI expected * TMDS_MODE[hdmi_config] * 0: DVI Mode 1: HDMI Mode */ - if (is_dvi_device(&hdev->RXCap)) { + if (is_dvi_device(&hdev->rxcap)) { pr_info(VID "Sink is DVI device\n"); - hdev->HWOp.CntlConfig(hdev, + hdev->hwop.cntlconfig(hdev, CONF_HDMI_DVI_MODE, DVI_MODE); } else { pr_info(VID "Sink is HDMI device\n"); - hdev->HWOp.CntlConfig(hdev, + hdev->hwop.cntlconfig(hdev, CONF_HDMI_DVI_MODE, HDMI_MODE); } hdmi_tx_construct_avi_packet(param, (char *)AVI_DB); @@ -971,22 +971,22 @@ int hdmitx_set_display(struct hdmitx_dev *hdev, enum hdmi_vic VideoCode) else ; - switch (hdev->RXCap.allm ? hdev->allm_mode : 0) { + switch (hdev->rxcap.allm ? hdev->allm_mode : 0) { case 1: /* game */ hdmitx_construct_vsif(hdev, VT_ALLM, 1, NULL); - hdev->HWOp.CntlConfig(hdev, CONF_ALLM_MODE, + hdev->hwop.cntlconfig(hdev, CONF_ALLM_MODE, SET_ALLM_GAME); break; case 2: /* graphics */ - hdev->HWOp.CntlConfig(hdev, CONF_ALLM_MODE, + hdev->hwop.cntlconfig(hdev, CONF_ALLM_MODE, SET_ALLM_GRAPHICS); break; case 3: /* photo */ - hdev->HWOp.CntlConfig(hdev, CONF_ALLM_MODE, + hdev->hwop.cntlconfig(hdev, CONF_ALLM_MODE, SET_ALLM_PHOTO); break; case 4: /* cinema */ - hdev->HWOp.CntlConfig(hdev, CONF_ALLM_MODE, + hdev->hwop.cntlconfig(hdev, CONF_ALLM_MODE, SET_ALLM_CINEMA); break; default: @@ -1013,12 +1013,12 @@ static void hdmi_set_vend_spec_infofram(struct hdmitx_dev *hdev, VEN_HB[2] = 0x5; if (VideoCode == 0) { /* For non-4kx2k mode setting */ - hdev->HWOp.SetPacket(HDMI_PACKET_VEND, NULL, VEN_HB); + hdev->hwop.setpacket(HDMI_PACKET_VEND, NULL, VEN_HB); return; } - if ((hdev->RXCap.dv_info.block_flag == CORRECT) || - (hdev->dv_src_feature == 1)) { /* For dolby */ + if ((hdev->rxcap.dv_info.block_flag == CORRECT) || + (hdev->dv_src_feature == 1)) { /* For dolby */ return; } @@ -1043,7 +1043,7 @@ static void hdmi_set_vend_spec_infofram(struct hdmitx_dev *hdev, VEN_DB[4] = 0x4; } else ; - hdev->HWOp.SetPacket(HDMI_PACKET_VEND, VEN_DB, VEN_HB); + hdev->hwop.setpacket(HDMI_PACKET_VEND, VEN_DB, VEN_HB); } int hdmi_set_3d(struct hdmitx_dev *hdev, int type, unsigned int param) @@ -1056,7 +1056,7 @@ int hdmi_set_3d(struct hdmitx_dev *hdev, int type, unsigned int param) VEN_HB[1] = 0x01; VEN_HB[2] = 0x6; if (type == T3D_DISABLE) - hdev->HWOp.SetPacket(HDMI_PACKET_VEND, NULL, VEN_HB); + hdev->hwop.setpacket(HDMI_PACKET_VEND, NULL, VEN_HB); else { for (i = 0; i < 0x6; i++) VEN_DB[i] = 0; @@ -1066,7 +1066,7 @@ int hdmi_set_3d(struct hdmitx_dev *hdev, int type, unsigned int param) VEN_DB[3] = 0x40; VEN_DB[4] = type<<4; VEN_DB[5] = param<<4; - hdev->HWOp.SetPacket(HDMI_PACKET_VEND, VEN_DB, VEN_HB); + hdev->hwop.setpacket(HDMI_PACKET_VEND, VEN_DB, VEN_HB); } return 0; @@ -1098,7 +1098,7 @@ static void hdmitx_set_spd_info(struct hdmitx_dev *hdev) (len > 16) ? 16 : len); } SPD_DB[24] = 0x1; - hdev->HWOp.SetPacket(HDMI_SOURCE_DESCRIPTION, SPD_DB, SPD_HB); + hdev->hwop.setpacket(HDMI_SOURCE_DESCRIPTION, SPD_DB, SPD_HB); } static void fill_hdmi4k_vsif_data(enum hdmi_vic vic, unsigned char *DB, @@ -1168,6 +1168,6 @@ int hdmitx_construct_vsif(struct hdmitx_dev *hdev, enum vsif_type type, DB[1] = GET_OUI_BYTE1(ieeeoui); DB[2] = GET_OUI_BYTE2(ieeeoui); - hdev->HWOp.SetDataPacket(HDMI_PACKET_VEND, DB, HB); + hdev->hwop.setdatapacket(HDMI_PACKET_VEND, DB, HB); return 1; } 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 e9702644..de0e171 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 @@ -624,24 +624,24 @@ static void hdmi_hwi_init(struct hdmitx_dev *hdev) void HDMITX_Meson_Init(struct hdmitx_dev *hdev) { - hdev->HWOp.SetPacket = hdmitx_set_packet; - hdev->HWOp.SetDataPacket = hdmitx_set_datapacket; - hdev->HWOp.SetAudioInfoFrame = hdmitx_setaudioinfoframe; - hdev->HWOp.SetDispMode = hdmitx_set_dispmode; - hdev->HWOp.SetAudMode = hdmitx_set_audmode; - hdev->HWOp.SetupIRQ = hdmitx_setupirq; - hdev->HWOp.DebugFun = hdmitx_debug; - hdev->HWOp.UnInit = hdmitx_uninit; - hdev->HWOp.Cntl = hdmitx_cntl; /* todo */ - hdev->HWOp.CntlDDC = hdmitx_cntl_ddc; - hdev->HWOp.GetState = hdmitx_get_state; - hdev->HWOp.CntlPacket = hdmitx_cntl; - hdev->HWOp.CntlConfig = hdmitx_cntl_config; - hdev->HWOp.CntlMisc = hdmitx_cntl_misc; + hdev->hwop.setpacket = hdmitx_set_packet; + hdev->hwop.setdatapacket = hdmitx_set_datapacket; + hdev->hwop.setaudioinfoframe = hdmitx_setaudioinfoframe; + hdev->hwop.setdispmode = hdmitx_set_dispmode; + hdev->hwop.setaudmode = hdmitx_set_audmode; + hdev->hwop.setupirq = hdmitx_setupirq; + hdev->hwop.debugfun = hdmitx_debug; + hdev->hwop.uninit = hdmitx_uninit; + hdev->hwop.cntl = hdmitx_cntl; /* todo */ + hdev->hwop.cntlddc = hdmitx_cntl_ddc; + hdev->hwop.getstate = hdmitx_get_state; + hdev->hwop.cntlpacket = hdmitx_cntl; + hdev->hwop.cntlconfig = hdmitx_cntl_config; + hdev->hwop.cntlmisc = hdmitx_cntl_misc; init_reg_map(hdev->chip_type); hdmi_hwp_init(hdev); hdmi_hwi_init(hdev); - hdev->HWOp.CntlMisc(hdev, MISC_AVMUTE_OP, CLR_AVMUTE); + hdev->hwop.cntlmisc(hdev, MISC_AVMUTE_OP, CLR_AVMUTE); } static void hdmitx_phy_bandgap_en(struct hdmitx_dev *hdev) @@ -4172,8 +4172,8 @@ static void hdmitx_debug(struct hdmitx_dev *hdev, const char *buf) set_vmode_clk(hdev); return; } else if (strncmp(tmpbuf, "testedid", 8) == 0) { - hdev->HWOp.CntlDDC(hdev, DDC_RESET_EDID, 0); - hdev->HWOp.CntlDDC(hdev, DDC_EDID_READ_DATA, 0); + hdev->hwop.cntlddc(hdev, DDC_RESET_EDID, 0); + hdev->hwop.cntlddc(hdev, DDC_EDID_READ_DATA, 0); return; } else if (strncmp(tmpbuf, "bist", 4) == 0) { if (strncmp(tmpbuf + 4, "off", 3) == 0) { @@ -4221,7 +4221,7 @@ static void hdmitx_debug(struct hdmitx_dev *hdev, const char *buf) if (i == 2) pr_info("hdcp rslt = %d", hdmitx_hdcp_opr(2)); if (i == 1) - hdev->HWOp.CntlDDC(hdev, DDC_HDCP_OP, HDCP14_ON); + hdev->hwop.cntlddc(hdev, DDC_HDCP_OP, HDCP14_ON); return; } else if (strncmp(tmpbuf, "chkfmt", 6) == 0) { check_detail_fmt(); @@ -5161,7 +5161,7 @@ static int hdmitx_tmds_rxsense(void) hd_write_reg(P_HHI_HDMI_PHY_CNTL0, 0); break; } - if (!(hdev->HWOp.CntlMisc(hdev, MISC_HPD_GPI_ST, 0))) + if (!(hdev->hwop.cntlmisc(hdev, MISC_HPD_GPI_ST, 0))) return 0; return ret; } @@ -5812,7 +5812,7 @@ static void config_hdmi20_tx(enum hdmi_vic vic, hdmitx_set_avi_colorimetry(para); if (hdev->hdr_color_feature == C_BT2020) - hdev->HWOp.CntlConfig(hdev, CONF_AVI_BT2020, SET_AVI_BT2020); + hdev->hwop.cntlconfig(hdev, CONF_AVI_BT2020, SET_AVI_BT2020); data32 = 0; data32 |= (((0 == COLORRANGE_FUL) ? 1 : 0) << 2); @@ -5894,9 +5894,9 @@ static void config_hdmi20_tx(enum hdmi_vic vic, /* If RX support 2084 or hlg , and the hdr_src_feature is 2020 * then enable HDR send out */ - if ((hdev->RXCap.hdr_sup_eotf_smpte_st_2084 || - hdev->RXCap.hdr_sup_eotf_hlg) && - (hdev->hdr_color_feature == C_BT2020)) { + if ((hdev->rxcap.hdr_sup_eotf_smpte_st_2084 || + hdev->rxcap.hdr_sup_eotf_hlg) && + (hdev->hdr_color_feature == C_BT2020)) { hdmitx_set_reg_bits(HDMITX_DWC_FC_DATAUTO3, 1, 6, 1); hdmitx_set_reg_bits(HDMITX_DWC_FC_PACKET_TX_EN, 1, 7, 1); } else { 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 422803b..992b096 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 @@ -126,6 +126,7 @@ struct rx_cap { unsigned char hdr_lum_max; unsigned char hdr_lum_avg; unsigned char hdr_lum_min; + unsigned char hdr_rawdata[7]; struct hdr_dynamic_struct hdr_dynamic_info[4]; struct hdr10_plus_info hdr10plus_info; unsigned char IDManufacturerName[4]; @@ -349,42 +350,42 @@ struct hdmitx_dev { unsigned int div40; unsigned int lstore; struct { - void (*SetPacket)(int type, unsigned char *DB, - unsigned char *HB); - /* In original SetPacket, there are many policys, like + void (*setpacket)(int type, unsigned char *DB, + unsigned char *HB); + /* In original setpacket, there are many policys, like * if ((DB[4] >> 4) == T3D_FRAME_PACKING) * Need a only pure data packet to call */ - void (*SetDataPacket)(int type, unsigned char *DB, - unsigned char *HB); - void (*SetAudioInfoFrame)(unsigned char *AUD_DB, - unsigned char *CHAN_STAT_BUF); - int (*SetDispMode)(struct hdmitx_dev *hdmitx_device); - int (*SetAudMode)(struct hdmitx_dev *hdmitx_device, - struct hdmitx_audpara *audio_param); - void (*SetupIRQ)(struct hdmitx_dev *hdmitx_device); - void (*DebugFun)(struct hdmitx_dev *hdmitx_device, - const char *buf); - void (*UnInit)(struct hdmitx_dev *hdmitx_device); - int (*CntlPower)(struct hdmitx_dev *hdmitx_device, - unsigned int cmd, unsigned int arg); /* Power control */ + void (*setdatapacket)(int type, unsigned char *DB, + unsigned char *HB); + void (*setaudioinfoframe)(unsigned char *AUD_DB, + unsigned char *CHAN_STAT_BUF); + int (*setdispmode)(struct hdmitx_dev *hdmitx_device); + int (*setaudmode)(struct hdmitx_dev *hdmitx_device, + struct hdmitx_audpara *audio_param); + void (*setupirq)(struct hdmitx_dev *hdmitx_device); + void (*debugfun)(struct hdmitx_dev *hdmitx_device, + const char *buf); + void (*uninit)(struct hdmitx_dev *hdmitx_device); + int (*cntlpower)(struct hdmitx_dev *hdmitx_device, + unsigned int cmd, unsigned int arg); /* edid/hdcp control */ - int (*CntlDDC)(struct hdmitx_dev *hdmitx_device, - unsigned int cmd, unsigned long arg); + int (*cntlddc)(struct hdmitx_dev *hdmitx_device, + unsigned int cmd, unsigned long arg); /* Audio/Video/System Status */ - int (*GetState)(struct hdmitx_dev *hdmitx_device, - unsigned int cmd, unsigned int arg); - int (*CntlPacket)(struct hdmitx_dev *hdmitx_device, - unsigned int cmd, - unsigned int arg); /* Packet control */ - int (*CntlConfig)(struct hdmitx_dev *hdmitx_device, - unsigned int cmd, - unsigned int arg); /* Configure control */ - int (*CntlMisc)(struct hdmitx_dev *hdmitx_device, - unsigned int cmd, unsigned int arg); /* Other control */ - int (*Cntl)(struct hdmitx_dev *hdmitx_device, unsigned int cmd, - unsigned int arg); /* Other control */ - } HWOp; + int (*getstate)(struct hdmitx_dev *hdmitx_device, + unsigned int cmd, unsigned int arg); + int (*cntlpacket)(struct hdmitx_dev *hdmitx_device, + unsigned int cmd, + unsigned int arg); /* Packet control */ + int (*cntlconfig)(struct hdmitx_dev *hdmitx_device, + unsigned int cmd, + unsigned int arg); /* Configure control */ + int (*cntlmisc)(struct hdmitx_dev *hdmitx_device, + unsigned int cmd, unsigned int arg); + int (*cntl)(struct hdmitx_dev *hdmitx_device, unsigned int cmd, + unsigned int arg); /* Other control */ + } hwop; struct { unsigned int hdcp14_en; unsigned int hdcp14_rslt; @@ -401,7 +402,7 @@ struct hdmitx_dev { unsigned char *edid_ptr; unsigned int edid_parsing; /* Indicator that RX edid data integrated */ unsigned char EDID_hash[20]; - struct rx_cap RXCap; + struct rx_cap rxcap; struct hdmitx_vidpara *cur_video_param; int vic_count; struct hdmitx_clk_tree_s hdmitx_clk_tree; @@ -467,6 +468,7 @@ struct hdmitx_dev { unsigned int hdmi_current_hdr_mode; unsigned int dv_src_feature; unsigned int sdr_hdr_feature; + unsigned int hdr10plus_feature; enum eotf_type hdmi_current_eotf_type; enum mode_type hdmi_current_tunnel_mode; unsigned int flag_3dfp:1; @@ -485,7 +487,7 @@ struct hdmitx_dev { #define CMD_STAT_OFFSET (0x15 << 24) /*********************************************************************** - * DDC CONTROL //CntlDDC + * DDC CONTROL //cntlddc **********************************************************************/ #define DDC_RESET_EDID (CMD_DDC_OFFSET + 0x00) #define DDC_RESET_HDCP (CMD_DDC_OFFSET + 0x01) @@ -515,7 +517,7 @@ struct hdmitx_dev { #define DDC_HDCP14_SAVE_OBS (CMD_DDC_OFFSET + 0x40) /*********************************************************************** - * CONFIG CONTROL //CntlConfig + * CONFIG CONTROL //cntlconfig **********************************************************************/ /* Video part */ #define CONF_HDMI_DVI_MODE (CMD_CONF_OFFSET + 0x02) @@ -560,7 +562,7 @@ struct hdmitx_dev { #define CONF_CLR_AUDINFO_PACKET (CMD_CONF_OFFSET + 0x1000 + 0x01) /*********************************************************************** - * MISC control, hpd, hpll //CntlMisc + * MISC control, hpd, hpll //cntlmisc **********************************************************************/ #define MISC_HPD_MUX_OP (CMD_MISC_OFFSET + 0x00) #define MISC_HPD_GPI_ST (CMD_MISC_OFFSET + 0x02) @@ -596,7 +598,7 @@ struct hdmitx_dev { #define MISC_TRIGGER_HPD (CMD_MISC_OFFSET + 0X14) /*********************************************************************** - * Get State //GetState + * Get State //getstate **********************************************************************/ #define STAT_VIDEO_VIC (CMD_STAT_OFFSET + 0x00) #define STAT_VIDEO_CLK (CMD_STAT_OFFSET + 0x01) diff --git a/include/linux/amlogic/media/vout/vinfo.h b/include/linux/amlogic/media/vout/vinfo.h index 82c630d..15afa9f 100644 --- a/include/linux/amlogic/media/vout/vinfo.h +++ b/include/linux/amlogic/media/vout/vinfo.h @@ -151,6 +151,10 @@ enum mode_type { #define DV_IEEE_OUI 0x00D046 #define HDR10_PLUS_IEEE_OUI 0x90848B +#define HDR10_PLUS_DISABLE_VSIF 0 +#define HDR10_PLUS_ENABLE_VSIF 1 +#define HDR10_PLUS_ZERO_VSIF 2 + /* Dolby Version VSIF parameter*/ struct dv_vsif_para {