diff mbox

[06/11] ov534: Fix Auto White Balance control

Message ID 1267302028-7941-7-git-send-email-ospite@studenti.unina.it (mailing list archive)
State Accepted
Headers show

Commit Message

Antonio Ospite Feb. 27, 2010, 8:20 p.m. UTC
None
diff mbox

Patch

Index: gspca/linux/drivers/media/video/gspca/ov534.c
===================================================================
--- gspca.orig/linux/drivers/media/video/gspca/ov534.c
+++ gspca/linux/drivers/media/video/gspca/ov534.c
@@ -171,7 +171,7 @@ 
 		.minimum = 0,
 		.maximum = 1,
 		.step    = 1,
-#define AWB_DEF 0
+#define AWB_DEF 1
 		.default_value = AWB_DEF,
 	},
 	.set = sd_setawb,
@@ -718,10 +718,17 @@ 
 {
 	struct sd *sd = (struct sd *) gspca_dev;
 
-	if (sd->awb)
-		sccb_reg_write(gspca_dev, 0x63, 0xe0);	/* AWB on */
-	else
-		sccb_reg_write(gspca_dev, 0x63, 0xaa);	/* AWB off */
+	if (sd->awb) {
+		sccb_reg_write(gspca_dev, 0x13,
+				sccb_reg_read(gspca_dev, 0x13) | 0x02);
+		sccb_reg_write(gspca_dev, 0x63,
+				sccb_reg_read(gspca_dev, 0x63) | 0xc0);
+	} else {
+		sccb_reg_write(gspca_dev, 0x13,
+				sccb_reg_read(gspca_dev, 0x13) & ~0x02);
+		sccb_reg_write(gspca_dev, 0x63,
+				sccb_reg_read(gspca_dev, 0x63) & ~0xc0);
+	}
 }
 
 static void setaec(struct gspca_dev *gspca_dev)
@@ -800,9 +807,7 @@ 
 #else
 	gspca_dev->ctrl_inac |= (1 << AWB_IDX);
 #endif
-#if AWB_DEF != 0
-	sd->awb = AWB_DEF
-#endif
+	sd->awb = AWB_DEF;
 	sd->aec = AEC_DEF;
 #if SHARPNESS_DEF != 0
 	sd->sharpness = SHARPNESS_DEF;