hdmitx: correct the unit of physical size [1/1]

PD#SWPL-54362

Problem:
The physical size is cm, while the screen size is mm.
Need unify the unit.

Solution:
Correct the unit of physical size as mm.

Verify:
g12/u212

Change-Id: I0c1f3d71f2df4930d8a91f692b713ad537133a55
Signed-off-by: Zongdong Jiao <zongdong.jiao@amlogic.com>
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 66167b3..b8a0a78 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
@@ -2102,12 +2102,13 @@
 	prxcap->edid_revision = (data[1] < 0x5) ? data[1] : 0;
 }
 
-static void Edid_PhyscialSizeParse(struct rx_cap *pRxCap,
+static void Edid_PhyscialSizeParse(struct rx_cap *prxcap,
 		unsigned char *data)
 {
 	if ((data[0] != 0) && (data[1] != 0)) {
-		pRxCap->physcial_weight = data[0];
-		pRxCap->physcial_height = data[1];
+		/* Here the unit is cm, transfer to mm */
+		prxcap->physical_width  = data[0] * 10;
+		prxcap->physical_height = data[1] * 10;
 	}
 }
 
@@ -2161,7 +2162,7 @@
 		((data[10] >> 4) & 0xf);
 	t->v_sync = (((data[11] >> 0) & 0x3) << 4) + ((data[10] >> 0) & 0xf);
 	t->h_image_size = (((data[14] >> 4) & 0xf) << 8) + data[12];
-	t->v_image_size = ((data[14] & 0xf) << 8) + data[11];
+	t->v_image_size = ((data[14] & 0xf) << 8) + data[13];
 /*
  * Special handling of 1080i60hz, 1080i50hz
  */
@@ -2646,11 +2647,11 @@
 	 * and re-calculate it from the h/v image size from dtd
 	 * the unit of screen size is cm, but the unit of image size is mm
 	 */
-	if (prxcap->physcial_weight == 0 || prxcap->physcial_height == 0) {
+	if (prxcap->physical_width == 0 || prxcap->physical_height == 0) {
 		struct dtd *t = &prxcap->dtd[0];
 
-		prxcap->physcial_weight = (t->h_image_size + 5) / 10;
-		prxcap->physcial_height = (t->v_image_size + 5) / 10;
+		prxcap->physical_width  = t->h_image_size;
+		prxcap->physical_height = t->v_image_size;
 	}
 
 	/* if edid are all zeroes, or no VIC, no vesa dtd, set default vic */
@@ -2659,7 +2660,6 @@
 		hdmitx_edid_set_default_vic(hdmitx_device);
 
 	return 0;
-
 }
 
 static struct dispmode_vic dispmode_vic_tab[] = {
@@ -3229,8 +3229,8 @@
 		"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);
+		"Physcial size(mm): %d x %d\n",
+		prxcap->physical_width, prxcap->physical_height);
 
 	pos += snprintf(buffer+pos, buffer_len-pos,
 		"EDID Version: %d.%d\n",
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 76da86e..795c9d1 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
@@ -483,7 +483,7 @@
 		info->sync_duration_num, info->sync_duration_den, info->frac);
 }
 
-static void hdmi_physcial_size_update(struct hdmitx_dev *hdev)
+static void hdmi_physical_size_update(struct hdmitx_dev *hdev)
 {
 	unsigned int width, height;
 	struct vinfo_s *info = NULL;
@@ -495,17 +495,16 @@
 	}
 
 	if (info->mode == VMODE_HDMI) {
-		width = hdev->rxcap.physcial_weight;
-		height = hdev->rxcap.physcial_height;
+		width = hdev->rxcap.physical_width;
+		height = hdev->rxcap.physical_height;
 		if ((width == 0) || (height == 0)) {
 			info->screen_real_width = info->aspect_ratio_num;
 			info->screen_real_height = info->aspect_ratio_den;
 		} else {
-			/* transfer mm */
-			info->screen_real_width = width * 10;
-			info->screen_real_height = height * 10;
+			info->screen_real_width = width;
+			info->screen_real_height = height;
 		}
-		pr_info(SYS "update physcial size: %d %d\n",
+		pr_info(SYS "update physical size: %d %d\n",
 			info->screen_real_width, info->screen_real_height);
 	}
 
@@ -618,7 +617,7 @@
 	/*update hdmi checksum to vout*/
 	memcpy(info->hdmichecksum, hdev->rxcap.chksum, 10);
 
-	hdmi_physcial_size_update(hdev);
+	hdmi_physical_size_update(hdev);
 
 	/* If info->name equals to cvbs, then set mode to I mode to hdmi
 	 */
@@ -5547,7 +5546,7 @@
 		rx_repeat_hpd_state(1);
 	hdmitx_get_edid(hdev);
 	hdev->cedst_policy = hdev->cedst_en & hdev->rxcap.scdc_present;
-	hdmi_physcial_size_update(hdev);
+	hdmi_physical_size_update(hdev);
 	if (hdev->rxcap.ieeeoui != HDMI_IEEEOUI)
 		hdev->hwop.cntlconfig(hdev,
 			CONF_HDMI_DVI_MODE, DVI_MODE);
@@ -5647,7 +5646,7 @@
 		hdev->hdmitx_event &= ~HDMI_TX_HPD_PLUGOUT;
 		rx_edid_physical_addr(0, 0, 0, 0);
 		hdmitx_edid_clear(hdev);
-		hdmi_physcial_size_update(hdev);
+		hdmi_physical_size_update(hdev);
 		hdmitx_edid_ram_buffer_clear(hdev);
 		hdev->hpd_state = 0;
 		hdmitx_notify_hpd(hdev->hpd_state);
@@ -5675,7 +5674,7 @@
 	clear_rx_vinfo(hdev);
 	rx_edid_physical_addr(0, 0, 0, 0);
 	hdmitx_edid_clear(hdev);
-	hdmi_physcial_size_update(hdev);
+	hdmi_physical_size_update(hdev);
 	hdmitx_edid_ram_buffer_clear(hdev);
 	hdev->hpd_state = 0;
 	hdmitx_notify_hpd(hdev->hpd_state);
diff --git a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main_drm.c b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main_drm.c
index 88ee929..eed9f96 100644
--- a/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main_drm.c
+++ b/drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main_drm.c
@@ -725,7 +725,7 @@
 		info->sync_duration_num, info->sync_duration_den, info->frac);
 }
 
-static void hdmi_physcial_size_update(struct hdmitx_dev *hdev)
+static void hdmi_physical_size_update(struct hdmitx_dev *hdev)
 {
 	unsigned int width, height;
 	struct vinfo_s *info = NULL;
@@ -737,17 +737,16 @@
 	}
 
 	if (info->mode == VMODE_HDMI) {
-		width = hdev->rxcap.physcial_weight;
-		height = hdev->rxcap.physcial_height;
+		width = hdev->rxcap.physical_width;
+		height = hdev->rxcap.physical_height;
 		if ((width == 0) || (height == 0)) {
 			info->screen_real_width = info->aspect_ratio_num;
 			info->screen_real_height = info->aspect_ratio_den;
 		} else {
-			/* transfer mm */
-			info->screen_real_width = width * 10;
-			info->screen_real_height = height * 10;
+			info->screen_real_width = width;
+			info->screen_real_height = height;
 		}
-		pr_info(SYS "update physcial size: %d %d\n",
+		pr_info(SYS "update physical size: %d %d\n",
 			info->screen_real_width, info->screen_real_height);
 	}
 }
@@ -5194,7 +5193,7 @@
 		rx_repeat_hpd_state(1);
 	hdmitx_get_edid(hdev);
 	hdev->cedst_policy = hdev->cedst_en & hdev->rxcap.scdc_present;
-	hdmi_physcial_size_update(hdev);
+	hdmi_physical_size_update(hdev);
 	if (hdev->rxcap.ieeeoui != HDMI_IEEEOUI)
 		hdev->hwop.cntlconfig(hdev,
 			CONF_HDMI_DVI_MODE, DVI_MODE);
@@ -5284,7 +5283,7 @@
 	clear_rx_vinfo(hdev);
 	rx_edid_physical_addr(0, 0, 0, 0);
 	hdmitx_edid_clear(hdev);
-	hdmi_physcial_size_update(hdev);
+	hdmi_physical_size_update(hdev);
 	hdmitx_edid_ram_buffer_clear(hdev);
 	hdev->hpd_state = 0;
 	hdmitx_notify_hpd(hdev->hpd_state, NULL);
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 ec507f3..671c56a 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
@@ -146,8 +146,8 @@
 	unsigned char ReceiverProductName[16];
 	unsigned char manufacture_week;
 	unsigned char manufacture_year;
-	unsigned char physcial_weight;
-	unsigned char physcial_height;
+	unsigned short physical_width;
+	unsigned short physical_height;
 	unsigned char edid_version;
 	unsigned char edid_revision;
 	unsigned char ColorDeepSupport;