[Openchrome-devel] xf86-video-openchrome: 9 commits - configure.ac src/via_display.c src/via_outputs.c src/via_vt1632.c

Kevin Brace kevinbrace at kemper.freedesktop.org
Tue Jun 28 04:08:05 UTC 2016


 configure.ac      |    2 -
 src/via_display.c |   36 +++++++++++++++++--
 src/via_outputs.c |   98 +++++++++++++++++++++++++++++++++++++++++++-----------
 src/via_vt1632.c  |    2 -
 4 files changed, 112 insertions(+), 26 deletions(-)

New commits:
commit bf22627745ff2c395ed1211ab72856fa69ec664c
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Mon Jun 27 23:03:15 2016 -0500

    Version bumped to 0.4.904 (Version 0.5 RC5)
    
    This fifth release candidate had lots of changes made to the analog
    VGA output control portion of the code. I sure hope there are no
    regressions.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/configure.ac b/configure.ac
index 4963fa9..6b55419 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ(2.57)
 AC_INIT([xf86-video-openchrome],
-        [0.4.903],
+        [0.4.904],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/openchrome],
         [xf86-video-openchrome])
 
commit ed68b1e9428b96b2c3ec4dc56625579bf531bc63
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Mon Jun 27 22:58:54 2016 -0500

    Using SR01[5] to turn off analog VGA output rather than CR47[2]
    
    CR47[2] (3X5.47[2]) is the “back door” register to turn off analog
    VGA output. Will rather use the “front door” version of it located
    at SR01[5] (3C5.01[5]).
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_outputs.c b/src/via_outputs.c
index bc516c8..e7f2ab7 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -520,11 +520,10 @@ viaAnalogOutput(ScrnInfoPtr pScrn, Bool displayState)
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Entered viaAnalogOutput.\n"));
 
-    /* This register controls analog VGA DAC output state. */
-    /* 3X5.47[2] - DACOFF Backdoor Register
+    /* 3C5.01[5] - DACOFF Register
      *             0: DAC on
      *             1: DAC off */
-    ViaCrtcMask(hwp, 0x47, displayState ? 0x00 : 0x04, 0x04);
+    ViaSeqMask(hwp, 0x01, displayState ? 0x00 : 0x20, 0x20);
     xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                 "Analog VGA Output: %s\n",
                 displayState ? "On" : "Off");
commit 6ed9ca5a32bfff8908cfa2329e09b66241e819dd
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Mon Jun 27 22:51:39 2016 -0500

    Added viaAnalogInit
    
    This function initializes several analog VGA output DAC related
    registers. It is called from via_analog_mode_set callback function
    during mode setting for analog VGA output.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_outputs.c b/src/via_outputs.c
index d78902a..bc516c8 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -554,6 +554,51 @@ viaAnalogSource(ScrnInfoPtr pScrn, CARD8 displaySource)
                         "Exiting viaAnalogSource.\n"));
 }
 
+/*
+ * Intializes analog VGA related registers.
+ */
+static void
+viaAnalogInit(ScrnInfoPtr pScrn)
+{
+    vgaHWPtr hwp = VGAHWPTR(pScrn);
+    VIAPtr pVia = VIAPTR(pScrn);
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered viaAnalogInit.\n"));
+
+    /* 3X5.37[7]   - DAC Power Save Control 1
+     *               0: Depend on Rx3X5.37[5:4] setting
+     *               1: DAC always goes into power save mode
+     * 3X5.37[6]   - DAC Power Down Control
+     *               0: Depend on Rx3X5.47[2] setting
+     *               1: DAC never goes to power down mode
+     * 3X5.37[5:4] - DAC Power Save Control 2
+     *               00: DAC never goes to power save mode
+     *               01: DAC goes to power save mode by line
+     *               10: DAC goes to power save mode by frame
+     *               11: DAC goes to power save mode by line and frame
+     * 3X5.37[3]   - DAC PEDESTAL Control
+     * 3X5.37[2:0] - DAC Factor
+     *               (Default: 100) */
+    ViaCrtcMask(hwp, 0x37, 0x04, 0xFF);
+
+    switch (pVia->Chipset) {
+    case VIA_CX700:
+    case VIA_VX800:
+    case VIA_VX855:
+    case VIA_VX900:
+        /* 3C5.5E[0] - CRT DACOFF Setting
+         *             1: CRT DACOFF controlled by 3C5.01[5] */
+        ViaSeqMask(hwp, 0x5E, 0x01, 0x01);
+        break;
+    default:
+        break;
+    }
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting viaAnalogInit.\n"));
+}
+
 static void
 via_analog_create_resources(xf86OutputPtr output)
 {
@@ -649,6 +694,8 @@ via_analog_mode_set(xf86OutputPtr output, DisplayModePtr mode,
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Entered via_analog_mode_set.\n"));
 
+    viaAnalogInit(pScrn);
+
     if (output->crtc) {
         viaAnalogSource(pScrn, iga->index ? 0x01 : 0x00);
     }
commit 676739f6335c45d06da58fc7f0ff7032bb63a00d
Author: Mario J. Rugiero <mrugiero at gmail.com>
Date:   Mon Jun 27 21:21:00 2016 -0500

    Small fix to VT1632(A) detection
    
    via_vt1632_detect was checking the 0x02 flag by using the boolean
    and operator instead of the binary one, which causes any non-zero
    value to set the status as connected.
    
    Signed-off-by: Mario J. Rugiero <mrugiero at gmail.com>
    Reviewed-by: Xavier Bachelot <xavier at bachelot.org>

diff --git a/src/via_vt1632.c b/src/via_vt1632.c
index c82d3a8..0d6b662 100644
--- a/src/via_vt1632.c
+++ b/src/via_vt1632.c
@@ -212,7 +212,7 @@ via_vt1632_detect(xf86OutputPtr output)
                         "Entered via_vt1632_detect.\n"));
 
     xf86I2CReadByte(Private->VT1632I2CDev, 0x09, &tmp);
-    if (tmp && 0x02) {
+    if (tmp & 0x02) {
         xf86DrvMsg(pScrn->scrnIndex, X_INFO, 
                     "VT1632A: DVI device is detected.\n");
         status = XF86OutputStatusConnected;
commit f75872b24e9220539118d874ee5df8308b51c035
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Mon Jun 27 21:13:45 2016 -0500

    Added the capability for viaAnalogOutput to log analog VGA output state
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_outputs.c b/src/via_outputs.c
index b438d56..d78902a 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -525,6 +525,9 @@ viaAnalogOutput(ScrnInfoPtr pScrn, Bool displayState)
      *             0: DAC on
      *             1: DAC off */
     ViaCrtcMask(hwp, 0x47, displayState ? 0x00 : 0x04, 0x04);
+    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                "Analog VGA Output: %s\n",
+                displayState ? "On" : "Off");
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Exiting viaAnalogOutput.\n"));
commit 7363978f3b4f8d4771b0b27ae6bbae59387e36d4
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Mon Jun 27 18:32:04 2016 -0500

    Added viaAnalogSource
    
    This function selects IGA1 or IGA2 to feed into analog VGA output DAC.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_outputs.c b/src/via_outputs.c
index 6a6daee..b438d56 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -530,6 +530,27 @@ viaAnalogOutput(ScrnInfoPtr pScrn, Bool displayState)
                         "Exiting viaAnalogOutput.\n"));
 }
 
+/*
+ * Specifies IGA1 or IGA2 for analog VGA DAC source.
+ */
+static void
+viaAnalogSource(ScrnInfoPtr pScrn, CARD8 displaySource)
+{
+    vgaHWPtr hwp = VGAHWPTR(pScrn);
+    CARD8 value = displaySource;
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered viaAnalogSource.\n"));
+
+    ViaSeqMask(hwp, 0x16, value << 6, 0x40);
+    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                "Analog VGA Output Source: IGA%d\n",
+                (value & 0x01) + 1);
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting viaAnalogSource.\n"));
+}
+
 static void
 via_analog_create_resources(xf86OutputPtr output)
 {
@@ -621,18 +642,12 @@ via_analog_mode_set(xf86OutputPtr output, DisplayModePtr mode,
     ScrnInfoPtr pScrn = output->scrn;
     vgaHWPtr hwp = VGAHWPTR(pScrn);
     drmmode_crtc_private_ptr iga = output->crtc->driver_private;
-    CARD8 value = 0x00; /* Value for IGA 1 */
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Entered via_analog_mode_set.\n"));
 
     if (output->crtc) {
-        /* IGA 2 */
-        if (iga->index) {
-            value = 0x40;
-        }
-
-        ViaSeqMask(hwp, 0x16, value, 0x40);
+        viaAnalogSource(pScrn, iga->index ? 0x01 : 0x00);
     }
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
commit 7d8ad906d1d6ed34f09f908c46f88dcac467f179
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Mon Jun 27 13:31:16 2016 -0500

    Not turning on analog VGA output DAC within via_analog_mode_set
    
    Analog VGA output DAC should be turned on only by via_analog_dpms
    callback function, and via_analog_mode_set callback function
    should not be touching it.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_outputs.c b/src/via_outputs.c
index 3dadb8e..6a6daee 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -635,8 +635,6 @@ via_analog_mode_set(xf86OutputPtr output, DisplayModePtr mode,
         ViaSeqMask(hwp, 0x16, value, 0x40);
     }
 
-    viaAnalogOutput(pScrn, TRUE);
-
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Exiting via_analog_mode_set.\n"));
 }
commit 85f99cf47ab82a941775b627a0259e89985f3b92
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Mon Jun 27 12:40:58 2016 -0500

    Turning off analog VGA output DAC rather than IGA1 DPMS state
    
    Previously, in order to turn off analog VGA output, the code was
    putting IGA1 to DPMS off state. The correct way to turn off analog
    VGA output is to control its DAC output state.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_outputs.c b/src/via_outputs.c
index 30602dd..3dadb8e 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -509,27 +509,25 @@ via_tv_init(ScrnInfoPtr pScrn)
 }
 
 /*
- * Enables CRT using DPMS registers.
+ * Enables or disables analog VGA output by controlling DAC
+ * (Digital to Analog Converter) output state.
  */
 static void
-ViaDisplayEnableCRT(ScrnInfoPtr pScrn)
+viaAnalogOutput(ScrnInfoPtr pScrn, Bool displayState)
 {
     vgaHWPtr hwp = VGAHWPTR(pScrn);
 
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaDisplayEnableCRT\n"));
-    ViaCrtcMask(hwp, 0x36, 0x00, 0x30);
-}
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered viaAnalogOutput.\n"));
 
-/*
- * Disables CRT using DPMS registers.
- */
-static void
-ViaDisplayDisableCRT(ScrnInfoPtr pScrn)
-{
-    vgaHWPtr hwp = VGAHWPTR(pScrn);
+    /* This register controls analog VGA DAC output state. */
+    /* 3X5.47[2] - DACOFF Backdoor Register
+     *             0: DAC on
+     *             1: DAC off */
+    ViaCrtcMask(hwp, 0x47, displayState ? 0x00 : 0x04, 0x04);
 
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaDisplayDisableCRT\n"));
-    ViaCrtcMask(hwp, 0x36, 0x30, 0x30);
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting viaAnalogOutput.\n"));
 }
 
 static void
@@ -562,12 +560,12 @@ via_analog_dpms(xf86OutputPtr output, int mode)
 
     switch (mode) {
     case DPMSModeOn:
-        ViaDisplayEnableCRT(pScrn);
+        viaAnalogOutput(pScrn, TRUE);
         break;
     case DPMSModeStandby:
     case DPMSModeSuspend:
     case DPMSModeOff:
-        ViaDisplayDisableCRT(pScrn);
+        viaAnalogOutput(pScrn, FALSE);
         break;
     default:
         break;
@@ -637,7 +635,7 @@ via_analog_mode_set(xf86OutputPtr output, DisplayModePtr mode,
         ViaSeqMask(hwp, 0x16, value, 0x40);
     }
 
-    ViaDisplayEnableCRT(pScrn);
+    viaAnalogOutput(pScrn, TRUE);
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Exiting via_analog_mode_set.\n"));
commit 18bab1abef97a2aba6c97d235692e1329a11695c
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Mon Jun 27 12:11:37 2016 -0500

    Initializing CR47 within viaIGAInitCommon
    
    Some of the register bits of CR47 (3X5.47) should be initialized
    within viaIGAInitCommon function rather than viaIGA1Init function
    since viaIGA1Init function will not be called if only IGA2 is used.
    (i.e., flat panel only usage)
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_display.c b/src/via_display.c
index 0eda809..90c71d1 100644
--- a/src/via_display.c
+++ b/src/via_display.c
@@ -318,6 +318,15 @@ viaIGAInitCommon(ScrnInfoPtr pScrn)
     temp = hwp->readCrtc(hwp, 0x36);
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "CR36: 0x%02X\n", temp));
+
+    /* For UniChrome Pro and Chrome9. */
+    if ((pVia->Chipset != VIA_CLE266)
+        && (pVia->Chipset != VIA_KM400)) {
+        temp = hwp->readCrtc(hwp, 0x47);
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "CR47: 0x%02X\n", temp));
+    }
+
     temp = hwp->readCrtc(hwp, 0x6B);
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "CR6B: 0x%02X\n", temp));
@@ -542,6 +551,26 @@ viaIGAInitCommon(ScrnInfoPtr pScrn)
      *               1: Enable */
     ViaCrtcMask(hwp, 0x36, 0x01, 0x01);
 
+    /* For UniChrome Pro and Chrome9. */
+    if ((pVia->Chipset != VIA_CLE266)
+        && (pVia->Chipset != VIA_KM400)) {
+        /* 3X5.47[7] - IGA1 Timing Plus 2 VCK
+         * 3X5.47[6] - IGA1 Timing Plus 4 VCK
+         * 3X5.47[5] - Peep at the PCI-bus
+         *             0: Disable
+         *             1: Enable
+         * 3X5.47[4] - Reserved
+         * 3X5.47[3] - IGA1 Timing Plus 6 VCK
+         * 3X5.47[2] - DACOFF Backdoor Register
+         * 3X5.47[1] - LCD Simultaneous Mode Backdoor Register for
+         *             8/9 Dot Clocks
+         * 3X5.47[0] - LCD Simultaneous Mode Backdoor Register for
+         *             Clock Select and CRTC Register Protect
+         *
+         */
+        ViaCrtcMask(hwp, 0x47, 0x00, 0x23);
+    }
+
     /* 3X5.6B[3] - Simultaneous Display Enable
      *             0: Disable
      *             1: Enable */
@@ -722,11 +751,8 @@ viaIGA1Init(ScrnInfoPtr pScrn)
          * 3X5.47[1] - LCD Simultaneous Mode Backdoor Register for
          *             8/9 Dot Clocks
          * 3X5.47[0] - LCD Simultaneous Mode Backdoor Register for
-         *             Clock Select and CRTC Register Protect
-         *
-         */
-        ViaCrtcMask(hwp, 0x47, 0x00, 0xEF);
-
+         *             Clock Select and CRTC Register Protect */
+        ViaCrtcMask(hwp, 0x47, 0x00, 0xCC);
     }
 
     /* TV out uses division by 2 mode.


More information about the Openchrome-devel mailing list