[Openchrome-devel] xf86-video-openchrome: 12 commits - configure.ac src/via_analog.c src/via_sii164.c src/via_tmds.c src/via_ums.h src/via_vt1632.c

Kevin Brace kevinbrace at kemper.freedesktop.org
Fri Sep 23 06:19:09 UTC 2016


 configure.ac     |    2 
 src/via_analog.c |   10 -
 src/via_sii164.c |  490 +------------------------------------------------------
 src/via_tmds.c   |  490 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 src/via_ums.h    |    6 
 src/via_vt1632.c |  482 +-----------------------------------------------------
 6 files changed, 514 insertions(+), 966 deletions(-)

New commits:
commit c4c17e8e3395221dccb8e6f922e55b7fc3037ea0
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Sep 22 01:07:52 2016 -0700

    Version bumped to 0.5.159
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/configure.ac b/configure.ac
index 8192014..f93bb42 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ(2.57)
 AC_INIT([xf86-video-openchrome],
-        [0.5.158],
+        [0.5.159],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/openchrome],
         [xf86-video-openchrome])
 
commit e43dc9078336ea6f2ede9d48f0f5159eb92dede1
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Sep 22 01:06:37 2016 -0700

    Changed the way integrated TMDS transmitter detects DVI presence
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_tmds.c b/src/via_tmds.c
index 8c0cdbb..21b6cac 100644
--- a/src/via_tmds.c
+++ b/src/via_tmds.c
@@ -192,24 +192,31 @@ static Bool
 viaTMDSSense(ScrnInfoPtr pScrn)
 {
     vgaHWPtr hwp = VGAHWPTR(pScrn);
-    CARD8 sr1a;
-    Bool tmdsReceiverDetected = FALSE;
+    VIAPtr pVia = VIAPTR(pScrn);
+    CARD8 tmdsReceiverDetected = 0x00;
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Entered viaTMDSSense.\n"));
 
-    /* Detect the presence of DVI. */
-    /* 3C5.1A[4] - DVI Sense
-     *             0: No connect
-     *             1: Connected */
-    sr1a = hwp->readSeq(hwp, 0x1A);
-    if (sr1a & 0x10) {
-        tmdsReceiverDetected = TRUE;
+    if (pVia->Chipset == VIA_CX700) {
+        /* Detect the presence of DVI. */
+        /* 3C5.1A[4] - DVI Sense
+         *             0: No connect
+         *             1: Connected */
+        tmdsReceiverDetected = (hwp->readSeq(hwp, 0x1A) >> 4) & 0x01;
+    } else if ((pVia->Chipset == VIA_VX800)
+                || (pVia->Chipset == VIA_VX855)
+                || (pVia->Chipset == VIA_VX900)) {
+        /* Detect the presence of DVI. */
+        /* 3C5.3E[5] - Integrated DVI Sense
+         *             0: No connect
+         *             1: Connected */
+        tmdsReceiverDetected = (hwp->readSeq(hwp, 0x3E) >> 5) & 0x01;
     }
 
     xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                 "Integrated TMDS transmitter %s a TMDS receiver.\n",
-                tmdsReceiverDetected ? "detected" : "did not detect");
+                (tmdsReceiverDetected & 0x01) ? "detected" : "did not detect");
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Exiting viaTMDSSense.\n"));
commit c907c1c8552a814d9f4a183d9851b3b39255c86d
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Sep 22 00:32:54 2016 -0700

    Version bumped to 0.5.158
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/configure.ac b/configure.ac
index 6f58d60..8192014 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ(2.57)
 AC_INIT([xf86-video-openchrome],
-        [0.5.157],
+        [0.5.158],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/openchrome],
         [xf86-video-openchrome])
 
commit 5f01c7e1df141f6fb1a62041950fdf3113abab89
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Sep 22 00:28:27 2016 -0700

    Created viaExtTMDSSetDataDriveStrength
    
    viaExtTMDSSetDataDriveStrength function is meant to replace
    viaVT1632SetDataDriveStrength and viaSiI164SetDataDriveStrength
    functions.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_sii164.c b/src/via_sii164.c
index f8432a3..0f49258 100644
--- a/src/via_sii164.c
+++ b/src/via_sii164.c
@@ -33,106 +33,6 @@
 #include "via_sii164.h"
 
 static void
-viaSiI164SetDataDriveStrength(ScrnInfoPtr pScrn, CARD8 dataDriveStrength)
-{
-    vgaHWPtr hwp = VGAHWPTR(pScrn);
-    VIAPtr pVia = VIAPTR(pScrn);
-    CARD8 sr12, sr13, sr5a;
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Entered viaSiI164SetDataDriveStrength.\n"));
-
-    if ((pVia->Chipset == VIA_CX700)
-        || (pVia->Chipset == VIA_VX800)
-        || (pVia->Chipset == VIA_VX855)
-        || (pVia->Chipset == VIA_VX900)) {
-
-        sr5a = hwp->readSeq(hwp, 0x5A);
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "SR5A: 0x%02X\n", sr5a));
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "Setting 3C5.5A[0] to 0.\n"));
-        ViaSeqMask(hwp, 0x5A, sr5a & 0xFE, 0x01);
-    }
-
-    sr12 = hwp->readSeq(hwp, 0x12);
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "SR12: 0x%02X\n", sr12));
-    sr13 = hwp->readSeq(hwp, 0x13);
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "SR13: 0x%02X\n", sr13));
-    switch (pVia->Chipset) {
-    case VIA_CLE266:
-        /* 3C5.12[5] - FPD18 pin strapping
-         *             0: DIP0 (Digital Interface Port 0) is used by
-         *                a TMDS transmitter (DVI)
-         *             1: DIP0 (Digital Interface Port 0) is used by
-         *                a TV encoder */
-        if (!(sr12 & 0x20)) {
-            viaDIP0SetDataDriveStrength(pScrn, dataDriveStrength);
-        }
-
-        break;
-    case VIA_KM400:
-    case VIA_K8M800:
-    case VIA_PM800:
-    case VIA_P4M800PRO:
-        /* 3C5.12[6] - DVP0D6 pin strapping
-         *             0: Disable DVP0 (Digital Video Port 0)
-         *             1: Enable DVP0 (Digital Video Port 0)
-         * 3C5.12[5] - DVP0D5 pin strapping
-         *             0: DVP0 is used by a TMDS transmitter (DVI)
-         *             1: DVP0 is used by a TV encoder */
-        if ((sr12 & 0x40) && (!(sr12 & 0x20))) {
-            viaDVP0SetDataDriveStrength(pScrn, dataDriveStrength);
-        }
-
-        break;
-    case VIA_P4M890:
-    case VIA_K8M890:
-    case VIA_P4M900:
-        /* 3C5.12[6] - FPD6 pin strapping
-         *             0: Disable DVP0 (Digital Video Port 0)
-         *             1: Enable DVP0 (Digital Video Port 0)
-         * 3C5.12[5] - FPD5 pin strapping
-         *             0: DVP0 is used by a TMDS transmitter (DVI)
-         *             1: DVP0 is used by a TV encoder */
-        if ((sr12 & 0x40) && (!(sr12 & 0x20))) {
-            viaDVP0SetDataDriveStrength(pScrn, dataDriveStrength);
-        }
-
-        break;
-    case VIA_CX700:
-    case VIA_VX800:
-    case VIA_VX855:
-    case VIA_VX900:
-        /* 3C5.13[6] - DVP1 DVP / capture port selection
-         *             0: DVP1 is used as a DVP (Digital Video Port)
-         *             1: DVP1 is used as a capture port */
-        if (!(sr13 & 0x40)) {
-            viaDVP1SetDataDriveStrength(pScrn, dataDriveStrength);
-        }
-
-        break;
-    default:
-        break;
-    }
-
-    if ((pVia->Chipset == VIA_CX700)
-        || (pVia->Chipset == VIA_VX800)
-        || (pVia->Chipset == VIA_VX855)
-        || (pVia->Chipset == VIA_VX900)) {
-
-        hwp->writeSeq(hwp, 0x5A, sr5a);
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "Restoring 3C5.5A[0].\n"));
-    }
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Exiting viaSiI164SetDataDriveStrength.\n"));
-}
-
-static void
 viaSiI164DumpRegisters(ScrnInfoPtr pScrn, I2CDevPtr pDev)
 {
     int i;
@@ -374,7 +274,7 @@ via_sii164_mode_set(xf86OutputPtr output, DisplayModePtr mode,
 
     if (output->crtc) {
         viaExtTMDSSetClockDriveStrength(pScrn, 0x03);
-        viaSiI164SetDataDriveStrength(pScrn, 0x03);
+        viaExtTMDSSetDataDriveStrength(pScrn, 0x03);
         viaExtTMDSEnableIOPads(pScrn, 0x03);
 
         viaSiI164DumpRegisters(pScrn, pSiI164Rec->SiI164I2CDev);
diff --git a/src/via_tmds.c b/src/via_tmds.c
index d326bf7..8c0cdbb 100644
--- a/src/via_tmds.c
+++ b/src/via_tmds.c
@@ -634,6 +634,106 @@ viaExtTMDSSetClockDriveStrength(ScrnInfoPtr pScrn, CARD8 clockDriveStrength)
                         "Exiting viaExtTMDSSetClockDriveStrength.\n"));
 }
 
+void
+viaExtTMDSSetDataDriveStrength(ScrnInfoPtr pScrn, CARD8 dataDriveStrength)
+{
+    vgaHWPtr hwp = VGAHWPTR(pScrn);
+    VIAPtr pVia = VIAPTR(pScrn);
+    CARD8 sr12, sr13, sr5a;
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered viaExtTMDSSetDataDriveStrength.\n"));
+
+    if ((pVia->Chipset == VIA_CX700)
+        || (pVia->Chipset == VIA_VX800)
+        || (pVia->Chipset == VIA_VX855)
+        || (pVia->Chipset == VIA_VX900)) {
+
+        sr5a = hwp->readSeq(hwp, 0x5A);
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "SR5A: 0x%02X\n", sr5a));
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Setting 3C5.5A[0] to 0.\n"));
+        ViaSeqMask(hwp, 0x5A, sr5a & 0xFE, 0x01);
+    }
+
+    sr12 = hwp->readSeq(hwp, 0x12);
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "SR12: 0x%02X\n", sr12));
+    sr13 = hwp->readSeq(hwp, 0x13);
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "SR13: 0x%02X\n", sr13));
+    switch (pVia->Chipset) {
+    case VIA_CLE266:
+        /* 3C5.12[5] - FPD18 pin strapping
+         *             0: DIP0 (Digital Interface Port 0) is used by
+         *                a TMDS transmitter (DVI)
+         *             1: DIP0 (Digital Interface Port 0) is used by
+         *                a TV encoder */
+        if (!(sr12 & 0x20)) {
+            viaDIP0SetDataDriveStrength(pScrn, dataDriveStrength);
+        }
+
+        break;
+    case VIA_KM400:
+    case VIA_K8M800:
+    case VIA_PM800:
+    case VIA_P4M800PRO:
+        /* 3C5.12[6] - DVP0D6 pin strapping
+         *             0: Disable DVP0 (Digital Video Port 0)
+         *             1: Enable DVP0 (Digital Video Port 0)
+         * 3C5.12[5] - DVP0D5 pin strapping
+         *             0: DVP0 is used by a TMDS transmitter (DVI)
+         *             1: DVP0 is used by a TV encoder */
+        if ((sr12 & 0x40) && (!(sr12 & 0x20))) {
+            viaDVP0SetDataDriveStrength(pScrn, dataDriveStrength);
+        }
+
+        break;
+    case VIA_P4M890:
+    case VIA_K8M890:
+    case VIA_P4M900:
+        /* 3C5.12[6] - FPD6 pin strapping
+         *             0: Disable DVP0 (Digital Video Port 0)
+         *             1: Enable DVP0 (Digital Video Port 0)
+         * 3C5.12[5] - FPD5 pin strapping
+         *             0: DVP0 is used by a TMDS transmitter (DVI)
+         *             1: DVP0 is used by a TV encoder */
+        if ((sr12 & 0x40) && (!(sr12 & 0x20))) {
+            viaDVP0SetDataDriveStrength(pScrn, dataDriveStrength);
+        }
+
+        break;
+    case VIA_CX700:
+    case VIA_VX800:
+    case VIA_VX855:
+    case VIA_VX900:
+        /* 3C5.13[6] - DVP1 DVP / capture port selection
+         *             0: DVP1 is used as a DVP (Digital Video Port)
+         *             1: DVP1 is used as a capture port */
+        if (!(sr13 & 0x40)) {
+            viaDVP1SetDataDriveStrength(pScrn, dataDriveStrength);
+        }
+
+        break;
+    default:
+        break;
+    }
+
+    if ((pVia->Chipset == VIA_CX700)
+        || (pVia->Chipset == VIA_VX800)
+        || (pVia->Chipset == VIA_VX855)
+        || (pVia->Chipset == VIA_VX900)) {
+
+        hwp->writeSeq(hwp, 0x5A, sr5a);
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Restoring 3C5.5A[0].\n"));
+    }
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting viaExtTMDSSetDataDriveStrength.\n"));
+}
+
 static void
 via_tmds_create_resources(xf86OutputPtr output)
 {
diff --git a/src/via_ums.h b/src/via_ums.h
index fed6ea6..83c6d63 100644
--- a/src/via_ums.h
+++ b/src/via_ums.h
@@ -267,6 +267,8 @@ void viaExtTMDSSetDisplaySource(ScrnInfoPtr pScrn, CARD8 displaySource);
 void viaExtTMDSEnableIOPads(ScrnInfoPtr pScrn, CARD8 ioPadState);
 void viaExtTMDSSetClockDriveStrength(ScrnInfoPtr pScrn,
                                         CARD8 clockDriveStrength);
+void viaExtTMDSSetDataDriveStrength(ScrnInfoPtr pScrn,
+                                        CARD8 dataDriveStrength);
 void via_dvi_init(ScrnInfoPtr pScrn);
 
 /*via_tv.c */
diff --git a/src/via_vt1632.c b/src/via_vt1632.c
index e8902db..2369f5f 100644
--- a/src/via_vt1632.c
+++ b/src/via_vt1632.c
@@ -33,106 +33,6 @@
 #include "via_vt1632.h"
 
 static void
-viaVT1632SetDataDriveStrength(ScrnInfoPtr pScrn, CARD8 dataDriveStrength)
-{
-    vgaHWPtr hwp = VGAHWPTR(pScrn);
-    VIAPtr pVia = VIAPTR(pScrn);
-    CARD8 sr12, sr13, sr5a;
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Entered viaVT1632SetDataDriveStrength.\n"));
-
-    if ((pVia->Chipset == VIA_CX700)
-        || (pVia->Chipset == VIA_VX800)
-        || (pVia->Chipset == VIA_VX855)
-        || (pVia->Chipset == VIA_VX900)) {
-
-        sr5a = hwp->readSeq(hwp, 0x5A);
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "SR5A: 0x%02X\n", sr5a));
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "Setting 3C5.5A[0] to 0.\n"));
-        ViaSeqMask(hwp, 0x5A, sr5a & 0xFE, 0x01);
-    }
-
-    sr12 = hwp->readSeq(hwp, 0x12);
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "SR12: 0x%02X\n", sr12));
-    sr13 = hwp->readSeq(hwp, 0x13);
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "SR13: 0x%02X\n", sr13));
-    switch (pVia->Chipset) {
-    case VIA_CLE266:
-        /* 3C5.12[5] - FPD18 pin strapping
-         *             0: DIP0 (Digital Interface Port 0) is used by
-         *                a TMDS transmitter (DVI)
-         *             1: DIP0 (Digital Interface Port 0) is used by
-         *                a TV encoder */
-        if (!(sr12 & 0x20)) {
-            viaDIP0SetDataDriveStrength(pScrn, dataDriveStrength);
-        }
-
-        break;
-    case VIA_KM400:
-    case VIA_K8M800:
-    case VIA_PM800:
-    case VIA_P4M800PRO:
-        /* 3C5.12[6] - DVP0D6 pin strapping
-         *             0: Disable DVP0 (Digital Video Port 0)
-         *             1: Enable DVP0 (Digital Video Port 0)
-         * 3C5.12[5] - DVP0D5 pin strapping
-         *             0: DVP0 is used by a TMDS transmitter (DVI)
-         *             1: DVP0 is used by a TV encoder */
-        if ((sr12 & 0x40) && (!(sr12 & 0x20))) {
-            viaDVP0SetDataDriveStrength(pScrn, dataDriveStrength);
-        }
-
-        break;
-    case VIA_P4M890:
-    case VIA_K8M890:
-    case VIA_P4M900:
-        /* 3C5.12[6] - FPD6 pin strapping
-         *             0: Disable DVP0 (Digital Video Port 0)
-         *             1: Enable DVP0 (Digital Video Port 0)
-         * 3C5.12[5] - FPD5 pin strapping
-         *             0: DVP0 is used by a TMDS transmitter (DVI)
-         *             1: DVP0 is used by a TV encoder */
-        if ((sr12 & 0x40) && (!(sr12 & 0x20))) {
-            viaDVP0SetDataDriveStrength(pScrn, dataDriveStrength);
-        }
-
-        break;
-    case VIA_CX700:
-    case VIA_VX800:
-    case VIA_VX855:
-    case VIA_VX900:
-        /* 3C5.13[6] - DVP1 DVP / capture port selection
-         *             0: DVP1 is used as a DVP (Digital Video Port)
-         *             1: DVP1 is used as a capture port */
-        if (!(sr13 & 0x40)) {
-            viaDVP1SetDataDriveStrength(pScrn, dataDriveStrength);
-        }
-
-        break;
-    default:
-        break;
-    }
-
-    if ((pVia->Chipset == VIA_CX700)
-        || (pVia->Chipset == VIA_VX800)
-        || (pVia->Chipset == VIA_VX855)
-        || (pVia->Chipset == VIA_VX900)) {
-
-        hwp->writeSeq(hwp, 0x5A, sr5a);
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "Restoring 3C5.5A[0].\n"));
-    }
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Exiting viaVT1632SetDataDriveStrength.\n"));
-}
-
-static void
 viaVT1632DumpRegisters(ScrnInfoPtr pScrn, I2CDevPtr pDev)
 {
     int i;
@@ -387,7 +287,7 @@ via_vt1632_mode_set(xf86OutputPtr output, DisplayModePtr mode,
 
     if (output->crtc) {
         viaExtTMDSSetClockDriveStrength(pScrn, 0x03);
-        viaVT1632SetDataDriveStrength(pScrn, 0x03);
+        viaExtTMDSSetDataDriveStrength(pScrn, 0x03);
         viaExtTMDSEnableIOPads(pScrn, 0x03);
 
         viaVT1632DumpRegisters(pScrn, pVIAVT1632Rec->VT1632I2CDev);
commit ac234b827c899613e900a7baeb64ec8f09c4cd2d
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Sep 22 00:09:01 2016 -0700

    Created viaExtTMDSSetClockDriveStrength
    
    viaExtTMDSSetClockDriveStrength function is meant to replace
    viaVT1632SetClockDriveStrength and viaSiI164SetClockDriveStrength
    functions.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_sii164.c b/src/via_sii164.c
index ccef26a..f8432a3 100644
--- a/src/via_sii164.c
+++ b/src/via_sii164.c
@@ -33,106 +33,6 @@
 #include "via_sii164.h"
 
 static void
-viaSiI164SetClockDriveStrength(ScrnInfoPtr pScrn, CARD8 clockDriveStrength)
-{
-    vgaHWPtr hwp = VGAHWPTR(pScrn);
-    VIAPtr pVia = VIAPTR(pScrn);
-    CARD8 sr12, sr13, sr5a;
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Entered viaSiI164SetClockDriveStrength.\n"));
-
-    if ((pVia->Chipset == VIA_CX700)
-        || (pVia->Chipset == VIA_VX800)
-        || (pVia->Chipset == VIA_VX855)
-        || (pVia->Chipset == VIA_VX900)) {
-
-        sr5a = hwp->readSeq(hwp, 0x5A);
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "SR5A: 0x%02X\n", sr5a));
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "Setting 3C5.5A[0] to 0.\n"));
-        ViaSeqMask(hwp, 0x5A, sr5a & 0xFE, 0x01);
-    }
-
-    sr12 = hwp->readSeq(hwp, 0x12);
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "SR12: 0x%02X\n", sr12));
-    sr13 = hwp->readSeq(hwp, 0x13);
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "SR13: 0x%02X\n", sr13));
-    switch (pVia->Chipset) {
-    case VIA_CLE266:
-        /* 3C5.12[5] - FPD18 pin strapping
-         *             0: DIP0 (Digital Interface Port 0) is used by
-         *                a TMDS transmitter (DVI)
-         *             1: DIP0 (Digital Interface Port 0) is used by
-         *                a TV encoder */
-        if (!(sr12 & 0x20)) {
-            viaDIP0SetClockDriveStrength(pScrn, clockDriveStrength);
-        }
-
-        break;
-    case VIA_KM400:
-    case VIA_K8M800:
-    case VIA_PM800:
-    case VIA_P4M800PRO:
-        /* 3C5.12[6] - DVP0D6 pin strapping
-         *             0: Disable DVP0 (Digital Video Port 0)
-         *             1: Enable DVP0 (Digital Video Port 0)
-         * 3C5.12[5] - DVP0D5 pin strapping
-         *             0: DVP0 is used by a TMDS transmitter (DVI)
-         *             1: DVP0 is used by a TV encoder */
-        if ((sr12 & 0x40) && (!(sr12 & 0x20))) {
-            viaDVP0SetClockDriveStrength(pScrn, clockDriveStrength);
-        }
-
-        break;
-    case VIA_P4M890:
-    case VIA_K8M890:
-    case VIA_P4M900:
-        /* 3C5.12[6] - FPD6 pin strapping
-         *             0: Disable DVP0 (Digital Video Port 0)
-         *             1: Enable DVP0 (Digital Video Port 0)
-         * 3C5.12[5] - FPD5 pin strapping
-         *             0: DVP0 is used by a TMDS transmitter (DVI)
-         *             1: DVP0 is used by a TV encoder */
-        if ((sr12 & 0x40) && (!(sr12 & 0x20))) {
-            viaDVP0SetClockDriveStrength(pScrn, clockDriveStrength);
-        }
-
-        break;
-    case VIA_CX700:
-    case VIA_VX800:
-    case VIA_VX855:
-    case VIA_VX900:
-        /* 3C5.13[6] - DVP1 DVP / capture port selection
-         *             0: DVP1 is used as a DVP (Digital Video Port)
-         *             1: DVP1 is used as a capture port */
-        if (!(sr13 & 0x40)) {
-            viaDVP1SetClockDriveStrength(pScrn, clockDriveStrength);
-        }
-
-        break;
-    default:
-        break;
-    }
-
-    if ((pVia->Chipset == VIA_CX700)
-        || (pVia->Chipset == VIA_VX800)
-        || (pVia->Chipset == VIA_VX855)
-        || (pVia->Chipset == VIA_VX900)) {
-
-        hwp->writeSeq(hwp, 0x5A, sr5a);
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "Restoring 3C5.5A[0].\n"));
-    }
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Exiting viaSiI164SetClockDriveStrength.\n"));
-}
-
-static void
 viaSiI164SetDataDriveStrength(ScrnInfoPtr pScrn, CARD8 dataDriveStrength)
 {
     vgaHWPtr hwp = VGAHWPTR(pScrn);
@@ -473,7 +373,7 @@ via_sii164_mode_set(xf86OutputPtr output, DisplayModePtr mode,
                         "Entered via_sii164_mode_set.\n"));
 
     if (output->crtc) {
-        viaSiI164SetClockDriveStrength(pScrn, 0x03);
+        viaExtTMDSSetClockDriveStrength(pScrn, 0x03);
         viaSiI164SetDataDriveStrength(pScrn, 0x03);
         viaExtTMDSEnableIOPads(pScrn, 0x03);
 
diff --git a/src/via_tmds.c b/src/via_tmds.c
index d37e779..d326bf7 100644
--- a/src/via_tmds.c
+++ b/src/via_tmds.c
@@ -534,6 +534,106 @@ viaExtTMDSEnableIOPads(ScrnInfoPtr pScrn, CARD8 ioPadState)
                         "Exiting viaExtTMDSEnableIOPads.\n"));
 }
 
+void
+viaExtTMDSSetClockDriveStrength(ScrnInfoPtr pScrn, CARD8 clockDriveStrength)
+{
+    vgaHWPtr hwp = VGAHWPTR(pScrn);
+    VIAPtr pVia = VIAPTR(pScrn);
+    CARD8 sr12, sr13, sr5a;
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered viaExtTMDSSetClockDriveStrength.\n"));
+
+    if ((pVia->Chipset == VIA_CX700)
+        || (pVia->Chipset == VIA_VX800)
+        || (pVia->Chipset == VIA_VX855)
+        || (pVia->Chipset == VIA_VX900)) {
+
+        sr5a = hwp->readSeq(hwp, 0x5A);
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "SR5A: 0x%02X\n", sr5a));
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Setting 3C5.5A[0] to 0.\n"));
+        ViaSeqMask(hwp, 0x5A, sr5a & 0xFE, 0x01);
+    }
+
+    sr12 = hwp->readSeq(hwp, 0x12);
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "SR12: 0x%02X\n", sr12));
+    sr13 = hwp->readSeq(hwp, 0x13);
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "SR13: 0x%02X\n", sr13));
+    switch (pVia->Chipset) {
+    case VIA_CLE266:
+        /* 3C5.12[5] - FPD18 pin strapping
+         *             0: DIP0 (Digital Interface Port 0) is used by
+         *                a TMDS transmitter (DVI)
+         *             1: DIP0 (Digital Interface Port 0) is used by
+         *                a TV encoder */
+        if (!(sr12 & 0x20)) {
+            viaDIP0SetClockDriveStrength(pScrn, clockDriveStrength);
+        }
+
+        break;
+    case VIA_KM400:
+    case VIA_K8M800:
+    case VIA_PM800:
+    case VIA_P4M800PRO:
+        /* 3C5.12[6] - DVP0D6 pin strapping
+         *             0: Disable DVP0 (Digital Video Port 0)
+         *             1: Enable DVP0 (Digital Video Port 0)
+         * 3C5.12[5] - DVP0D5 pin strapping
+         *             0: DVP0 is used by a TMDS transmitter (DVI)
+         *             1: DVP0 is used by a TV encoder */
+        if ((sr12 & 0x40) && (!(sr12 & 0x20))) {
+            viaDVP0SetClockDriveStrength(pScrn, clockDriveStrength);
+        }
+
+        break;
+    case VIA_P4M890:
+    case VIA_K8M890:
+    case VIA_P4M900:
+        /* 3C5.12[6] - FPD6 pin strapping
+         *             0: Disable DVP0 (Digital Video Port 0)
+         *             1: Enable DVP0 (Digital Video Port 0)
+         * 3C5.12[5] - FPD5 pin strapping
+         *             0: DVP0 is used by a TMDS transmitter (DVI)
+         *             1: DVP0 is used by a TV encoder */
+        if ((sr12 & 0x40) && (!(sr12 & 0x20))) {
+            viaDVP0SetClockDriveStrength(pScrn, clockDriveStrength);
+        }
+
+        break;
+    case VIA_CX700:
+    case VIA_VX800:
+    case VIA_VX855:
+    case VIA_VX900:
+        /* 3C5.13[6] - DVP1 DVP / capture port selection
+         *             0: DVP1 is used as a DVP (Digital Video Port)
+         *             1: DVP1 is used as a capture port */
+        if (!(sr13 & 0x40)) {
+            viaDVP1SetClockDriveStrength(pScrn, clockDriveStrength);
+        }
+
+        break;
+    default:
+        break;
+    }
+
+    if ((pVia->Chipset == VIA_CX700)
+        || (pVia->Chipset == VIA_VX800)
+        || (pVia->Chipset == VIA_VX855)
+        || (pVia->Chipset == VIA_VX900)) {
+
+        hwp->writeSeq(hwp, 0x5A, sr5a);
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Restoring 3C5.5A[0].\n"));
+    }
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting viaExtTMDSSetClockDriveStrength.\n"));
+}
+
 static void
 via_tmds_create_resources(xf86OutputPtr output)
 {
diff --git a/src/via_ums.h b/src/via_ums.h
index a1fc507..fed6ea6 100644
--- a/src/via_ums.h
+++ b/src/via_ums.h
@@ -265,6 +265,8 @@ void via_lvds_init(ScrnInfoPtr pScrn);
 /* via_tmds.c */
 void viaExtTMDSSetDisplaySource(ScrnInfoPtr pScrn, CARD8 displaySource);
 void viaExtTMDSEnableIOPads(ScrnInfoPtr pScrn, CARD8 ioPadState);
+void viaExtTMDSSetClockDriveStrength(ScrnInfoPtr pScrn,
+                                        CARD8 clockDriveStrength);
 void via_dvi_init(ScrnInfoPtr pScrn);
 
 /*via_tv.c */
diff --git a/src/via_vt1632.c b/src/via_vt1632.c
index 32803af..e8902db 100644
--- a/src/via_vt1632.c
+++ b/src/via_vt1632.c
@@ -33,106 +33,6 @@
 #include "via_vt1632.h"
 
 static void
-viaVT1632SetClockDriveStrength(ScrnInfoPtr pScrn, CARD8 clockDriveStrength)
-{
-    vgaHWPtr hwp = VGAHWPTR(pScrn);
-    VIAPtr pVia = VIAPTR(pScrn);
-    CARD8 sr12, sr13, sr5a;
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Entered viaVT1632SetClockDriveStrength.\n"));
-
-    if ((pVia->Chipset == VIA_CX700)
-        || (pVia->Chipset == VIA_VX800)
-        || (pVia->Chipset == VIA_VX855)
-        || (pVia->Chipset == VIA_VX900)) {
-
-        sr5a = hwp->readSeq(hwp, 0x5A);
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "SR5A: 0x%02X\n", sr5a));
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "Setting 3C5.5A[0] to 0.\n"));
-        ViaSeqMask(hwp, 0x5A, sr5a & 0xFE, 0x01);
-    }
-
-    sr12 = hwp->readSeq(hwp, 0x12);
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "SR12: 0x%02X\n", sr12));
-    sr13 = hwp->readSeq(hwp, 0x13);
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "SR13: 0x%02X\n", sr13));
-    switch (pVia->Chipset) {
-    case VIA_CLE266:
-        /* 3C5.12[5] - FPD18 pin strapping
-         *             0: DIP0 (Digital Interface Port 0) is used by
-         *                a TMDS transmitter (DVI)
-         *             1: DIP0 (Digital Interface Port 0) is used by
-         *                a TV encoder */
-        if (!(sr12 & 0x20)) {
-            viaDIP0SetClockDriveStrength(pScrn, clockDriveStrength);
-        }
-
-        break;
-    case VIA_KM400:
-    case VIA_K8M800:
-    case VIA_PM800:
-    case VIA_P4M800PRO:
-        /* 3C5.12[6] - DVP0D6 pin strapping
-         *             0: Disable DVP0 (Digital Video Port 0)
-         *             1: Enable DVP0 (Digital Video Port 0)
-         * 3C5.12[5] - DVP0D5 pin strapping
-         *             0: DVP0 is used by a TMDS transmitter (DVI)
-         *             1: DVP0 is used by a TV encoder */
-        if ((sr12 & 0x40) && (!(sr12 & 0x20))) {
-            viaDVP0SetClockDriveStrength(pScrn, clockDriveStrength);
-        }
-
-        break;
-    case VIA_P4M890:
-    case VIA_K8M890:
-    case VIA_P4M900:
-        /* 3C5.12[6] - FPD6 pin strapping
-         *             0: Disable DVP0 (Digital Video Port 0)
-         *             1: Enable DVP0 (Digital Video Port 0)
-         * 3C5.12[5] - FPD5 pin strapping
-         *             0: DVP0 is used by a TMDS transmitter (DVI)
-         *             1: DVP0 is used by a TV encoder */
-        if ((sr12 & 0x40) && (!(sr12 & 0x20))) {
-            viaDVP0SetClockDriveStrength(pScrn, clockDriveStrength);
-        }
-
-        break;
-    case VIA_CX700:
-    case VIA_VX800:
-    case VIA_VX855:
-    case VIA_VX900:
-        /* 3C5.13[6] - DVP1 DVP / capture port selection
-         *             0: DVP1 is used as a DVP (Digital Video Port)
-         *             1: DVP1 is used as a capture port */
-        if (!(sr13 & 0x40)) {
-            viaDVP1SetClockDriveStrength(pScrn, clockDriveStrength);
-        }
-
-        break;
-    default:
-        break;
-    }
-
-    if ((pVia->Chipset == VIA_CX700)
-        || (pVia->Chipset == VIA_VX800)
-        || (pVia->Chipset == VIA_VX855)
-        || (pVia->Chipset == VIA_VX900)) {
-
-        hwp->writeSeq(hwp, 0x5A, sr5a);
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "Restoring 3C5.5A[0].\n"));
-    }
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Exiting viaVT1632SetClockDriveStrength.\n"));
-}
-
-static void
 viaVT1632SetDataDriveStrength(ScrnInfoPtr pScrn, CARD8 dataDriveStrength)
 {
     vgaHWPtr hwp = VGAHWPTR(pScrn);
@@ -486,7 +386,7 @@ via_vt1632_mode_set(xf86OutputPtr output, DisplayModePtr mode,
                         "Entered via_vt1632_mode_set.\n"));
 
     if (output->crtc) {
-        viaVT1632SetClockDriveStrength(pScrn, 0x03);
+        viaExtTMDSSetClockDriveStrength(pScrn, 0x03);
         viaVT1632SetDataDriveStrength(pScrn, 0x03);
         viaExtTMDSEnableIOPads(pScrn, 0x03);
 
commit 64f1dc0a974906a99448294c57378eacbacecccf
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Wed Sep 21 23:54:26 2016 -0700

    Created viaExtTMDSEnableIOPads
    
    viaExtTMDSEnableIOPads function is meant to replace
    viaVT1632EnableIOPads and viaSiI164EnableIOPads functions.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_sii164.c b/src/via_sii164.c
index f623571..ccef26a 100644
--- a/src/via_sii164.c
+++ b/src/via_sii164.c
@@ -33,138 +33,6 @@
 #include "via_sii164.h"
 
 static void
-viaSiI164EnableIOPads(ScrnInfoPtr pScrn, CARD8 ioPadState)
-{
-
-    vgaHWPtr hwp = VGAHWPTR(pScrn);
-    VIAPtr pVia = VIAPTR(pScrn);
-    CARD8 sr12, sr13, sr5a;
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Entered viaSiI164EnableIOPads.\n"));
-
-    if ((pVia->Chipset == VIA_CX700)
-        || (pVia->Chipset == VIA_VX800)
-        || (pVia->Chipset == VIA_VX855)
-        || (pVia->Chipset == VIA_VX900)) {
-
-        sr5a = hwp->readSeq(hwp, 0x5A);
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "SR5A: 0x%02X\n", sr5a));
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "Setting 3C5.5A[0] to 0.\n"));
-        ViaSeqMask(hwp, 0x5A, sr5a & 0xFE, 0x01);
-    }
-
-    sr12 = hwp->readSeq(hwp, 0x12);
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "SR12: 0x%02X\n", sr12));
-    sr13 = hwp->readSeq(hwp, 0x13);
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "SR13: 0x%02X\n", sr13));
-    switch (pVia->Chipset) {
-    case VIA_CLE266:
-        /* 3C5.12[5] - FPD18 pin strapping
-         *             0: DIP0 (Digital Interface Port 0) is used by
-         *                a TMDS transmitter (DVI)
-         *             1: DIP0 (Digital Interface Port 0) is used by
-         *                a TV encoder */
-        if (!(sr12 & 0x20)) {
-            viaDIP0EnableIOPads(pScrn, ioPadState);
-        } else {
-            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                        "DIP0 was not set up for "
-                        "TMDS transmitter use.\n");
-        }
-
-        break;
-    case VIA_KM400:
-    case VIA_K8M800:
-    case VIA_PM800:
-    case VIA_P4M800PRO:
-        /* 3C5.13[3] - DVP0D8 pin strapping
-         *             0: AGP pins are used for AGP
-         *             1: AGP pins are used by FPDP
-         *                (Flat Panel Display Port)
-         * 3C5.12[6] - DVP0D6 pin strapping
-         *             0: Disable DVP0 (Digital Video Port 0)
-         *             1: Enable DVP0 (Digital Video Port 0)
-         * 3C5.12[5] - DVP0D5 pin strapping
-         *             0: DVP0 is used by a TMDS transmitter (DVI)
-         *             1: DVP0 is used by a TV encoder
-         * 3C5.12[4] - DVP0D4 pin strapping
-         *             0: Dual 12-bit FPDP (Flat Panel Display Port)
-         *             1: 24-bit FPDP (Flat Panel Display Port) */
-        if ((sr12 & 0x40) && (!(sr12 & 0x20))) {
-            viaDVP0EnableIOPads(pScrn, ioPadState);
-        } else if ((sr13 & 0x08) && (!(sr12 & 0x10))) {
-            viaDFPLowEnableIOPads(pScrn, ioPadState);
-        } else {
-            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                        "None of the external ports were set up for "
-                        "TMDS transmitter use.\n");
-        }
-
-        break;
-    case VIA_P4M890:
-    case VIA_K8M890:
-    case VIA_P4M900:
-        /* 3C5.12[6] - FPD6 pin strapping
-         *             0: Disable DVP0 (Digital Video Port 0)
-         *             1: Enable DVP0 (Digital Video Port 0)
-         * 3C5.12[5] - FPD5 pin strapping
-         *             0: DVP0 is used by a TMDS transmitter (DVI)
-         *             1: DVP0 is used by a TV encoder */
-        if ((sr12 & 0x40) && (!(sr12 & 0x20))) {
-            viaDVP0EnableIOPads(pScrn, ioPadState);
-        } else if (!(sr12 & 0x10)) {
-            viaDFPLowEnableIOPads(pScrn, ioPadState);
-        } else {
-            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                        "None of the external ports were set up for "
-                        "TMDS transmitter use.\n");
-        }
-
-        break;
-    case VIA_CX700:
-    case VIA_VX800:
-    case VIA_VX855:
-    case VIA_VX900:
-        /* 3C5.13[6] - DVP1 DVP / capture port selection
-         *             0: DVP1 is used as a DVP (Digital Video Port)
-         *             1: DVP1 is used as a capture port
-         */
-        if (!(sr13 & 0x40)) {
-            viaDVP1EnableIOPads(pScrn, ioPadState);
-        } else {
-            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                        "DVP1 is not set up for TMDS "
-                        "transmitter use.\n");
-        }
-
-        break;
-    default:
-        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                    "Unrecognized IGP for "
-                    "TMDS transmitter use.\n");
-        break;
-    }
-
-    if ((pVia->Chipset == VIA_CX700)
-        || (pVia->Chipset == VIA_VX800)
-        || (pVia->Chipset == VIA_VX855)
-        || (pVia->Chipset == VIA_VX900)) {
-
-        hwp->writeSeq(hwp, 0x5A, sr5a);
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "Restoring 3C5.5A[0].\n"));
-    }
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Exiting viaSiI164EnableIOPads.\n"));
-}
-
-static void
 viaSiI164SetClockDriveStrength(ScrnInfoPtr pScrn, CARD8 clockDriveStrength)
 {
     vgaHWPtr hwp = VGAHWPTR(pScrn);
@@ -607,7 +475,7 @@ via_sii164_mode_set(xf86OutputPtr output, DisplayModePtr mode,
     if (output->crtc) {
         viaSiI164SetClockDriveStrength(pScrn, 0x03);
         viaSiI164SetDataDriveStrength(pScrn, 0x03);
-        viaSiI164EnableIOPads(pScrn, 0x03);
+        viaExtTMDSEnableIOPads(pScrn, 0x03);
 
         viaSiI164DumpRegisters(pScrn, pSiI164Rec->SiI164I2CDev);
         viaSiI164InitRegisters(pScrn, pSiI164Rec->SiI164I2CDev);
diff --git a/src/via_tmds.c b/src/via_tmds.c
index 7fc7575..d37e779 100644
--- a/src/via_tmds.c
+++ b/src/via_tmds.c
@@ -402,6 +402,138 @@ viaExtTMDSSetDisplaySource(ScrnInfoPtr pScrn, CARD8 displaySource)
                         "Exiting viaExtTMDSSetDisplaySource.\n"));
 }
 
+void
+viaExtTMDSEnableIOPads(ScrnInfoPtr pScrn, CARD8 ioPadState)
+{
+
+    vgaHWPtr hwp = VGAHWPTR(pScrn);
+    VIAPtr pVia = VIAPTR(pScrn);
+    CARD8 sr12, sr13, sr5a;
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered viaExtTMDSEnableIOPads.\n"));
+
+    if ((pVia->Chipset == VIA_CX700)
+        || (pVia->Chipset == VIA_VX800)
+        || (pVia->Chipset == VIA_VX855)
+        || (pVia->Chipset == VIA_VX900)) {
+
+        sr5a = hwp->readSeq(hwp, 0x5A);
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "SR5A: 0x%02X\n", sr5a));
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Setting 3C5.5A[0] to 0.\n"));
+        ViaSeqMask(hwp, 0x5A, sr5a & 0xFE, 0x01);
+    }
+
+    sr12 = hwp->readSeq(hwp, 0x12);
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "SR12: 0x%02X\n", sr12));
+    sr13 = hwp->readSeq(hwp, 0x13);
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "SR13: 0x%02X\n", sr13));
+    switch (pVia->Chipset) {
+    case VIA_CLE266:
+        /* 3C5.12[5] - FPD18 pin strapping
+         *             0: DIP0 (Digital Interface Port 0) is used by
+         *                a TMDS transmitter (DVI)
+         *             1: DIP0 (Digital Interface Port 0) is used by
+         *                a TV encoder */
+        if (!(sr12 & 0x20)) {
+            viaDIP0EnableIOPads(pScrn, ioPadState);
+        } else {
+            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                        "DIP0 was not set up for "
+                        "TMDS transmitter use.\n");
+        }
+
+        break;
+    case VIA_KM400:
+    case VIA_K8M800:
+    case VIA_PM800:
+    case VIA_P4M800PRO:
+        /* 3C5.13[3] - DVP0D8 pin strapping
+         *             0: AGP pins are used for AGP
+         *             1: AGP pins are used by FPDP
+         *                (Flat Panel Display Port)
+         * 3C5.12[6] - DVP0D6 pin strapping
+         *             0: Disable DVP0 (Digital Video Port 0)
+         *             1: Enable DVP0 (Digital Video Port 0)
+         * 3C5.12[5] - DVP0D5 pin strapping
+         *             0: DVP0 is used by a TMDS transmitter (DVI)
+         *             1: DVP0 is used by a TV encoder
+         * 3C5.12[4] - DVP0D4 pin strapping
+         *             0: Dual 12-bit FPDP (Flat Panel Display Port)
+         *             1: 24-bit FPDP (Flat Panel Display Port) */
+        if ((sr12 & 0x40) && (!(sr12 & 0x20))) {
+            viaDVP0EnableIOPads(pScrn, ioPadState);
+        } else if ((sr13 & 0x08) && (!(sr12 & 0x10))) {
+            viaDFPLowEnableIOPads(pScrn, ioPadState);
+        } else {
+            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                        "None of the external ports were set up for "
+                        "TMDS transmitter use.\n");
+        }
+
+        break;
+    case VIA_P4M890:
+    case VIA_K8M890:
+    case VIA_P4M900:
+        /* 3C5.12[6] - FPD6 pin strapping
+         *             0: Disable DVP0 (Digital Video Port 0)
+         *             1: Enable DVP0 (Digital Video Port 0)
+         * 3C5.12[5] - FPD5 pin strapping
+         *             0: DVP0 is used by a TMDS transmitter (DVI)
+         *             1: DVP0 is used by a TV encoder */
+        if ((sr12 & 0x40) && (!(sr12 & 0x20))) {
+            viaDVP0EnableIOPads(pScrn, ioPadState);
+        } else if (!(sr12 & 0x10)) {
+            viaDFPLowEnableIOPads(pScrn, ioPadState);
+        } else {
+            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                        "None of the external ports were set up for "
+                        "TMDS transmitter use.\n");
+        }
+
+        break;
+    case VIA_CX700:
+    case VIA_VX800:
+    case VIA_VX855:
+    case VIA_VX900:
+        /* 3C5.13[6] - DVP1 DVP / capture port selection
+         *             0: DVP1 is used as a DVP (Digital Video Port)
+         *             1: DVP1 is used as a capture port
+         */
+        if (!(sr13 & 0x40)) {
+            viaDVP1EnableIOPads(pScrn, ioPadState);
+        } else {
+            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                        "DVP1 is not set up for TMDS "
+                        "transmitter use.\n");
+        }
+
+        break;
+    default:
+        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                    "Unrecognized IGP for "
+                    "TMDS transmitter use.\n");
+        break;
+    }
+
+    if ((pVia->Chipset == VIA_CX700)
+        || (pVia->Chipset == VIA_VX800)
+        || (pVia->Chipset == VIA_VX855)
+        || (pVia->Chipset == VIA_VX900)) {
+
+        hwp->writeSeq(hwp, 0x5A, sr5a);
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Restoring 3C5.5A[0].\n"));
+    }
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting viaExtTMDSEnableIOPads.\n"));
+}
+
 static void
 via_tmds_create_resources(xf86OutputPtr output)
 {
diff --git a/src/via_ums.h b/src/via_ums.h
index 094b902..a1fc507 100644
--- a/src/via_ums.h
+++ b/src/via_ums.h
@@ -264,6 +264,7 @@ void via_lvds_init(ScrnInfoPtr pScrn);
 
 /* via_tmds.c */
 void viaExtTMDSSetDisplaySource(ScrnInfoPtr pScrn, CARD8 displaySource);
+void viaExtTMDSEnableIOPads(ScrnInfoPtr pScrn, CARD8 ioPadState);
 void via_dvi_init(ScrnInfoPtr pScrn);
 
 /*via_tv.c */
diff --git a/src/via_vt1632.c b/src/via_vt1632.c
index bf810df..32803af 100644
--- a/src/via_vt1632.c
+++ b/src/via_vt1632.c
@@ -33,138 +33,6 @@
 #include "via_vt1632.h"
 
 static void
-viaVT1632EnableIOPads(ScrnInfoPtr pScrn, CARD8 ioPadState)
-{
-
-    vgaHWPtr hwp = VGAHWPTR(pScrn);
-    VIAPtr pVia = VIAPTR(pScrn);
-    CARD8 sr12, sr13, sr5a;
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Entered viaVT1632EnableIOPads.\n"));
-
-    if ((pVia->Chipset == VIA_CX700)
-        || (pVia->Chipset == VIA_VX800)
-        || (pVia->Chipset == VIA_VX855)
-        || (pVia->Chipset == VIA_VX900)) {
-
-        sr5a = hwp->readSeq(hwp, 0x5A);
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "SR5A: 0x%02X\n", sr5a));
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "Setting 3C5.5A[0] to 0.\n"));
-        ViaSeqMask(hwp, 0x5A, sr5a & 0xFE, 0x01);
-    }
-
-    sr12 = hwp->readSeq(hwp, 0x12);
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "SR12: 0x%02X\n", sr12));
-    sr13 = hwp->readSeq(hwp, 0x13);
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "SR13: 0x%02X\n", sr13));
-    switch (pVia->Chipset) {
-    case VIA_CLE266:
-        /* 3C5.12[5] - FPD18 pin strapping
-         *             0: DIP0 (Digital Interface Port 0) is used by
-         *                a TMDS transmitter (DVI)
-         *             1: DIP0 (Digital Interface Port 0) is used by
-         *                a TV encoder */
-        if (!(sr12 & 0x20)) {
-            viaDIP0EnableIOPads(pScrn, ioPadState);
-        } else {
-            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                        "DIP0 was not set up for "
-                        "TMDS transmitter use.\n");
-        }
-
-        break;
-    case VIA_KM400:
-    case VIA_K8M800:
-    case VIA_PM800:
-    case VIA_P4M800PRO:
-        /* 3C5.13[3] - DVP0D8 pin strapping
-         *             0: AGP pins are used for AGP
-         *             1: AGP pins are used by FPDP
-         *                (Flat Panel Display Port)
-         * 3C5.12[6] - DVP0D6 pin strapping
-         *             0: Disable DVP0 (Digital Video Port 0)
-         *             1: Enable DVP0 (Digital Video Port 0)
-         * 3C5.12[5] - DVP0D5 pin strapping
-         *             0: DVP0 is used by a TMDS transmitter (DVI)
-         *             1: DVP0 is used by a TV encoder
-         * 3C5.12[4] - DVP0D4 pin strapping
-         *             0: Dual 12-bit FPDP (Flat Panel Display Port)
-         *             1: 24-bit FPDP (Flat Panel Display Port) */
-        if ((sr12 & 0x40) && (!(sr12 & 0x20))) {
-            viaDVP0EnableIOPads(pScrn, ioPadState);
-        } else if ((sr13 & 0x08) && (!(sr12 & 0x10))) {
-            viaDFPLowEnableIOPads(pScrn, ioPadState);
-        } else {
-            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                        "None of the external ports were set up for "
-                        "TMDS transmitter use.\n");
-        }
-
-        break;
-    case VIA_P4M890:
-    case VIA_K8M890:
-    case VIA_P4M900:
-        /* 3C5.12[6] - FPD6 pin strapping
-         *             0: Disable DVP0 (Digital Video Port 0)
-         *             1: Enable DVP0 (Digital Video Port 0)
-         * 3C5.12[5] - FPD5 pin strapping
-         *             0: DVP0 is used by a TMDS transmitter (DVI)
-         *             1: DVP0 is used by a TV encoder */
-        if ((sr12 & 0x40) && (!(sr12 & 0x20))) {
-            viaDVP0EnableIOPads(pScrn, ioPadState);
-        } else if (!(sr12 & 0x10)) {
-            viaDFPLowEnableIOPads(pScrn, ioPadState);
-        } else {
-            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                        "None of the external ports were set up for "
-                        "TMDS transmitter use.\n");
-        }
-
-        break;
-    case VIA_CX700:
-    case VIA_VX800:
-    case VIA_VX855:
-    case VIA_VX900:
-        /* 3C5.13[6] - DVP1 DVP / capture port selection
-         *             0: DVP1 is used as a DVP (Digital Video Port)
-         *             1: DVP1 is used as a capture port
-         */
-        if (!(sr13 & 0x40)) {
-            viaDVP1EnableIOPads(pScrn, ioPadState);
-        } else {
-            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                        "DVP1 is not set up for TMDS "
-                        "transmitter use.\n");
-        }
-
-        break;
-    default:
-        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                    "Unrecognized IGP for "
-                    "TMDS transmitter use.\n");
-        break;
-    }
-
-    if ((pVia->Chipset == VIA_CX700)
-        || (pVia->Chipset == VIA_VX800)
-        || (pVia->Chipset == VIA_VX855)
-        || (pVia->Chipset == VIA_VX900)) {
-
-        hwp->writeSeq(hwp, 0x5A, sr5a);
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "Restoring 3C5.5A[0].\n"));
-    }
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Exiting viaVT1632EnableIOPads.\n"));
-}
-
-static void
 viaVT1632SetClockDriveStrength(ScrnInfoPtr pScrn, CARD8 clockDriveStrength)
 {
     vgaHWPtr hwp = VGAHWPTR(pScrn);
@@ -620,7 +488,7 @@ via_vt1632_mode_set(xf86OutputPtr output, DisplayModePtr mode,
     if (output->crtc) {
         viaVT1632SetClockDriveStrength(pScrn, 0x03);
         viaVT1632SetDataDriveStrength(pScrn, 0x03);
-        viaVT1632EnableIOPads(pScrn, 0x03);
+        viaExtTMDSEnableIOPads(pScrn, 0x03);
 
         viaVT1632DumpRegisters(pScrn, pVIAVT1632Rec->VT1632I2CDev);
         viaVT1632InitRegisters(pScrn, pVIAVT1632Rec->VT1632I2CDev);
commit d00f60c800e65d3e93bac8fb3cf169209d629bc5
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Wed Sep 21 22:22:03 2016 -0700

    Created viaExtTMDSSetDisplaySource
    
    viaExtTMDSSetDisplaySource function is meant to replace
    viaVT1632SetDisplaySource and viaSiI164SetDisplaySource functions.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_sii164.c b/src/via_sii164.c
index 1fe3997..f623571 100644
--- a/src/via_sii164.c
+++ b/src/via_sii164.c
@@ -33,138 +33,6 @@
 #include "via_sii164.h"
 
 static void
-viaSiI164SetDisplaySource(ScrnInfoPtr pScrn, CARD8 displaySource)
-{
-
-    vgaHWPtr hwp = VGAHWPTR(pScrn);
-    VIAPtr pVia = VIAPTR(pScrn);
-    CARD8 sr12, sr13, sr5a;
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Entered viaSiI164SetDisplaySource.\n"));
-
-    if ((pVia->Chipset == VIA_CX700)
-        || (pVia->Chipset == VIA_VX800)
-        || (pVia->Chipset == VIA_VX855)
-        || (pVia->Chipset == VIA_VX900)) {
-
-        sr5a = hwp->readSeq(hwp, 0x5A);
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "SR5A: 0x%02X\n", sr5a));
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "Setting 3C5.5A[0] to 0.\n"));
-        ViaSeqMask(hwp, 0x5A, sr5a & 0xFE, 0x01);
-    }
-
-    sr12 = hwp->readSeq(hwp, 0x12);
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "SR12: 0x%02X\n", sr12));
-    sr13 = hwp->readSeq(hwp, 0x13);
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "SR13: 0x%02X\n", sr13));
-    switch (pVia->Chipset) {
-    case VIA_CLE266:
-        /* 3C5.12[5] - FPD18 pin strapping
-         *             0: DIP0 (Digital Interface Port 0) is used by
-         *                a TMDS transmitter (DVI)
-         *             1: DIP0 (Digital Interface Port 0) is used by
-         *                a TV encoder */
-        if (!(sr12 & 0x20)) {
-            viaDIP0SetDisplaySource(pScrn, displaySource);
-        } else {
-            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                        "DIP0 was not set up for "
-                        "TMDS transmitter use.\n");
-        }
-
-        break;
-    case VIA_KM400:
-    case VIA_K8M800:
-    case VIA_PM800:
-    case VIA_P4M800PRO:
-        /* 3C5.13[3] - DVP0D8 pin strapping
-         *             0: AGP pins are used for AGP
-         *             1: AGP pins are used by FPDP
-         *                (Flat Panel Display Port)
-         * 3C5.12[6] - DVP0D6 pin strapping
-         *             0: Disable DVP0 (Digital Video Port 0)
-         *             1: Enable DVP0 (Digital Video Port 0)
-         * 3C5.12[5] - DVP0D5 pin strapping
-         *             0: DVP0 is used by a TMDS transmitter (DVI)
-         *             1: DVP0 is used by a TV encoder
-         * 3C5.12[4] - DVP0D4 pin strapping
-         *             0: Dual 12-bit FPDP (Flat Panel Display Port)
-         *             1: 24-bit FPDP (Flat Panel Display Port) */
-        if ((sr12 & 0x40) && (!(sr12 & 0x20))) {
-            viaDVP0SetDisplaySource(pScrn, displaySource);
-        } else if ((sr13 & 0x08) && (!(sr12 & 0x10))) {
-            viaDFPLowSetDisplaySource(pScrn, displaySource);
-        } else {
-            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                        "None of the external ports were set up for "
-                        "TMDS transmitter use.\n");
-        }
-
-        break;
-    case VIA_P4M890:
-    case VIA_K8M890:
-    case VIA_P4M900:
-        /* 3C5.12[6] - FPD6 pin strapping
-         *             0: Disable DVP0 (Digital Video Port 0)
-         *             1: Enable DVP0 (Digital Video Port 0)
-         * 3C5.12[5] - FPD5 pin strapping
-         *             0: DVP0 is used by a TMDS transmitter (DVI)
-         *             1: DVP0 is used by a TV encoder */
-        if ((sr12 & 0x40) && (!(sr12 & 0x20))) {
-            viaDVP0SetDisplaySource(pScrn, displaySource);
-        } else if (!(sr12 & 0x10)) {
-            viaDFPLowSetDisplaySource(pScrn, displaySource);
-        } else {
-            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                        "None of the external ports were set up for "
-                        "TMDS transmitter use.\n");
-        }
-
-        break;
-    case VIA_CX700:
-    case VIA_VX800:
-    case VIA_VX855:
-    case VIA_VX900:
-        /* 3C5.13[6] - DVP1 DVP / capture port selection
-         *             0: DVP1 is used as a DVP (Digital Video Port)
-         *             1: DVP1 is used as a capture port
-         */
-        if (!(sr13 & 0x40)) {
-            viaDVP1SetDisplaySource(pScrn, displaySource);
-        } else {
-            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                        "DVP1 is not set up for TMDS "
-                        "transmitter use.\n");
-        }
-
-        break;
-    default:
-        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                    "Unrecognized IGP for "
-                    "TMDS transmitter use.\n");
-        break;
-    }
-
-    if ((pVia->Chipset == VIA_CX700)
-        || (pVia->Chipset == VIA_VX800)
-        || (pVia->Chipset == VIA_VX855)
-        || (pVia->Chipset == VIA_VX900)) {
-
-        hwp->writeSeq(hwp, 0x5A, sr5a);
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "Restoring 3C5.5A[0].\n"));
-    }
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Exiting viaSiI164SetDisplaySource.\n"));
-}
-
-static void
 viaSiI164EnableIOPads(ScrnInfoPtr pScrn, CARD8 ioPadState)
 {
 
@@ -745,7 +613,7 @@ via_sii164_mode_set(xf86OutputPtr output, DisplayModePtr mode,
         viaSiI164InitRegisters(pScrn, pSiI164Rec->SiI164I2CDev);
         viaSiI164DumpRegisters(pScrn, pSiI164Rec->SiI164I2CDev);
 
-        viaSiI164SetDisplaySource(pScrn, iga->index ? 0x01 : 0x00);
+        viaExtTMDSSetDisplaySource(pScrn, iga->index ? 0x01 : 0x00);
     }
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
diff --git a/src/via_tmds.c b/src/via_tmds.c
index 805f4fb..7fc7575 100644
--- a/src/via_tmds.c
+++ b/src/via_tmds.c
@@ -271,6 +271,137 @@ viaTMDSPower(ScrnInfoPtr pScrn, Bool powerState)
                         "Exiting viaTMDSPower.\n"));
 }
 
+void
+viaExtTMDSSetDisplaySource(ScrnInfoPtr pScrn, CARD8 displaySource)
+{
+    vgaHWPtr hwp = VGAHWPTR(pScrn);
+    VIAPtr pVia = VIAPTR(pScrn);
+    CARD8 sr12, sr13, sr5a;
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered viaExtTMDSSetDisplaySource.\n"));
+
+    if ((pVia->Chipset == VIA_CX700)
+        || (pVia->Chipset == VIA_VX800)
+        || (pVia->Chipset == VIA_VX855)
+        || (pVia->Chipset == VIA_VX900)) {
+
+        sr5a = hwp->readSeq(hwp, 0x5A);
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "SR5A: 0x%02X\n", sr5a));
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Setting 3C5.5A[0] to 0.\n"));
+        ViaSeqMask(hwp, 0x5A, sr5a & 0xFE, 0x01);
+    }
+
+    sr12 = hwp->readSeq(hwp, 0x12);
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "SR12: 0x%02X\n", sr12));
+    sr13 = hwp->readSeq(hwp, 0x13);
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "SR13: 0x%02X\n", sr13));
+    switch (pVia->Chipset) {
+    case VIA_CLE266:
+        /* 3C5.12[5] - FPD18 pin strapping
+         *             0: DIP0 (Digital Interface Port 0) is used by
+         *                a TMDS transmitter (DVI)
+         *             1: DIP0 (Digital Interface Port 0) is used by
+         *                a TV encoder */
+        if (!(sr12 & 0x20)) {
+            viaDIP0SetDisplaySource(pScrn, displaySource);
+        } else {
+            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                        "DIP0 was not set up for "
+                        "TMDS transmitter use.\n");
+        }
+
+        break;
+    case VIA_KM400:
+    case VIA_K8M800:
+    case VIA_PM800:
+    case VIA_P4M800PRO:
+        /* 3C5.13[3] - DVP0D8 pin strapping
+         *             0: AGP pins are used for AGP
+         *             1: AGP pins are used by FPDP
+         *                (Flat Panel Display Port)
+         * 3C5.12[6] - DVP0D6 pin strapping
+         *             0: Disable DVP0 (Digital Video Port 0)
+         *             1: Enable DVP0 (Digital Video Port 0)
+         * 3C5.12[5] - DVP0D5 pin strapping
+         *             0: DVP0 is used by a TMDS transmitter (DVI)
+         *             1: DVP0 is used by a TV encoder
+         * 3C5.12[4] - DVP0D4 pin strapping
+         *             0: Dual 12-bit FPDP (Flat Panel Display Port)
+         *             1: 24-bit FPDP (Flat Panel Display Port) */
+        if ((sr12 & 0x40) && (!(sr12 & 0x20))) {
+            viaDVP0SetDisplaySource(pScrn, displaySource);
+        } else if ((sr13 & 0x08) && (!(sr12 & 0x10))) {
+            viaDFPLowSetDisplaySource(pScrn, displaySource);
+        } else {
+            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                        "None of the external ports were set up for "
+                        "TMDS transmitter use.\n");
+        }
+
+        break;
+    case VIA_P4M890:
+    case VIA_K8M890:
+    case VIA_P4M900:
+        /* 3C5.12[6] - FPD6 pin strapping
+         *             0: Disable DVP0 (Digital Video Port 0)
+         *             1: Enable DVP0 (Digital Video Port 0)
+         * 3C5.12[5] - FPD5 pin strapping
+         *             0: DVP0 is used by a TMDS transmitter (DVI)
+         *             1: DVP0 is used by a TV encoder */
+        if ((sr12 & 0x40) && (!(sr12 & 0x20))) {
+            viaDVP0SetDisplaySource(pScrn, displaySource);
+        } else if (!(sr12 & 0x10)) {
+            viaDFPLowSetDisplaySource(pScrn, displaySource);
+        } else {
+            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                        "None of the external ports were set up for "
+                        "TMDS transmitter use.\n");
+        }
+
+        break;
+    case VIA_CX700:
+    case VIA_VX800:
+    case VIA_VX855:
+    case VIA_VX900:
+        /* 3C5.13[6] - DVP1 DVP / capture port selection
+         *             0: DVP1 is used as a DVP (Digital Video Port)
+         *             1: DVP1 is used as a capture port
+         */
+        if (!(sr13 & 0x40)) {
+            viaDVP1SetDisplaySource(pScrn, displaySource);
+        } else {
+            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                        "DVP1 is not set up for TMDS "
+                        "transmitter use.\n");
+        }
+
+        break;
+    default:
+        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                    "Unrecognized IGP for "
+                    "TMDS transmitter use.\n");
+        break;
+    }
+
+    if ((pVia->Chipset == VIA_CX700)
+        || (pVia->Chipset == VIA_VX800)
+        || (pVia->Chipset == VIA_VX855)
+        || (pVia->Chipset == VIA_VX900)) {
+
+        hwp->writeSeq(hwp, 0x5A, sr5a);
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Restoring 3C5.5A[0].\n"));
+    }
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting viaExtTMDSSetDisplaySource.\n"));
+}
+
 static void
 via_tmds_create_resources(xf86OutputPtr output)
 {
diff --git a/src/via_ums.h b/src/via_ums.h
index 8e1e9af..094b902 100644
--- a/src/via_ums.h
+++ b/src/via_ums.h
@@ -263,6 +263,7 @@ void via_analog_init(ScrnInfoPtr pScrn);
 void via_lvds_init(ScrnInfoPtr pScrn);
 
 /* via_tmds.c */
+void viaExtTMDSSetDisplaySource(ScrnInfoPtr pScrn, CARD8 displaySource);
 void via_dvi_init(ScrnInfoPtr pScrn);
 
 /*via_tv.c */
diff --git a/src/via_vt1632.c b/src/via_vt1632.c
index ce4f41c..bf810df 100644
--- a/src/via_vt1632.c
+++ b/src/via_vt1632.c
@@ -33,138 +33,6 @@
 #include "via_vt1632.h"
 
 static void
-viaVT1632SetDisplaySource(ScrnInfoPtr pScrn, CARD8 displaySource)
-{
-
-    vgaHWPtr hwp = VGAHWPTR(pScrn);
-    VIAPtr pVia = VIAPTR(pScrn);
-    CARD8 sr12, sr13, sr5a;
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Entered viaVT1632SetDisplaySource.\n"));
-
-    if ((pVia->Chipset == VIA_CX700)
-        || (pVia->Chipset == VIA_VX800)
-        || (pVia->Chipset == VIA_VX855)
-        || (pVia->Chipset == VIA_VX900)) {
-
-        sr5a = hwp->readSeq(hwp, 0x5A);
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "SR5A: 0x%02X\n", sr5a));
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "Setting 3C5.5A[0] to 0.\n"));
-        ViaSeqMask(hwp, 0x5A, sr5a & 0xFE, 0x01);
-    }
-
-    sr12 = hwp->readSeq(hwp, 0x12);
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "SR12: 0x%02X\n", sr12));
-    sr13 = hwp->readSeq(hwp, 0x13);
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "SR13: 0x%02X\n", sr13));
-    switch (pVia->Chipset) {
-    case VIA_CLE266:
-        /* 3C5.12[5] - FPD18 pin strapping
-         *             0: DIP0 (Digital Interface Port 0) is used by
-         *                a TMDS transmitter (DVI)
-         *             1: DIP0 (Digital Interface Port 0) is used by
-         *                a TV encoder */
-        if (!(sr12 & 0x20)) {
-            viaDIP0SetDisplaySource(pScrn, displaySource);
-        } else {
-            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                        "DIP0 was not set up for "
-                        "TMDS transmitter use.\n");
-        }
-
-        break;
-    case VIA_KM400:
-    case VIA_K8M800:
-    case VIA_PM800:
-    case VIA_P4M800PRO:
-        /* 3C5.13[3] - DVP0D8 pin strapping
-         *             0: AGP pins are used for AGP
-         *             1: AGP pins are used by FPDP
-         *                (Flat Panel Display Port)
-         * 3C5.12[6] - DVP0D6 pin strapping
-         *             0: Disable DVP0 (Digital Video Port 0)
-         *             1: Enable DVP0 (Digital Video Port 0)
-         * 3C5.12[5] - DVP0D5 pin strapping
-         *             0: DVP0 is used by a TMDS transmitter (DVI)
-         *             1: DVP0 is used by a TV encoder
-         * 3C5.12[4] - DVP0D4 pin strapping
-         *             0: Dual 12-bit FPDP (Flat Panel Display Port)
-         *             1: 24-bit FPDP (Flat Panel Display Port) */
-        if ((sr12 & 0x40) && (!(sr12 & 0x20))) {
-            viaDVP0SetDisplaySource(pScrn, displaySource);
-        } else if ((sr13 & 0x08) && (!(sr12 & 0x10))) {
-            viaDFPLowSetDisplaySource(pScrn, displaySource);
-        } else {
-            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                        "None of the external ports were set up for "
-                        "TMDS transmitter use.\n");
-        }
-
-        break;
-    case VIA_P4M890:
-    case VIA_K8M890:
-    case VIA_P4M900:
-        /* 3C5.12[6] - FPD6 pin strapping
-         *             0: Disable DVP0 (Digital Video Port 0)
-         *             1: Enable DVP0 (Digital Video Port 0)
-         * 3C5.12[5] - FPD5 pin strapping
-         *             0: DVP0 is used by a TMDS transmitter (DVI)
-         *             1: DVP0 is used by a TV encoder */
-        if ((sr12 & 0x40) && (!(sr12 & 0x20))) {
-            viaDVP0SetDisplaySource(pScrn, displaySource);
-        } else if (!(sr12 & 0x10)) {
-            viaDFPLowSetDisplaySource(pScrn, displaySource);
-        } else {
-            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                        "None of the external ports were set up for "
-                        "TMDS transmitter use.\n");
-        }
-
-        break;
-    case VIA_CX700:
-    case VIA_VX800:
-    case VIA_VX855:
-    case VIA_VX900:
-        /* 3C5.13[6] - DVP1 DVP / capture port selection
-         *             0: DVP1 is used as a DVP (Digital Video Port)
-         *             1: DVP1 is used as a capture port
-         */
-        if (!(sr13 & 0x40)) {
-            viaDVP1SetDisplaySource(pScrn, displaySource);
-        } else {
-            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                        "DVP1 is not set up for TMDS "
-                        "transmitter use.\n");
-        }
-
-        break;
-    default:
-        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                    "Unrecognized IGP for "
-                    "TMDS transmitter use.\n");
-        break;
-    }
-
-    if ((pVia->Chipset == VIA_CX700)
-        || (pVia->Chipset == VIA_VX800)
-        || (pVia->Chipset == VIA_VX855)
-        || (pVia->Chipset == VIA_VX900)) {
-
-        hwp->writeSeq(hwp, 0x5A, sr5a);
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "Restoring 3C5.5A[0].\n"));
-    }
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Exiting viaVT1632SetDisplaySource.\n"));
-}
-
-static void
 viaVT1632EnableIOPads(ScrnInfoPtr pScrn, CARD8 ioPadState)
 {
 
@@ -758,7 +626,7 @@ via_vt1632_mode_set(xf86OutputPtr output, DisplayModePtr mode,
         viaVT1632InitRegisters(pScrn, pVIAVT1632Rec->VT1632I2CDev);
         viaVT1632DumpRegisters(pScrn, pVIAVT1632Rec->VT1632I2CDev);
 
-        viaVT1632SetDisplaySource(pScrn, iga->index ? 0x01 : 0x00);
+        viaExtTMDSSetDisplaySource(pScrn, iga->index ? 0x01 : 0x00);
     }
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
commit 9eaa439a2277ffcb1040c4cc461b4ed4e2c34c52
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Wed Sep 21 22:01:21 2016 -0700

    Changed via_sii164_dump_registers to viaSiI164DumpRegisters
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_sii164.c b/src/via_sii164.c
index c345971..1fe3997 100644
--- a/src/via_sii164.c
+++ b/src/via_sii164.c
@@ -497,13 +497,13 @@ viaSiI164SetDataDriveStrength(ScrnInfoPtr pScrn, CARD8 dataDriveStrength)
 }
 
 static void
-via_sii164_dump_registers(ScrnInfoPtr pScrn, I2CDevPtr pDev)
+viaSiI164DumpRegisters(ScrnInfoPtr pScrn, I2CDevPtr pDev)
 {
     int i;
     CARD8 tmp;
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Entered via_sii164_dump_registers.\n"));
+                        "Entered viaSiI164DumpRegisters.\n"));
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "SiI 164: dumping registers:\n"));
     for (i = 0; i <= 0x0f; i++) {
@@ -512,7 +512,7 @@ via_sii164_dump_registers(ScrnInfoPtr pScrn, I2CDevPtr pDev)
     }
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Exiting via_sii164_dump_registers.\n"));
+                        "Exiting viaSiI164DumpRegisters.\n"));
 }
 
 static void
@@ -741,9 +741,9 @@ via_sii164_mode_set(xf86OutputPtr output, DisplayModePtr mode,
         viaSiI164SetDataDriveStrength(pScrn, 0x03);
         viaSiI164EnableIOPads(pScrn, 0x03);
 
-        via_sii164_dump_registers(pScrn, pSiI164Rec->SiI164I2CDev);
+        viaSiI164DumpRegisters(pScrn, pSiI164Rec->SiI164I2CDev);
         viaSiI164InitRegisters(pScrn, pSiI164Rec->SiI164I2CDev);
-        via_sii164_dump_registers(pScrn, pSiI164Rec->SiI164I2CDev);
+        viaSiI164DumpRegisters(pScrn, pSiI164Rec->SiI164I2CDev);
 
         viaSiI164SetDisplaySource(pScrn, iga->index ? 0x01 : 0x00);
     }
@@ -937,7 +937,7 @@ viaSiI164Init(ScrnInfoPtr pScrn, I2CBusPtr pI2CBus)
     output->interlaceAllowed = FALSE;
     output->doubleScanAllowed = FALSE;
 
-    via_sii164_dump_registers(pScrn, pI2CDevice);
+    viaSiI164DumpRegisters(pScrn, pI2CDevice);
 
     pVia->numberDVI++;
     status = TRUE;
commit 2ff109247c597cabf02134914ac83254528de020
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Wed Sep 21 21:57:58 2016 -0700

    Changed the hardware resource initialization sequence for SiI 164
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_sii164.c b/src/via_sii164.c
index c935575..c345971 100644
--- a/src/via_sii164.c
+++ b/src/via_sii164.c
@@ -736,16 +736,17 @@ via_sii164_mode_set(xf86OutputPtr output, DisplayModePtr mode,
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Entered via_sii164_mode_set.\n"));
 
-    viaSiI164SetDisplaySource(pScrn, iga->index ? 0x01 : 0x00);
-    viaSiI164EnableIOPads(pScrn, 0x03);
-    viaSiI164SetClockDriveStrength(pScrn, 0x03);
-    viaSiI164SetDataDriveStrength(pScrn, 0x03);
+    if (output->crtc) {
+        viaSiI164SetClockDriveStrength(pScrn, 0x03);
+        viaSiI164SetDataDriveStrength(pScrn, 0x03);
+        viaSiI164EnableIOPads(pScrn, 0x03);
 
-    via_sii164_dump_registers(pScrn, pSiI164Rec->SiI164I2CDev);
+        via_sii164_dump_registers(pScrn, pSiI164Rec->SiI164I2CDev);
+        viaSiI164InitRegisters(pScrn, pSiI164Rec->SiI164I2CDev);
+        via_sii164_dump_registers(pScrn, pSiI164Rec->SiI164I2CDev);
 
-    viaSiI164InitRegisters(pScrn, pSiI164Rec->SiI164I2CDev);
-
-    via_sii164_dump_registers(pScrn, pSiI164Rec->SiI164I2CDev);
+        viaSiI164SetDisplaySource(pScrn, iga->index ? 0x01 : 0x00);
+    }
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                 "Exiting via_sii164_mode_set.\n"));
commit df1dfeaf8d3d66f586b691589989522dd3b72989
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Wed Sep 21 21:54:10 2016 -0700

    Changed the hardware resource initialization sequence for VT1632(A)
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_vt1632.c b/src/via_vt1632.c
index 48bb80e..ce4f41c 100644
--- a/src/via_vt1632.c
+++ b/src/via_vt1632.c
@@ -749,16 +749,17 @@ via_vt1632_mode_set(xf86OutputPtr output, DisplayModePtr mode,
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Entered via_vt1632_mode_set.\n"));
 
-    viaVT1632SetDisplaySource(pScrn, iga->index ? 0x01 : 0x00);
-    viaVT1632EnableIOPads(pScrn, 0x03);
-    viaVT1632SetClockDriveStrength(pScrn, 0x03);
-    viaVT1632SetDataDriveStrength(pScrn, 0x03);
+    if (output->crtc) {
+        viaVT1632SetClockDriveStrength(pScrn, 0x03);
+        viaVT1632SetDataDriveStrength(pScrn, 0x03);
+        viaVT1632EnableIOPads(pScrn, 0x03);
 
-    viaVT1632DumpRegisters(pScrn, pVIAVT1632Rec->VT1632I2CDev);
+        viaVT1632DumpRegisters(pScrn, pVIAVT1632Rec->VT1632I2CDev);
+        viaVT1632InitRegisters(pScrn, pVIAVT1632Rec->VT1632I2CDev);
+        viaVT1632DumpRegisters(pScrn, pVIAVT1632Rec->VT1632I2CDev);
 
-    viaVT1632InitRegisters(pScrn, pVIAVT1632Rec->VT1632I2CDev);
-
-    viaVT1632DumpRegisters(pScrn, pVIAVT1632Rec->VT1632I2CDev);
+        viaVT1632SetDisplaySource(pScrn, iga->index ? 0x01 : 0x00);
+    }
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                 "Exiting via_vt1632_mode_set.\n"));
commit f699c172910de0049e433023fd9f4aababe5da9b
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Wed Sep 21 21:10:08 2016 -0700

    Eliminated new compilation warnings
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_sii164.c b/src/via_sii164.c
index c0262da..c935575 100644
--- a/src/via_sii164.c
+++ b/src/via_sii164.c
@@ -731,7 +731,6 @@ via_sii164_mode_set(xf86OutputPtr output, DisplayModePtr mode,
 {
     ScrnInfoPtr pScrn = output->scrn;
     drmmode_crtc_private_ptr iga = output->crtc->driver_private;
-    VIAPtr pVia = VIAPTR(pScrn);
     viaSiI164RecPtr pSiI164Rec = output->driver_private;
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
diff --git a/src/via_vt1632.c b/src/via_vt1632.c
index ba866d6..48bb80e 100644
--- a/src/via_vt1632.c
+++ b/src/via_vt1632.c
@@ -744,7 +744,6 @@ via_vt1632_mode_set(xf86OutputPtr output, DisplayModePtr mode,
 {
     ScrnInfoPtr pScrn = output->scrn;
     drmmode_crtc_private_ptr iga = output->crtc->driver_private;
-    VIAPtr pVia = VIAPTR(pScrn);
     viaVT1632RecPtr pVIAVT1632Rec = output->driver_private;
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
commit eef0b90793b7dd59daa3db8afb01a9a3272646f4
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Wed Sep 21 21:05:30 2016 -0700

    Changed viaAnalogSource to viaAnalogSetDisplaySource
    
    Also, made updates to the log message displayed by
    viaAnalogSetDisplaySource function.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_analog.c b/src/via_analog.c
index 185d31b..72c0f52 100644
--- a/src/via_analog.c
+++ b/src/via_analog.c
@@ -70,21 +70,21 @@ viaAnalogOutput(ScrnInfoPtr pScrn, Bool outputState)
  * Specifies IGA1 or IGA2 for analog VGA DAC source.
  */
 static void
-viaAnalogSource(ScrnInfoPtr pScrn, CARD8 displaySource)
+viaAnalogSetDisplaySource(ScrnInfoPtr pScrn, CARD8 displaySource)
 {
     vgaHWPtr hwp = VGAHWPTR(pScrn);
     CARD8 value = displaySource;
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Entered viaAnalogSource.\n"));
+                        "Entered viaAnalogSetDisplaySource.\n"));
 
     ViaSeqMask(hwp, 0x16, value << 6, 0x40);
     xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                "Analog VGA Output Source: IGA%d\n",
+                "Analog VGA Display Output Source: IGA%d\n",
                 (value & 0x01) + 1);
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Exiting viaAnalogSource.\n"));
+                        "Exiting viaAnalogSetDisplaySource.\n"));
 }
 
 /*
@@ -249,7 +249,7 @@ via_analog_mode_set(xf86OutputPtr output, DisplayModePtr mode,
     if (output->crtc) {
         viaAnalogInit(pScrn);
         viaAnalogSetSyncPolarity(pScrn, adjusted_mode);
-        viaAnalogSource(pScrn, iga->index ? 0x01 : 0x00);
+        viaAnalogSetDisplaySource(pScrn, iga->index ? 0x01 : 0x00);
     }
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,


More information about the Openchrome-devel mailing list