OK,
complete restart:
1. Delete all patches and setup a clean development branch again.
2. Apply only the attached patch.
3. Build and insmod the module.
4. Test it using
$ LD_PRELOAD=... mplayer ...

I really hope this works now. If not I am clueless what's wrong.

GWater

(Explanation: I rewrote the sensor init. I suspect that I "uniq"ed some page settings away when I made the last patch.)
From b2b2125ec4ec92ce226edbe88859f5b49de80e57 Mon Sep 17 00:00:00 2001
From: GWater <[EMAIL PROTECTED]>
Date: Fri, 14 Nov 2008 19:14:27 +0100
Subject: [PATCH] Add sensor MT9V112 used in 6270 devices

        The sensor supports YUV442 and 10-bit Bayer output.
        JPEG is available via sn9c20x.
        However YUV422 output is disabled until we get it to work.

Signed-off-by: GWater <[EMAIL PROTECTED]>
---
 microdia-dev.c |    6 ++++
 microdia.h     |    1 +
 micron.c       |   72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 micron.h       |    2 +
 4 files changed, 79 insertions(+), 2 deletions(-)

diff --git a/microdia-dev.c b/microdia-dev.c
index f3cdf4d..a233ab9 100644
--- a/microdia-dev.c
+++ b/microdia-dev.c
@@ -88,6 +88,12 @@ struct sensor_info sensors[] = {
                .address = 0x5d,
                .probe = mt9m001_probe
        },
+       {
+               .id = MT9V112_SENSOR,
+               .name = "MT9V112",
+               .address = 0x5d,
+               .probe = mt9v112_probe
+       },
 };
 
 /**
diff --git a/microdia.h b/microdia.h
index b3ad414..bdf9610 100644
--- a/microdia.h
+++ b/microdia.h
@@ -310,6 +310,7 @@ enum microdia_sensors {
        MT9V111_SENSOR          = 7,
        MT9V011_SENSOR          = 8,
        MT9M001_SENSOR          = 9,
+       MT9V112_SENSOR          = 10,
 };
 
 
diff --git a/micron.c b/micron.c
index d263cbe..57c113f 100644
--- a/micron.c
+++ b/micron.c
@@ -52,12 +52,12 @@ struct microdia_video_format mt9m111_fmts[] = {
                .depth = 8,
                .set_format = mt9m111_set_raw
        },
-       {
+       /*{
                .pix_fmt = V4L2_PIX_FMT_YUYV,
                .desc = "YUV 4:2:2",
                .depth = 16,
                .set_format = mt9m111_set_yuv422
-       },
+       },*/
        {
                .pix_fmt = V4L2_PIX_FMT_JPEG,
                .desc = "JPEG (YUV 4:2:2)",
@@ -425,6 +425,74 @@ static __u8 mt9m001_init[][3] = {
        {0x2e, 0x00, 0x24}, {0x07, 0x00, 0x02},
 };
 
+static __u8 mt9v112_init[][3] = {
+       {0x0d, 0x00, 0x21}, {0x0d, 0x00, 0x20}, {0xf0, 0x00, 0x00},
+       {0x34, 0xc0, 0x19}, {0x0a, 0x00, 0x11}, {0x0b, 0x00, 0x0b},
+       {0x20, 0x07, 0x03}, {0x35, 0x20, 0x22}, {0xf0, 0x00, 0x01},
+       {0x05, 0x00, 0x00}, {0x06, 0x34, 0x0c}, {0x3b, 0x04, 0x2a},
+       {0x3c, 0x04, 0x00}, {0xf0, 0x00, 0x02}, {0x2e, 0x0c, 0x58},
+       {0x5b, 0x00, 0x01}, {0xc8, 0x9f, 0x0b}, {0xf0, 0x00, 0x01},
+       {0x9b, 0x53, 0x00}, {0xf0, 0x00, 0x00}, {0x2b, 0x00, 0x20},
+       {0x2c, 0x00, 0x2a}, {0x2d, 0x00, 0x32}, {0x2e, 0x00, 0x20},
+       {0x09, 0x01, 0xdc}, {0x01, 0x00, 0x0c}, {0x02, 0x00, 0x20},
+       {0x03, 0x01, 0xe0}, {0x04, 0x02, 0x80}, {0x06, 0x00, 0x0c},
+       {0x05, 0x00, 0x98}, {0x20, 0x07, 0x03}, {0x09, 0x01, 0xf2},
+       {0x2b, 0x00, 0xa0}, {0x2c, 0x00, 0xa0}, {0x2d, 0x00, 0xa0},
+       {0x2e, 0x00, 0xa0}, {0x01, 0x00, 0x0c}, {0x02, 0x00, 0x20},
+       {0x03, 0x01, 0xe0}, {0x04, 0x02, 0x80}, {0x06, 0x00, 0x0c},
+       {0x05, 0x00, 0x98}, {0x09, 0x01, 0xc1}, {0x2b, 0x00, 0xae},
+       {0x2c, 0x00, 0xae}, {0x2d, 0x00, 0xae}, {0x2e, 0x00, 0xae},
+};
+
+/**
+ * @brief Initialize mt9v112 sensors
+ *
+ * @param dev Pointer to device structure
+ *
+ * @return 0 or negative error code
+ *
+ */
+int  mt9v112_initialize(struct usb_microdia *dev)
+{
+       int i;
+       int ret = 0;
+       __u8 value[2], reg;
+       for (i = 0; i < ARRAY_SIZE(mt9v112_init); i++) {
+               reg = mt9v011_init[i][0];
+               value[0] = mt9v112_init[i][1];
+               value[1] = mt9v112_init[i][2];
+               ret = sn9c20x_write_i2c_data(dev, 2, reg, value);
+               if (ret < 0) {
+                       UDIA_WARNING("Sensor Init Error (%d). "
+                               "line %d\n", ret, i);
+                       break;
+               }
+       }
+
+       return ret;
+}
+
+int mt9v112_probe(struct usb_microdia *dev)
+{
+       int ret;
+       __u8 buf[2];
+       ret = sn9c20x_read_i2c_data(dev, 2, 0x00, buf);
+       if (ret == 0) {
+               if (buf[0] != 0x12)
+                       return -EINVAL;
+               if (buf[1] == 0x29) {
+                       mt9v112_initialize(dev);
+                       dev->camera.modes = micron_resolutions;
+                       dev->camera.nmodes = ARRAY_SIZE(micron_resolutions);
+                       dev->camera.fmts = mt9m111_fmts;
+                       dev->camera.nfmts = ARRAY_SIZE(mt9m111_fmts);
+                       return MT9V112_SENSOR;
+               }
+       }
+
+       return -EINVAL;
+}
+
 /**
  * @brief Initialize mt9v011 sensors
  *
diff --git a/micron.h b/micron.h
index 4e2ee99..1955e5e 100644
--- a/micron.h
+++ b/micron.h
@@ -121,4 +121,6 @@ int mt9m111_set_yuv422(struct usb_microdia *dev);
 
 int mt9m001_probe(struct usb_microdia *dev);
 
+int mt9v112_probe(struct usb_microdia *dev);
+
 #endif
-- 
1.5.6.5

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to