drivers/gpu/drm/via/crtc_hw.h  |   37 +++++++++++++++++++++++
 drivers/gpu/drm/via/via_drv.h  |    4 +-
 drivers/gpu/drm/via/via_tmds.c |   65 ++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 103 insertions(+), 3 deletions(-)

New commits:
commit 4e40895ddc19e115ae4c3bb630f02efaf147706d
Author: Kevin Brace <kevinbr...@gmx.com>
Date:   Sat Apr 15 14:44:43 2017 -0700

    Version bumped to 3.0.31
    
    This version creates a dedicated mode setting callback function for
    CX700 / VX700 and VX800 chipsets’ integrated TMDS transmitter.
    
    Signed-off-by: Kevin Brace <kevinbr...@gmx.com>

diff --git a/drivers/gpu/drm/via/via_drv.h b/drivers/gpu/drm/via/via_drv.h
index 0f258bfe7a1..b5adab14dd6 100644
--- a/drivers/gpu/drm/via/via_drv.h
+++ b/drivers/gpu/drm/via/via_drv.h
@@ -30,11 +30,11 @@
 #define DRIVER_AUTHOR       "The OpenChrome Project"
 #define DRIVER_NAME         "via"
 #define DRIVER_DESC         "OpenChrome DRM for VIA Technologies Chrome IGP"
-#define DRIVER_DATE         "20170411"
+#define DRIVER_DATE         "20170415"
 
 #define DRIVER_MAJOR           3
 #define DRIVER_MINOR           0
-#define DRIVER_PATCHLEVEL      30
+#define DRIVER_PATCHLEVEL      31
 
 #include <linux/module.h>
 
commit b8d0836d992a49cf5040e24857277d81db928836
Author: Kevin Brace <kevinbr...@gmx.com>
Date:   Sat Apr 15 14:40:59 2017 -0700

    Added via_tmds_mode_set
    
    This function was added to via_tmds.c. This function improves the mode
    setting behavior of CX700 / VX700 and VX800 chipsets’ integrated TMDS
    transmitter.
    
    Signed-off-by: Kevin Brace <kevinbr...@gmx.com>

diff --git a/drivers/gpu/drm/via/via_tmds.c b/drivers/gpu/drm/via/via_tmds.c
index 72b82e3f20b..aff4c6be054 100644
--- a/drivers/gpu/drm/via/via_tmds.c
+++ b/drivers/gpu/drm/via/via_tmds.c
@@ -145,10 +145,29 @@ via_tmds_mode_fixup(struct drm_encoder *encoder,
        return true;
 }
 
+/*
+ * Handle CX700 / VX700 and VX800 integrated TMDS (DVI) mode setting.
+ */
+static void
+via_tmds_mode_set(struct drm_encoder *encoder,
+                       struct drm_display_mode *mode,
+                       struct drm_display_mode *adjusted_mode)
+{
+       struct via_device *dev_priv = encoder->dev->dev_private;
+       struct via_crtc *iga = container_of(encoder->crtc, struct via_crtc, 
base);
+
+       DRM_DEBUG_KMS("Entered via_tmds_mode_set.\n");
+
+       viaTMDSSyncPolarity(dev_priv, adjusted_mode->flags);
+       viaTMDSDisplaySource(dev_priv, iga->index);
+
+       DRM_DEBUG_KMS("Exiting via_tmds_mode_set.\n");
+}
+
 static const struct drm_encoder_helper_funcs via_tmds_enc_helper_funcs = {
        .dpms = via_tmds_dpms,
        .mode_fixup = via_tmds_mode_fixup,
-       .mode_set = via_set_sync_polarity,
+       .mode_set = via_tmds_mode_set,
        .prepare = via_encoder_prepare,
        .commit = via_encoder_commit,
        .disable = via_encoder_disable,
commit fe1ae610b4e6a720116cab51a7ebbf8d54df4a08
Author: Kevin Brace <kevinbr...@gmx.com>
Date:   Sat Apr 15 14:36:32 2017 -0700

    Added viaTMDSDisplaySource
    
    This function was added to via_tmds.c.
    
    Signed-off-by: Kevin Brace <kevinbr...@gmx.com>

diff --git a/drivers/gpu/drm/via/via_tmds.c b/drivers/gpu/drm/via/via_tmds.c
index 9e53859b7be..72b82e3f20b 100644
--- a/drivers/gpu/drm/via/via_tmds.c
+++ b/drivers/gpu/drm/via/via_tmds.c
@@ -84,6 +84,23 @@ viaTMDSSyncPolarity(struct via_device *dev_priv, unsigned 
int flags)
 }
 
 /*
+ * Sets TMDS (DVI) display source.
+ */
+static void
+viaTMDSDisplaySource(struct via_device *dev_priv, int index)
+{
+       u8 displaySource = index;
+
+       DRM_DEBUG_KMS("Entered viaTMDSDisplaySource.\n");
+
+       viaTMDSSetDisplaySource(VGABASE, displaySource & 0x01);
+       DRM_INFO("TMDS (DVI) Display Source: IGA%d\n",
+                       (displaySource & 0x01) + 1);
+
+       DRM_DEBUG_KMS("Exiting viaTMDSDisplaySource.\n");
+}
+
+/*
  * Routines for controlling stuff on the TMDS port
  */
 static const struct drm_encoder_funcs via_tmds_enc_funcs = {
commit f99e42538381eaa2fbe67c302e39f785996c4218
Author: Kevin Brace <kevinbr...@gmx.com>
Date:   Sat Apr 15 14:32:34 2017 -0700

    Added viaTMDSSyncPolarity
    
    This function was added to via_tmds.c.
    
    Signed-off-by: Kevin Brace <kevinbr...@gmx.com>

diff --git a/drivers/gpu/drm/via/via_tmds.c b/drivers/gpu/drm/via/via_tmds.c
index d5f244acb7b..9e53859b7be 100644
--- a/drivers/gpu/drm/via/via_tmds.c
+++ b/drivers/gpu/drm/via/via_tmds.c
@@ -57,6 +57,33 @@ viaTMDSPower(struct via_device *dev_priv,
 }
 
 /*
+ * Set TMDS (DVI) sync polarity.
+ */
+static void
+viaTMDSSyncPolarity(struct via_device *dev_priv, unsigned int flags)
+{
+       u8 syncPolarity = 0x00;
+
+       DRM_DEBUG_KMS("Entered viaTMDSSyncPolarity.\n");
+
+       if (flags & DRM_MODE_FLAG_NHSYNC) {
+               syncPolarity |= BIT(0);
+       }
+
+       if (flags & DRM_MODE_FLAG_NVSYNC) {
+               syncPolarity |= BIT(1);
+       }
+
+       viaTMDSSetSyncPolarity(VGABASE, syncPolarity);
+       DRM_INFO("TMDS (DVI) Horizontal Sync Polarity: %s\n",
+               (syncPolarity & BIT(0)) ? "-" : "+");
+       DRM_INFO("TMDS (DVI) Vertical Sync Polarity: %s\n",
+               (syncPolarity & BIT(1)) ? "-" : "+");
+
+       DRM_DEBUG_KMS("Exiting viaTMDSSyncPolarity.\n");
+}
+
+/*
  * Routines for controlling stuff on the TMDS port
  */
 static const struct drm_encoder_funcs via_tmds_enc_funcs = {
commit 45710b40110c552f223bf86cf4080de3bae5af37
Author: Kevin Brace <kevinbr...@gmx.com>
Date:   Sat Apr 15 14:20:32 2017 -0700

    Added viaTMDSSetDisplaySource
    
    This inline function was added to crtc_hw.h.
    
    Signed-off-by: Kevin Brace <kevinbr...@gmx.com>

diff --git a/drivers/gpu/drm/via/crtc_hw.h b/drivers/gpu/drm/via/crtc_hw.h
index 8c3eb0b2665..4e8c8bd70e0 100644
--- a/drivers/gpu/drm/via/crtc_hw.h
+++ b/drivers/gpu/drm/via/crtc_hw.h
@@ -234,6 +234,23 @@ viaTMDSSetSyncPolarity(void __iomem *regs, u8 syncPolarity)
                        (syncPolarity & BIT(1)) ? "-" : "+");
 }
 
+/*
+ * Sets TMDS (DVI) display source.
+ */
+static inline void
+viaTMDSSetDisplaySource(void __iomem *regs, u8 displaySource)
+{
+       /* Set TMDS (DVI) display source.
+        * The integrated TMDS transmitter appears to utilize LVDS1's
+        * data source selection bit (3X5.99[4]). */
+       /* 3X5.99[4] - LVDS Channel1 Data Source Selection
+        *             0: Primary Display
+        *             1: Secondary Display */
+       svga_wcrt_mask(regs, 0x99, displaySource << 4, BIT(4));
+       DRM_DEBUG_KMS("TMDS (DVI) Display Source: IGA%d\n",
+                       (displaySource & 0x01) + 1);
+}
+
 
 extern void load_register_tables(void __iomem *regbase, struct vga_registers 
*regs);
 extern void load_value_to_registers(void __iomem *regbase, struct 
vga_registers *regs,
commit 339e8ab59077b38e259c3859ba47245ffbfdc781
Author: Kevin Brace <kevinbr...@gmx.com>
Date:   Sat Apr 15 14:04:01 2017 -0700

    Added viaTMDSSetSyncPolarity
    
    This inline function was added to crtc_hw.h.
    
    Signed-off-by: Kevin Brace <kevinbr...@gmx.com>

diff --git a/drivers/gpu/drm/via/crtc_hw.h b/drivers/gpu/drm/via/crtc_hw.h
index 07a7cd9dac3..8c3eb0b2665 100644
--- a/drivers/gpu/drm/via/crtc_hw.h
+++ b/drivers/gpu/drm/via/crtc_hw.h
@@ -214,6 +214,26 @@ viaTMDSSetPower(void __iomem *regs, bool powerState)
                        powerState ? "On" : "Off");
 }
 
+/*
+ * Sets CX700 / VX700 and VX800 chipsets' TMDS (DVI) sync polarity.
+ */
+static inline void
+viaTMDSSetSyncPolarity(void __iomem *regs, u8 syncPolarity)
+{
+       /* Set TMDS (DVI) sync polarity. */
+       /* 3X5.97[6] - DVI (TMDS) VSYNC Polarity
+       *              0: Positive
+       *              1: Negative
+       * 3X5.97[5] - DVI (TMDS) HSYNC Polarity
+       *              0: Positive
+       *              1: Negative */
+       svga_wcrt_mask(regs, 0x97, syncPolarity << 5, BIT(6) | BIT(5));
+       DRM_DEBUG_KMS("TMDS (DVI) Horizontal Sync Polarity: %s\n",
+                       (syncPolarity & BIT(0)) ? "-" : "+");
+       DRM_DEBUG_KMS("TMDS (DVI) Vertical Sync Polarity: %s\n",
+                       (syncPolarity & BIT(1)) ? "-" : "+");
+}
+
 
 extern void load_register_tables(void __iomem *regbase, struct vga_registers 
*regs);
 extern void load_value_to_registers(void __iomem *regbase, struct 
vga_registers *regs,
_______________________________________________
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel

Reply via email to