[Openchrome-devel] xf86-video-openchrome: 4 commits - configure.ac src/via_lvds.c src/via_tmds.c

Kevin Brace kevinbrace at kemper.freedesktop.org
Fri Sep 2 06:50:24 UTC 2016


 configure.ac   |    2 -
 src/via_lvds.c |   50 ++++++++++++++++++++++++++++++++++++++++++++----
 src/via_tmds.c |   59 +++++++++++++++++++++++++++++++++++++++++++++++++++++----
 3 files changed, 102 insertions(+), 9 deletions(-)

New commits:
commit daadf39ae6e2207a9dd6eb573f3d203e9f84b0a7
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Sep 1 23:40:38 2016 -0700

    Version bumped to 0.5.150
    
    This version fixes a bug where turning off an LVDS FP (Flat Panel)
    when the DVI coming off of an integrated TMDS transmitter is in
    use will turn off both display devices. Also, older chipsets like
    CLE266, KM400, and K8M800 chipset families will now execute a
    different code path (legacy code) when turning on / off the FP
    than the newer devices.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/configure.ac b/configure.ac
index 0ab513d..9b5e4fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ(2.57)
 AC_INIT([xf86-video-openchrome],
-        [0.5.149],
+        [0.5.150],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/openchrome],
         [xf86-video-openchrome])
 
commit fab6c684086da1ab3e3ee3806da0208becddbf80
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Sep 1 23:20:35 2016 -0700

    Changes in FP turn on / off code behavior
    
    There are still number of issues with the FP (Flat Panel) code, but
    did a temporary fix to relegate the use of old FP turn on / off code
    to CLE266, KM400, and K8M800 chipset families.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_lvds.c b/src/via_lvds.c
index f845334..cf9a121 100644
--- a/src/via_lvds.c
+++ b/src/via_lvds.c
@@ -465,13 +465,14 @@ ViaLVDSPower(ScrnInfoPtr pScrn, Bool Power_On)
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Entered ViaLVDSPower.\n"));
+
     /*
      * VX800, CX700 have HW issue, so we'd better use SW power sequence
      * Fix Ticket #308
      */
     switch (pVia->Chipset) {
-    case VIA_VX800:
     case VIA_CX700:
+    case VIA_VX800:
 
         /* Is the integrated TMDS transmitter (DVI) not in use? */
         crd2 = hwp->readCrtc(hwp, 0xD2);
@@ -485,7 +486,9 @@ ViaLVDSPower(ScrnInfoPtr pScrn, Bool Power_On)
 
         ViaLVDSSoftwarePowerSecondSequence(pScrn, Power_On);
         break;
-    default:
+
+    case VIA_VX855:
+    case VIA_VX900:
         /* Is the integrated TMDS transmitter (DVI) not in use? */
         crd2 = hwp->readCrtc(hwp, 0xD2);
         if (((pVia->Chipset == VIA_CX700)
@@ -498,6 +501,10 @@ ViaLVDSPower(ScrnInfoPtr pScrn, Bool Power_On)
 
         ViaLVDSHardwarePowerSecondSequence(pScrn, Power_On);
         break;
+    default:
+        ViaLVDSHardwarePowerFirstSequence(pScrn, Power_On);
+        ViaLVDSHardwarePowerSecondSequence(pScrn, Power_On);
+        break;
     }
 
     ViaLVDSPowerChannel(pScrn, Power_On);
@@ -895,6 +902,10 @@ via_lvds_dpms(xf86OutputPtr output, int mode)
     switch (mode) {
     case DPMSModeOn:
         switch (pVia->Chipset) {
+        case VIA_PM800:
+        case VIA_P4M800PRO:
+        case VIA_P4M890:
+        case VIA_K8M890:
         case VIA_P4M900:
         case VIA_CX700:
         case VIA_VX800:
@@ -902,14 +913,21 @@ via_lvds_dpms(xf86OutputPtr output, int mode)
         case VIA_VX900:
             ViaLVDSPower(pScrn, TRUE);
             break;
+        default:
+            ViaLCDPower(output, TRUE);
+            break;
         }
-        ViaLCDPower(output, TRUE);
+
         break;
 
     case DPMSModeStandby:
     case DPMSModeSuspend:
     case DPMSModeOff:
         switch (pVia->Chipset) {
+        case VIA_PM800:
+        case VIA_P4M800PRO:
+        case VIA_P4M890:
+        case VIA_K8M890:
         case VIA_P4M900:
         case VIA_CX700:
         case VIA_VX800:
@@ -917,8 +935,11 @@ via_lvds_dpms(xf86OutputPtr output, int mode)
         case VIA_VX900:
             ViaLVDSPower(pScrn, FALSE);
             break;
+        default:
+            ViaLCDPower(output, FALSE);
+            break;
         }
-        ViaLCDPower(output, FALSE);
+
         break;
     }
 }
commit 4715d9661ffbdd4499200b0e751c6c72621eeee9
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Sep 1 23:18:40 2016 -0700

    Not turning on / off integrated TMDS / LVDS1 if TMDS is in use
    
    While this code is somewhat of a short term fix, if the integrated
    TMDS / LVDS1 transmitter is not in use, the FP (Flat Panel) code
    will not manage turning the circuitry on / off. This affects CX700
    chipset through VX900 chipset.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_lvds.c b/src/via_lvds.c
index a73a692..f845334 100644
--- a/src/via_lvds.c
+++ b/src/via_lvds.c
@@ -459,7 +459,9 @@ ViaLVDSPowerChannel(ScrnInfoPtr pScrn, Bool on)
 static void
 ViaLVDSPower(ScrnInfoPtr pScrn, Bool Power_On)
 {
+    vgaHWPtr hwp = VGAHWPTR(pScrn);
     VIAPtr pVia = VIAPTR(pScrn);
+    CARD8 crd2;
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Entered ViaLVDSPower.\n"));
@@ -470,11 +472,30 @@ ViaLVDSPower(ScrnInfoPtr pScrn, Bool Power_On)
     switch (pVia->Chipset) {
     case VIA_VX800:
     case VIA_CX700:
-        ViaLVDSSoftwarePowerFirstSequence(pScrn, Power_On);
+
+        /* Is the integrated TMDS transmitter (DVI) not in use? */
+        crd2 = hwp->readCrtc(hwp, 0xD2);
+        if (((pVia->Chipset == VIA_CX700)
+                || (pVia->Chipset == VIA_VX800)
+                || (pVia->Chipset == VIA_VX855)
+                || (pVia->Chipset == VIA_VX900))
+            && (!(crd2 & 0x10))) {
+            ViaLVDSSoftwarePowerFirstSequence(pScrn, Power_On);
+        }
+
         ViaLVDSSoftwarePowerSecondSequence(pScrn, Power_On);
         break;
     default:
-        ViaLVDSHardwarePowerFirstSequence(pScrn, Power_On);
+        /* Is the integrated TMDS transmitter (DVI) not in use? */
+        crd2 = hwp->readCrtc(hwp, 0xD2);
+        if (((pVia->Chipset == VIA_CX700)
+                || (pVia->Chipset == VIA_VX800)
+                || (pVia->Chipset == VIA_VX855)
+                || (pVia->Chipset == VIA_VX900))
+            && (!(crd2 & 0x10))) {
+            ViaLVDSHardwarePowerFirstSequence(pScrn, Power_On);
+        }
+
         ViaLVDSHardwarePowerSecondSequence(pScrn, Power_On);
         break;
     }
commit 5813b10aeff86ec139ca2c7db156fdae5ff711d5
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Sep 1 16:09:45 2016 -0700

    Integrated TMDS (DVI) code will now manage power on / off
    
    Previously, the integrated TMDS code was relying on the FP (Flat
    Panel) code to turn on the relevant circuitry. This will become
    a problem if the system does not have a FP. Now, integrated TMDS
    code will manage power on / off of the integrated TMDS transmitter.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_tmds.c b/src/via_tmds.c
index f5bf30f..7aee063 100644
--- a/src/via_tmds.c
+++ b/src/via_tmds.c
@@ -44,6 +44,23 @@
 
 
 /*
+	1. Formula:
+		2^13 X 0.0698uSec [1/14.318MHz] = 8192 X 0.0698uSec =572.1uSec
+		Timer = Counter x 572 uSec
+	2. Note:
+		0.0698 uSec is too small to compute for hardware. So we multiply a
+		reference value(2^13) to make it big enough to compute for hardware.
+	3. Note:
+		The meaning of the TD0~TD3 are count of the clock.
+		TD(sec) = (sec)/(per clock) x (count of clocks)
+*/
+#define TD0 200
+#define TD1 25
+#define TD2 0
+#define TD3 25
+
+
+/*
  * Initializes most registers related to VIA Technologies IGP
  * integrated TMDS transmitter. Synchronization polarity and
  * display output source need to be set separately. */
@@ -207,10 +224,44 @@ viaTMDSPower(ScrnInfoPtr pScrn, Bool powerState)
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Entered viaTMDSPower.\n"));
 
-    /* 3X5.D2[3] - Power Down (Active High) for DVI
-     *             0: TMDS power on
-     *             1: TMDS power down */
-    ViaCrtcMask(hwp, 0xD2, powerState ? 0x00 : 0x08, 0x08);
+    if (powerState) {
+        /* 3X5.91[7] - Software Direct On / Off Display Period
+                       in the Panel Path
+                       0: On
+                       1: Off */
+        ViaCrtcMask(hwp, 0x91, 0x00, 0x80);
+
+        /* 3X5.91[0] - Hardware or Software Control Power Sequence
+                       1: Software Control */
+        ViaCrtcMask(hwp, 0x91, 0x01, 0x01);
+
+        usleep(TD0);
+
+        /* 3X5.91[4] - Software VDD On
+                       0: Off
+                       1: On */
+        ViaCrtcMask(hwp, 0x91, 0x10, 0x10);
+
+        usleep(TD1);
+
+        /* 3X5.91[3] - Software Data On
+                       0: Off
+                       1: On */
+        ViaCrtcMask(hwp, 0x91, 0x08, 0x08);
+
+        /* 3X5.D2[3] - Power Down (Active High) for DVI
+         *             0: TMDS power on
+         *             1: TMDS power down */
+        ViaCrtcMask(hwp, 0xD2, 0x00, 0x08);
+    } else {
+        ViaCrtcMask(hwp, 0xD2, 0x08, 0x08);
+
+        ViaCrtcMask(hwp, 0x91, 0x00, 0x08);
+
+        usleep(TD1);
+
+        ViaCrtcMask(hwp, 0x91, 0x00, 0x10);
+    }
 
     xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                 "Integrated TMDS (DVI) Power: %s\n",


More information about the Openchrome-devel mailing list