Except that the exposure value for the micron cameras should be 12 bits long not 4 and so the set_exposure for the mt9v011 and mt9v111 is just plain wrong :-) Try the attached patch which shifts the exposure value left instead of right and see if things work any better.
On Sat, Mar 7, 2009 at 4:18 PM, Vasily Khoruzhick <[email protected]> wrote: > On Saturday 07 March 2009 14:14:33 [email protected] wrote: >> Hi all, >> >> After I installed your driver my cam works great but there is one >> annoyance that plagues the good experience. On mixed light or too high >> illumination the exposure starts changing from too bright to too dark >> few times per second. As I am not acquainted with the inner-workings >> of the driver I am not sure if this is some correction done in the >> chip or something done in the driver. If it's the later I am willing >> to pursue the mater my self, but I hope you can direct me to good >> documentation on the subject as I am little short on time and can not >> spend the effort to learn the whole architecture of the driver. As I >> am may be from a different background I am also not really acquainted >> with the git system, but I hope my coding skills will be enough (all >> this if the exposure correction is done in the driver and there is >> something to be done). >> >> Best regards >> Stefan Krastanov >> >> PS: my camera is as reported by lsusb 0c45:6270 Microdia U-CAM PC >> Camera NE878 > > Yep, it can happen if set_exposure function is not enough accurate. > It seems there's only 16 exposure values for your sensor (line 562 in > micron.c, buf[0] = (dev->vsettings.exposure >> 4), .exposure is 8 bit long, 2 > ^ 4 == 16, and our autoexposure algo is too simple (it's linear correction > with some calibration). If you want - you can improve it ;) > > Regards > Vasily > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
From f23629c0df84c775f0627fe83b974e96399320fd Mon Sep 17 00:00:00 2001 From: Brian Johnson <[email protected]> Date: Sat, 7 Mar 2009 17:37:52 -0500 Subject: [PATCH] Fix set_exposure for mt9v111 and mt9v011 Signed-off-by: Brian Johnson <[email protected]> --- micron.c | 14 ++++++-------- 1 files changed, 6 insertions(+), 8 deletions(-) diff --git a/micron.c b/micron.c index f924c6f..9e3e479 100644 --- a/micron.c +++ b/micron.c @@ -557,11 +557,10 @@ int mt9v112_probe(struct usb_sn9c20x *dev) int mt9v011_set_exposure(struct usb_sn9c20x *dev) { int ret = 0; - __u8 buf[2]; + __u16 exp; - buf[0] = (dev->vsettings.exposure >> 4); - buf[1] = 0; - ret |= sn9c20x_write_i2c_data(dev, 2, 0x09, buf); + exp = (dev->vsettings.exposure << 4); + ret |= sn9c20x_write_i2c_data16(dev, 1, 0x09, &exp); /* Maybe we have to disable AE/AWB/flicker avoidence (currently not * used) for MT9V111 sensor, because IFP controls this register if * one of them is enabled. */ @@ -571,7 +570,7 @@ int mt9v011_set_exposure(struct usb_sn9c20x *dev) int mt9v111_set_exposure(struct usb_sn9c20x *dev) { int ret = 0; - __u8 buf[2]; + __u16 exp; ret = mt9v111_select_address_space(dev, MT9V111_ADDRESSSPACE_SENSOR); @@ -579,9 +578,8 @@ int mt9v111_set_exposure(struct usb_sn9c20x *dev) if (ret < 0) return -11; /* -EAGAIN */ - buf[0] = (dev->vsettings.exposure >> 4); - buf[1] = 0; - ret |= sn9c20x_write_i2c_data(dev, 2, 0x09, buf); + exp = (dev->vsettings.exposure << 4); + ret |= sn9c20x_write_i2c_data16(dev, 1, 0x09, &exp); /* Maybe we have to disable AE/AWB/flicker avoidence (currently not * used) for MT9V111 sensor, because IFP controls this register if * one of them is enabled. */ -- 1.5.6.3
