Paweł Jabłoński schrieb:
So, this means I have to read through the whole log (last time I only
grepped the data I needed). This may take time - in the meantime please try
repluggin, rebooting and stuff like that to make sure it wasn't a one-time
failure in the cam.

If you have some even not polished improvements send me please, I can
check it immediately to save your time.

Paweł

--~--~---------~--~----~------------~-------~--~----~
Lets make microdia webcams plug'n play, (currently plug'n pray)
To post to this group, send email to [email protected]
Visit us online https://groups.google.com/group/microdia
-~----------~----~----~----~------~----~------~--~---


OK,
here's a new patch.

I changed a few parameters (i think it's gain and exposure but the datasheet is a bit unclear). Anyway - I expect the image to brighten up and shine and make us all very happy.

First you need to reset the changes from the previous patch:
$ git reset --hard origin

Then apply the new patch
$ git am <patchfile>

Then test it again like you did it before.

Good luck,
GWater
From 86cbcf901432947615f79ff27dedf4424999994d Mon Sep 17 00:00:00 2001
From: GWater <[email protected]>
Date: Wed, 17 Dec 2008 23:07:56 +0100
Subject: [PATCH] Add support for hv7131r sensors

        devices 627c and 62bc should now work

Signed-off-by: GWater <[email protected]>
---
 Makefile       |    2 +-
 hv7131r.c      |   87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 microdia-dev.c |   10 ++++++
 microdia.h     |    4 ++
 sn9c20x.c      |   14 +--------
 5 files changed, 104 insertions(+), 13 deletions(-)
 create mode 100644 hv7131r.c

diff --git a/Makefile b/Makefile
index 379ae58..59d10ba 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ include $(src)/.config
 
 microdia-objs := microdia-usb.o microdia-v4l.o microdia-sysfs.o
 microdia-objs += microdia-dev.o microdia-queue.o
-microdia-objs += sn9c20x.o omnivision.o micron.o
+microdia-objs += sn9c20x.o omnivision.o micron.o hv7131r.o
 
 ifeq ($(CONFIG_MICRODIA_DEBUGFS),y)
 microdia-objs += microdia-debugfs.o
diff --git a/hv7131r.c b/hv7131r.c
new file mode 100644
index 0000000..c9b2d5b
--- /dev/null
+++ b/hv7131r.c
@@ -0,0 +1,87 @@
+/**
+ * @file hv7131r.c
+ * @author GWater
+ * @date 2008-12-17
+ *
+ * @brief Common control functions the HV7131R Image Sensor
+ *
+ * @note Copyright (C) GWater
+ *
+ * @par Licences
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "microdia.h"
+#include "sn9c20x.h"
+
+static __u8 hv7131r_init[][2] = {
+       {0x02, 0x08},
+       {0x02, 0x00},
+       {0x01, 0x08},
+       {0x02, 0x00},
+       {0x20, 0x00},
+       {0x21, 0xd0},
+       {0x22, 0x00},
+       {0x23, 0x09},
+       {0x01, 0x08},
+       {0x01, 0x08},
+       {0x01, 0x08},
+       {0x25, 0x07},
+       {0x26, 0xc3},
+       {0x27, 0x50},
+       {0x30, 0x62},
+       {0x31, 0x00},
+       {0x32, 0x00},
+       {0x33, 0x10},
+       {0x20, 0x00},
+       {0x21, 0xd0},
+       {0x22, 0x00},
+       {0x23, 0x09},
+       {0x01, 0x08},
+};
+
+/* other stuff in the logs - later adjustments to gain, etc.
+maybe we can build something nice from it later.
+c1 25 01 86 a0 00 1e
+a1 30 1e 00 00 00 1d
+c1 25 03 0d 40 00 1e
+a1 30 26 00 00 00 1d
+c1 25 06 1a 80 00 1e
+a1 30 2f 00 00 00 1d
+c1 25 07 a1 20 00 1e
+a1 30 62 00 00 00 1d
+*/
+
+int hv7131r_initialize(struct usb_microdia *dev)
+{
+       int i;
+       int ret = 0;
+
+       dev->camera.i2c_flags |= SN9C20X_I2C_400KHZ;
+
+       for (i = 0; i < ARRAY_SIZE(hv7131r_init); i++) {
+               ret = sn9c20x_write_i2c_data(dev, 1, hv7131r_init[i][0],
+                       &hv7131r_init[i][1]);
+               if (ret < 0)
+                       goto err;
+       }
+
+       return ret;
+
+err:
+       UDIA_ERROR("Sensor Init failed (%d)! - line %d\n", ret, i);
+       return ret;
+}
diff --git a/microdia-dev.c b/microdia-dev.c
index 2f684ce..c3e4e69 100644
--- a/microdia-dev.c
+++ b/microdia-dev.c
@@ -139,6 +139,14 @@ static struct sensor_info sensors[] = {
                .hstart = 2,
                .vstart = 2,
        },
+       {
+               .id = HV7131R_SENSOR,
+               .name = "HV7131R",
+               .address = 0x11,
+               .initialize = hv7131r_initialize,
+               .hstart = 0,
+               .vstart = 1,
+       },
 };
 
 static __u16 known_cams[][2] = {
@@ -151,6 +159,7 @@ static __u16 known_cams[][2] = {
        {0x6253, OV9650_SENSOR},
        {0x6260, OV7670_SENSOR},
        {0x627b, OV7660_SENSOR},
+       {0x627c, HV7131R_SENSOR},
        {0x627f, OV9650_SENSOR},
        {0x6280, MT9M001_SENSOR},
        {0x6282, MT9M111_SENSOR},
@@ -160,6 +169,7 @@ static __u16 known_cams[][2] = {
        {0x62a0, OV7670_SENSOR},
        {0x62b3, OV9655_SENSOR},
        {0x62bb, OV7660_SENSOR},
+       {0x62bc, HV7131R_SENSOR},
        /* The following PIDs have VIDs different from 0x0c45. */
        {0x00f4, OV9650_SENSOR},
        {0x013d, OV7660_SENSOR},
diff --git a/microdia.h b/microdia.h
index 1134542..6d4bb16 100644
--- a/microdia.h
+++ b/microdia.h
@@ -324,6 +324,7 @@ enum microdia_sensors {
        MT9V111_SENSOR          = 7,
        MT9V011_SENSOR          = 8,
        MT9M001_SENSOR          = 9,
+       HV7131R_SENSOR          = 10,
 };
 
 
@@ -522,4 +523,7 @@ static inline int microdia_queue_streaming(struct 
microdia_video_queue *queue)
        return queue->flags & MICRODIA_QUEUE_STREAMING;
 }
 
+/* sensor hv7131r has no header-file of its own: */
+int hv7131r_initialize(struct usb_microdia *dev);
+
 #endif
diff --git a/sn9c20x.c b/sn9c20x.c
index 328dad2..b66c1e1 100644
--- a/sn9c20x.c
+++ b/sn9c20x.c
@@ -227,17 +227,12 @@ int sn9c20x_set_LEDs(struct usb_microdia *dev, int enable)
        if (enable) {
                switch (sensor) {
                case MT9M001_SENSOR:
-                       led[0] = 0x80;
-                       led[1] = 0xa0;
-               break;
+               case HV7131R_SENSOR:
                case SOI968_SENSOR:
                        led[0] = 0x80;
                        led[1] = 0xa0;
                break;
                case MT9V011_SENSOR:
-                       led[0] = 0x40;
-                       led[1] = 0x60;
-               break;
                case OV7660_SENSOR:
                        led[0] = 0x40;
                        led[1] = 0x60;
@@ -252,18 +247,13 @@ int sn9c20x_set_LEDs(struct usb_microdia *dev, int enable)
                }
        } else {
                switch (sensor) {
+               case HV7131R_SENSOR:
                case MT9M001_SENSOR:
-                       led[0] = 0xa0;
-                       led[1] = 0xa0;
-               break;
                case MT9V011_SENSOR:
                        led[0] = 0xa0;
                        led[1] = 0xa0;
                break;
                case MT9M111_SENSOR:
-                       led[0] = 0x20;
-                       led[1] = 0x60;
-               break;
                case OV7660_SENSOR:
                        led[0] = 0x20;
                        led[1] = 0x60;
-- 
1.6.0.4

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to