Vojtech Pavlik wrote:
Hi!

I've got an OrangeMicro iBot2 camera and I want to use it in my robotic
project. You helped me to get it running somehow with the ovfx2 driver,
but it still was not satisfying.

As the project starts to get completed, I really really needed to get it
running, and so I sat for a day with an ov7620 and fx2 datasheets, some
papers about Bayer demosaicking, and I fixed the driver.

The attached patch:

        * Replaces the BGBR decoding with Bayer decoding, which is
          correct for this type of camera. It uses a mix of bilinear
          and nearest-neighbor approaches, which is fast and simple.

        * Fixes the fact that in raw RGB progressive mode the ov7620
          chip sends every pixel twice at two different positions in
          the data stream. This is fixed by switching into interlaced
          mode.

        * Uses the QVGA60 bit to turn the interlaced mode into a
          progressive mode with half the data (the correct amount -
          640x480 bytes, which is the number of pixels the camera has),
          and twice the framerate.

        * Suggests using "clockdiv=0" to achieve 60 Hz framerate.

        * Disables all kinds of image enhancement options which are
          OK for YUV mode, but disturb raw RGB mode.

        * Enables RGB matrix reweighing, since the colors "seep" into
          each other and this undoes that effect.

        * Removes the hardware image flip, since I was too lazy to
          recompute all the Bayer decoding for a mirrored image.

All in all, it gives you a very nice smooth image with a very good
(30 Hz or 60 Hz) framerate.

Please test it, and if you're inclined to, merge into your ov511
driver suite.

By the way, I'd like to see the ovfx2 merged into the 2.6 kernel, do you
think it's a good idea now that it works rather well?

Yes, please. Mark, what's going on with getting the ov511 & ovfx2 driver updates merged?

After Vojtech's patch, for 2.6.11-rc and later, it also needs the
attached patches to ov511-2.28 + Vojtech's.

I'm still not able to open /dev/video with an app for some reason.
(no video or camera device found)
Any ideas or suggestions?  I'm testing on 2.6.11-rc2.

Thanks,
--
~Randy
Update for removal of remap_page_range() after 2.6.10:
convert to use remap_pfn_range().

Signed-off-by: Randy Dunlap <[EMAIL PROTECTED]>

diffstat:=
 ov511_core.c |    5 ++++-
 ovfx2.c      |    5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff -Naurp ./ov511_core.c~remap_page ./ov511_core.c
--- ./ov511_core.c~remap_page	2004-07-13 04:54:22.000000000 -0700
+++ ./ov511_core.c	2005-02-06 18:53:36.000000000 -0800
@@ -4882,7 +4882,10 @@ ov51x_mmap(struct file *file, struct vm_
 	pos = (unsigned long)ov->fbuf;
 	while (size > 0) {
 		page = kvirt_to_pa(pos);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 3) || defined(RH9_REMAP)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
+		if (remap_pfn_range(vma, start, page >> PAGE_SHIFT,
+				    PAGE_SIZE, PAGE_SHARED)) {
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 3) || defined(RH9_REMAP)
 		if (remap_page_range(vma, start, page, PAGE_SIZE,
 				     PAGE_SHARED)) {
 #else
diff -Naurp ./ovfx2.c~remap_page ./ovfx2.c
--- ./ovfx2.c~remap_page	2005-02-06 17:20:47.000000000 -0800
+++ ./ovfx2.c	2005-02-06 18:53:43.000000000 -0800
@@ -2536,7 +2536,10 @@ ovfx2_mmap(struct file *file, struct vm_
 	pos = (unsigned long)ov->fbuf;
 	while (size > 0) {
 		page = kvirt_to_pa(pos);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 3) || defined(RH9_REMAP)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
+		if (remap_pfn_range(vma, start, page >> PAGE_SHIFT,
+				    PAGE_SIZE, PAGE_SHARED)) {
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 3) || defined(RH9_REMAP)
 		if (remap_page_range(vma, start, page, PAGE_SIZE,
 				     PAGE_SHARED)) {
 #else
Use usb_kill_urb() instead of usb_unlink_urb() after 2.6.10
(could probably do it for some versions earlier than 2.6.10).

Signed-off-by: Randy Dunlap <[EMAIL PROTECTED]>

diffstat:=
 ov511_core.c |    4 ++++
 ovfx2.c      |    4 ++++
 2 files changed, 8 insertions(+)

diff -Naurp ./ovfx2.c~unlink_kill ./ovfx2.c
--- ./ovfx2.c~unlink_kill	2005-02-06 22:37:03.000000000 -0800
+++ ./ovfx2.c	2005-02-06 22:32:12.000000000 -0800
@@ -1725,7 +1725,11 @@ ovfx2_unlink_bulk(struct usb_ovfx2 *ov)
 	/* Unschedule all of the bulk td's */
 	for (n = OVFX2_NUMSBUF - 1; n >= 0; n--) {
 		if (ov->sbuf[n].urb) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 11)
 			usb_unlink_urb(ov->sbuf[n].urb);
+#else
+			usb_kill_urb(ov->sbuf[n].urb);
+#endif
 			usb_free_urb(ov->sbuf[n].urb);
 			ov->sbuf[n].urb = NULL;
 		}
diff -Naurp ./ov511_core.c~unlink_kill ./ov511_core.c
--- ./ov511_core.c~unlink_kill	2005-02-06 22:37:08.000000000 -0800
+++ ./ov511_core.c	2005-02-06 22:30:21.000000000 -0800
@@ -3547,7 +3547,11 @@ ov51x_unlink_isoc(struct usb_ov511 *ov)
 	/* Unschedule all of the iso td's */
 	for (n = OV511_NUMSBUF - 1; n >= 0; n--) {
 		if (ov->sbuf[n].urb) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 11)
 			usb_unlink_urb(ov->sbuf[n].urb);
+#else
+			usb_kill_urb(ov->sbuf[n].urb);
+#endif
 			usb_free_urb(ov->sbuf[n].urb);
 			ov->sbuf[n].urb = NULL;
 		}
Modules are no longer allowed to mix the use of MODULE_PARM()
and module_param(), so use module_param() if it's available.

Signed-off-by: Randy Dunlap <[EMAIL PROTECTED]>

diffstat:=
 tuner.c |    9 +++++++++
 1 files changed, 9 insertions(+)

diff -Naurp ./tuner.c~module_param ./tuner.c
--- ./tuner.c~module_param	2004-07-13 05:03:56.000000000 -0700
+++ ./tuner.c	2005-02-06 22:19:44.000000000 -0800
@@ -33,12 +33,21 @@ static int addr  =  0;
 static char *pal =  "b";
 static int tv_range[2]    = { 44, 958 };
 static int radio_range[2] = { 65, 108 };
+#if defined(module_param)
+module_param(debug, int, 0);
+module_param(type, int, 0);
+module_param(addr, int, 0);
+module_param_array(tv_range, int, NULL, 0);
+module_param_array(radio_range, int, NULL, 0);
+module_param(pal, charp, 0);
+#else
 MODULE_PARM(debug,"i");
 MODULE_PARM(type,"i");
 MODULE_PARM(addr,"i");
 MODULE_PARM(tv_range,"2i");
 MODULE_PARM(radio_range,"2i");
 MODULE_PARM(pal,"s");
+#endif
 
 #define optimize_vco 1
 

Reply via email to