hdmitx: correct the unit of physical size [1/1]
authorZongdong Jiao <zongdong.jiao@amlogic.com>
Tue, 27 Jul 2021 11:45:30 +0000 (19:45 +0800)
committerNolen Johnson <johnsonnolen@gmail.com>
Tue, 21 Dec 2021 18:34:38 +0000 (13:34 -0500)
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>
drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_edid.c
drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main.c
drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hdmi_tx_main_drm.c
include/linux/amlogic/media/vout/hdmi_tx/hdmi_tx_module.h

index 66167b346ada58f4b46f9763da04d3e553e569c1..b8a0a78d6b921f309ecdc5c5f3e21f1b74dfad6f 100644 (file)
@@ -2102,12 +2102,13 @@ static void Edid_VersionParse(struct rx_cap *prxcap,
        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 @@ static void Edid_DTD_parsing(struct rx_cap *prxcap, unsigned char *data)
                ((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 @@ int hdmitx_edid_parse(struct hdmitx_dev *hdmitx_device)
         * 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 @@ int hdmitx_edid_parse(struct hdmitx_dev *hdmitx_device)
                hdmitx_edid_set_default_vic(hdmitx_device);
 
        return 0;
-
 }
 
 static struct dispmode_vic dispmode_vic_tab[] = {
@@ -3229,8 +3229,8 @@ int hdmitx_edid_dump(struct hdmitx_dev *hdmitx_device, char *buffer,
                "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",
index 76da86e8cd00a8832a3ef44e4a19702624b2b960..795c9d17086701a22eb0225ac0c70c739427772e 100644 (file)
@@ -483,7 +483,7 @@ static void recalc_vinfo_sync_duration(struct vinfo_s *info, unsigned int frac)
                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 @@ 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.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 @@ static int set_disp_mode_auto(void)
        /*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 @@ static void hdmitx_hpd_plugin_handler(struct work_struct *work)
                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 @@ static void hdmitx_hpd_plugout_handler(struct work_struct *work)
                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 @@ static void hdmitx_hpd_plugout_handler(struct work_struct *work)
        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);
index 88ee929e9ad49a77e847012fe0a7ac6e22a8f385..eed9f9666f05554ac8361d174cf6367836dd56e2 100644 (file)
@@ -725,7 +725,7 @@ static void recalc_vinfo_sync_duration(struct vinfo_s *info, unsigned int frac)
                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 @@ 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.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 @@ static void hdmitx_hpd_plugin_handler(struct work_struct *work)
                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 @@ static void hdmitx_hpd_plugout_handler(struct work_struct *work)
        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);
index ec507f399edff168e22a60705ce68e4a8a0f1f22..671c56a68b07e4e7bb5c5cf613ec86ce502f7295 100644 (file)
@@ -146,8 +146,8 @@ struct rx_cap {
        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;