changeset 13901:be030b3627a1

h/w revision detection patch by Timothy Lee <timothy.lee@siriushk.com>
author faust3
date Mon, 08 Nov 2004 11:29:55 +0000
parents 99b893f9fb67
children fe81a6978745
files vidix/drivers/unichrome_vid.c
diffstat 1 files changed, 31 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/vidix/drivers/unichrome_vid.c	Mon Nov 08 11:07:06 2004 +0000
+++ b/vidix/drivers/unichrome_vid.c	Mon Nov 08 11:29:55 2004 +0000
@@ -26,6 +26,8 @@
       Initial version
     2004-10-09
       Added Doxygen documentation (Benjamin Zores <ben@geexbox.org>)
+    2004-11-08
+      Added h/w revision detection (Timothy Lee <timothy.lee@siriushk.com>)
 
     To Do:
 */
@@ -60,6 +62,7 @@
 uint8_t *vio;
 uint8_t *uc_mem;
 uint8_t mclk_save[3];
+uint8_t hwrev;
 
 #define VIA_OUT(hwregs, reg, val)	*(volatile uint32_t *)((hwregs) + (reg)) = (val)
 #define VIA_IN(hwregs, reg)		*(volatile uint32_t *)((hwregs) + (reg))
@@ -544,6 +547,25 @@
   uc_grkey.ckey.green = 0x00;
   uc_grkey.ckey.red = 0x00;
 
+  /* Detect whether we have a CLE266Ax or CLE266Cx */
+  outb (0x4f, 0x3d4);
+  tmp = inb (0x3d5);
+  outb (0x4f, 0x3d4);
+  outb (0x55, 0x3d5);
+  outb (0x4f, 0x3d4);
+  if (0x55 == inb (0x3d5))
+  {
+    /* Only CLE266Cx supports CR4F */
+    hwrev = 0x11;
+  }
+  else
+  {
+    /* Otherwise assume to be a CLE266Ax */
+    hwrev = 0x00;
+  }
+  outb (0x4f, 0x3d4);
+  outb (tmp, 0x3d5);
+
 #ifdef DEBUG_LOGFILE
   logfile = fopen ("/tmp/uc_vidix.log", "w");
 #endif
@@ -767,7 +789,7 @@
   uc_ovl_setup_fifo (&extfifo_on, src_w);
 
   /* Get image format, FIFO size, etc. */
-  uc_ovl_map_v1_control (info->fourcc, src_w, 3, extfifo_on,
+  uc_ovl_map_v1_control (info->fourcc, src_w, hwrev, extfifo_on,
 			 &v_ctrl, &fifo_ctrl);
 
   /* Setup layer window */
@@ -846,9 +868,17 @@
   /* Configure diy_pitchlay parameters now */
   if (v_ctrl & V1_COLORSPACE_SIGN)
     {
+      if (hwrev >= 0x10)
+	{
+	  VIDEO_OUT (vio, V1_ColorSpaceReg_2, ColorSpaceValue_2_3123C0);
+	  VIDEO_OUT (vio, V1_ColorSpaceReg_1, ColorSpaceValue_1_3123C0);
+	}
+      else
+	{
       VIDEO_OUT (vio, V1_ColorSpaceReg_2, ColorSpaceValue_2);
       VIDEO_OUT (vio, V1_ColorSpaceReg_1, ColorSpaceValue_1);
     }
+    }
 
   VIDEO_OUT (vio, V1_CONTROL, v_ctrl);
   VIDEO_OUT (vio, V_FIFO_CONTROL, fifo_ctrl);