[Openchrome-devel] xf86-video-openchrome: src/via_lvds.c

Kevin Brace kevinbrace at kemper.freedesktop.org
Sun Mar 6 11:43:39 UTC 2016


 src/via_lvds.c |   43 +++++++++++++++++++++++++++++++++++--------
 1 file changed, 35 insertions(+), 8 deletions(-)

New commits:
commit 7dd217502d91ffecfc857c4337893e826ffd00bd
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Sun Mar 6 02:27:28 2016 -0800

    Fixing the misdetection of NanoBook flat panel
    
    It was observed in a VIA Technologies NanoBook based laptop computer
    that the flat panel it contains is not connected to an I2C bus, hence
    the supported screen resolution cannot be determined via an I2C bus.
    Furthermore, the code was obtaining EDID information via I2C bus 2, but
    it was not scrutinizing the interface type. Hence, if a VGA monitor
    is connected to the computer, the code was determining the flat panel
    screen resolution based on the EDID information obtained from the VGA
    monitor via I2C bus 2. Due to all of these issues, the flat panel
    screen color was going completely white, making the flat panel
    completely useless. Thanks to this fix, the flat panel and a VGA
    monitor can now be detected correctly.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_lvds.c b/src/via_lvds.c
index 073cef6..09c5763 100644
--- a/src/via_lvds.c
+++ b/src/via_lvds.c
@@ -485,28 +485,55 @@ ViaPanelGetSizeFromDDCv1(xf86OutputPtr output, int *width, int *height)
     VIAPtr pVia = VIAPTR(pScrn);
     xf86MonPtr pMon;
 
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAGetPanelSizeFromDDCv1\n"));
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered VIAGetPanelSizeFromDDCv1.\n"));
 
-    if (!(pVia->I2CDevices & VIA_I2C_BUS2))
+    if (!pVia->pI2CBus2) {
+        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                    "I2C Bus 2 does not exist.\n");
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Exiting VIAGetPanelSizeFromDDCv1.\n"));
         return FALSE;
+    }
 
-    if (!xf86I2CProbeAddress(pVia->pI2CBus2, 0xA0))
+    if (!xf86I2CProbeAddress(pVia->pI2CBus2, 0xA0)) {
+        xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+                    "I2C device on I2C Bus 2 does not support EDID.\n");
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Exiting VIAGetPanelSizeFromDDCv1.\n"));
         return FALSE;
+    }
 
-    pMon = xf86DoEEDID(XF86_SCRN_ARG(pScrn), pVia->pI2CBus2, TRUE);
-    if (!pMon)
+    /* Probe I2C Bus 2 to see if a flat panel is connected. */
+    xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+                "Probing for a flat panel on I2C Bus 2.\n");
+    pMon = xf86OutputGetEDID(output, pVia->pI2CBus2);
+    if (pMon && DIGITAL(pMon->features.input_type)) {
+        xf86OutputSetEDID(output, pMon);
+        xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+                    "Detected a flat panel on I2C Bus 2.\n");
+    } else {
+        xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+                    "Did not detect a flat panel on I2C Bus 2.\n");
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Exiting VIAGetPanelSizeFromDDCv1.\n"));
         return FALSE;
 
-    xf86OutputSetEDID(output, pMon);
+    }
 
     if (!ViaPanelGetSizeFromEDID(pScrn, pMon, width, height)) {
         xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                   "Unable to read PanelSize from EDID information\n");
+                    "Unable to obtain panel size from EDID information.\n");
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Exiting VIAGetPanelSizeFromDDCv1.\n"));
         return FALSE;
     }
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                     "VIAGetPanelSizeFromDDCv1: (%dx%d)\n", *width, *height));
+                        "VIAGetPanelSizeFromDDCv1: (%d X %d)\n",
+                        *width, *height));
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting VIAGetPanelSizeFromDDCv1.\n"));
     return TRUE;
 }
 


More information about the Openchrome-devel mailing list