[openchrome-devel] xf86-video-openchrome: Branch 'main' - 4 commits - configure.ac src/Makefile.am src/via_fp.c src/via_output.c src/via_outputs.c src/via_sii164.c src/via_tmds.c src/via_ums.h src/via_vt1632.c

Kevin Brace kevinbrace at kemper.freedesktop.org
Sun Jul 25 22:09:13 UTC 2021


 configure.ac     |    2 
 src/Makefile.am  |    2 
 src/via_fp.c     |  107 ---------------
 src/via_output.c |   90 ++++++++++++
 src/via_sii164.c |   12 -
 src/via_tmds.c   |  390 +------------------------------------------------------
 src/via_ums.h    |    6 
 src/via_vt1632.c |   12 -
 8 files changed, 120 insertions(+), 501 deletions(-)

New commits:
commit 104bad551eb98e7112b7f3251c0bdc31186ac286
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Sun Jul 25 16:59:07 2021 -0500

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

diff --git a/configure.ac b/configure.ac
index 8844cfa..9119300 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-openchrome],
-        [0.6.407],
+        [0.6.408],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/openchrome],
         [xf86-video-openchrome])
 
commit bc7045a4a14c38dea0f6309d226710303b420ef7
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Sun Jul 25 16:57:27 2021 -0500

    Use viaDisplaySource() for FP and DVI display source selection
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_fp.c b/src/via_fp.c
index 2501b76..497c82d 100644
--- a/src/via_fp.c
+++ b/src/via_fp.c
@@ -542,56 +542,6 @@ viaFPSyncPolarity(ScrnInfoPtr pScrn, uint32_t diPort, unsigned int flags)
                         "Exiting viaFPSyncPolarity.\n"));
 }
 
-static void
-viaFPDisplaySource(ScrnInfoPtr pScrn, uint32_t diPort, int index)
-{
-    CARD8 displaySource = index & 0x01;
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Entered viaFPDisplaySource.\n"));
-
-    switch(diPort) {
-    case VIA_DI_PORT_DVP0:
-        viaDVP0SetDisplaySource(pScrn, displaySource);
-        break;
-    case VIA_DI_PORT_DVP1:
-        viaDVP1SetDisplaySource(pScrn, displaySource);
-        break;
-    case VIA_DI_PORT_FPDPLOW:
-        viaFPDPLowSetDisplaySource(pScrn, displaySource);
-        viaDVP1SetDisplaySource(pScrn, displaySource);
-        break;
-    case VIA_DI_PORT_FPDPHIGH:
-        viaFPDPHighSetDisplaySource(pScrn, displaySource);
-        viaDVP0SetDisplaySource(pScrn, displaySource);
-        break;
-    case (VIA_DI_PORT_FPDPLOW |
-          VIA_DI_PORT_FPDPHIGH):
-        viaFPDPLowSetDisplaySource(pScrn, displaySource);
-        viaFPDPHighSetDisplaySource(pScrn, displaySource);
-        break;
-    case VIA_DI_PORT_LVDS1:
-        viaLVDS1SetDisplaySource(pScrn, displaySource);
-        break;
-    case VIA_DI_PORT_LVDS2:
-        viaLVDS2SetDisplaySource(pScrn, displaySource);
-        break;
-    case (VIA_DI_PORT_LVDS1 |
-          VIA_DI_PORT_LVDS2):
-        viaLVDS1SetDisplaySource(pScrn, displaySource);
-        viaLVDS2SetDisplaySource(pScrn, displaySource);
-        break;
-    default:
-        break;
-    }
-    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                "FP Display Source: IGA%d\n",
-                displaySource + 1);
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Exiting viaFPDisplaySource.\n"));
-}
-
 /*
  * Try to interpret EDID ourselves.
  */
@@ -1063,7 +1013,7 @@ via_fp_mode_set(xf86OutputPtr output, DisplayModePtr mode,
         }
 
         viaFPSyncPolarity(pScrn, pVIAFP->diPort, adjusted_mode->Flags);
-        viaFPDisplaySource(pScrn, pVIAFP->diPort, iga->index);
+        viaDisplaySource(pScrn, pVIAFP->diPort, iga->index);
     }
 }
 
diff --git a/src/via_output.c b/src/via_output.c
index e2c1452..2f20634 100644
--- a/src/via_output.c
+++ b/src/via_output.c
@@ -83,6 +83,53 @@ viaIOPadState(ScrnInfoPtr pScrn, uint32_t diPort, uint8_t ioPadState)
                         "Exiting %s.\n", __func__));
 }
 
+void
+viaDisplaySource(ScrnInfoPtr pScrn, uint32_t diPort, int index)
+{
+    CARD8 displaySource = index & 0x01;
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered %s.\n", __func__));
+
+    switch(diPort) {
+    case VIA_DI_PORT_DVP0:
+        viaDVP0SetDisplaySource(pScrn, displaySource);
+        break;
+    case VIA_DI_PORT_DVP1:
+        viaDVP1SetDisplaySource(pScrn, displaySource);
+        break;
+    case VIA_DI_PORT_FPDPLOW:
+        viaFPDPLowSetDisplaySource(pScrn, displaySource);
+        viaDVP1SetDisplaySource(pScrn, displaySource);
+        break;
+    case VIA_DI_PORT_FPDPHIGH:
+        viaFPDPHighSetDisplaySource(pScrn, displaySource);
+        viaDVP0SetDisplaySource(pScrn, displaySource);
+        break;
+    case (VIA_DI_PORT_FPDPLOW |
+          VIA_DI_PORT_FPDPHIGH):
+        viaFPDPLowSetDisplaySource(pScrn, displaySource);
+        viaFPDPHighSetDisplaySource(pScrn, displaySource);
+        break;
+    case VIA_DI_PORT_LVDS1:
+        viaLVDS1SetDisplaySource(pScrn, displaySource);
+        break;
+    case VIA_DI_PORT_LVDS2:
+        viaLVDS2SetDisplaySource(pScrn, displaySource);
+        break;
+    case (VIA_DI_PORT_LVDS1 |
+          VIA_DI_PORT_LVDS2):
+        viaLVDS1SetDisplaySource(pScrn, displaySource);
+        viaLVDS2SetDisplaySource(pScrn, displaySource);
+        break;
+    default:
+        break;
+    }
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting %s.\n", __func__));
+}
+
 void
 viaInitDisplay(ScrnInfoPtr pScrn)
 {
diff --git a/src/via_sii164.c b/src/via_sii164.c
index 5bd33ef..49e379f 100644
--- a/src/via_sii164.c
+++ b/src/via_sii164.c
@@ -299,7 +299,7 @@ via_sii164_mode_set(xf86OutputPtr output, DisplayModePtr mode,
         viaSiI164InitRegisters(pScrn, pSiI164Rec->pSiI164I2CDev);
         viaSiI164DumpRegisters(pScrn, pSiI164Rec->pSiI164I2CDev);
 
-        viaExtTMDSSetDisplaySource(pScrn, iga->index ? 0x01 : 0x00);
+        viaDisplaySource(pScrn, pSiI164Rec->diPort, iga->index);
     }
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
diff --git a/src/via_tmds.c b/src/via_tmds.c
index 1eb86a7..f9f4dbe 100644
--- a/src/via_tmds.c
+++ b/src/via_tmds.c
@@ -75,26 +75,6 @@ viaTMDSSyncPolarity(ScrnInfoPtr pScrn, unsigned int flags)
                         "Exiting viaTMDSSyncPolarity.\n"));
 }
 
-/*
- * Sets TMDS (DVI) display source.
- */
-static void
-viaTMDSDisplaySource(ScrnInfoPtr pScrn, int index)
-{
-    CARD8 displaySource = index;
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Entered viaTMDSDisplaySource.\n"));
-
-    viaTMDSSetDisplaySource(pScrn, displaySource & 0x01);
-    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                "TMDS (DVI) Display Source: IGA%d\n",
-                (displaySource & 0x01) + 1);
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Exiting viaTMDSDisplaySource.\n"));
-}
-
 /*
  * Initializes most registers related to VIA Technologies IGP
  * integrated TMDS transmitter. Synchronization polarity and
@@ -203,138 +183,6 @@ 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;
-    CARD8 sr5a = 0x00;
-
-    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))) {
-            viaFPDPLowSetDisplaySource(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)) {
-            viaFPDPLowSetDisplaySource(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"));
-}
-
 void
 viaExtTMDSSetClockDriveStrength(ScrnInfoPtr pScrn, CARD8 clockDriveStrength)
 {
@@ -663,6 +511,7 @@ via_tmds_mode_set(xf86OutputPtr output, DisplayModePtr mode,
 {
     ScrnInfoPtr pScrn = output->scrn;
     drmmode_crtc_private_ptr iga = output->crtc->driver_private;
+    VIATMDSPtr pVIATMDS = (VIATMDSPtr) output->driver_private;
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Entered via_tmds_mode_set.\n"));
@@ -674,7 +523,7 @@ via_tmds_mode_set(xf86OutputPtr output, DisplayModePtr mode,
         /* Set integrated TMDS transmitter sync polarity. */
         viaTMDSSyncPolarity(pScrn, adjusted_mode->Flags);
 
-        viaTMDSDisplaySource(pScrn, iga->index);
+        viaDisplaySource(pScrn, pVIATMDS->diPort, iga->index);
     }
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
diff --git a/src/via_ums.h b/src/via_ums.h
index 3280a2e..902079f 100644
--- a/src/via_ums.h
+++ b/src/via_ums.h
@@ -1600,6 +1600,7 @@ Bool xf86I2CMaskByte(I2CDevPtr d, I2CByte subaddr,
                         I2CByte value, I2CByte mask);
 
 /* via_output.c */
+void viaDisplaySource(ScrnInfoPtr pScrn, uint32_t diPort, int index);
 void viaIOPadState(ScrnInfoPtr pScrn, uint32_t diPort, uint8_t ioPadState);
 void viaInitDisplay(ScrnInfoPtr pScrn);
 CARD32 ViaGetMemoryBandwidth(ScrnInfoPtr pScrn);
@@ -1633,7 +1634,6 @@ void viaFPProbe(ScrnInfoPtr pScrn);
 void viaFPInit(ScrnInfoPtr pScrn);
 
 /* via_tmds.c */
-void viaExtTMDSSetDisplaySource(ScrnInfoPtr pScrn, CARD8 displaySource);
 void viaExtTMDSSetClockDriveStrength(ScrnInfoPtr pScrn,
                                         CARD8 clockDriveStrength);
 void viaExtTMDSSetDataDriveStrength(ScrnInfoPtr pScrn,
diff --git a/src/via_vt1632.c b/src/via_vt1632.c
index 4289d9a..625a57e 100644
--- a/src/via_vt1632.c
+++ b/src/via_vt1632.c
@@ -313,7 +313,7 @@ via_vt1632_mode_set(xf86OutputPtr output, DisplayModePtr mode,
         viaVT1632InitRegisters(pScrn, pVIAVT1632->VT1632I2CDev);
         viaVT1632DumpRegisters(pScrn, pVIAVT1632->VT1632I2CDev);
 
-        viaExtTMDSSetDisplaySource(pScrn, iga->index ? 0x01 : 0x00);
+        viaDisplaySource(pScrn, pVIAVT1632->diPort, iga->index);
     }
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
commit 7b92e0e336d326d510c4dccc439a867427d12e8f
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Sun Jul 25 16:48:02 2021 -0500

    Use viaIOPadState() for FP and DVI I/O pad control
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_fp.c b/src/via_fp.c
index cfd19ae..2501b76 100644
--- a/src/via_fp.c
+++ b/src/via_fp.c
@@ -401,53 +401,6 @@ viaFPPower(ScrnInfoPtr pScrn, int Chipset, uint32_t diPort,
                         "Exiting viaFPPower.\n"));
 }
 
-static void
-viaFPIOPadState(ScrnInfoPtr pScrn, uint32_t diPort, Bool ioPadOn)
-{
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Entered viaFPIOPadState.\n"));
-
-    switch(diPort) {
-    case VIA_DI_PORT_DVP0:
-        viaDVP0SetIOPadState(pScrn, ioPadOn ? 0x03 : 0x00);
-        break;
-    case VIA_DI_PORT_DVP1:
-        viaDVP1SetIOPadState(pScrn, ioPadOn ? 0x03 : 0x00);
-        break;
-    case VIA_DI_PORT_FPDPLOW:
-        viaFPDPLowSetIOPadState(pScrn, ioPadOn ? 0x03 : 0x00);
-        break;
-    case VIA_DI_PORT_FPDPHIGH:
-        viaFPDPHighSetIOPadState(pScrn, ioPadOn ? 0x03 : 0x00);
-        break;
-    case (VIA_DI_PORT_FPDPLOW |
-          VIA_DI_PORT_FPDPHIGH):
-        viaFPDPLowSetIOPadState(pScrn, ioPadOn ? 0x03 : 0x00);
-        viaFPDPHighSetIOPadState(pScrn, ioPadOn ? 0x03 : 0x00);
-        break;
-    case VIA_DI_PORT_LVDS1:
-        viaLVDS1SetIOPadSetting(pScrn, ioPadOn ? 0x03 : 0x00);
-        break;
-    case VIA_DI_PORT_LVDS2:
-        viaLVDS2SetIOPadSetting(pScrn, ioPadOn ? 0x03 : 0x00);
-        break;
-    case (VIA_DI_PORT_LVDS1 |
-          VIA_DI_PORT_LVDS2):
-        viaLVDS1SetIOPadSetting(pScrn, ioPadOn ? 0x03 : 0x00);
-        viaLVDS2SetIOPadSetting(pScrn, ioPadOn ? 0x03 : 0x00);
-        break;
-    default:
-        break;
-    }
-
-    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                "FP I/O Pad: %s\n",
-                ioPadOn ? "On": "Off");
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Exiting viaFPIOPadState.\n"));
-}
-
 static void
 viaFPFormat(ScrnInfoPtr pScrn, uint32_t diPort, CARD8 format)
 {
@@ -973,13 +926,13 @@ via_fp_dpms(xf86OutputPtr output, int mode)
     switch (mode) {
     case DPMSModeOn:
         viaFPPower(pScrn, pVia->Chipset, pVIAFP->diPort, TRUE);
-        viaFPIOPadState(pScrn, pVIAFP->diPort, TRUE);
+        viaIOPadState(pScrn, pVIAFP->diPort, 0x03);
         break;
     case DPMSModeStandby:
     case DPMSModeSuspend:
     case DPMSModeOff:
         viaFPPower(pScrn, pVia->Chipset, pVIAFP->diPort, FALSE);
-        viaFPIOPadState(pScrn, pVIAFP->diPort, FALSE);
+        viaIOPadState(pScrn, pVIAFP->diPort, 0x00);
         break;
     default:
         break;
@@ -1047,7 +1000,7 @@ via_fp_prepare(xf86OutputPtr output)
                         "Entered via_fp_prepare.\n"));
 
     viaFPPower(pScrn, pVia->Chipset, pVIAFP->diPort, FALSE);
-    viaFPIOPadState(pScrn, pVIAFP->diPort, FALSE);
+    viaIOPadState(pScrn, pVIAFP->diPort, 0x00);
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Exiting via_fp_prepare.\n"));
@@ -1064,7 +1017,7 @@ via_fp_commit(xf86OutputPtr output)
                         "Entered via_fp_commit.\n"));
 
     viaFPPower(pScrn, pVia->Chipset, pVIAFP->diPort, TRUE);
-    viaFPIOPadState(pScrn, pVIAFP->diPort, TRUE);
+    viaIOPadState(pScrn, pVIAFP->diPort, 0x03);
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Exiting via_fp_commit.\n"));
diff --git a/src/via_output.c b/src/via_output.c
index 84d5f28..e2c1452 100644
--- a/src/via_output.c
+++ b/src/via_output.c
@@ -40,6 +40,49 @@
 #include "via_driver.h"
 #include <unistd.h>
 
+void
+viaIOPadState(ScrnInfoPtr pScrn, uint32_t diPort, uint8_t ioPadState)
+{
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered %s.\n", __func__));
+
+    switch(diPort) {
+    case VIA_DI_PORT_DVP0:
+        viaDVP0SetIOPadState(pScrn, ioPadState);
+        break;
+    case VIA_DI_PORT_DVP1:
+        viaDVP1SetIOPadState(pScrn, ioPadState);
+        break;
+    case VIA_DI_PORT_FPDPLOW:
+        viaFPDPLowSetIOPadState(pScrn, ioPadState);
+        break;
+    case VIA_DI_PORT_FPDPHIGH:
+        viaFPDPHighSetIOPadState(pScrn, ioPadState);
+        break;
+    case (VIA_DI_PORT_FPDPLOW |
+          VIA_DI_PORT_FPDPHIGH):
+        viaFPDPLowSetIOPadState(pScrn, ioPadState);
+        viaFPDPHighSetIOPadState(pScrn, ioPadState);
+        break;
+    case VIA_DI_PORT_LVDS1:
+        viaLVDS1SetIOPadSetting(pScrn, ioPadState);
+        break;
+    case VIA_DI_PORT_LVDS2:
+        viaLVDS2SetIOPadSetting(pScrn, ioPadState);
+        break;
+    case (VIA_DI_PORT_LVDS1 |
+          VIA_DI_PORT_LVDS2):
+        viaLVDS1SetIOPadSetting(pScrn, ioPadState);
+        viaLVDS2SetIOPadSetting(pScrn, ioPadState);
+        break;
+    default:
+        break;
+    }
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting %s.\n", __func__));
+}
+
 void
 viaInitDisplay(ScrnInfoPtr pScrn)
 {
diff --git a/src/via_sii164.c b/src/via_sii164.c
index 701b812..5bd33ef 100644
--- a/src/via_sii164.c
+++ b/src/via_sii164.c
@@ -187,13 +187,13 @@ via_sii164_dpms(xf86OutputPtr output, int mode)
     switch (mode) {
     case DPMSModeOn:
         viaSiI164Power(pScrn, pSiI164Rec->pSiI164I2CDev, TRUE);
-        viaExtTMDSIOPadState(pScrn, pSiI164Rec->diPort, TRUE);
+        viaIOPadState(pScrn, pSiI164Rec->diPort, 0x03);
         break;
     case DPMSModeStandby:
     case DPMSModeSuspend:
     case DPMSModeOff:
         viaSiI164Power(pScrn, pSiI164Rec->pSiI164I2CDev, FALSE);
-        viaExtTMDSIOPadState(pScrn, pSiI164Rec->diPort, FALSE);
+        viaIOPadState(pScrn, pSiI164Rec->diPort, 0x00);
         break;
     default:
         break;
@@ -257,7 +257,7 @@ via_sii164_prepare(xf86OutputPtr output)
                         "Entered %s.\n", __func__));
 
     viaSiI164Power(pScrn, pSiI164Rec->pSiI164I2CDev, FALSE);
-    viaExtTMDSIOPadState(pScrn, pSiI164Rec->diPort, FALSE);
+    viaIOPadState(pScrn, pSiI164Rec->diPort, 0x00);
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Exiting %s.\n", __func__));
@@ -273,7 +273,7 @@ via_sii164_commit(xf86OutputPtr output)
                         "Entered %s.\n", __func__));
 
     viaSiI164Power(pScrn, pSiI164Rec->pSiI164I2CDev, TRUE);
-    viaExtTMDSIOPadState(pScrn, pSiI164Rec->diPort, TRUE);
+    viaIOPadState(pScrn, pSiI164Rec->diPort, 0x03);
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Exiting %s.\n", __func__));
@@ -293,7 +293,7 @@ via_sii164_mode_set(xf86OutputPtr output, DisplayModePtr mode,
     if (output->crtc) {
         viaExtTMDSSetClockDriveStrength(pScrn, 0x03);
         viaExtTMDSSetDataDriveStrength(pScrn, 0x03);
-        viaExtTMDSEnableIOPads(pScrn, 0x03);
+        viaIOPadState(pScrn, pSiI164Rec->diPort, 0x03);
 
         viaSiI164DumpRegisters(pScrn, pSiI164Rec->pSiI164I2CDev);
         viaSiI164InitRegisters(pScrn, pSiI164Rec->pSiI164I2CDev);
diff --git a/src/via_tmds.c b/src/via_tmds.c
index 40efabc..1eb86a7 100644
--- a/src/via_tmds.c
+++ b/src/via_tmds.c
@@ -203,97 +203,6 @@ viaTMDSPower(ScrnInfoPtr pScrn, Bool powerState)
                         "Exiting viaTMDSPower.\n"));
 }
 
-static void
-viaTMDSIOPadSetting(ScrnInfoPtr pScrn, Bool ioPadOn)
-{
-    vgaHWPtr hwp = VGAHWPTR(pScrn);
-    VIAPtr pVia = VIAPTR(pScrn);
-    VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
-    CARD8 sr13, sr5a;
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Entered viaTMDSIOPadSetting.\n"));
-
-    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);
-
-    sr13 = hwp->readSeq(hwp, 0x13);
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "SR13: 0x%02X\n", sr13));
-
-    /*
-     * 3C5.13[7:6] - DVP1D15 and DVP1D14 pin strappings
-     *               00: LVDS1 + LVDS2
-     *               01: DVI + LVDS2
-     *               10: Dual LVDS (LVDS1 + LVDS2 used
-     *                   simultaneously)
-     *               11: DVI only
-     */
-    if ((((~(sr13 & BIT(7))) && (sr13 & BIT(6))) ||
-        ((sr13 & BIT(7)) && (sr13 & BIT(6)))) ||
-        (pVIADisplay->isVIANanoBook)) {
-        viaLVDS1SetIOPadSetting(pScrn, ioPadOn ? 0x03 : 0x00);
-    }
-
-    hwp->writeSeq(hwp, 0x5A, sr5a);
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Restoring 3C5.5A[0].\n"));
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Exiting viaTMDSIOPadSetting.\n"));
-}
-
-void
-viaExtTMDSIOPadState(ScrnInfoPtr pScrn, uint32_t diPort, Bool ioPadOn)
-{
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Entered %s.\n", __func__));
-
-    switch(diPort) {
-    case VIA_DI_PORT_DVP0:
-        viaDVP0SetIOPadState(pScrn, ioPadOn ? 0x03 : 0x00);
-        break;
-    case VIA_DI_PORT_DVP1:
-        viaDVP1SetIOPadState(pScrn, ioPadOn ? 0x03 : 0x00);
-        break;
-    case VIA_DI_PORT_FPDPLOW:
-        viaFPDPLowSetIOPadState(pScrn, ioPadOn ? 0x03 : 0x00);
-        break;
-    case VIA_DI_PORT_FPDPHIGH:
-        viaFPDPHighSetIOPadState(pScrn, ioPadOn ? 0x03 : 0x00);
-        break;
-    case (VIA_DI_PORT_FPDPLOW |
-          VIA_DI_PORT_FPDPHIGH):
-        viaFPDPLowSetIOPadState(pScrn, ioPadOn ? 0x03 : 0x00);
-        viaFPDPHighSetIOPadState(pScrn, ioPadOn ? 0x03 : 0x00);
-        break;
-    case VIA_DI_PORT_LVDS1:
-        viaLVDS1SetIOPadSetting(pScrn, ioPadOn ? 0x03 : 0x00);
-        break;
-    case VIA_DI_PORT_LVDS2:
-        viaLVDS2SetIOPadSetting(pScrn, ioPadOn ? 0x03 : 0x00);
-        break;
-    case (VIA_DI_PORT_LVDS1 |
-          VIA_DI_PORT_LVDS2):
-        viaLVDS1SetIOPadSetting(pScrn, ioPadOn ? 0x03 : 0x00);
-        viaLVDS2SetIOPadSetting(pScrn, ioPadOn ? 0x03 : 0x00);
-        break;
-    default:
-        break;
-    }
-
-    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                "DVI I/O Pad: %s\n",
-                ioPadOn ? "On": "Off");
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Exiting %s.\n", __func__));
-}
-
 void
 viaExtTMDSSetDisplaySource(ScrnInfoPtr pScrn, CARD8 displaySource)
 {
@@ -426,139 +335,6 @@ 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;
-    CARD8 sr5a = 0x00;
-
-    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)) {
-            viaDIP0SetIOPadState(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))) {
-            viaDVP0SetIOPadState(pScrn, ioPadState);
-        } else if ((sr13 & 0x08) && (!(sr12 & 0x10))) {
-            viaFPDPLowSetIOPadState(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))) {
-            viaDVP0SetIOPadState(pScrn, ioPadState);
-        } else if (!(sr12 & 0x10)) {
-            viaFPDPLowSetIOPadState(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)) {
-            viaDVP1SetIOPadState(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"));
-}
-
 void
 viaExtTMDSSetClockDriveStrength(ScrnInfoPtr pScrn, CARD8 clockDriveStrength)
 {
@@ -761,6 +537,7 @@ static void
 via_tmds_dpms(xf86OutputPtr output, int mode)
 {
     ScrnInfoPtr pScrn = output->scrn;
+    VIATMDSPtr pVIATMDS = (VIATMDSPtr) output->driver_private;
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Entered via_tmds_dpms.\n"));
@@ -768,13 +545,13 @@ via_tmds_dpms(xf86OutputPtr output, int mode)
     switch (mode) {
     case DPMSModeOn:
         viaTMDSPower(pScrn, TRUE);
-        viaTMDSIOPadSetting(pScrn, TRUE);
+        viaIOPadState(pScrn, pVIATMDS->diPort, 0x03);
         break;
     case DPMSModeStandby:
     case DPMSModeSuspend:
     case DPMSModeOff:
         viaTMDSPower(pScrn, FALSE);
-        viaTMDSIOPadSetting(pScrn, FALSE);
+        viaIOPadState(pScrn, pVIATMDS->diPort, 0x00);
         break;
     default:
         break;
@@ -852,12 +629,13 @@ static void
 via_tmds_prepare(xf86OutputPtr output)
 {
     ScrnInfoPtr pScrn = output->scrn;
+    VIATMDSPtr pVIATMDS = (VIATMDSPtr) output->driver_private;
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Entered via_tmds_prepare.\n"));
 
     viaTMDSPower(pScrn, FALSE);
-    viaTMDSIOPadSetting(pScrn, FALSE);
+    viaIOPadState(pScrn, pVIATMDS->diPort, 0x00);
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Exiting via_tmds_prepare.\n"));
@@ -867,12 +645,13 @@ static void
 via_tmds_commit(xf86OutputPtr output)
 {
     ScrnInfoPtr pScrn = output->scrn;
+    VIATMDSPtr pVIATMDS = (VIATMDSPtr) output->driver_private;
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Entered via_tmds_commit.\n"));
 
     viaTMDSPower(pScrn, TRUE);
-    viaTMDSIOPadSetting(pScrn, TRUE);
+    viaIOPadState(pScrn, pVIATMDS->diPort, 0x03);
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Exiting via_tmds_commit.\n"));
diff --git a/src/via_ums.h b/src/via_ums.h
index d77d0a5..3280a2e 100644
--- a/src/via_ums.h
+++ b/src/via_ums.h
@@ -1600,6 +1600,7 @@ Bool xf86I2CMaskByte(I2CDevPtr d, I2CByte subaddr,
                         I2CByte value, I2CByte mask);
 
 /* via_output.c */
+void viaIOPadState(ScrnInfoPtr pScrn, uint32_t diPort, uint8_t ioPadState);
 void viaInitDisplay(ScrnInfoPtr pScrn);
 CARD32 ViaGetMemoryBandwidth(ScrnInfoPtr pScrn);
 void viaSetUseExternalClock(ScrnInfoPtr pScrn);
@@ -1632,10 +1633,7 @@ void viaFPProbe(ScrnInfoPtr pScrn);
 void viaFPInit(ScrnInfoPtr pScrn);
 
 /* via_tmds.c */
-void viaExtTMDSIOPadState(ScrnInfoPtr pScrn, uint32_t diPort,
-                            Bool ioPadOn);
 void viaExtTMDSSetDisplaySource(ScrnInfoPtr pScrn, CARD8 displaySource);
-void viaExtTMDSEnableIOPads(ScrnInfoPtr pScrn, CARD8 ioPadState);
 void viaExtTMDSSetClockDriveStrength(ScrnInfoPtr pScrn,
                                         CARD8 clockDriveStrength);
 void viaExtTMDSSetDataDriveStrength(ScrnInfoPtr pScrn,
diff --git a/src/via_vt1632.c b/src/via_vt1632.c
index bc1b810..4289d9a 100644
--- a/src/via_vt1632.c
+++ b/src/via_vt1632.c
@@ -201,13 +201,13 @@ via_vt1632_dpms(xf86OutputPtr output, int mode)
     switch (mode) {
     case DPMSModeOn:
         viaVT1632Power(pScrn, pVIAVT1632->VT1632I2CDev, TRUE);
-        viaExtTMDSIOPadState(pScrn, pVIAVT1632->diPort, TRUE);
+        viaIOPadState(pScrn, pVIAVT1632->diPort, 0x03);
         break;
     case DPMSModeStandby:
     case DPMSModeSuspend:
     case DPMSModeOff:
         viaVT1632Power(pScrn, pVIAVT1632->VT1632I2CDev, FALSE);
-        viaExtTMDSIOPadState(pScrn, pVIAVT1632->diPort, FALSE);
+        viaIOPadState(pScrn, pVIAVT1632->diPort, 0x00);
         break;
     default:
         break;
@@ -271,7 +271,7 @@ via_vt1632_prepare(xf86OutputPtr output)
                         "Entered %s.\n", __func__));
 
     viaVT1632Power(pScrn, pVIAVT1632->VT1632I2CDev, FALSE);
-    viaExtTMDSIOPadState(pScrn, pVIAVT1632->diPort, FALSE);
+    viaIOPadState(pScrn, pVIAVT1632->diPort, 0x00);
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Exiting %s.\n", __func__));
@@ -287,7 +287,7 @@ via_vt1632_commit(xf86OutputPtr output)
                         "Entered %s.\n", __func__));
 
     viaVT1632Power(pScrn, pVIAVT1632->VT1632I2CDev, TRUE);
-    viaExtTMDSIOPadState(pScrn, pVIAVT1632->diPort, TRUE);
+    viaIOPadState(pScrn, pVIAVT1632->diPort, 0x03);
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Exiting %s.\n", __func__));
@@ -307,7 +307,7 @@ via_vt1632_mode_set(xf86OutputPtr output, DisplayModePtr mode,
     if (output->crtc) {
         viaExtTMDSSetClockDriveStrength(pScrn, 0x03);
         viaExtTMDSSetDataDriveStrength(pScrn, 0x03);
-        viaExtTMDSEnableIOPads(pScrn, 0x03);
+        viaIOPadState(pScrn, pVIAVT1632->diPort, 0x03);
 
         viaVT1632DumpRegisters(pScrn, pVIAVT1632->VT1632I2CDev);
         viaVT1632InitRegisters(pScrn, pVIAVT1632->VT1632I2CDev);
commit 44f1ba8282c48705ddd2829ef16b990a3723f306
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Sun Jul 25 16:45:57 2021 -0500

    Rename src/via_outputs.c to src/via_output.c
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/Makefile.am b/src/Makefile.am
index 865194c..73f65a0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -57,7 +57,7 @@ openchrome_drv_la_SOURCES = \
     via_memcpy.c \
     via_memmgr.c \
     via_options.c \
-    via_outputs.c \
+    via_output.c \
     via_sii164.c \
     via_tmds.c \
     via_tv.c \
diff --git a/src/via_outputs.c b/src/via_output.c
similarity index 100%
rename from src/via_outputs.c
rename to src/via_output.c


More information about the openchrome-devel mailing list