diff options
Diffstat (limited to 'drivers/media/video/gspca/sonixj.c')
-rw-r--r-- | drivers/media/video/gspca/sonixj.c | 181 |
1 files changed, 151 insertions, 30 deletions
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index dc6a6f11354a..0d02f41fa7d0 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c | |||
@@ -46,6 +46,7 @@ struct sd { | |||
46 | u8 gamma; | 46 | u8 gamma; |
47 | u8 vflip; /* ov7630/ov7648 only */ | 47 | u8 vflip; /* ov7630/ov7648 only */ |
48 | u8 infrared; /* mt9v111 only */ | 48 | u8 infrared; /* mt9v111 only */ |
49 | u8 freq; /* ov76xx only */ | ||
49 | u8 quality; /* image quality */ | 50 | u8 quality; /* image quality */ |
50 | #define QUALITY_MIN 60 | 51 | #define QUALITY_MIN 60 |
51 | #define QUALITY_MAX 95 | 52 | #define QUALITY_MAX 95 |
@@ -96,8 +97,11 @@ static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val); | |||
96 | static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val); | 97 | static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val); |
97 | static int sd_setinfrared(struct gspca_dev *gspca_dev, __s32 val); | 98 | static int sd_setinfrared(struct gspca_dev *gspca_dev, __s32 val); |
98 | static int sd_getinfrared(struct gspca_dev *gspca_dev, __s32 *val); | 99 | static int sd_getinfrared(struct gspca_dev *gspca_dev, __s32 *val); |
100 | static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val); | ||
101 | static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val); | ||
99 | 102 | ||
100 | static struct ctrl sd_ctrls[] = { | 103 | static struct ctrl sd_ctrls[] = { |
104 | #define BRIGHTNESS_IDX 0 | ||
101 | { | 105 | { |
102 | { | 106 | { |
103 | .id = V4L2_CID_BRIGHTNESS, | 107 | .id = V4L2_CID_BRIGHTNESS, |
@@ -113,6 +117,7 @@ static struct ctrl sd_ctrls[] = { | |||
113 | .set = sd_setbrightness, | 117 | .set = sd_setbrightness, |
114 | .get = sd_getbrightness, | 118 | .get = sd_getbrightness, |
115 | }, | 119 | }, |
120 | #define CONTRAST_IDX 1 | ||
116 | { | 121 | { |
117 | { | 122 | { |
118 | .id = V4L2_CID_CONTRAST, | 123 | .id = V4L2_CID_CONTRAST, |
@@ -128,20 +133,22 @@ static struct ctrl sd_ctrls[] = { | |||
128 | .set = sd_setcontrast, | 133 | .set = sd_setcontrast, |
129 | .get = sd_getcontrast, | 134 | .get = sd_getcontrast, |
130 | }, | 135 | }, |
136 | #define COLOR_IDX 2 | ||
131 | { | 137 | { |
132 | { | 138 | { |
133 | .id = V4L2_CID_SATURATION, | 139 | .id = V4L2_CID_SATURATION, |
134 | .type = V4L2_CTRL_TYPE_INTEGER, | 140 | .type = V4L2_CTRL_TYPE_INTEGER, |
135 | .name = "Color", | 141 | .name = "Saturation", |
136 | .minimum = 0, | 142 | .minimum = 0, |
137 | .maximum = 40, | 143 | .maximum = 40, |
138 | .step = 1, | 144 | .step = 1, |
139 | #define COLOR_DEF 32 | 145 | #define COLOR_DEF 25 |
140 | .default_value = COLOR_DEF, | 146 | .default_value = COLOR_DEF, |
141 | }, | 147 | }, |
142 | .set = sd_setcolors, | 148 | .set = sd_setcolors, |
143 | .get = sd_getcolors, | 149 | .get = sd_getcolors, |
144 | }, | 150 | }, |
151 | #define BLUE_BALANCE_IDX 3 | ||
145 | { | 152 | { |
146 | { | 153 | { |
147 | .id = V4L2_CID_BLUE_BALANCE, | 154 | .id = V4L2_CID_BLUE_BALANCE, |
@@ -156,6 +163,7 @@ static struct ctrl sd_ctrls[] = { | |||
156 | .set = sd_setblue_balance, | 163 | .set = sd_setblue_balance, |
157 | .get = sd_getblue_balance, | 164 | .get = sd_getblue_balance, |
158 | }, | 165 | }, |
166 | #define RED_BALANCE_IDX 4 | ||
159 | { | 167 | { |
160 | { | 168 | { |
161 | .id = V4L2_CID_RED_BALANCE, | 169 | .id = V4L2_CID_RED_BALANCE, |
@@ -170,6 +178,7 @@ static struct ctrl sd_ctrls[] = { | |||
170 | .set = sd_setred_balance, | 178 | .set = sd_setred_balance, |
171 | .get = sd_getred_balance, | 179 | .get = sd_getred_balance, |
172 | }, | 180 | }, |
181 | #define GAMMA_IDX 5 | ||
173 | { | 182 | { |
174 | { | 183 | { |
175 | .id = V4L2_CID_GAMMA, | 184 | .id = V4L2_CID_GAMMA, |
@@ -184,7 +193,7 @@ static struct ctrl sd_ctrls[] = { | |||
184 | .set = sd_setgamma, | 193 | .set = sd_setgamma, |
185 | .get = sd_getgamma, | 194 | .get = sd_getgamma, |
186 | }, | 195 | }, |
187 | #define AUTOGAIN_IDX 5 | 196 | #define AUTOGAIN_IDX 6 |
188 | { | 197 | { |
189 | { | 198 | { |
190 | .id = V4L2_CID_AUTOGAIN, | 199 | .id = V4L2_CID_AUTOGAIN, |
@@ -200,7 +209,7 @@ static struct ctrl sd_ctrls[] = { | |||
200 | .get = sd_getautogain, | 209 | .get = sd_getautogain, |
201 | }, | 210 | }, |
202 | /* ov7630/ov7648 only */ | 211 | /* ov7630/ov7648 only */ |
203 | #define VFLIP_IDX 6 | 212 | #define VFLIP_IDX 7 |
204 | { | 213 | { |
205 | { | 214 | { |
206 | .id = V4L2_CID_VFLIP, | 215 | .id = V4L2_CID_VFLIP, |
@@ -209,14 +218,14 @@ static struct ctrl sd_ctrls[] = { | |||
209 | .minimum = 0, | 218 | .minimum = 0, |
210 | .maximum = 1, | 219 | .maximum = 1, |
211 | .step = 1, | 220 | .step = 1, |
212 | #define VFLIP_DEF 0 /* vflip def = 1 for ov7630 */ | 221 | #define VFLIP_DEF 0 |
213 | .default_value = VFLIP_DEF, | 222 | .default_value = VFLIP_DEF, |
214 | }, | 223 | }, |
215 | .set = sd_setvflip, | 224 | .set = sd_setvflip, |
216 | .get = sd_getvflip, | 225 | .get = sd_getvflip, |
217 | }, | 226 | }, |
218 | /* mt9v111 only */ | 227 | /* mt9v111 only */ |
219 | #define INFRARED_IDX 7 | 228 | #define INFRARED_IDX 8 |
220 | { | 229 | { |
221 | { | 230 | { |
222 | .id = V4L2_CID_INFRARED, | 231 | .id = V4L2_CID_INFRARED, |
@@ -231,28 +240,44 @@ static struct ctrl sd_ctrls[] = { | |||
231 | .set = sd_setinfrared, | 240 | .set = sd_setinfrared, |
232 | .get = sd_getinfrared, | 241 | .get = sd_getinfrared, |
233 | }, | 242 | }, |
243 | /* ov7630/ov7648/ov7660 only */ | ||
244 | #define FREQ_IDX 9 | ||
245 | { | ||
246 | { | ||
247 | .id = V4L2_CID_POWER_LINE_FREQUENCY, | ||
248 | .type = V4L2_CTRL_TYPE_MENU, | ||
249 | .name = "Light frequency filter", | ||
250 | .minimum = 0, | ||
251 | .maximum = 2, /* 0: 0, 1: 50Hz, 2:60Hz */ | ||
252 | .step = 1, | ||
253 | #define FREQ_DEF 2 | ||
254 | .default_value = FREQ_DEF, | ||
255 | }, | ||
256 | .set = sd_setfreq, | ||
257 | .get = sd_getfreq, | ||
258 | }, | ||
234 | }; | 259 | }; |
235 | 260 | ||
236 | /* table of the disabled controls */ | 261 | /* table of the disabled controls */ |
237 | static __u32 ctrl_dis[] = { | 262 | static __u32 ctrl_dis[] = { |
238 | (1 << INFRARED_IDX) | (1 << VFLIP_IDX), | 263 | (1 << INFRARED_IDX) | (1 << VFLIP_IDX) | (1 << FREQ_IDX), |
239 | /* SENSOR_HV7131R 0 */ | 264 | /* SENSOR_HV7131R 0 */ |
240 | (1 << INFRARED_IDX) | (1 << VFLIP_IDX), | 265 | (1 << INFRARED_IDX) | (1 << VFLIP_IDX) | (1 << FREQ_IDX), |
241 | /* SENSOR_MI0360 1 */ | 266 | /* SENSOR_MI0360 1 */ |
242 | (1 << INFRARED_IDX) | (1 << VFLIP_IDX), | 267 | (1 << INFRARED_IDX) | (1 << VFLIP_IDX) | (1 << FREQ_IDX), |
243 | /* SENSOR_MO4000 2 */ | 268 | /* SENSOR_MO4000 2 */ |
244 | (1 << VFLIP_IDX), | 269 | (1 << VFLIP_IDX) | (1 << FREQ_IDX), |
245 | /* SENSOR_MT9V111 3 */ | 270 | /* SENSOR_MT9V111 3 */ |
246 | (1 << INFRARED_IDX) | (1 << VFLIP_IDX), | 271 | (1 << INFRARED_IDX) | (1 << VFLIP_IDX) | (1 << FREQ_IDX), |
247 | /* SENSOR_OM6802 4 */ | 272 | /* SENSOR_OM6802 4 */ |
248 | (1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX), | 273 | (1 << INFRARED_IDX), |
249 | /* SENSOR_OV7630 5 */ | 274 | /* SENSOR_OV7630 5 */ |
250 | (1 << INFRARED_IDX), | 275 | (1 << INFRARED_IDX), |
251 | /* SENSOR_OV7648 6 */ | 276 | /* SENSOR_OV7648 6 */ |
252 | (1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX) | (1 << VFLIP_IDX), | 277 | (1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX) | (1 << VFLIP_IDX), |
253 | /* SENSOR_OV7660 7 */ | 278 | /* SENSOR_OV7660 7 */ |
254 | (1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX) | (1 << VFLIP_IDX), | 279 | (1 << AUTOGAIN_IDX) | (1 << INFRARED_IDX) | (1 << VFLIP_IDX) | |
255 | /* SENSOR_SP80708 8 */ | 280 | (1 << FREQ_IDX), /* SENSOR_SP80708 8 */ |
256 | }; | 281 | }; |
257 | 282 | ||
258 | static const struct v4l2_pix_format vga_mode[] = { | 283 | static const struct v4l2_pix_format vga_mode[] = { |
@@ -268,7 +293,8 @@ static const struct v4l2_pix_format vga_mode[] = { | |||
268 | .priv = 1}, | 293 | .priv = 1}, |
269 | {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, | 294 | {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, |
270 | .bytesperline = 640, | 295 | .bytesperline = 640, |
271 | .sizeimage = 640 * 480 * 3 / 8 + 590, | 296 | /* Note 3 / 8 is not large enough, not even 5 / 8 is ?! */ |
297 | .sizeimage = 640 * 480 * 3 / 4 + 590, | ||
272 | .colorspace = V4L2_COLORSPACE_JPEG, | 298 | .colorspace = V4L2_COLORSPACE_JPEG, |
273 | .priv = 0}, | 299 | .priv = 0}, |
274 | }; | 300 | }; |
@@ -604,7 +630,9 @@ static const u8 ov7630_sensor_init[][8] = { | |||
604 | /* win: i2c_r from 00 to 80 */ | 630 | /* win: i2c_r from 00 to 80 */ |
605 | {0xd1, 0x21, 0x03, 0x80, 0x10, 0x20, 0x80, 0x10}, | 631 | {0xd1, 0x21, 0x03, 0x80, 0x10, 0x20, 0x80, 0x10}, |
606 | {0xb1, 0x21, 0x0c, 0x20, 0x20, 0x00, 0x00, 0x10}, | 632 | {0xb1, 0x21, 0x0c, 0x20, 0x20, 0x00, 0x00, 0x10}, |
607 | {0xd1, 0x21, 0x11, 0x00, 0x48, 0xc0, 0x00, 0x10}, | 633 | /* HDG: 0x11 was 0x00 change to 0x01 for better exposure (15 fps instead of 30) |
634 | 0x13 was 0xc0 change to 0xc3 for auto gain and exposure */ | ||
635 | {0xd1, 0x21, 0x11, 0x01, 0x48, 0xc3, 0x00, 0x10}, | ||
608 | {0xb1, 0x21, 0x15, 0x80, 0x03, 0x00, 0x00, 0x10}, | 636 | {0xb1, 0x21, 0x15, 0x80, 0x03, 0x00, 0x00, 0x10}, |
609 | {0xd1, 0x21, 0x17, 0x1b, 0xbd, 0x05, 0xf6, 0x10}, | 637 | {0xd1, 0x21, 0x17, 0x1b, 0xbd, 0x05, 0xf6, 0x10}, |
610 | {0xa1, 0x21, 0x1b, 0x04, 0x00, 0x00, 0x00, 0x10}, | 638 | {0xa1, 0x21, 0x1b, 0x04, 0x00, 0x00, 0x00, 0x10}, |
@@ -638,9 +666,8 @@ static const u8 ov7630_sensor_init[][8] = { | |||
638 | {0xa1, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, | 666 | {0xa1, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, |
639 | {0xb1, 0x21, 0x01, 0x80, 0x80, 0x00, 0x00, 0x10}, | 667 | {0xb1, 0x21, 0x01, 0x80, 0x80, 0x00, 0x00, 0x10}, |
640 | /* */ | 668 | /* */ |
641 | {0xa1, 0x21, 0x11, 0x00, 0x00, 0x00, 0x00, 0x10}, | 669 | /* {0xa1, 0x21, 0x2a, 0x88, 0x00, 0x00, 0x00, 0x10}, * set by setfreq */ |
642 | {0xa1, 0x21, 0x2a, 0x88, 0x00, 0x00, 0x00, 0x10}, | 670 | /* {0xa1, 0x21, 0x2b, 0x34, 0x00, 0x00, 0x00, 0x10}, * set by setfreq */ |
643 | {0xa1, 0x21, 0x2b, 0x34, 0x00, 0x00, 0x00, 0x10}, | ||
644 | /* */ | 671 | /* */ |
645 | {0xa1, 0x21, 0x10, 0x83, 0x00, 0x00, 0x00, 0x10}, | 672 | {0xa1, 0x21, 0x10, 0x83, 0x00, 0x00, 0x00, 0x10}, |
646 | /* {0xb1, 0x21, 0x01, 0x88, 0x70, 0x00, 0x00, 0x10}, */ | 673 | /* {0xb1, 0x21, 0x01, 0x88, 0x70, 0x00, 0x00, 0x10}, */ |
@@ -673,7 +700,7 @@ static const u8 ov7648_sensor_init[][8] = { | |||
673 | {0xd1, 0x21, 0x21, 0x86, 0x00, 0xde, 0xa0, 0x10}, | 700 | {0xd1, 0x21, 0x21, 0x86, 0x00, 0xde, 0xa0, 0x10}, |
674 | /* {0xd1, 0x21, 0x25, 0x80, 0x32, 0xfe, 0xa0, 0x10}, jfm done */ | 701 | /* {0xd1, 0x21, 0x25, 0x80, 0x32, 0xfe, 0xa0, 0x10}, jfm done */ |
675 | /* {0xd1, 0x21, 0x29, 0x00, 0x91, 0x00, 0x88, 0x10}, jfm done */ | 702 | /* {0xd1, 0x21, 0x29, 0x00, 0x91, 0x00, 0x88, 0x10}, jfm done */ |
676 | {0xb1, 0x21, 0x2d, 0x85, 0x00, 0x00, 0x00, 0x10}, | 703 | /* {0xb1, 0x21, 0x2d, 0x85, 0x00, 0x00, 0x00, 0x10}, set by setfreq */ |
677 | /*...*/ | 704 | /*...*/ |
678 | /* {0xa1, 0x21, 0x12, 0x08, 0x00, 0x00, 0x00, 0x10}, jfm done */ | 705 | /* {0xa1, 0x21, 0x12, 0x08, 0x00, 0x00, 0x00, 0x10}, jfm done */ |
679 | /* {0xa1, 0x21, 0x75, 0x06, 0x00, 0x00, 0x00, 0x10}, * COMN | 706 | /* {0xa1, 0x21, 0x75, 0x06, 0x00, 0x00, 0x00, 0x10}, * COMN |
@@ -1294,11 +1321,9 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
1294 | sd->gamma = GAMMA_DEF; | 1321 | sd->gamma = GAMMA_DEF; |
1295 | sd->autogain = AUTOGAIN_DEF; | 1322 | sd->autogain = AUTOGAIN_DEF; |
1296 | sd->ag_cnt = -1; | 1323 | sd->ag_cnt = -1; |
1297 | if (sd->sensor != SENSOR_OV7630) | 1324 | sd->vflip = VFLIP_DEF; |
1298 | sd->vflip = 0; | ||
1299 | else | ||
1300 | sd->vflip = 1; | ||
1301 | sd->infrared = INFRARED_DEF; | 1325 | sd->infrared = INFRARED_DEF; |
1326 | sd->freq = FREQ_DEF; | ||
1302 | sd->quality = QUALITY_DEF; | 1327 | sd->quality = QUALITY_DEF; |
1303 | sd->jpegqual = 80; | 1328 | sd->jpegqual = 80; |
1304 | 1329 | ||
@@ -1569,7 +1594,7 @@ static void setautogain(struct gspca_dev *gspca_dev) | |||
1569 | else | 1594 | else |
1570 | comb = 0xa0; | 1595 | comb = 0xa0; |
1571 | if (sd->autogain) | 1596 | if (sd->autogain) |
1572 | comb |= 0x02; | 1597 | comb |= 0x03; |
1573 | i2c_w1(&sd->gspca_dev, 0x13, comb); | 1598 | i2c_w1(&sd->gspca_dev, 0x13, comb); |
1574 | return; | 1599 | return; |
1575 | } | 1600 | } |
@@ -1585,12 +1610,15 @@ static void setvflip(struct sd *sd) | |||
1585 | { | 1610 | { |
1586 | u8 comn; | 1611 | u8 comn; |
1587 | 1612 | ||
1588 | if (sd->sensor == SENSOR_OV7630) | 1613 | if (sd->sensor == SENSOR_OV7630) { |
1589 | comn = 0x02; | 1614 | comn = 0x02; |
1590 | else | 1615 | if (!sd->vflip) |
1616 | comn |= 0x80; | ||
1617 | } else { | ||
1591 | comn = 0x06; | 1618 | comn = 0x06; |
1592 | if (sd->vflip) | 1619 | if (sd->vflip) |
1593 | comn |= 0x80; | 1620 | comn |= 0x80; |
1621 | } | ||
1594 | i2c_w1(&sd->gspca_dev, 0x75, comn); | 1622 | i2c_w1(&sd->gspca_dev, 0x75, comn); |
1595 | } | 1623 | } |
1596 | 1624 | ||
@@ -1602,6 +1630,58 @@ static void setinfrared(struct sd *sd) | |||
1602 | sd->infrared ? 0x66 : 0x64); | 1630 | sd->infrared ? 0x66 : 0x64); |
1603 | } | 1631 | } |
1604 | 1632 | ||
1633 | static void setfreq(struct gspca_dev *gspca_dev) | ||
1634 | { | ||
1635 | struct sd *sd = (struct sd *) gspca_dev; | ||
1636 | |||
1637 | if (sd->sensor == SENSOR_OV7660) { | ||
1638 | switch (sd->freq) { | ||
1639 | case 0: /* Banding filter disabled */ | ||
1640 | i2c_w1(gspca_dev, 0x13, 0xdf); | ||
1641 | break; | ||
1642 | case 1: /* 50 hz */ | ||
1643 | i2c_w1(gspca_dev, 0x13, 0xff); | ||
1644 | i2c_w1(gspca_dev, 0x3b, 0x0a); | ||
1645 | break; | ||
1646 | case 2: /* 60 hz */ | ||
1647 | i2c_w1(gspca_dev, 0x13, 0xff); | ||
1648 | i2c_w1(gspca_dev, 0x3b, 0x02); | ||
1649 | break; | ||
1650 | } | ||
1651 | } else { | ||
1652 | u8 reg2a = 0, reg2b = 0, reg2d = 0; | ||
1653 | |||
1654 | /* Get reg2a / reg2d base values */ | ||
1655 | switch (sd->sensor) { | ||
1656 | case SENSOR_OV7630: | ||
1657 | reg2a = 0x08; | ||
1658 | reg2d = 0x01; | ||
1659 | break; | ||
1660 | case SENSOR_OV7648: | ||
1661 | reg2a = 0x11; | ||
1662 | reg2d = 0x81; | ||
1663 | break; | ||
1664 | } | ||
1665 | |||
1666 | switch (sd->freq) { | ||
1667 | case 0: /* Banding filter disabled */ | ||
1668 | break; | ||
1669 | case 1: /* 50 hz (filter on and framerate adj) */ | ||
1670 | reg2a |= 0x80; | ||
1671 | reg2b = 0xac; | ||
1672 | reg2d |= 0x04; | ||
1673 | break; | ||
1674 | case 2: /* 60 hz (filter on, no framerate adj) */ | ||
1675 | reg2a |= 0x80; | ||
1676 | reg2d |= 0x04; | ||
1677 | break; | ||
1678 | } | ||
1679 | i2c_w1(gspca_dev, 0x2a, reg2a); | ||
1680 | i2c_w1(gspca_dev, 0x2b, reg2b); | ||
1681 | i2c_w1(gspca_dev, 0x2d, reg2d); | ||
1682 | } | ||
1683 | } | ||
1684 | |||
1605 | static void setjpegqual(struct gspca_dev *gspca_dev) | 1685 | static void setjpegqual(struct gspca_dev *gspca_dev) |
1606 | { | 1686 | { |
1607 | struct sd *sd = (struct sd *) gspca_dev; | 1687 | struct sd *sd = (struct sd *) gspca_dev; |
@@ -1828,6 +1908,7 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
1828 | setbrightness(gspca_dev); | 1908 | setbrightness(gspca_dev); |
1829 | setcontrast(gspca_dev); | 1909 | setcontrast(gspca_dev); |
1830 | setautogain(gspca_dev); | 1910 | setautogain(gspca_dev); |
1911 | setfreq(gspca_dev); | ||
1831 | return 0; | 1912 | return 0; |
1832 | } | 1913 | } |
1833 | 1914 | ||
@@ -2131,6 +2212,24 @@ static int sd_getinfrared(struct gspca_dev *gspca_dev, __s32 *val) | |||
2131 | return 0; | 2212 | return 0; |
2132 | } | 2213 | } |
2133 | 2214 | ||
2215 | static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val) | ||
2216 | { | ||
2217 | struct sd *sd = (struct sd *) gspca_dev; | ||
2218 | |||
2219 | sd->freq = val; | ||
2220 | if (gspca_dev->streaming) | ||
2221 | setfreq(gspca_dev); | ||
2222 | return 0; | ||
2223 | } | ||
2224 | |||
2225 | static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val) | ||
2226 | { | ||
2227 | struct sd *sd = (struct sd *) gspca_dev; | ||
2228 | |||
2229 | *val = sd->freq; | ||
2230 | return 0; | ||
2231 | } | ||
2232 | |||
2134 | static int sd_set_jcomp(struct gspca_dev *gspca_dev, | 2233 | static int sd_set_jcomp(struct gspca_dev *gspca_dev, |
2135 | struct v4l2_jpegcompression *jcomp) | 2234 | struct v4l2_jpegcompression *jcomp) |
2136 | { | 2235 | { |
@@ -2159,6 +2258,27 @@ static int sd_get_jcomp(struct gspca_dev *gspca_dev, | |||
2159 | return 0; | 2258 | return 0; |
2160 | } | 2259 | } |
2161 | 2260 | ||
2261 | static int sd_querymenu(struct gspca_dev *gspca_dev, | ||
2262 | struct v4l2_querymenu *menu) | ||
2263 | { | ||
2264 | switch (menu->id) { | ||
2265 | case V4L2_CID_POWER_LINE_FREQUENCY: | ||
2266 | switch (menu->index) { | ||
2267 | case 0: /* V4L2_CID_POWER_LINE_FREQUENCY_DISABLED */ | ||
2268 | strcpy((char *) menu->name, "NoFliker"); | ||
2269 | return 0; | ||
2270 | case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */ | ||
2271 | strcpy((char *) menu->name, "50 Hz"); | ||
2272 | return 0; | ||
2273 | case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */ | ||
2274 | strcpy((char *) menu->name, "60 Hz"); | ||
2275 | return 0; | ||
2276 | } | ||
2277 | break; | ||
2278 | } | ||
2279 | return -EINVAL; | ||
2280 | } | ||
2281 | |||
2162 | /* sub-driver description */ | 2282 | /* sub-driver description */ |
2163 | static const struct sd_desc sd_desc = { | 2283 | static const struct sd_desc sd_desc = { |
2164 | .name = MODULE_NAME, | 2284 | .name = MODULE_NAME, |
@@ -2173,6 +2293,7 @@ static const struct sd_desc sd_desc = { | |||
2173 | .dq_callback = do_autogain, | 2293 | .dq_callback = do_autogain, |
2174 | .get_jcomp = sd_get_jcomp, | 2294 | .get_jcomp = sd_get_jcomp, |
2175 | .set_jcomp = sd_set_jcomp, | 2295 | .set_jcomp = sd_set_jcomp, |
2296 | .querymenu = sd_querymenu, | ||
2176 | }; | 2297 | }; |
2177 | 2298 | ||
2178 | /* -- module initialisation -- */ | 2299 | /* -- module initialisation -- */ |
@@ -2233,7 +2354,7 @@ static const __devinitdata struct usb_device_id device_table[] = { | |||
2233 | {USB_DEVICE(0x0c45, 0x613b), BSI(SN9C120, OV7660, 0x21)}, | 2354 | {USB_DEVICE(0x0c45, 0x613b), BSI(SN9C120, OV7660, 0x21)}, |
2234 | #endif | 2355 | #endif |
2235 | {USB_DEVICE(0x0c45, 0x613c), BSI(SN9C120, HV7131R, 0x11)}, | 2356 | {USB_DEVICE(0x0c45, 0x613c), BSI(SN9C120, HV7131R, 0x11)}, |
2236 | /* {USB_DEVICE(0x0c45, 0x613e), BSI(SN9C120, OV7630, 0x??)}, */ | 2357 | {USB_DEVICE(0x0c45, 0x613e), BSI(SN9C120, OV7630, 0x21)}, |
2237 | {USB_DEVICE(0x0c45, 0x6143), BSI(SN9C120, SP80708, 0x18)}, | 2358 | {USB_DEVICE(0x0c45, 0x6143), BSI(SN9C120, SP80708, 0x18)}, |
2238 | {} | 2359 | {} |
2239 | }; | 2360 | }; |