Vasily Khoruzhick schrieb:
On Saturday 31 January 2009 23:13:36 GWater wrote:

I'm shocked no one is interested in this. So we just drop it?

GWater

Are you 100% sure that bridge can't provide stream in sxga resolution?

I just tested it agian to be sure.

It doesn't work. Not even with JPEG.

Attached is my patch - if you see any obvious mistakes, please tell me.

GWater
From ccffd8e1bc9fefae3e5323c30c0e3eceea92caca Mon Sep 17 00:00:00 2001
From: Josua Grawitter <[email protected]>
Date: Sat, 31 Jan 2009 22:29:19 +0100
Subject: [PATCH] final test sxga
 Signed-off-by: Josua Grawitter <[email protected]>

---
 sn9c20x-bridge.c |   12 ++++++++++--
 sn9c20x-dev.c    |    6 ++++++
 sn9c20x.h        |    2 +-
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/sn9c20x-bridge.c b/sn9c20x-bridge.c
index fc89ece..9d9490e 100644
--- a/sn9c20x-bridge.c
+++ b/sn9c20x-bridge.c
@@ -665,7 +665,7 @@ int sn9c20x_get_closest_resolution(struct usb_sn9c20x *dev,
 
        for (i = SN9C20X_N_MODES - 1; i >= 0; i--) {
                if (*width >= sn9c20x_modes[i].width
-                   && *height >= sn9c20x_modes[i].height)
+                   || *height >= sn9c20x_modes[i].height)
                        break;
        }
 
@@ -691,7 +691,7 @@ int sn9c20x_set_resolution(struct usb_sn9c20x *dev,
        int width, int height)
 {
        int ret;
-       __u8 scale;
+       __u8 scale, buf;
        __u8 window[6];
        __u8 clrwindow[5];
        struct sn9c20x_video_mode *mode;
@@ -719,6 +719,14 @@ int sn9c20x_set_resolution(struct usb_sn9c20x *dev,
        window[4] = mode->window[2] >> 4;
        window[5] = mode->window[3] >> 3;
 
+       if (mode->window[2] == 1280) {
+               /* FIXME: This is SOI968 specific - look up SXGA settings
+                * for other sensors in datasheets */
+               sn9c20x_read_i2c_data(dev, 1, 0x12, &buf);
+               buf &= ~0x40;
+               sn9c20x_write_i2c_data(dev, 1, 0x12, &buf);
+       }
+
        usb_sn9c20x_control_write(dev, 0x10fb, clrwindow, 5);
        usb_sn9c20x_control_write(dev, 0x1180, window, 6);
        usb_sn9c20x_control_write(dev, SN9C20X_SCALE, &scale, 1);
diff --git a/sn9c20x-dev.c b/sn9c20x-dev.c
index 6ca9dca..c3693fc 100644
--- a/sn9c20x-dev.c
+++ b/sn9c20x-dev.c
@@ -76,6 +76,12 @@ struct sn9c20x_video_mode sn9c20x_modes[SN9C20X_N_MODES] = {
                .scale = SN9C20X_NO_SCALE,
                .window = {0, 0, 640, 480}
        },
+       {
+               .width = 1280,
+               .height = 960,
+               .scale = SN9C20X_NO_SCALE,
+               .window = {0, 0, 1280, 960}
+       },
 };
 
 struct sn9c20x_video_format sn9c20x_fmts[SN9C20X_N_FMTS] = {
diff --git a/sn9c20x.h b/sn9c20x.h
index 2b80a39..b52eab7 100644
--- a/sn9c20x.h
+++ b/sn9c20x.h
@@ -303,7 +303,7 @@ extern struct sn9c20x_i2c_regs ov7670_init[];
 extern struct sn9c20x_i2c_regs hv7131r_init[];
 
 #define SN9C20X_N_FMTS 3
-#define SN9C20X_N_MODES        6
+#define SN9C20X_N_MODES        7
 
 extern struct sn9c20x_video_format sn9c20x_fmts[SN9C20X_N_FMTS];
 extern struct sn9c20x_video_mode sn9c20x_modes[SN9C20X_N_MODES];
-- 
1.6.0.6

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to