diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2008-09-08 03:57:26 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-12 07:36:59 -0400 |
commit | 6c86274fcdf4b3893ee22c1e39ddfb5b05bf0362 (patch) | |
tree | a3f1da590d0a722dcaaf479940ffb8778c1120af | |
parent | 51977a8daab6775b91986b566056eb2a2f10202d (diff) |
V4L/DVB (8931): gspca: Vflip added for sonixj - ov7630.
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.c | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index cd961cad4f9a..1d6f2ee1eec8 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c | |||
@@ -39,6 +39,7 @@ struct sd { | |||
39 | unsigned char contrast; | 39 | unsigned char contrast; |
40 | unsigned char colors; | 40 | unsigned char colors; |
41 | unsigned char autogain; | 41 | unsigned char autogain; |
42 | __u8 vflip; /* ov7630 only */ | ||
42 | 43 | ||
43 | signed char ag_cnt; | 44 | signed char ag_cnt; |
44 | #define AG_CNT_START 13 | 45 | #define AG_CNT_START 13 |
@@ -70,6 +71,8 @@ static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val); | |||
70 | static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val); | 71 | static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val); |
71 | static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val); | 72 | static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val); |
72 | static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val); | 73 | static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val); |
74 | static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val); | ||
75 | static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val); | ||
73 | 76 | ||
74 | static struct ctrl sd_ctrls[] = { | 77 | static struct ctrl sd_ctrls[] = { |
75 | { | 78 | { |
@@ -131,6 +134,22 @@ static struct ctrl sd_ctrls[] = { | |||
131 | .set = sd_setautogain, | 134 | .set = sd_setautogain, |
132 | .get = sd_getautogain, | 135 | .get = sd_getautogain, |
133 | }, | 136 | }, |
137 | /* ov7630 only */ | ||
138 | #define VFLIP_IDX 4 | ||
139 | { | ||
140 | { | ||
141 | .id = V4L2_CID_VFLIP, | ||
142 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
143 | .name = "Vflip", | ||
144 | .minimum = 0, | ||
145 | .maximum = 1, | ||
146 | .step = 1, | ||
147 | #define VFLIP_DEF 0 | ||
148 | .default_value = VFLIP_DEF, | ||
149 | }, | ||
150 | .set = sd_setvflip, | ||
151 | .get = sd_getvflip, | ||
152 | }, | ||
134 | }; | 153 | }; |
135 | 154 | ||
136 | static struct v4l2_pix_format vga_mode[] = { | 155 | static struct v4l2_pix_format vga_mode[] = { |
@@ -434,7 +453,8 @@ static const __u8 ov7630_sensor_init[][8] = { | |||
434 | {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10}, | 453 | {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10}, |
435 | {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10}, | 454 | {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10}, |
436 | /*fixme: + 0x12, 0x04*/ | 455 | /*fixme: + 0x12, 0x04*/ |
437 | {0xa1, 0x21, 0x75, 0x82, 0x00, 0x00, 0x00, 0x10}, | 456 | /* {0xa1, 0x21, 0x75, 0x82, 0x00, 0x00, 0x00, 0x10}, * COMN |
457 | * set by setvflip */ | ||
438 | {0xa1, 0x21, 0x10, 0x32, 0x00, 0x00, 0x00, 0x10}, | 458 | {0xa1, 0x21, 0x10, 0x32, 0x00, 0x00, 0x00, 0x10}, |
439 | {0xa1, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, | 459 | {0xa1, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, |
440 | {0xb1, 0x21, 0x01, 0x80, 0x80, 0x00, 0x00, 0x10}, | 460 | {0xb1, 0x21, 0x01, 0x80, 0x80, 0x00, 0x00, 0x10}, |
@@ -949,6 +969,8 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
949 | gspca_dev->ctrl_dis = (1 << AUTOGAIN_IDX); | 969 | gspca_dev->ctrl_dis = (1 << AUTOGAIN_IDX); |
950 | break; | 970 | break; |
951 | } | 971 | } |
972 | if (sd->sensor != SENSOR_OV7630) | ||
973 | gspca_dev->ctrl_dis |= (1 << VFLIP_IDX); | ||
952 | 974 | ||
953 | return 0; | 975 | return 0; |
954 | } | 976 | } |
@@ -1172,6 +1194,14 @@ static void setautogain(struct gspca_dev *gspca_dev) | |||
1172 | sd->ag_cnt = -1; | 1194 | sd->ag_cnt = -1; |
1173 | } | 1195 | } |
1174 | 1196 | ||
1197 | static void setvflip(struct sd *sd) | ||
1198 | { | ||
1199 | if (sd->sensor != SENSOR_OV7630) | ||
1200 | return; | ||
1201 | i2c_w1(&sd->gspca_dev, 0x75, /* COMN */ | ||
1202 | sd->vflip ? 0x82 : 0x02); | ||
1203 | } | ||
1204 | |||
1175 | /* -- start the camera -- */ | 1205 | /* -- start the camera -- */ |
1176 | static void sd_start(struct gspca_dev *gspca_dev) | 1206 | static void sd_start(struct gspca_dev *gspca_dev) |
1177 | { | 1207 | { |
@@ -1263,6 +1293,7 @@ static void sd_start(struct gspca_dev *gspca_dev) | |||
1263 | break; | 1293 | break; |
1264 | case SENSOR_OV7630: | 1294 | case SENSOR_OV7630: |
1265 | ov7630_InitSensor(gspca_dev); | 1295 | ov7630_InitSensor(gspca_dev); |
1296 | setvflip(sd); | ||
1266 | reg17 = 0xe2; | 1297 | reg17 = 0xe2; |
1267 | reg1 = 0x44; | 1298 | reg1 = 0x44; |
1268 | break; | 1299 | break; |
@@ -1546,6 +1577,23 @@ static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val) | |||
1546 | return 0; | 1577 | return 0; |
1547 | } | 1578 | } |
1548 | 1579 | ||
1580 | static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val) | ||
1581 | { | ||
1582 | struct sd *sd = (struct sd *) gspca_dev; | ||
1583 | |||
1584 | sd->vflip = val; | ||
1585 | setvflip(sd); | ||
1586 | return 0; | ||
1587 | } | ||
1588 | |||
1589 | static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val) | ||
1590 | { | ||
1591 | struct sd *sd = (struct sd *) gspca_dev; | ||
1592 | |||
1593 | *val = sd->vflip; | ||
1594 | return 0; | ||
1595 | } | ||
1596 | |||
1549 | /* sub-driver description */ | 1597 | /* sub-driver description */ |
1550 | static const struct sd_desc sd_desc = { | 1598 | static const struct sd_desc sd_desc = { |
1551 | .name = MODULE_NAME, | 1599 | .name = MODULE_NAME, |