changeset 29948:20da977f0f3e

Update the SuperH VEU vidix driver with experimental support for VEU3F. Patch by Magnus Damm, damm opensource se
author cehoyos
date Thu, 10 Dec 2009 23:22:19 +0000
parents 2c0a16bf54bb
children fc8f901ee516
files vidix/sh_veu_vid.c
diffstat 1 files changed, 37 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/vidix/sh_veu_vid.c	Thu Dec 10 23:20:09 2009 +0000
+++ b/vidix/sh_veu_vid.c	Thu Dec 10 23:22:19 2009 +0000
@@ -219,6 +219,8 @@
 #define VCOFFR 0x224 /* color conversion offset */
 #define VCBR   0x228 /* color conversion clip */
 
+#define VRPBR  0xc8 /* resize passband */
+
 /* Helper functions for reading registers. */
 
 static unsigned long read_reg(struct uio_map *ump, int reg_offs)
@@ -323,14 +325,19 @@
 
 static int sh_veu_is_veu2h(void)
 {
-    return uio_mmio.size > 0xb8;
+    return uio_mmio.size == 0x27c;
+}
+
+static int sh_veu_is_veu3f(void)
+{
+    return uio_mmio.size == 0xcc;
 }
 
 static unsigned long sh_veu_do_scale(struct uio_map *ump,
                                      int vertical, int size_in,
                                      int size_out, int crop_out)
 {
-    unsigned long fixpoint, mant, frac, value, rep;
+    unsigned long fixpoint, mant, frac, value, rep, vb;
 
     /* calculate FRAC and MANT */
     do {
@@ -402,6 +409,34 @@
     }
     write_reg(ump, value, VRFSR);
 
+    /* VEU3F needs additional VRPBR register handling */
+    if (sh_veu_is_veu3f()) {
+        if (size_out > size_in)
+            vb = 64;
+        else {
+            if ((mant >= 8) && (mant < 16))
+                value = 4;
+            else if ((mant >= 4) && (mant < 8))
+                value = 2;
+            else
+                value = 1;
+
+            vb = 64 * 4096 * value;
+            vb /= 4096 * mant + frac;
+        }
+
+        /* set resize passband register */
+        value = read_reg(ump, VRPBR);
+        if (vertical) {
+            value &= ~0xffff0000;
+            value |= vb << 16;
+        } else {
+            value &= ~0xffff;
+            value |= vb;
+        }
+        write_reg(ump, value, VRPBR);
+    }
+
     return (((size_in * crop_out) / size_out) + 0x03) & ~0x03;
 }