[PATCH 0/6] gspca - gl860 new driver for MI2020 and others changes

2010-06-01 Thread Olivier Lorin
Hello!

This is a new submit of last sunday 3 patches.
The first patch is the new driver for MI2020, 
other patches are functional changes and some minor changes.

Regards

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/6] gspca - gl860: new driver for MI2020 sensor

2010-06-01 Thread Olivier Lorin
gspca - gl860: new driver for MI2020 sensor

From: Olivier Lorin o.lo...@laposte.net

- new MI2020 driver version made from a webcam gift
- all previous flavors of this driver removed

Priority: normal

Signed-off-by: Olivier Lorin o.lo...@laposte.net

diff -urpN i0/gl860.c gl860/gl860.c
--- i0/gl860.c  2010-03-27 10:08:16.0 +0100
+++ gl860/gl860.c   2010-06-01 23:26:22.0 +0200
@@ -91,7 +91,6 @@ SD_SETGET(contrast)
 /* control table */
 static struct ctrl sd_ctrls_mi1320[GL860_NCTRLS];
 static struct ctrl sd_ctrls_mi2020[GL860_NCTRLS];
-static struct ctrl sd_ctrls_mi2020b[GL860_NCTRLS];
 static struct ctrl sd_ctrls_ov2640[GL860_NCTRLS];
 static struct ctrl sd_ctrls_ov9655[GL860_NCTRLS];
 
@@ -121,8 +120,6 @@ static int gl860_build_control_table(str
sd_ctrls = sd_ctrls_mi1320;
else if (_MI2020_)
sd_ctrls = sd_ctrls_mi2020;
-   else if (_MI2020b_)
-   sd_ctrls = sd_ctrls_mi2020b;
else if (_OV2640_)
sd_ctrls = sd_ctrls_ov2640;
else if (_OV9655_)
@@ -187,19 +184,6 @@ static const struct sd_desc sd_desc_mi20
.dq_callback = sd_callback,
 };
 
-static const struct sd_desc sd_desc_mi2020b = {
-   .name= MODULE_NAME,
-   .ctrls   = sd_ctrls_mi2020b,
-   .nctrls  = GL860_NCTRLS,
-   .config  = sd_config,
-   .init= sd_init,
-   .isoc_init   = sd_isoc_init,
-   .start   = sd_start,
-   .stop0   = sd_stop0,
-   .pkt_scan= sd_pkt_scan,
-   .dq_callback = sd_callback,
-};
-
 static const struct sd_desc sd_desc_ov2640 = {
.name= MODULE_NAME,
.ctrls   = sd_ctrls_ov2640,
@@ -344,8 +328,6 @@ static int sd_config(struct gspca_dev *g
sd-sensor = ID_OV9655;
else if (strcmp(sensor, MI2020) == 0)
sd-sensor = ID_MI2020;
-   else if (strcmp(sensor, MI2020b) == 0)
-   sd-sensor = ID_MI2020b;
 
/* Get sensor and set the suitable init/start/../stop functions */
if (gl860_guess_sensor(gspca_dev, vendor_id, product_id) == -1)
@@ -369,13 +351,6 @@ static int sd_config(struct gspca_dev *g
dev_init_settings   = mi2020_init_settings;
break;
 
-   case ID_MI2020b:
-   gspca_dev-sd_desc = sd_desc_mi2020b;
-   cam-cam_mode = mi2020_mode;
-   cam-nmodes = ARRAY_SIZE(mi2020_mode);
-   dev_init_settings   = mi2020_init_settings;
-   break;
-
case ID_OV2640:
gspca_dev-sd_desc = sd_desc_ov2640;
cam-cam_mode = ov2640_mode;
@@ -620,7 +595,7 @@ int gl860_RTx(struct gspca_dev *gspca_de
else if (len  1  r  len)
PDEBUG(D_ERR, short ctrl transfer %d/%d, r, len);
 
-   if ((_MI2020_ || _MI2020b_ || _MI2020c_)  (val || index))
+   if (_MI2020_  (val || index))
msleep(1);
if (_OV2640_)
msleep(1);
@@ -767,8 +742,6 @@ static int gl860_guess_sensor(struct gsp
PDEBUG(D_PROBE, 05e3:f191 sensor MI1320 (1.3M));
} else if (_MI2020_) {
PDEBUG(D_PROBE, 05e3:0503 sensor MI2020 (2.0M));
-   } else if (_MI2020b_) {
-   PDEBUG(D_PROBE, 05e3:0503 sensor MI2020 alt. driver (2.0M));
} else if (_OV9655_) {
PDEBUG(D_PROBE, 05e3:0503 sensor OV9655 (1.3M));
} else if (_OV2640_) {
diff -urpN i0/gl860.h gl860/gl860.h
--- i0/gl860.h  2010-03-27 10:08:25.0 +0100
+++ gl860/gl860.h   2010-06-01 23:10:52.0 +0200
@@ -32,12 +32,9 @@
 #define ID_OV2640   2
 #define ID_OV9655   4
 #define ID_MI2020   8
-#define ID_MI2020b 16
 
 #define _MI1320_  (((struct sd *) gspca_dev)-sensor == ID_MI1320)
 #define _MI2020_  (((struct sd *) gspca_dev)-sensor == ID_MI2020)
-#define _MI2020b_ (((struct sd *) gspca_dev)-sensor == ID_MI2020b)
-#define _MI2020c_ 0
 #define _OV2640_  (((struct sd *) gspca_dev)-sensor == ID_OV2640)
 #define _OV9655_  (((struct sd *) gspca_dev)-sensor == ID_OV9655)
 
diff -urpN i0/gl860-mi2020.c gl860/gl860-mi2020.c
--- i0/gl860-mi2020.c   2010-03-27 10:08:16.0 +0100
+++ gl860/gl860-mi2020.c2010-05-30 23:40:33.0 +0200
@@ -1,6 +1,7 @@
 /* Subdriver for the GL860 chip with the MI2020 sensor
- * Author Olivier LORIN, from Ice/Soro2005's logs(A), Fret_saw/Hulkie's
- * logs(B) and Tricids logs(C). With the help of
Kytrix/BUGabundo/Blazercist.
+ * Author Olivier LORIN, from logs by Iceman/Soro2005 +
Fret_saw/Hulkie/Tricid
+ * with the help of Kytrix/BUGabundo/Blazercist.
+ * Driver achieved thanks to a webcam gift by Kytrix.
  *
  * 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
@@ -20,47 +21,70 @@
 
 #include gl860.h
 
+static u8 dat_wbal1[] = {0x8c, 0xa2, 0x0c};
+
 static u8 dat_bright1[] = {0x8c, 0xa2, 0x06};
 static u8 dat_bright3[] = {0x8c, 0xa1, 0x02

[PATCH 2/6] gspca - gl860: setting changes applied after an EOI

2010-06-01 Thread Olivier Lorin
gspca - gl860: setting changes applied after an EOI

From: Olivier Lorin o.lo...@laposte.net

- Setting changes applied after an end of image marker reception
  This is the way MI2020 sensor works.
  It seems to be logical to wait for a complete image before 
  to change a setting.

Priority: normal

Signed-off-by: Olivier Lorin o.lo...@laposte.net

diff -urpN i1/gl860.c gl860/gl860.c
--- i1/gl860.c  2010-06-01 23:26:22.0 +0200
+++ gl860/gl860.c   2010-06-01 23:11:26.0 +0200
@@ -63,7 +63,7 @@ static int sd_set_##thename(struct gspca
 \
sd-vcur.thename = val;\
if (gspca_dev-streaming)\
-   sd-dev_camera_settings(gspca_dev);\
+   sd-waitSet = 1;\
return 0;\
 } \
 static int sd_get_##thename(struct gspca_dev *gspca_dev, s32 *val)\


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/6] gspca - gl860: USB control message delay unification

2010-06-01 Thread Olivier Lorin
gspca - gl860: USB control message delay unification

From: Olivier Lorin o.lo...@laposte.net

- 1 ms msleep applied to each sensor after USB control data exchange
  This was done for two sensors because these exchanges were known to
  be too quick depending on laptop model.
  It is fairly logical to apply this delay to each sensor
  in order to prevent from having errors with untested hardwares.

Priority: normal

Signed-off-by: Olivier Lorin o.lo...@laposte.net

diff -urpN i2/gl860.c gl860/gl860.c
--- i2/gl860.c  2010-06-01 23:11:26.0 +0200
+++ gl860/gl860.c   2010-06-01 23:16:59.0 +0200
@@ -595,10 +595,7 @@ int gl860_RTx(struct gspca_dev *gspca_de
else if (len  1  r  len)
PDEBUG(D_ERR, short ctrl transfer %d/%d, r, len);
 
-   if (_MI2020_  (val || index))
-   msleep(1);
-   if (_OV2640_)
-   msleep(1);
+   msleep(1);
 
return r;
 }


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/6] gspca - gl860: use of real resolutions for MI2020 sensor

2010-06-01 Thread Olivier Lorin
gspca - gl860: use of real resolutions for MI2020 sensor

From: Olivier Lorin o.lo...@laposte.net

- Change of rounded image resolutions to the real ones for MI2020 sensor
  in order to discard 2 random lines in the bottom of images

Priority: normal

Signed-off-by: Olivier Lorin o.lo...@laposte.net

diff -urpN i3/gl860.c gl860/gl860.c
--- i3/gl860.c  2010-06-01 23:16:59.0 +0200
+++ gl860/gl860.c   2010-04-28 23:45:19.0 +0200
@@ -219,9 +219,9 @@ static struct v4l2_pix_format mi2020_mod
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 0
},
-   { 800,  600, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE,
+   { 800,  598, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE,
.bytesperline = 800,
-   .sizeimage = 800 * 600,
+   .sizeimage = 800 * 598,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 1
},
@@ -231,9 +231,9 @@ static struct v4l2_pix_format mi2020_mod
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 2
},
-   {1600, 1200, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE,
+   {1600, 1198, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE,
.bytesperline = 1600,
-   .sizeimage = 1600 * 1200,
+   .sizeimage = 1600 * 1198,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 3
},


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/6] gspca - gl860: fix for wrong 0V9655 resolution identifier name

2010-06-01 Thread Olivier Lorin
gspca - gl860: fix for wrong 0V9655 resolution identifier name

From: Olivier Lorin o.lo...@laposte.net

- Fix for a wrong OV9655 image resolution identifier name

Priority: normal

Signed-off-by: Olivier Lorin o.lo...@laposte.net

diff -urpN i4/gl860-ov9655.c gl860/gl860-ov9655.c
--- i4/gl860-ov9655.c   2010-06-01 23:18:28.0 +0200
+++ gl860/gl860-ov9655.c2010-04-28 13:39:14.0 +0200
@@ -69,7 +69,7 @@ static u8 *tbl_640[] = {
\xd0\x01\xd1\x08\xd2\xe0\xd3\x01 \xd4\x10\xd5\x80
 };
 
-static u8 *tbl_800[] = {
+static u8 *tbl_1280[] = {
\x00\x40\x07\x6a\x06\xf3\x0d\x6a \x10\x10\xc1\x01
,
\x12\x80\x00\x00\x01\x98\x02\x80 \x03\x12\x04\x01\x0b\x57\x0e\x61
@@ -217,7 +217,7 @@ static int ov9655_init_post_alt(struct g
 
ctrl_out(gspca_dev, 0x40, 5, 0x0001, 0x, 0, NULL);
 
-   tbl = (reso == IMAGE_640) ? tbl_640 : tbl_800;
+   tbl = (reso == IMAGE_640) ? tbl_640 : tbl_1280;
 
ctrl_out(gspca_dev, 0x40, 3, 0x, 0x0200,
tbl_length[0], tbl[0]);


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/6] gspca - gl860: text alignment

2010-06-01 Thread Olivier Lorin
gspca - gl860: text alignment

From: Olivier Lorin o.lo...@laposte.net

- Extra spaces to align some variable names and a defined value

Priority: normal

Signed-off-by: Olivier Lorin o.lo...@laposte.net

diff -urpN i5/gl860.h gl860/gl860.h
--- i5/gl860.h  2010-06-01 23:20:10.0 +0200
+++ gl860/gl860.h   2010-04-28 13:36:36.0 +0200
@@ -41,7 +41,7 @@
 #define IMAGE_640   0
 #define IMAGE_800   1
 #define IMAGE_1280  2
-#define IMAGE_1600 3
+#define IMAGE_1600  3
 
 struct sd_gl860 {
u16 backlight;
@@ -72,10 +72,10 @@ struct sd {
int  (*dev_camera_settings)(struct gspca_dev *);
 
u8   swapRB;
-   u8  mirrorMask;
-   u8  sensor;
-   s32 nbIm;
-   s32 nbRightUp;
+   u8   mirrorMask;
+   u8   sensor;
+   s32  nbIm;
+   s32  nbRightUp;
u8   waitSet;
 };
 


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATH 0/3] gspca-gl860 driver update

2010-05-30 Thread Olivier Lorin
Hello

Here is three patches for the gspca_gl860 driver.
The main patch is the second one, it is a rewrite for the sensor MI2020.

These patches have been proposed on February 28th and refused some days
later because of a concern about the use of udelay instead of
msleep.
Compared to February, there is no more use of udelay. I also 
mapped a new setting to an already existing one in V4L2 instead of the
new one.

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] Gspca-gl860 driver update

2010-05-30 Thread Olivier Lorin
gspca - gl860: minor fixes

From: Olivier Lorin o.lo...@laposte.net

- Change of rounded image resolutions to the real ones
- Fix for an irrelevant OV9655 image resolution identifier name
- Extra spaces to align some variable names and a defined value

Priority: normal

Signed-off-by: Olivier Lorin o.lo...@laposte.net

diff -rupN der_gl860b/gl860.c gl860/gl860.c
--- der_gl860b/gl860.c  2010-03-27 10:08:16.0 +0100
+++ gl860/gl860.c   2010-04-28 23:26:53.0 +0200
@@ -235,9 +235,9 @@ static struct v4l2_pix_format mi2020_mod
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 0
},
-   { 800,  600, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE,
+   { 800,  598, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE,
.bytesperline = 800,
-   .sizeimage = 800 * 600,
+   .sizeimage = 800 * 598,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 1
},
@@ -247,9 +247,9 @@ static struct v4l2_pix_format mi2020_mod
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 2
},
-   {1600, 1200, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE,
+   {1600, 1198, V4L2_PIX_FMT_SGBRG8, V4L2_FIELD_NONE,
.bytesperline = 1600,
-   .sizeimage = 1600 * 1200,
+   .sizeimage = 1600 * 1198,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 3
},
diff -rupN der_gl860b/gl860.h gl860/gl860.h
--- der_gl860b/gl860.h  2010-03-27 10:08:25.0 +0100
+++ gl860/gl860.h   2010-04-28 13:56:51.0 +0200
@@ -44,7 +44,7 @@
 #define IMAGE_640   0
 #define IMAGE_800   1
 #define IMAGE_1280  2
-#define IMAGE_1600 3
+#define IMAGE_1600  3
 
 struct sd_gl860 {
u16 backlight;
@@ -75,10 +75,10 @@ struct sd {
int  (*dev_camera_settings)(struct gspca_dev *);
 
u8   swapRB;
-   u8  mirrorMask;
-   u8  sensor;
-   s32 nbIm;
-   s32 nbRightUp;
+   u8   mirrorMask;
+   u8   sensor;
+   s32  nbIm;
+   s32  nbRightUp;
u8   waitSet;
 };
 
diff -rupN der_gl860b/gl860-ov9655.c gl860/gl860-ov9655.c
--- der_gl860b/gl860-ov9655.c   2010-03-27 10:08:16.0 +0100
+++ gl860/gl860-ov9655.c2010-04-28 13:39:14.0 +0200
@@ -69,7 +69,7 @@ static u8 *tbl_640[] = {
\xd0\x01\xd1\x08\xd2\xe0\xd3\x01 \xd4\x10\xd5\x80
 };
 
-static u8 *tbl_800[] = {
+static u8 *tbl_1280[] = {
\x00\x40\x07\x6a\x06\xf3\x0d\x6a \x10\x10\xc1\x01
,
\x12\x80\x00\x00\x01\x98\x02\x80 \x03\x12\x04\x01\x0b\x57\x0e\x61
@@ -217,7 +217,7 @@ static int ov9655_init_post_alt(struct g
 
ctrl_out(gspca_dev, 0x40, 5, 0x0001, 0x, 0, NULL);
 
-   tbl = (reso == IMAGE_640) ? tbl_640 : tbl_800;
+   tbl = (reso == IMAGE_640) ? tbl_640 : tbl_1280;
 
ctrl_out(gspca_dev, 0x40, 3, 0x, 0x0200,
tbl_length[0], tbl[0]);


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] Gspca-gl860 - MI2030 sensor subdriver rewrite

2010-05-30 Thread Olivier Lorin
gspca - gl860: new driver for MI2020 sensor

From: Olivier Lorin o.lo...@laposte.net

- new MI2020 driver version made from a webcam given to me
- remove all previous flavors of this driver

Priority: normal

Signed-off-by: Olivier Lorin o.lo...@laposte.net

diff -urpN der_gl860i1/gl860.c gl860/gl860.c
--- der_gl860i1/gl860.c 2010-04-28 23:26:53.0 +0200
+++ gl860/gl860.c   2010-04-29 21:01:15.0 +0200
@@ -91,7 +91,6 @@ SD_SETGET(contrast)
 /* control table */
 static struct ctrl sd_ctrls_mi1320[GL860_NCTRLS];
 static struct ctrl sd_ctrls_mi2020[GL860_NCTRLS];
-static struct ctrl sd_ctrls_mi2020b[GL860_NCTRLS];
 static struct ctrl sd_ctrls_ov2640[GL860_NCTRLS];
 static struct ctrl sd_ctrls_ov9655[GL860_NCTRLS];
 
@@ -121,8 +120,6 @@ static int gl860_build_control_table(str
sd_ctrls = sd_ctrls_mi1320;
else if (_MI2020_)
sd_ctrls = sd_ctrls_mi2020;
-   else if (_MI2020b_)
-   sd_ctrls = sd_ctrls_mi2020b;
else if (_OV2640_)
sd_ctrls = sd_ctrls_ov2640;
else if (_OV9655_)
@@ -187,19 +184,6 @@ static const struct sd_desc sd_desc_mi20
.dq_callback = sd_callback,
 };
 
-static const struct sd_desc sd_desc_mi2020b = {
-   .name= MODULE_NAME,
-   .ctrls   = sd_ctrls_mi2020b,
-   .nctrls  = GL860_NCTRLS,
-   .config  = sd_config,
-   .init= sd_init,
-   .isoc_init   = sd_isoc_init,
-   .start   = sd_start,
-   .stop0   = sd_stop0,
-   .pkt_scan= sd_pkt_scan,
-   .dq_callback = sd_callback,
-};
-
 static const struct sd_desc sd_desc_ov2640 = {
.name= MODULE_NAME,
.ctrls   = sd_ctrls_ov2640,
@@ -344,8 +328,6 @@ static int sd_config(struct gspca_dev *g
sd-sensor = ID_OV9655;
else if (strcmp(sensor, MI2020) == 0)
sd-sensor = ID_MI2020;
-   else if (strcmp(sensor, MI2020b) == 0)
-   sd-sensor = ID_MI2020b;
 
/* Get sensor and set the suitable init/start/../stop functions */
if (gl860_guess_sensor(gspca_dev, vendor_id, product_id) == -1)
@@ -369,13 +351,6 @@ static int sd_config(struct gspca_dev *g
dev_init_settings   = mi2020_init_settings;
break;
 
-   case ID_MI2020b:
-   gspca_dev-sd_desc = sd_desc_mi2020b;
-   cam-cam_mode = mi2020_mode;
-   cam-nmodes = ARRAY_SIZE(mi2020_mode);
-   dev_init_settings   = mi2020_init_settings;
-   break;
-
case ID_OV2640:
gspca_dev-sd_desc = sd_desc_ov2640;
cam-cam_mode = ov2640_mode;
@@ -620,7 +595,7 @@ int gl860_RTx(struct gspca_dev *gspca_de
else if (len  1  r  len)
PDEBUG(D_ERR, short ctrl transfer %d/%d, r, len);
 
-   if ((_MI2020_ || _MI2020b_ || _MI2020c_)  (val || index))
+   if (_MI2020_  (val || index))
msleep(1);
if (_OV2640_)
msleep(1);
@@ -767,8 +742,6 @@ static int gl860_guess_sensor(struct gsp
PDEBUG(D_PROBE, 05e3:f191 sensor MI1320 (1.3M));
} else if (_MI2020_) {
PDEBUG(D_PROBE, 05e3:0503 sensor MI2020 (2.0M));
-   } else if (_MI2020b_) {
-   PDEBUG(D_PROBE, 05e3:0503 sensor MI2020 alt. driver (2.0M));
} else if (_OV9655_) {
PDEBUG(D_PROBE, 05e3:0503 sensor OV9655 (1.3M));
} else if (_OV2640_) {
diff -urpN der_gl860i1/gl860.h gl860/gl860.h
--- der_gl860i1/gl860.h 2010-04-28 13:56:51.0 +0200
+++ gl860/gl860.h   2010-04-28 13:36:36.0 +0200
@@ -32,12 +32,9 @@
 #define ID_OV2640   2
 #define ID_OV9655   4
 #define ID_MI2020   8
-#define ID_MI2020b 16
 
 #define _MI1320_  (((struct sd *) gspca_dev)-sensor == ID_MI1320)
 #define _MI2020_  (((struct sd *) gspca_dev)-sensor == ID_MI2020)
-#define _MI2020b_ (((struct sd *) gspca_dev)-sensor == ID_MI2020b)
-#define _MI2020c_ 0
 #define _OV2640_  (((struct sd *) gspca_dev)-sensor == ID_OV2640)
 #define _OV9655_  (((struct sd *) gspca_dev)-sensor == ID_OV9655)
 
diff -urpN der_gl860i1/gl860-mi2020.c gl860/gl860-mi2020.c
--- der_gl860i1/gl860-mi2020.c  2009-12-30 18:19:11.0 +0100
+++ gl860/gl860-mi2020.c2010-05-30 23:41:56.0 +0200
@@ -1,6 +1,7 @@
 /* Subdriver for the GL860 chip with the MI2020 sensor
- * Author Olivier LORIN, from Ice/Soro2005's logs(A), Fret_saw/Hulkie's
- * logs(B) and Tricids logs(C). With the help of
Kytrix/BUGabundo/Blazercist.
+ * Author Olivier LORIN, from logs by Iceman/Soro2005 +
Fret_saw/Hulkie/Tricid
+ * with the help of Kytrix/BUGabundo/Blazercist.
+ * Driver achieved thanks to a webcam gift by Kytrix.
  *
  * 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
@@ -20,47 +21,70 @@
 
 #include gl860.h
 
+static u8 dat_wbal1[] = {0x8c, 0xa2, 0x0c};
+
 static u8 dat_bright1[] = {0x8c, 0xa2

[PATCH 3/3] Gspca-gl860 driver update

2010-05-30 Thread Olivier Lorin
gspca - gl860: minor functional changes

From: Olivier Lorin o.lo...@laposte.net

- Setting changes applied after an end of image marker reception
  This is the way MI2020 sensor works.
  It seems to be logical to wait for a complete image before 
  to change a setting.
- 1 ms msleep applied to each sensor after USB control data exchange
  This was done for two sensors because these exchanges were known to
  be too quick depending on laptop model.
  It should be fairly logical to apply this delay to each sensor
  in order to prevent from having errors with untested hardwares.

Priority: normal

Signed-off-by: Olivier Lorin o.lo...@laposte.net

diff -urpN der_gl860i3/gl860.c gl860/gl860.c
--- der_gl860i3/gl860.c 2010-04-29 21:01:15.0 +0200
+++ gl860/gl860.c   2010-04-28 23:45:19.0 +0200
@@ -63,7 +63,7 @@ static int sd_set_##thename(struct gspca
 \
sd-vcur.thename = val;\
if (gspca_dev-streaming)\
-   sd-dev_camera_settings(gspca_dev);\
+   sd-waitSet = 1;\
return 0;\
 } \
 static int sd_get_##thename(struct gspca_dev *gspca_dev, s32 *val)\
@@ -595,10 +595,7 @@ int gl860_RTx(struct gspca_dev *gspca_de
else if (len  1  r  len)
PDEBUG(D_ERR, short ctrl transfer %d/%d, r, len);
 
-   if (_MI2020_  (val || index))
-   msleep(1);
-   if (_OV2640_)
-   msleep(1);
+   msleep(1);
 
return r;
 }


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] New driver for MI2020 sensor with GL860 bridge

2010-03-01 Thread Olivier Lorin
Hello,

light source is not related to LEDs, it is for the kind of light
source (tungsten, etc). The Windows driver had this control beside the
white balance. I could remove this new control as under Windows the
white balance is achieved by software and not hardware so the white
balance control is available with Linux.

About delay, they are required with at least 2 of four sensors managed
by the driver because there can be communication faults. It also
depends on the laptop as a same sensor driver is kown to always fails
with a laptop and not another one. I prefer now to secure the
communication with all four sensors with a small delay after a data
has been sent.
The delay is mostly stringent in the case of the MI2020 because there
is more than 400 USB messages sent to the webcam at startup and
initialisation time. Added with other required delay, several seconds
are needed to initialise the webcam. I know a msleep(1) lasts 5ms to
10ms depending on the scheduler. The msleep slows down too much the
communication. The OV2640 requires also more than 200 messages.
I never got any error with 850ms but we could use 900 or 1000ms. I
chose the less long delay.

Cheers,
OL

2010/3/1, Jean-Francois Moine moin...@free.fr:
 On Sun, 28 Feb 2010 21:19:25 +0100
 Olivier Lorin olori...@gmail.com wrote:

 - General changes for all drivers because of new MI2020 sensor
 driver :
   - add the light source control
   - control value changes only applied after an end of image
   - replace msleep with duration less than 5 ms by a busy loop
 - Fix for an irrelevant OV9655 image resolution identifier name

 Hello Olivier,

 What is this 'light source'? In the list, we are talking about the
 webcam LEDs and how to switch them on/off. Is it the same feature?

 Is it important to have a so precise delay in the webcam exchanges?

 Cheers.

 --
 Ken ar c'hentañ   | ** Breizh ha Linux atav! **
 Jef   |   http://moinejf.free.fr/

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] New driver for MI2020 sensor with GL860 bridge

2010-02-28 Thread Olivier Lorin
gspca - gl860: updates to prepare the new driver for MI2020 sensor

From: Olivier Lorin o.lo...@laposte.net

- General changes for all drivers because of new MI2020 sensor driver :
  - add the light source control
  - control value changes only applied after an end of image
  - replace msleep with duration less than 5 ms by a busy loop
- Fix for an irrelevant OV9655 image resolution identifier name

Priority: normal

Signed-off-by: Olivier Lorin o.lo...@laposte.net

diff
-rupN ../o/linux/drivers/media/video/gspca/gl860/gl860.c 
./linux/drivers/media/video/gspca/gl860/gl860.c
--- ../o/linux/drivers/media/video/gspca/gl860/gl860.c  2010-02-18
19:02:51.0 +0100
+++ ./linux/drivers/media/video/gspca/gl860/gl860.c 2010-02-28
15:04:52.0 +0100
@@ -63,7 +63,7 @@ static int sd_set_##thename(struct gspca
 \
sd-vcur.thename = val;\
if (gspca_dev-streaming)\
-   sd-dev_camera_settings(gspca_dev);\
+   sd-waitSet = 1;\
return 0;\
 } \
 static int sd_get_##thename(struct gspca_dev *gspca_dev, s32 *val)\
@@ -85,8 +85,10 @@ SD_SETGET(saturation)
 SD_SETGET(sharpness)
 SD_SETGET(whitebal)
 SD_SETGET(contrast)
+SD_SETGET(lightsource)
 
-#define GL860_NCTRLS 11
+#define GL860_NCTRLS 12
+#define V4L2_CID_LIGHT_SOURCE (V4L2_CID_PRIVATE_BASE + 0)
 
 /* control table */
 static struct ctrl sd_ctrls_mi1320[GL860_NCTRLS];
@@ -148,6 +150,8 @@ static int gl860_build_control_table(str
V4L2_CTRL_TYPE_INTEGER, White Bal., whitebal)
SET_MY_CTRL(V4L2_CID_BACKLIGHT_COMPENSATION,
V4L2_CTRL_TYPE_INTEGER, Backlight , backlight)
+   SET_MY_CTRL(V4L2_CID_LIGHT_SOURCE,
+   V4L2_CTRL_TYPE_INTEGER, Light Source , lightsource)
 
SET_MY_CTRL(V4L2_CID_HFLIP,
V4L2_CTRL_TYPE_BOOLEAN, Mirror, mirror)
@@ -620,10 +624,7 @@ int gl860_RTx(struct gspca_dev *gspca_de
else if (len  1  r  len)
PDEBUG(D_ERR, short ctrl transfer %d/%d, r, len);
 
-   if ((_MI2020_ || _MI2020b_ || _MI2020c_)  (val || index))
-   msleep(1);
-   if (_OV2640_)
-   msleep(1);
+   udelay(850);
 
return r;
 }
@@ -638,8 +639,10 @@ int fetch_validx(struct gspca_dev *gspca
tbl[n].idx, 0, NULL);
else if (tbl[n].val == 0x)
break;
-   else
+   else if (tbl[n].val  5)
msleep(tbl[n].val);
+   else
+   mdelay(tbl[n].val);
}
return n;
 }
@@ -653,8 +656,10 @@ int keep_on_fetching_validx(struct gspca
0, NULL);
else if (tbl[n].val == 0x)
break;
-   else
+   else if (tbl[n].val  5)
msleep(tbl[n].val);
+   else
+   mdelay(tbl[n].val);
}
return n;
 }
@@ -667,8 +672,10 @@ void fetch_idxdata(struct gspca_dev *gsp
if (memcmp(tbl[n].data, \xff\xff\xff, 3) != 0)
ctrl_out(gspca_dev, 0x40, 3, 0x7a00, tbl[n].idx,
3, tbl[n].data);
-   else
+   else if (tbl[n].idx  5)
msleep(tbl[n].idx);
+   else
+   mdelay(tbl[n].idx);
}
 }
 
diff
-rupN ../o/linux/drivers/media/video/gspca/gl860/gl860.h 
./linux/drivers/media/video/gspca/gl860/gl860.h
--- ../o/linux/drivers/media/video/gspca/gl860/gl860.h  2010-02-18
19:02:51.0 +0100
+++ ./linux/drivers/media/video/gspca/gl860/gl860.h 2010-02-28
15:02:12.0 +0100
@@ -44,7 +44,7 @@
 #define IMAGE_640   0
 #define IMAGE_800   1
 #define IMAGE_1280  2
-#define IMAGE_1600 3
+#define IMAGE_1600  3
 
 struct sd_gl860 {
u16 backlight;
@@ -58,6 +58,7 @@ struct sd_gl860 {
u8  mirror;
u8  flip;
u8  AC50Hz;
+   u8  lightsource;
 };
 
 /* Specific webcam descriptor */
diff
-rupN ../o/linux/drivers/media/video/gspca/gl860/gl860-mi1320.c 
./linux/drivers/media/video/gspca/gl860/gl860-mi1320.c
--- ../o/linux/drivers/media/video/gspca/gl860/gl860-mi1320.c   2010-02-18
19:02:51.0 +0100
+++ ./linux/drivers/media/video/gspca/gl860/gl860-mi1320.c  2010-02-28
15:01:20.0 +0100
@@ -206,6 +206,7 @@ void mi1320_init_settings(struct gspca_d
sd-vmax.hue=  5 + 1;
sd-vmax.saturation =  8;
sd-vmax.whitebal   =  2;
+   sd-vmax.lightsource = 0;
sd-vmax.mirror = 1;
sd-vmax.flip   = 1;
sd-vmax.AC50Hz = 1;
diff
-rupN ../o/linux/drivers/media/video/gspca/gl860/gl860-mi2020.c 
./linux/drivers/media/video/gspca/gl860/gl860-mi2020.c
--- ../o/linux/drivers/media/video/gspca/gl860/gl860-mi2020.c   2010-02-18
19:02:51.0 +0100
+++ ./linux/drivers/media/video/gspca/gl860/gl860-mi2020.c  2010-02-28
15:09:46.0 +0100
@@ -361,9

Re: flicker/jumpy at the bottom of the video

2009-12-23 Thread Olivier Lorin
Hi,

one of the sensors managed by the gspca_gl860 has some weird
resolutions : 800 x 598 and 1600 x 1198. To set these resolutions to
800 x 600 and 1600 x 1200 causes a flickering effect because of both
missing lines of data from the sensor. Thus a stupid question, does
the resolutions are these chip are well known ?

O. Lorin

2009/12/22, Jean-Francois Moine moin...@free.fr:
 On Mon, 23 Nov 2009 15:00:09 +0530 (IST)
 Purushottam R S purushottam_...@yahoo.com wrote:

 I am using latest gspca driver from dvb for camera driver. But I see
 bottom of the video has flickering/jumping effect.

 I have Zippys web camera, which is from Z-Star.  I have loaded the
 following drivers.
 1. gspca_zc3xx 44832 0 - Live 0xbf01f000
 2. gspca_main 23840 1 gspca_zc3xx, Live 0xbf014000
 3. videodev 36672 1 gspca_main, Live 0xbf006000
 4. v4l1_compat 14788 1 videodev, Live 0xbf00

 But otherwise there is no issue with video.

 Hello Purush,

 Sorry for the delay. We know that some webcams with Z-Star chips have
 such a problem, but it is a hardware problem and we did not find yet a
 way to fix it correctly...

 Best regards.

 --
 Ken ar c'hentañ   | ** Breizh ha Linux atav! **
 Jef   |   http://moinejf.free.fr/
 --
 To unsubscribe from this list: send the line unsubscribe linux-media in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] MAINTAINERS file

2009-12-13 Thread Olivier Lorin
Patch of the MAINTAINERS file to include the gspca_gl860 driver

Signed-off-by: Olivier Lorin olori...@gmail.com
Signed-off-by: Jean-Francois Moine moin...@free.fr

---
diff ../orgn/MAINTAINERS MAINTAINERS -rupN
--- ../orgn/MAINTAINERS 2009-12-05 22:21:59.0 +0100
+++ MAINTAINERS 2009-09-20 03:35:18.0 +0200
@@ -2224,6 +2224,13 @@ T:   git git://git.kernel.org/pub/scm/linu
 S: Maintained
 F: drivers/media/video/gspca/finepix.c
 
+GSPCA GL860 SUBDRIVER
+M: Olivier Lorin olori...@gmail.com
+L: linux-media@vger.kernel.org
+T: git
git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+S: Maintained
+F: drivers/media/video/gspca/gl860/
+
 GSPCA M5602 SUBDRIVER
 M: Erik Andren erik.and...@gmail.com
 L: linux-media@vger.kernel.org


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] gspca_gl860

2009-10-03 Thread Olivier Lorin

gspca - gl860: improvement of the main driver part

From: Olivier Lorin o.lo...@laposte.net

- fix for warning compilation about sd_ctrls
- trace improvement while probing the sensor

Priority: normal

Signed-off-by: Olivier Lorin o.lo...@laposte.net

diff -rupN ../gspca-o/linux/drivers/media/video/gspca/gl860/gl860.c 
./linux/drivers/media/video/gspca/gl860/gl860.c
--- ../gspca-o/linux/drivers/media/video/gspca/gl860/gl860.c
2009-09-18 10:36:24.0 +0200
+++ ./linux/drivers/media/video/gspca/gl860/gl860.c2009-09-24 
13:55:34.0 +0200

@@ -23,8 +23,8 @@
#include gspca.h
#include gl860.h

-MODULE_AUTHOR(Olivier Lorin lo...@laposte.net);
-MODULE_DESCRIPTION(GSPCA/Genesys Logic GL860 USB Camera Driver);
+MODULE_AUTHOR(Olivier Lorin o.lo...@laposte.net);
+MODULE_DESCRIPTION(Genesys Logic USB PC Camera Driver);
MODULE_LICENSE(GPL);

/* static function declarations 
*/

@@ -53,7 +53,7 @@ MODULE_PARM_DESC(AC50Hz,  Does AC power
static char sensor[7];
module_param_string(sensor, sensor, sizeof(sensor), 0644);
MODULE_PARM_DESC(sensor,
- Driver sensor ('MI1320'/'MI2020'/'OV9655'/'OV2640'/''));
+ Driver sensor ('MI1320'/'MI2020'/'OV9655'/'OV2640'));

/* webcam controls 
=*/


@@ -119,16 +119,23 @@ static int gl860_build_control_table(str
struct ctrl *sd_ctrls;
int nCtrls = 0;

-if (_MI1320_)
+switch (sd-sensor) {
+case ID_MI1320:
sd_ctrls = sd_ctrls_mi1320;
-else if (_MI2020_)
+break;
+case ID_MI2020:
sd_ctrls = sd_ctrls_mi2020;
-else if (_MI2020b_)
+break;
+case ID_MI2020b:
sd_ctrls = sd_ctrls_mi2020b;
-else if (_OV2640_)
+break;
+case ID_OV2640:
sd_ctrls = sd_ctrls_ov2640;
-else if (_OV9655_)
+break;
+default:
sd_ctrls = sd_ctrls_ov9655;
+break;
+}

memset(sd_ctrls, 0, GL860_NCTRLS * sizeof(struct ctrl));

@@ -154,7 +161,7 @@ static int gl860_build_control_table(str
SET_MY_CTRL(V4L2_CID_VFLIP,
V4L2_CTRL_TYPE_BOOLEAN, Flip, flip)
SET_MY_CTRL(V4L2_CID_POWER_LINE_FREQUENCY,
-V4L2_CTRL_TYPE_BOOLEAN, 50Hz, AC50Hz)
+V4L2_CTRL_TYPE_BOOLEAN, AC power 50Hz, AC50Hz)

return nCtrls;
}
@@ -700,6 +707,7 @@ static int gl860_guess_sensor(struct gsp
ctrl_out(gspca_dev, 0x40, 1, 0x006a, 0x000d, 0, NULL);
msleep(56);

+PDEBUG(D_PROBE, probing for sensor MI2020 or OV);
nOV = 0;
for (ntry = 0; ntry  4; ntry++) {
ctrl_out(gspca_dev, 0x40, 1, 0x0040, 0x, 0, NULL);
@@ -709,14 +717,14 @@ static int gl860_guess_sensor(struct gsp
ctrl_out(gspca_dev, 0x40, 1, 0x7a00, 0x8030, 0, NULL);
msleep(10);
ctrl_in(gspca_dev, 0xc0, 2, 0x7a00, 0x8030, 1, probe);
-PDEBUG(D_PROBE, 1st probe=%02x, probe);
+PDEBUG(D_PROBE, probe=0x%02x, probe);
if (probe == 0xff)
nOV++;
}

if (nOV) {
-PDEBUG(D_PROBE, 0xff - sensor OV);
-PDEBUG(D_PROBE, Probing for sensor OV2640 or OV9655);
+PDEBUG(D_PROBE, 0xff - OV);
+PDEBUG(D_PROBE, probing for sensor OV2640 or OV9655);

nb26 = nb96 = 0;
for (ntry = 0; ntry  4; ntry++) {
@@ -726,40 +734,38 @@ static int gl860_guess_sensor(struct gsp
ctrl_out(gspca_dev, 0x40, 1, 0x6000, 0x800a,
0, NULL);
msleep(10);
+
/* Wait for 26(OV2640) or 96(OV9655) */
ctrl_in(gspca_dev, 0xc0, 2, 0x6000, 0x800a,
1, probe);

-PDEBUG(D_PROBE, 2nd probe=%02x, probe);
-if (probe == 0x00)
-nb26++;
if (probe == 0x26 || probe == 0x40) {
+PDEBUG(D_PROBE,
+probe=0x%02x - OV2640,
+probe);
sd-sensor = ID_OV2640;
nb26 += 4;
break;
}
if (probe == 0x96 || probe == 0x55) {
+PDEBUG(D_PROBE,
+probe=0x%02x - OV9655,
+probe);
sd-sensor = ID_OV9655;
nb96 += 4;
break;
}
+PDEBUG(D_PROBE, probe=0x%02x, probe);
+if (probe == 0x00)
+nb26++;
if (probe == 0xff)
nb96++;
msleep(3);
}
-if (nb26  4  nb96  4) {
-PDEBUG(D_PROBE, No relevant answer );
-PDEBUG(D_PROBE, * 1.3Mpixels - use OV9655);
-PDEBUG(D_PROBE, * 2.0Mpixels - use OV2640);
-PDEBUG(D_PROBE,
-To force a sensor, add that line to 
-/etc/modprobe.d/options.conf

[PATCH 3/3] gspca_gl860

2009-10-03 Thread Olivier Lorin

gspca - gl860: add flip/mirror for OV2640

From: Olivier Lorin o.lo...@laposte.net

- add flip/mirror support for OV2640
- fix for backlight value range
- fix for red-blue inversion hue mode with V4L1 applications

diff -rupN ../gspca-msrc2/linux/drivers/media/video/gspca/gl860/gl860.h 
./linux/drivers/media/video/gspca/gl860/gl860.h
--- ../gspca-msrc2/linux/drivers/media/video/gspca/gl860/gl860.h   
2009-09-24 23:16:10.0 +0200
+++ ./linux/drivers/media/video/gspca/gl860/gl860.h2009-09-24 
23:55:32.0 +0200

@@ -23,7 +23,7 @@
#include gspca.h

#define MODULE_NAME gspca_gl860
-#define DRIVER_VERSION 0.9d11
+#define DRIVER_VERSION 0.9e

#define ctrl_in  gl860_RTx
#define ctrl_out gl860_RTx
diff -rupN 
../gspca-msrc2/linux/drivers/media/video/gspca/gl860/gl860-ov2640.c 
./linux/drivers/media/video/gspca/gl860/gl860-ov2640.c
--- 
../gspca-msrc2/linux/drivers/media/video/gspca/gl860/gl860-ov2640.c   
2009-09-24 23:34:57.0 +0200
+++ ./linux/drivers/media/video/gspca/gl860/gl860-ov2640.c2009-09-30 
00:40:49.0 +0200

@@ -107,36 +107,6 @@ static struct validx tbl_sensor_settings
{0x6001, 0x00ff}, {0x6038, 0x000c},
{10, 0x},
{0x6000, 0x0011},
-/* backlight=31/64 */
-{0x6001, 0x00ff}, {0x603e, 0x0024}, {0x6034, 0x0025},
-/* bright=0/256 */
-{0x6000, 0x00ff}, {0x6009, 0x007c}, {0x6000, 0x007d},
-/* wbal=64/128 */
-{0x6000, 0x00ff}, {0x6003, 0x007c}, {0x6040, 0x007d},
-/* cntr=0/256 */
-{0x6000, 0x00ff}, {0x6007, 0x007c}, {0x6000, 0x007d},
-/* sat=128/256 */
-{0x6000, 0x00ff}, {0x6001, 0x007c}, {0x6080, 0x007d},
-/* sharpness=0/32 */
-{0x6000, 0x00ff}, {0x6001, 0x0092}, {0x60c0, 0x0093},
-/* hue=0/256 */
-{0x6000, 0x00ff}, {0x6002, 0x007c}, {0x6000, 0x007d},
-/* gam=32/64 */
-{0x6000, 0x00ff}, {0x6008, 0x007c}, {0x6020, 0x007d},
-/* image right up */
-{0x, 0x},
-{15, 0x},
-{0x6001, 0x00ff}, {0x6000, 0x8004},
-{0x, 0x},
-{0x60a8, 0x0004},
-{15, 0x},
-{0x6001, 0x00ff}, {0x6000, 0x8004},
-{0x, 0x},
-{0x60f8, 0x0004},
-/* image right up */
-{0x, 0x},
-/* backlight=31/64 */
-{0x6001, 0x00ff}, {0x603e, 0x0024}, {0x6034, 0x0025},
};

static struct validx tbl_640[] = {
@@ -222,17 +192,19 @@ void ov2640_init_settings(struct gspca_d
sd-vcur.hue=   0;
sd-vcur.saturation = 128;
sd-vcur.whitebal   =  64;
+sd-vcur.mirror =   0;
+sd-vcur.flip   =   0;

sd-vmax.backlight  =  64;
sd-vmax.brightness = 255;
sd-vmax.sharpness  =  31;
sd-vmax.contrast   = 255;
sd-vmax.gamma  =  64;
-sd-vmax.hue= 255 + 1;
+sd-vmax.hue= 254 + 2;
sd-vmax.saturation = 255;
sd-vmax.whitebal   = 128;
-sd-vmax.mirror = 0;
-sd-vmax.flip   = 0;
+sd-vmax.mirror = 1;
+sd-vmax.flip   = 1;
sd-vmax.AC50Hz = 0;

sd-dev_camera_settings = ov2640_camera_settings;
@@ -284,6 +256,8 @@ static int ov2640_init_pre_alt(struct gs
sd-vold.gamma= -1;
sd-vold.hue  = -1;
sd-vold.whitebal = -1;
+sd-vold.mirror = -1;
+sd-vold.flip   = -1;

ov2640_init_post_alt(gspca_dev);

@@ -346,18 +320,6 @@ static int ov2640_init_post_alt(struct g

n = fetch_validx(gspca_dev, tbl_sensor_settings_common2,
ARRAY_SIZE(tbl_sensor_settings_common2));
-ctrl_in(gspca_dev, 0xc0, 2, 0x, 0x, 1, c50);
-keep_on_fetching_validx(gspca_dev, tbl_sensor_settings_common2,
-ARRAY_SIZE(tbl_sensor_settings_common2), n);
-ctrl_in(gspca_dev, 0xc0, 2, 0x6000, 0x8004, 1, c28);
-keep_on_fetching_validx(gspca_dev, tbl_sensor_settings_common2,
-ARRAY_SIZE(tbl_sensor_settings_common2), n);
-ctrl_in(gspca_dev, 0xc0, 2, 0x6000, 0x8004, 1, ca8);
-keep_on_fetching_validx(gspca_dev, tbl_sensor_settings_common2,
-ARRAY_SIZE(tbl_sensor_settings_common2), n);
-ctrl_in(gspca_dev, 0xc0, 2, 0x, 0x, 1, c50);
-keep_on_fetching_validx(gspca_dev, tbl_sensor_settings_common2,
-ARRAY_SIZE(tbl_sensor_settings_common2), n);

ov2640_camera_settings(gspca_dev);

@@ -394,6 +356,8 @@ static int ov2640_camera_settings(struct
s32 sat= sd-vcur.saturation;
s32 hue= sd-vcur.hue;
s32 wbal   = sd-vcur.whitebal;
+s32 mirror = (((sd-vcur.mirror  0) ^ sd-mirrorMask) == 0);
+s32 flip   = (((sd-vcur.flip0) ^ sd-mirrorMask) == 0);

if (backlight != sd-vold.backlight) {
/* No sd-vold.backlight=backlight; (to be done again later) */
@@ -402,9 +366,9 @@ static int ov2640_camera_settings(struct

ctrl_out(gspca_dev, 0x40, 1, 0x6001 , 0x00ff,
0, NULL);
-ctrl_out(gspca_dev, 0x40, 1, 0x601f + backlight , 0x0024,
+ctrl_out(gspca_dev, 0x40, 1, 0x601e + backlight , 0x0024,
0, NULL);
-ctrl_out(gspca_dev, 0x40, 1, 0x601f + backlight - 10

[PATCH 1/3] gspca_gl860/Fixed format : main part update

2009-10-03 Thread Olivier Lorin
I'm sorry, I used a bad format for the 3 previous patches I sent this day.
This is fixed now.


gspca_gl860: improvement of the main driver part

From: Olivier Lorin o.lo...@laposte.net

- fix for compilation warning about sd_ctrls
- trace improvement while probing the sensor

Priority: normal

Signed-off-by: Olivier Lorin o.lo...@laposte.net

diff -rupN ../gspca-o/linux/drivers/media/video/gspca/gl860/gl860.c 
./linux/drivers/media/video/gspca/gl860/gl860.c
--- ../gspca-o/linux/drivers/media/video/gspca/gl860/gl860.c2009-09-18 
10:36:24.0 +0200
+++ ./linux/drivers/media/video/gspca/gl860/gl860.c 2009-09-24 
13:55:34.0 +0200
@@ -23,8 +23,8 @@
 #include gspca.h
 #include gl860.h
 
-MODULE_AUTHOR(Olivier Lorin lo...@laposte.net);
-MODULE_DESCRIPTION(GSPCA/Genesys Logic GL860 USB Camera Driver);
+MODULE_AUTHOR(Olivier Lorin o.lo...@laposte.net);
+MODULE_DESCRIPTION(Genesys Logic USB PC Camera Driver);
 MODULE_LICENSE(GPL);
 
 /* static function declarations */
@@ -53,7 +53,7 @@ MODULE_PARM_DESC(AC50Hz,  Does AC power
 static char sensor[7];
 module_param_string(sensor, sensor, sizeof(sensor), 0644);
 MODULE_PARM_DESC(sensor,
-Driver sensor ('MI1320'/'MI2020'/'OV9655'/'OV2640'/''));
+Driver sensor ('MI1320'/'MI2020'/'OV9655'/'OV2640'));
 
 /* webcam controls =*/
 
@@ -119,16 +119,23 @@ static int gl860_build_control_table(str
struct ctrl *sd_ctrls;
int nCtrls = 0;
 
-   if (_MI1320_)
+   switch (sd-sensor) {
+   case ID_MI1320:
sd_ctrls = sd_ctrls_mi1320;
-   else if (_MI2020_)
+   break;
+   case ID_MI2020:
sd_ctrls = sd_ctrls_mi2020;
-   else if (_MI2020b_)
+   break;
+   case ID_MI2020b:
sd_ctrls = sd_ctrls_mi2020b;
-   else if (_OV2640_)
+   break;
+   case ID_OV2640:
sd_ctrls = sd_ctrls_ov2640;
-   else if (_OV9655_)
+   break;
+   default:
sd_ctrls = sd_ctrls_ov9655;
+   break;
+   }
 
memset(sd_ctrls, 0, GL860_NCTRLS * sizeof(struct ctrl));
 
@@ -154,7 +161,7 @@ static int gl860_build_control_table(str
SET_MY_CTRL(V4L2_CID_VFLIP,
V4L2_CTRL_TYPE_BOOLEAN, Flip, flip)
SET_MY_CTRL(V4L2_CID_POWER_LINE_FREQUENCY,
-   V4L2_CTRL_TYPE_BOOLEAN, 50Hz, AC50Hz)
+   V4L2_CTRL_TYPE_BOOLEAN, AC power 50Hz, AC50Hz)
 
return nCtrls;
 }
@@ -700,6 +707,7 @@ static int gl860_guess_sensor(struct gsp
ctrl_out(gspca_dev, 0x40, 1, 0x006a, 0x000d, 0, NULL);
msleep(56);
 
+   PDEBUG(D_PROBE, probing for sensor MI2020 or OV);
nOV = 0;
for (ntry = 0; ntry  4; ntry++) {
ctrl_out(gspca_dev, 0x40, 1, 0x0040, 0x, 0, NULL);
@@ -709,14 +717,14 @@ static int gl860_guess_sensor(struct gsp
ctrl_out(gspca_dev, 0x40, 1, 0x7a00, 0x8030, 0, NULL);
msleep(10);
ctrl_in(gspca_dev, 0xc0, 2, 0x7a00, 0x8030, 1, probe);
-   PDEBUG(D_PROBE, 1st probe=%02x, probe);
+   PDEBUG(D_PROBE, probe=0x%02x, probe);
if (probe == 0xff)
nOV++;
}
 
if (nOV) {
-   PDEBUG(D_PROBE, 0xff - sensor OV);
-   PDEBUG(D_PROBE, Probing for sensor OV2640 or OV9655);
+   PDEBUG(D_PROBE, 0xff - OV);
+   PDEBUG(D_PROBE, probing for sensor OV2640 or OV9655);
 
nb26 = nb96 = 0;
for (ntry = 0; ntry  4; ntry++) {
@@ -726,40 +734,38 @@ static int gl860_guess_sensor(struct gsp
ctrl_out(gspca_dev, 0x40, 1, 0x6000, 0x800a,
0, NULL);
msleep(10);
+
/* Wait for 26(OV2640) or 96(OV9655) */
ctrl_in(gspca_dev, 0xc0, 2, 0x6000, 0x800a,
1, probe);
 
-   PDEBUG(D_PROBE, 2nd probe=%02x, probe);
-   if (probe == 0x00)
-   nb26++;
if (probe == 0x26 || probe == 0x40) {
+   PDEBUG(D_PROBE,
+   probe=0x%02x - OV2640,
+   probe);
sd-sensor = ID_OV2640;
nb26 += 4;
break;
}
if (probe == 0x96 || probe

[PATCH 2/3] gspca_gl860/Fixed format : comment changes and unified naming scheme

2009-10-03 Thread Olivier Lorin
gspca_gl860: comment changes and unified naming scheme

From: Olivier Lorin o.lo...@laposte.net

- small changes in comments
- unified naming scheme for subdriver variables

Priority: trivial

Signed-off-by: Olivier Lorin o.lo...@laposte.net

diff -rupN ../gspca-msrc/linux/drivers/media/video/gspca/gl860/gl860.c 
./linux/drivers/media/video/gspca/gl860/gl860.c
--- ../gspca-msrc/linux/drivers/media/video/gspca/gl860/gl860.c 2009-09-24 
13:55:34.0 +0200
+++ ./linux/drivers/media/video/gspca/gl860/gl860.c 2009-09-24 
23:17:32.0 +0200
@@ -1,9 +1,7 @@
-/* @file gl860.c
- * @date 2009-08-27
+/* GSPCA subdrivers for Genesys Logic webcams with the GL860 chip
+ * Subdriver core
  *
- * Genesys Logic webcam with gl860 subdrivers
- *
- * Driver by Olivier Lorin o.lo...@laposte.net
+ * 2009/09/24 Olivier Lorin o.lo...@laposte.net
  * GSPCA by Jean-Francois Moine http://moinejf.free.fr
  * Thanks BUGabundo and Malmostoso for your amazing help!
  *
diff -rupN ../gspca-msrc/linux/drivers/media/video/gspca/gl860/gl860.h 
./linux/drivers/media/video/gspca/gl860/gl860.h
--- ../gspca-msrc/linux/drivers/media/video/gspca/gl860/gl860.h 2009-09-24 
14:01:41.0 +0200
+++ ./linux/drivers/media/video/gspca/gl860/gl860.h 2009-09-24 
23:16:10.0 +0200
@@ -1,6 +1,7 @@
-/* @file gl860.h
- * @author Olivier LORIN, tiré du pilote Syntek par Nicolas VIVIEN
- * @date 2009-08-27
+/* GSPCA subdrivers for Genesys Logic webcams with the GL860 chip
+ * Subdriver declarations
+ *
+ * 2009/09/24 Olivier LORIN o.lo...@laposte.net
  *
  * 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
diff -rupN ../gspca-msrc/linux/drivers/media/video/gspca/gl860/gl860-mi1320.c 
./linux/drivers/media/video/gspca/gl860/gl860-mi1320.c
--- ../gspca-msrc/linux/drivers/media/video/gspca/gl860/gl860-mi1320.c  
2009-09-18 10:36:24.0 +0200
+++ ./linux/drivers/media/video/gspca/gl860/gl860-mi1320.c  2009-09-24 
21:24:59.0 +0200
@@ -1,6 +1,5 @@
-/* @file gl860-mi1320.c
- * @author Olivier LORIN from my logs
- * @date 2009-08-27
+/* Subdriver for the GL860 chip with the MI1320 sensor
+ * Author Olivier LORIN from own logs
  *
  * 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
@@ -127,49 +126,49 @@ static u8 dat_wbalBL[] =
 
 static u8 dat_hvflip1[] = {0xf0, 0x00, 0xf1, 0x00};
 
-static u8 s000[] =
+static u8 dat_common00[] =
\x00\x01\x07\x6a\x06\x63\x0d\x6a \xc0\x00\x10\x10\xc1\x03\xc2\x42
\xd8\x04\x58\x00\x04\x02;
-static u8 s001[] =
+static u8 dat_common01[] =
\x0d\x00\xf1\x0b\x0d\x00\xf1\x08 \x35\x00\xf1\x22\x68\x00\xf1\x5d
\xf0\x00\xf1\x01\x06\x70\xf1\x0e \xf0\x00\xf1\x02\xdd\x18\xf1\xe0;
-static u8 s002[] =
+static u8 dat_common02[] =
\x05\x01\xf1\x84\x06\x00\xf1\x44 \x07\x00\xf1\xbe\x08\x00\xf1\x1e
\x20\x01\xf1\x03\x21\x84\xf1\x00 \x22\x0d\xf1\x0f\x24\x80\xf1\x00
\x34\x18\xf1\x2d\x35\x00\xf1\x22 \x43\x83\xf1\x83\x59\x00\xf1\xff;
-static u8 s003[] =
+static u8 dat_common03[] =
\xf0\x00\xf1\x02\x39\x06\xf1\x8c \x3a\x06\xf1\x8c\x3b\x03\xf1\xda
\x3c\x05\xf1\x30\x57\x01\xf1\x0c \x58\x01\xf1\x42\x59\x01\xf1\x0c
\x5a\x01\xf1\x42\x5c\x13\xf1\x0e \x5d\x17\xf1\x12\x64\x1e\xf1\x1c;
-static u8 s004[] =
+static u8 dat_common04[] =
\xf0\x00\xf1\x02\x24\x5f\xf1\x20 \x28\xea\xf1\x02\x5f\x41\xf1\x43;
-static u8 s005[] =
+static u8 dat_common05[] =
\x02\x00\xf1\xee\x03\x29\xf1\x1a \x04\x02\xf1\xa4\x09\x00\xf1\x68
\x0a\x00\xf1\x2a\x0b\x00\xf1\x04 \x0c\x00\xf1\x93\x0d\x00\xf1\x82
\x0e\x00\xf1\x40\x0f\x00\xf1\x5f \x10\x00\xf1\x4e\x11\x00\xf1\x5b;
-static u8 s006[] =
+static u8 dat_common06[] =
\x15\x00\xf1\xc9\x16\x00\xf1\x5e \x17\x00\xf1\x9d\x18\x00\xf1\x06
\x19\x00\xf1\x89\x1a\x00\xf1\x12 \x1b\x00\xf1\xa1\x1c\x00\xf1\xe4
\x1d\x00\xf1\x7a\x1e\x00\xf1\x64 \xf6\x00\xf1\x5f;
-static u8 s007[] =
+static u8 dat_common07[] =
\xf0\x00\xf1\x01\x53\x09\xf1\x03 \x54\x3d\xf1\x1c\x55\x99\xf1\x72
\x56\xc1\xf1\xb1\x57\xd8\xf1\xce \x58\xe0\xf1\x00\xdc\x0a\xf1\x03
\xdd\x45\xf1\x20\xde\xae\xf1\x82 \xdf\xdc\xf1\xc9\xe0\xf6\xf1\xea
\xe1\xff\xf1\x00;
-static u8 s008[] =
+static u8 dat_common08[] =
\xf0\x00\xf1\x01\x80\x00\xf1\x06 \x81\xf6\xf1\x08\x82\xfb\xf1\xf7
\x83\x00\xf1\xfe\xb6\x07\xf1\x03 \xb7\x18\xf1\x0c\x84\xfb\xf1\x06
\x85\xfb\xf1\xf9\x86\x00\xf1\xff \xb8\x07\xf1\x04\xb9\x16\xf1\x0a;
-static u8 s009[] =
+static u8 dat_common09[] =
\x87\xfa\xf1\x05\x88\xfc\xf1\xf9 \x89\x00\xf1\xff\xba\x06\xf1\x03
\xbb\x17\xf1\x09\x8a\xe8\xf1\x14 \x8b\xf7\xf1\xf0\x8c\xfd\xf1\xfa
\x8d\x00\xf1\x00\xbc\x05\xf1\x01 \xbd\x0c\xf1\x08\xbe\x00\xf1\x14;
-static u8 s010[] =
+static u8 dat_common10[] =
\x8e\xea\xf1\x13\x8f\xf7\xf1\xf2 \x90\xfd\xf1\xfa\x91\x00\xf1

[PATCH 3/3] gspca_gl860/Fixed format : improvement of the driver for OV2640 sensor

2009-10-03 Thread Olivier Lorin
gspca_gl860: improvement of the driver for OV2640 sensor

From: Olivier Lorin o.lo...@laposte.net

- simplified initialization sequence
- add flip/mirror support for OV2640
- fix for backlight value range
- fix for red-blue inversion hue mode with V4L1 applications

diff -rupN ../gspca-msrc2/linux/drivers/media/video/gspca/gl860/gl860.h 
./linux/drivers/media/video/gspca/gl860/gl860.h
--- ../gspca-msrc2/linux/drivers/media/video/gspca/gl860/gl860.h
2009-09-24 23:16:10.0 +0200
+++ ./linux/drivers/media/video/gspca/gl860/gl860.h 2009-09-24 
23:55:32.0 +0200
@@ -23,7 +23,7 @@
 #include gspca.h
 
 #define MODULE_NAME gspca_gl860
-#define DRIVER_VERSION 0.9d11
+#define DRIVER_VERSION 0.9e
 
 #define ctrl_in  gl860_RTx
 #define ctrl_out gl860_RTx
diff -rupN ../gspca-msrc2/linux/drivers/media/video/gspca/gl860/gl860-ov2640.c 
./linux/drivers/media/video/gspca/gl860/gl860-ov2640.c
--- ../gspca-msrc2/linux/drivers/media/video/gspca/gl860/gl860-ov2640.c 
2009-09-24 23:34:57.0 +0200
+++ ./linux/drivers/media/video/gspca/gl860/gl860-ov2640.c  2009-09-30 
00:40:49.0 +0200
@@ -107,36 +107,6 @@ static struct validx tbl_sensor_settings
{0x6001, 0x00ff}, {0x6038, 0x000c},
{10, 0x},
{0x6000, 0x0011},
-   /* backlight=31/64 */
-   {0x6001, 0x00ff}, {0x603e, 0x0024}, {0x6034, 0x0025},
-   /* bright=0/256 */
-   {0x6000, 0x00ff}, {0x6009, 0x007c}, {0x6000, 0x007d},
-   /* wbal=64/128 */
-   {0x6000, 0x00ff}, {0x6003, 0x007c}, {0x6040, 0x007d},
-   /* cntr=0/256 */
-   {0x6000, 0x00ff}, {0x6007, 0x007c}, {0x6000, 0x007d},
-   /* sat=128/256 */
-   {0x6000, 0x00ff}, {0x6001, 0x007c}, {0x6080, 0x007d},
-   /* sharpness=0/32 */
-   {0x6000, 0x00ff}, {0x6001, 0x0092}, {0x60c0, 0x0093},
-   /* hue=0/256 */
-   {0x6000, 0x00ff}, {0x6002, 0x007c}, {0x6000, 0x007d},
-   /* gam=32/64 */
-   {0x6000, 0x00ff}, {0x6008, 0x007c}, {0x6020, 0x007d},
-   /* image right up */
-   {0x, 0x},
-   {15, 0x},
-   {0x6001, 0x00ff}, {0x6000, 0x8004},
-   {0x, 0x},
-   {0x60a8, 0x0004},
-   {15, 0x},
-   {0x6001, 0x00ff}, {0x6000, 0x8004},
-   {0x, 0x},
-   {0x60f8, 0x0004},
-   /* image right up */
-   {0x, 0x},
-   /* backlight=31/64 */
-   {0x6001, 0x00ff}, {0x603e, 0x0024}, {0x6034, 0x0025},
 };
 
 static struct validx tbl_640[] = {
@@ -222,17 +192,19 @@ void ov2640_init_settings(struct gspca_d
sd-vcur.hue=   0;
sd-vcur.saturation = 128;
sd-vcur.whitebal   =  64;
+   sd-vcur.mirror =   0;
+   sd-vcur.flip   =   0;
 
sd-vmax.backlight  =  64;
sd-vmax.brightness = 255;
sd-vmax.sharpness  =  31;
sd-vmax.contrast   = 255;
sd-vmax.gamma  =  64;
-   sd-vmax.hue= 255 + 1;
+   sd-vmax.hue= 254 + 2;
sd-vmax.saturation = 255;
sd-vmax.whitebal   = 128;
-   sd-vmax.mirror = 0;
-   sd-vmax.flip   = 0;
+   sd-vmax.mirror = 1;
+   sd-vmax.flip   = 1;
sd-vmax.AC50Hz = 0;
 
sd-dev_camera_settings = ov2640_camera_settings;
@@ -284,6 +256,8 @@ static int ov2640_init_pre_alt(struct gs
sd-vold.gamma= -1;
sd-vold.hue  = -1;
sd-vold.whitebal = -1;
+   sd-vold.mirror = -1;
+   sd-vold.flip   = -1;
 
ov2640_init_post_alt(gspca_dev);
 
@@ -346,18 +320,6 @@ static int ov2640_init_post_alt(struct g
 
fetch_validx(gspca_dev, tbl_sensor_settings_common2,
ARRAY_SIZE(tbl_sensor_settings_common2));
-   ctrl_in(gspca_dev, 0xc0, 2, 0x, 0x, 1, c50);
-   keep_on_fetching_validx(gspca_dev, tbl_sensor_settings_common2,
-   ARRAY_SIZE(tbl_sensor_settings_common2), n);
-   ctrl_in(gspca_dev, 0xc0, 2, 0x6000, 0x8004, 1, c28);
-   keep_on_fetching_validx(gspca_dev, tbl_sensor_settings_common2,
-   ARRAY_SIZE(tbl_sensor_settings_common2), n);
-   ctrl_in(gspca_dev, 0xc0, 2, 0x6000, 0x8004, 1, ca8);
-   keep_on_fetching_validx(gspca_dev, tbl_sensor_settings_common2,
-   ARRAY_SIZE(tbl_sensor_settings_common2), n);
-   ctrl_in(gspca_dev, 0xc0, 2, 0x, 0x, 1, c50);
-   keep_on_fetching_validx(gspca_dev, tbl_sensor_settings_common2,
-   ARRAY_SIZE(tbl_sensor_settings_common2), n);
 
ov2640_camera_settings(gspca_dev);
 
@@ -394,6 +356,8 @@ static int ov2640_camera_settings(struct
s32 sat= sd-vcur.saturation;
s32 hue= sd-vcur.hue;
s32 wbal   = sd-vcur.whitebal;
+   s32 mirror = (((sd-vcur.mirror  0) ^ sd-mirrorMask) == 0);
+   s32 flip   = (((sd-vcur.flip0) ^ sd-mirrorMask) == 0);
 
if (backlight != sd-vold.backlight) {
/* No sd-vold.backlight=backlight; (to be done again

[PATCH] MAINTAINERS: addition of gspca_gl860 driver

2009-10-03 Thread Olivier Lorin
MAINTAINERS: addition of gspca_gl860 driver

From: Olivier Lorin o.lo...@laposte.net

- addition of gspca_gl860 driver

Priority: normal

Signed-off-by: Olivier Lorin o.lo...@laposte.net

--- ../a/MAINTAINERS2009-09-20 02:07:33.0 +0200
+++ MAINTAINERS 2009-09-20 02:09:56.0 +0200
@@ -2224,6 +2224,13 @@ T:   git git://git.kernel.org/pub/scm/linu
 S: Maintained
 F: drivers/media/video/gspca/finepix.c
 
+GSPCA GL860 SUBDRIVER
+M: Olivier Lorin o.lo...@laposte.net
+L: linux-media@vger.kernel.org
+T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+S: Maintained
+F: drivers/media/video/gspca/gl860/
+
 GSPCA M5602 SUBDRIVER
 M: Erik Andren erik.and...@gmail.com
 L: linux-media@vger.kernel.org

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html