aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2009-02-05 13:12:24 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:42:49 -0400
commit2797ba2a1727df07a4c74d494a43296cbf5179b9 (patch)
tree3fdea31291ba519c87066e0ed4b7145747d77c7f
parentc33c02ed07d678625d7ca2e26238c8e925710138 (diff)
V4L/DVB (10636): gspca - sonixj: Add autogain for ov7630/48 and vflip for ov7648.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/gspca/sonixj.c43
1 files changed, 35 insertions, 8 deletions
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index 7b28bc7cec77..444d2dc4544a 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -45,7 +45,7 @@ struct sd {
45 u8 blue; 45 u8 blue;
46 u8 red; 46 u8 red;
47 u8 gamma; 47 u8 gamma;
48 u8 vflip; /* ov7630 only */ 48 u8 vflip; /* ov7630/ov7648 only */
49 u8 infrared; /* mt9v111 only */ 49 u8 infrared; /* mt9v111 only */
50 50
51 s8 ag_cnt; 51 s8 ag_cnt;
@@ -192,7 +192,7 @@ static struct ctrl sd_ctrls[] = {
192 .set = sd_setautogain, 192 .set = sd_setautogain,
193 .get = sd_getautogain, 193 .get = sd_getautogain,
194 }, 194 },
195/* ov7630 only */ 195/* ov7630/ov7648 only */
196#define VFLIP_IDX 6 196#define VFLIP_IDX 6
197 { 197 {
198 { 198 {
@@ -202,7 +202,7 @@ static struct ctrl sd_ctrls[] = {
202 .minimum = 0, 202 .minimum = 0,
203 .maximum = 1, 203 .maximum = 1,
204 .step = 1, 204 .step = 1,
205#define VFLIP_DEF 1 205#define VFLIP_DEF 0 /* vflip def = 1 for ov7630 */
206 .default_value = VFLIP_DEF, 206 .default_value = VFLIP_DEF,
207 }, 207 },
208 .set = sd_setvflip, 208 .set = sd_setvflip,
@@ -240,7 +240,7 @@ static __u32 ctrl_dis[] = {
240 /* SENSOR_OM6802 4 */ 240 /* SENSOR_OM6802 4 */
241 (1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX), 241 (1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX),
242 /* SENSOR_OV7630 5 */ 242 /* SENSOR_OV7630 5 */
243 (1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX) | (1 << VFLIP_IDX), 243 (1 << INFRARED_IDX),
244 /* SENSOR_OV7648 6 */ 244 /* SENSOR_OV7648 6 */
245 (1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX) | (1 << VFLIP_IDX), 245 (1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX) | (1 << VFLIP_IDX),
246 /* SENSOR_OV7660 7 */ 246 /* SENSOR_OV7660 7 */
@@ -669,7 +669,8 @@ static const u8 ov7648_sensor_init[][8] = {
669 {0xb1, 0x21, 0x2d, 0x85, 0x00, 0x00, 0x00, 0x10}, 669 {0xb1, 0x21, 0x2d, 0x85, 0x00, 0x00, 0x00, 0x10},
670/*...*/ 670/*...*/
671/* {0xa1, 0x21, 0x12, 0x08, 0x00, 0x00, 0x00, 0x10}, jfm done */ 671/* {0xa1, 0x21, 0x12, 0x08, 0x00, 0x00, 0x00, 0x10}, jfm done */
672/* {0xa1, 0x21, 0x75, 0x06, 0x00, 0x00, 0x00, 0x10}, jfm done */ 672/* {0xa1, 0x21, 0x75, 0x06, 0x00, 0x00, 0x00, 0x10}, * COMN
673 * set by setvflip */
673 {0xa1, 0x21, 0x19, 0x02, 0x00, 0x00, 0x00, 0x10}, 674 {0xa1, 0x21, 0x19, 0x02, 0x00, 0x00, 0x00, 0x10},
674 {0xa1, 0x21, 0x10, 0x32, 0x00, 0x00, 0x00, 0x10}, 675 {0xa1, 0x21, 0x10, 0x32, 0x00, 0x00, 0x00, 0x10},
675/* {0xa1, 0x21, 0x16, 0x00, 0x00, 0x00, 0x00, 0x10}, jfm done */ 676/* {0xa1, 0x21, 0x16, 0x00, 0x00, 0x00, 0x00, 0x10}, jfm done */
@@ -1303,7 +1304,10 @@ static int sd_config(struct gspca_dev *gspca_dev,
1303 sd->gamma = GAMMA_DEF; 1304 sd->gamma = GAMMA_DEF;
1304 sd->autogain = AUTOGAIN_DEF; 1305 sd->autogain = AUTOGAIN_DEF;
1305 sd->ag_cnt = -1; 1306 sd->ag_cnt = -1;
1306 sd->vflip = VFLIP_DEF; 1307 if (sd->sensor != SENSOR_OV7630)
1308 sd->vflip = 0;
1309 else
1310 sd->vflip = 1;
1307 sd->infrared = INFRARED_DEF; 1311 sd->infrared = INFRARED_DEF;
1308 1312
1309 gspca_dev->ctrl_dis = ctrl_dis[sd->sensor]; 1313 gspca_dev->ctrl_dis = ctrl_dis[sd->sensor];
@@ -1563,16 +1567,39 @@ static void setautogain(struct gspca_dev *gspca_dev)
1563 1567
1564 if (gspca_dev->ctrl_dis & (1 << AUTOGAIN_IDX)) 1568 if (gspca_dev->ctrl_dis & (1 << AUTOGAIN_IDX))
1565 return; 1569 return;
1570 switch (sd->sensor) {
1571 case SENSOR_OV7630:
1572 case SENSOR_OV7648: {
1573 u8 comb;
1574
1575 if (sd->sensor == SENSOR_OV7630)
1576 comb = 0xc0;
1577 else
1578 comb = 0xa0;
1579 if (sd->autogain)
1580 comb |= 0x02;
1581 i2c_w1(&sd->gspca_dev, 0x13, comb);
1582 return;
1583 }
1584 }
1566 if (sd->autogain) 1585 if (sd->autogain)
1567 sd->ag_cnt = AG_CNT_START; 1586 sd->ag_cnt = AG_CNT_START;
1568 else 1587 else
1569 sd->ag_cnt = -1; 1588 sd->ag_cnt = -1;
1570} 1589}
1571 1590
1591/* ov7630/ov7648 only */
1572static void setvflip(struct sd *sd) 1592static void setvflip(struct sd *sd)
1573{ 1593{
1574 i2c_w1(&sd->gspca_dev, 0x75, /* COMN */ 1594 u8 comn;
1575 sd->vflip ? 0x82 : 0x02); 1595
1596 if (sd->sensor == SENSOR_OV7630)
1597 comn = 0x02;
1598 else
1599 comn = 0x06;
1600 if (sd->vflip)
1601 comn |= 0x80;
1602 i2c_w1(&sd->gspca_dev, 0x75, comn);
1576} 1603}
1577 1604
1578static void setinfrared(struct sd *sd) 1605static void setinfrared(struct sd *sd)