diff options
Diffstat (limited to 'drivers/media/video/gspca')
-rw-r--r-- | drivers/media/video/gspca/conex.c | 35 | ||||
-rw-r--r-- | drivers/media/video/gspca/mars.c | 35 | ||||
-rw-r--r-- | drivers/media/video/gspca/sonixj.c | 35 | ||||
-rw-r--r-- | drivers/media/video/gspca/spca500.c | 35 | ||||
-rw-r--r-- | drivers/media/video/gspca/stk014.c | 35 | ||||
-rw-r--r-- | drivers/media/video/gspca/sunplus.c | 35 | ||||
-rw-r--r-- | drivers/media/video/gspca/zc3xx.c | 35 |
7 files changed, 238 insertions, 7 deletions
diff --git a/drivers/media/video/gspca/conex.c b/drivers/media/video/gspca/conex.c index fd4df402bc2f..219cfa6fb877 100644 --- a/drivers/media/video/gspca/conex.c +++ b/drivers/media/video/gspca/conex.c | |||
@@ -37,6 +37,9 @@ struct sd { | |||
37 | unsigned char contrast; | 37 | unsigned char contrast; |
38 | unsigned char colors; | 38 | unsigned char colors; |
39 | u8 quality; | 39 | u8 quality; |
40 | #define QUALITY_MIN 30 | ||
41 | #define QUALITY_MAX 60 | ||
42 | #define QUALITY_DEF 40 | ||
40 | 43 | ||
41 | u8 *jpeg_hdr; | 44 | u8 *jpeg_hdr; |
42 | }; | 45 | }; |
@@ -822,7 +825,7 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
822 | sd->brightness = BRIGHTNESS_DEF; | 825 | sd->brightness = BRIGHTNESS_DEF; |
823 | sd->contrast = CONTRAST_DEF; | 826 | sd->contrast = CONTRAST_DEF; |
824 | sd->colors = COLOR_DEF; | 827 | sd->colors = COLOR_DEF; |
825 | sd->quality = 40; | 828 | sd->quality = QUALITY_DEF; |
826 | return 0; | 829 | return 0; |
827 | } | 830 | } |
828 | 831 | ||
@@ -1000,6 +1003,34 @@ static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val) | |||
1000 | return 0; | 1003 | return 0; |
1001 | } | 1004 | } |
1002 | 1005 | ||
1006 | static int sd_set_jcomp(struct gspca_dev *gspca_dev, | ||
1007 | struct v4l2_jpegcompression *jcomp) | ||
1008 | { | ||
1009 | struct sd *sd = (struct sd *) gspca_dev; | ||
1010 | |||
1011 | if (jcomp->quality < QUALITY_MIN) | ||
1012 | sd->quality = QUALITY_MIN; | ||
1013 | else if (jcomp->quality > QUALITY_MAX) | ||
1014 | sd->quality = QUALITY_MAX; | ||
1015 | else | ||
1016 | sd->quality = jcomp->quality; | ||
1017 | if (gspca_dev->streaming) | ||
1018 | jpeg_set_qual(sd->jpeg_hdr, sd->quality); | ||
1019 | return 0; | ||
1020 | } | ||
1021 | |||
1022 | static int sd_get_jcomp(struct gspca_dev *gspca_dev, | ||
1023 | struct v4l2_jpegcompression *jcomp) | ||
1024 | { | ||
1025 | struct sd *sd = (struct sd *) gspca_dev; | ||
1026 | |||
1027 | memset(jcomp, 0, sizeof *jcomp); | ||
1028 | jcomp->quality = sd->quality; | ||
1029 | jcomp->jpeg_markers = V4L2_JPEG_MARKER_DHT | ||
1030 | | V4L2_JPEG_MARKER_DQT; | ||
1031 | return 0; | ||
1032 | } | ||
1033 | |||
1003 | /* sub-driver description */ | 1034 | /* sub-driver description */ |
1004 | static struct sd_desc sd_desc = { | 1035 | static struct sd_desc sd_desc = { |
1005 | .name = MODULE_NAME, | 1036 | .name = MODULE_NAME, |
@@ -1010,6 +1041,8 @@ static struct sd_desc sd_desc = { | |||
1010 | .start = sd_start, | 1041 | .start = sd_start, |
1011 | .stop0 = sd_stop0, | 1042 | .stop0 = sd_stop0, |
1012 | .pkt_scan = sd_pkt_scan, | 1043 | .pkt_scan = sd_pkt_scan, |
1044 | .get_jcomp = sd_get_jcomp, | ||
1045 | .set_jcomp = sd_set_jcomp, | ||
1013 | }; | 1046 | }; |
1014 | 1047 | ||
1015 | /* -- module initialisation -- */ | 1048 | /* -- module initialisation -- */ |
diff --git a/drivers/media/video/gspca/mars.c b/drivers/media/video/gspca/mars.c index 6eb813e7b714..75e8d14e4ac7 100644 --- a/drivers/media/video/gspca/mars.c +++ b/drivers/media/video/gspca/mars.c | |||
@@ -37,6 +37,9 @@ struct sd { | |||
37 | u8 gamma; | 37 | u8 gamma; |
38 | u8 sharpness; | 38 | u8 sharpness; |
39 | u8 quality; | 39 | u8 quality; |
40 | #define QUALITY_MIN 40 | ||
41 | #define QUALITY_MAX 70 | ||
42 | #define QUALITY_DEF 50 | ||
40 | 43 | ||
41 | u8 *jpeg_hdr; | 44 | u8 *jpeg_hdr; |
42 | }; | 45 | }; |
@@ -178,7 +181,7 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
178 | sd->colors = COLOR_DEF; | 181 | sd->colors = COLOR_DEF; |
179 | sd->gamma = GAMMA_DEF; | 182 | sd->gamma = GAMMA_DEF; |
180 | sd->sharpness = SHARPNESS_DEF; | 183 | sd->sharpness = SHARPNESS_DEF; |
181 | sd->quality = 50; | 184 | sd->quality = QUALITY_DEF; |
182 | gspca_dev->nbalt = 9; /* use the altsetting 08 */ | 185 | gspca_dev->nbalt = 9; /* use the altsetting 08 */ |
183 | return 0; | 186 | return 0; |
184 | } | 187 | } |
@@ -445,6 +448,34 @@ static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val) | |||
445 | return 0; | 448 | return 0; |
446 | } | 449 | } |
447 | 450 | ||
451 | static int sd_set_jcomp(struct gspca_dev *gspca_dev, | ||
452 | struct v4l2_jpegcompression *jcomp) | ||
453 | { | ||
454 | struct sd *sd = (struct sd *) gspca_dev; | ||
455 | |||
456 | if (jcomp->quality < QUALITY_MIN) | ||
457 | sd->quality = QUALITY_MIN; | ||
458 | else if (jcomp->quality > QUALITY_MAX) | ||
459 | sd->quality = QUALITY_MAX; | ||
460 | else | ||
461 | sd->quality = jcomp->quality; | ||
462 | if (gspca_dev->streaming) | ||
463 | jpeg_set_qual(sd->jpeg_hdr, sd->quality); | ||
464 | return 0; | ||
465 | } | ||
466 | |||
467 | static int sd_get_jcomp(struct gspca_dev *gspca_dev, | ||
468 | struct v4l2_jpegcompression *jcomp) | ||
469 | { | ||
470 | struct sd *sd = (struct sd *) gspca_dev; | ||
471 | |||
472 | memset(jcomp, 0, sizeof *jcomp); | ||
473 | jcomp->quality = sd->quality; | ||
474 | jcomp->jpeg_markers = V4L2_JPEG_MARKER_DHT | ||
475 | | V4L2_JPEG_MARKER_DQT; | ||
476 | return 0; | ||
477 | } | ||
478 | |||
448 | /* sub-driver description */ | 479 | /* sub-driver description */ |
449 | static const struct sd_desc sd_desc = { | 480 | static const struct sd_desc sd_desc = { |
450 | .name = MODULE_NAME, | 481 | .name = MODULE_NAME, |
@@ -456,6 +487,8 @@ static const struct sd_desc sd_desc = { | |||
456 | .stopN = sd_stopN, | 487 | .stopN = sd_stopN, |
457 | .stop0 = sd_stop0, | 488 | .stop0 = sd_stop0, |
458 | .pkt_scan = sd_pkt_scan, | 489 | .pkt_scan = sd_pkt_scan, |
490 | .get_jcomp = sd_get_jcomp, | ||
491 | .set_jcomp = sd_set_jcomp, | ||
459 | }; | 492 | }; |
460 | 493 | ||
461 | /* -- module initialisation -- */ | 494 | /* -- module initialisation -- */ |
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index 363c0fa39d9e..7d0d949b72ba 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c | |||
@@ -47,6 +47,9 @@ struct sd { | |||
47 | u8 vflip; /* ov7630/ov7648 only */ | 47 | u8 vflip; /* ov7630/ov7648 only */ |
48 | u8 infrared; /* mt9v111 only */ | 48 | u8 infrared; /* mt9v111 only */ |
49 | u8 quality; /* image quality */ | 49 | u8 quality; /* image quality */ |
50 | #define QUALITY_MIN 60 | ||
51 | #define QUALITY_MAX 95 | ||
52 | #define QUALITY_DEF 80 | ||
50 | u8 jpegqual; /* webcam quality */ | 53 | u8 jpegqual; /* webcam quality */ |
51 | 54 | ||
52 | u8 reg18; | 55 | u8 reg18; |
@@ -1295,7 +1298,7 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
1295 | else | 1298 | else |
1296 | sd->vflip = 1; | 1299 | sd->vflip = 1; |
1297 | sd->infrared = INFRARED_DEF; | 1300 | sd->infrared = INFRARED_DEF; |
1298 | sd->quality = 80; | 1301 | sd->quality = QUALITY_DEF; |
1299 | sd->jpegqual = 80; | 1302 | sd->jpegqual = 80; |
1300 | 1303 | ||
1301 | gspca_dev->ctrl_dis = ctrl_dis[sd->sensor]; | 1304 | gspca_dev->ctrl_dis = ctrl_dis[sd->sensor]; |
@@ -2130,6 +2133,34 @@ static int sd_getinfrared(struct gspca_dev *gspca_dev, __s32 *val) | |||
2130 | return 0; | 2133 | return 0; |
2131 | } | 2134 | } |
2132 | 2135 | ||
2136 | static int sd_set_jcomp(struct gspca_dev *gspca_dev, | ||
2137 | struct v4l2_jpegcompression *jcomp) | ||
2138 | { | ||
2139 | struct sd *sd = (struct sd *) gspca_dev; | ||
2140 | |||
2141 | if (jcomp->quality < QUALITY_MIN) | ||
2142 | sd->quality = QUALITY_MIN; | ||
2143 | else if (jcomp->quality > QUALITY_MAX) | ||
2144 | sd->quality = QUALITY_MAX; | ||
2145 | else | ||
2146 | sd->quality = jcomp->quality; | ||
2147 | if (gspca_dev->streaming) | ||
2148 | jpeg_set_qual(sd->jpeg_hdr, sd->quality); | ||
2149 | return 0; | ||
2150 | } | ||
2151 | |||
2152 | static int sd_get_jcomp(struct gspca_dev *gspca_dev, | ||
2153 | struct v4l2_jpegcompression *jcomp) | ||
2154 | { | ||
2155 | struct sd *sd = (struct sd *) gspca_dev; | ||
2156 | |||
2157 | memset(jcomp, 0, sizeof *jcomp); | ||
2158 | jcomp->quality = sd->quality; | ||
2159 | jcomp->jpeg_markers = V4L2_JPEG_MARKER_DHT | ||
2160 | | V4L2_JPEG_MARKER_DQT; | ||
2161 | return 0; | ||
2162 | } | ||
2163 | |||
2133 | /* sub-driver description */ | 2164 | /* sub-driver description */ |
2134 | static const struct sd_desc sd_desc = { | 2165 | static const struct sd_desc sd_desc = { |
2135 | .name = MODULE_NAME, | 2166 | .name = MODULE_NAME, |
@@ -2142,6 +2173,8 @@ static const struct sd_desc sd_desc = { | |||
2142 | .stop0 = sd_stop0, | 2173 | .stop0 = sd_stop0, |
2143 | .pkt_scan = sd_pkt_scan, | 2174 | .pkt_scan = sd_pkt_scan, |
2144 | .dq_callback = do_autogain, | 2175 | .dq_callback = do_autogain, |
2176 | .get_jcomp = sd_get_jcomp, | ||
2177 | .set_jcomp = sd_set_jcomp, | ||
2145 | }; | 2178 | }; |
2146 | 2179 | ||
2147 | /* -- module initialisation -- */ | 2180 | /* -- module initialisation -- */ |
diff --git a/drivers/media/video/gspca/spca500.c b/drivers/media/video/gspca/spca500.c index 2176ac6850e3..6f38fa6d86b6 100644 --- a/drivers/media/video/gspca/spca500.c +++ b/drivers/media/video/gspca/spca500.c | |||
@@ -39,6 +39,9 @@ struct sd { | |||
39 | unsigned char contrast; | 39 | unsigned char contrast; |
40 | unsigned char colors; | 40 | unsigned char colors; |
41 | u8 quality; | 41 | u8 quality; |
42 | #define QUALITY_MIN 70 | ||
43 | #define QUALITY_MAX 95 | ||
44 | #define QUALITY_DEF 85 | ||
42 | 45 | ||
43 | char subtype; | 46 | char subtype; |
44 | #define AgfaCl20 0 | 47 | #define AgfaCl20 0 |
@@ -642,7 +645,7 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
642 | sd->brightness = BRIGHTNESS_DEF; | 645 | sd->brightness = BRIGHTNESS_DEF; |
643 | sd->contrast = CONTRAST_DEF; | 646 | sd->contrast = CONTRAST_DEF; |
644 | sd->colors = COLOR_DEF; | 647 | sd->colors = COLOR_DEF; |
645 | sd->quality = 85; | 648 | sd->quality = QUALITY_DEF; |
646 | return 0; | 649 | return 0; |
647 | } | 650 | } |
648 | 651 | ||
@@ -1021,6 +1024,34 @@ static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val) | |||
1021 | return 0; | 1024 | return 0; |
1022 | } | 1025 | } |
1023 | 1026 | ||
1027 | static int sd_set_jcomp(struct gspca_dev *gspca_dev, | ||
1028 | struct v4l2_jpegcompression *jcomp) | ||
1029 | { | ||
1030 | struct sd *sd = (struct sd *) gspca_dev; | ||
1031 | |||
1032 | if (jcomp->quality < QUALITY_MIN) | ||
1033 | sd->quality = QUALITY_MIN; | ||
1034 | else if (jcomp->quality > QUALITY_MAX) | ||
1035 | sd->quality = QUALITY_MAX; | ||
1036 | else | ||
1037 | sd->quality = jcomp->quality; | ||
1038 | if (gspca_dev->streaming) | ||
1039 | jpeg_set_qual(sd->jpeg_hdr, sd->quality); | ||
1040 | return 0; | ||
1041 | } | ||
1042 | |||
1043 | static int sd_get_jcomp(struct gspca_dev *gspca_dev, | ||
1044 | struct v4l2_jpegcompression *jcomp) | ||
1045 | { | ||
1046 | struct sd *sd = (struct sd *) gspca_dev; | ||
1047 | |||
1048 | memset(jcomp, 0, sizeof *jcomp); | ||
1049 | jcomp->quality = sd->quality; | ||
1050 | jcomp->jpeg_markers = V4L2_JPEG_MARKER_DHT | ||
1051 | | V4L2_JPEG_MARKER_DQT; | ||
1052 | return 0; | ||
1053 | } | ||
1054 | |||
1024 | /* sub-driver description */ | 1055 | /* sub-driver description */ |
1025 | static struct sd_desc sd_desc = { | 1056 | static struct sd_desc sd_desc = { |
1026 | .name = MODULE_NAME, | 1057 | .name = MODULE_NAME, |
@@ -1032,6 +1063,8 @@ static struct sd_desc sd_desc = { | |||
1032 | .stopN = sd_stopN, | 1063 | .stopN = sd_stopN, |
1033 | .stop0 = sd_stop0, | 1064 | .stop0 = sd_stop0, |
1034 | .pkt_scan = sd_pkt_scan, | 1065 | .pkt_scan = sd_pkt_scan, |
1066 | .get_jcomp = sd_get_jcomp, | ||
1067 | .set_jcomp = sd_set_jcomp, | ||
1035 | }; | 1068 | }; |
1036 | 1069 | ||
1037 | /* -- module initialisation -- */ | 1070 | /* -- module initialisation -- */ |
diff --git a/drivers/media/video/gspca/stk014.c b/drivers/media/video/gspca/stk014.c index dd007cb52006..f25be20cf1a6 100644 --- a/drivers/media/video/gspca/stk014.c +++ b/drivers/media/video/gspca/stk014.c | |||
@@ -36,6 +36,9 @@ struct sd { | |||
36 | unsigned char colors; | 36 | unsigned char colors; |
37 | unsigned char lightfreq; | 37 | unsigned char lightfreq; |
38 | u8 quality; | 38 | u8 quality; |
39 | #define QUALITY_MIN 60 | ||
40 | #define QUALITY_MAX 95 | ||
41 | #define QUALITY_DEF 80 | ||
39 | 42 | ||
40 | u8 *jpeg_hdr; | 43 | u8 *jpeg_hdr; |
41 | }; | 44 | }; |
@@ -301,7 +304,7 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
301 | sd->contrast = CONTRAST_DEF; | 304 | sd->contrast = CONTRAST_DEF; |
302 | sd->colors = COLOR_DEF; | 305 | sd->colors = COLOR_DEF; |
303 | sd->lightfreq = FREQ_DEF; | 306 | sd->lightfreq = FREQ_DEF; |
304 | sd->quality = 80; | 307 | sd->quality = QUALITY_DEF; |
305 | return 0; | 308 | return 0; |
306 | } | 309 | } |
307 | 310 | ||
@@ -535,6 +538,34 @@ static int sd_querymenu(struct gspca_dev *gspca_dev, | |||
535 | return -EINVAL; | 538 | return -EINVAL; |
536 | } | 539 | } |
537 | 540 | ||
541 | static int sd_set_jcomp(struct gspca_dev *gspca_dev, | ||
542 | struct v4l2_jpegcompression *jcomp) | ||
543 | { | ||
544 | struct sd *sd = (struct sd *) gspca_dev; | ||
545 | |||
546 | if (jcomp->quality < QUALITY_MIN) | ||
547 | sd->quality = QUALITY_MIN; | ||
548 | else if (jcomp->quality > QUALITY_MAX) | ||
549 | sd->quality = QUALITY_MAX; | ||
550 | else | ||
551 | sd->quality = jcomp->quality; | ||
552 | if (gspca_dev->streaming) | ||
553 | jpeg_set_qual(sd->jpeg_hdr, sd->quality); | ||
554 | return 0; | ||
555 | } | ||
556 | |||
557 | static int sd_get_jcomp(struct gspca_dev *gspca_dev, | ||
558 | struct v4l2_jpegcompression *jcomp) | ||
559 | { | ||
560 | struct sd *sd = (struct sd *) gspca_dev; | ||
561 | |||
562 | memset(jcomp, 0, sizeof *jcomp); | ||
563 | jcomp->quality = sd->quality; | ||
564 | jcomp->jpeg_markers = V4L2_JPEG_MARKER_DHT | ||
565 | | V4L2_JPEG_MARKER_DQT; | ||
566 | return 0; | ||
567 | } | ||
568 | |||
538 | /* sub-driver description */ | 569 | /* sub-driver description */ |
539 | static const struct sd_desc sd_desc = { | 570 | static const struct sd_desc sd_desc = { |
540 | .name = MODULE_NAME, | 571 | .name = MODULE_NAME, |
@@ -547,6 +578,8 @@ static const struct sd_desc sd_desc = { | |||
547 | .stop0 = sd_stop0, | 578 | .stop0 = sd_stop0, |
548 | .pkt_scan = sd_pkt_scan, | 579 | .pkt_scan = sd_pkt_scan, |
549 | .querymenu = sd_querymenu, | 580 | .querymenu = sd_querymenu, |
581 | .get_jcomp = sd_get_jcomp, | ||
582 | .set_jcomp = sd_set_jcomp, | ||
550 | }; | 583 | }; |
551 | 584 | ||
552 | /* -- module initialisation -- */ | 585 | /* -- module initialisation -- */ |
diff --git a/drivers/media/video/gspca/sunplus.c b/drivers/media/video/gspca/sunplus.c index eadfaa9f97d2..c2b8c10c075a 100644 --- a/drivers/media/video/gspca/sunplus.c +++ b/drivers/media/video/gspca/sunplus.c | |||
@@ -40,6 +40,9 @@ struct sd { | |||
40 | unsigned char colors; | 40 | unsigned char colors; |
41 | unsigned char autogain; | 41 | unsigned char autogain; |
42 | u8 quality; | 42 | u8 quality; |
43 | #define QUALITY_MIN 70 | ||
44 | #define QUALITY_MAX 95 | ||
45 | #define QUALITY_DEF 85 | ||
43 | 46 | ||
44 | char bridge; | 47 | char bridge; |
45 | #define BRIDGE_SPCA504 0 | 48 | #define BRIDGE_SPCA504 0 |
@@ -854,7 +857,7 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
854 | sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; | 857 | sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; |
855 | sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; | 858 | sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; |
856 | sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value; | 859 | sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value; |
857 | sd->quality = 85; | 860 | sd->quality = QUALITY_DEF; |
858 | return 0; | 861 | return 0; |
859 | } | 862 | } |
860 | 863 | ||
@@ -1319,6 +1322,34 @@ static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val) | |||
1319 | return 0; | 1322 | return 0; |
1320 | } | 1323 | } |
1321 | 1324 | ||
1325 | static int sd_set_jcomp(struct gspca_dev *gspca_dev, | ||
1326 | struct v4l2_jpegcompression *jcomp) | ||
1327 | { | ||
1328 | struct sd *sd = (struct sd *) gspca_dev; | ||
1329 | |||
1330 | if (jcomp->quality < QUALITY_MIN) | ||
1331 | sd->quality = QUALITY_MIN; | ||
1332 | else if (jcomp->quality > QUALITY_MAX) | ||
1333 | sd->quality = QUALITY_MAX; | ||
1334 | else | ||
1335 | sd->quality = jcomp->quality; | ||
1336 | if (gspca_dev->streaming) | ||
1337 | jpeg_set_qual(sd->jpeg_hdr, sd->quality); | ||
1338 | return 0; | ||
1339 | } | ||
1340 | |||
1341 | static int sd_get_jcomp(struct gspca_dev *gspca_dev, | ||
1342 | struct v4l2_jpegcompression *jcomp) | ||
1343 | { | ||
1344 | struct sd *sd = (struct sd *) gspca_dev; | ||
1345 | |||
1346 | memset(jcomp, 0, sizeof *jcomp); | ||
1347 | jcomp->quality = sd->quality; | ||
1348 | jcomp->jpeg_markers = V4L2_JPEG_MARKER_DHT | ||
1349 | | V4L2_JPEG_MARKER_DQT; | ||
1350 | return 0; | ||
1351 | } | ||
1352 | |||
1322 | /* sub-driver description */ | 1353 | /* sub-driver description */ |
1323 | static const struct sd_desc sd_desc = { | 1354 | static const struct sd_desc sd_desc = { |
1324 | .name = MODULE_NAME, | 1355 | .name = MODULE_NAME, |
@@ -1330,6 +1361,8 @@ static const struct sd_desc sd_desc = { | |||
1330 | .stopN = sd_stopN, | 1361 | .stopN = sd_stopN, |
1331 | .stop0 = sd_stop0, | 1362 | .stop0 = sd_stop0, |
1332 | .pkt_scan = sd_pkt_scan, | 1363 | .pkt_scan = sd_pkt_scan, |
1364 | .get_jcomp = sd_get_jcomp, | ||
1365 | .set_jcomp = sd_set_jcomp, | ||
1333 | }; | 1366 | }; |
1334 | 1367 | ||
1335 | /* -- module initialisation -- */ | 1368 | /* -- module initialisation -- */ |
diff --git a/drivers/media/video/gspca/zc3xx.c b/drivers/media/video/gspca/zc3xx.c index a4c673ff8f02..e4c27a1e1e29 100644 --- a/drivers/media/video/gspca/zc3xx.c +++ b/drivers/media/video/gspca/zc3xx.c | |||
@@ -46,6 +46,9 @@ struct sd { | |||
46 | __u8 lightfreq; | 46 | __u8 lightfreq; |
47 | __u8 sharpness; | 47 | __u8 sharpness; |
48 | u8 quality; /* image quality */ | 48 | u8 quality; /* image quality */ |
49 | #define QUALITY_MIN 40 | ||
50 | #define QUALITY_MAX 60 | ||
51 | #define QUALITY_DEF 50 | ||
49 | 52 | ||
50 | signed char sensor; /* Type of image sensor chip */ | 53 | signed char sensor; /* Type of image sensor chip */ |
51 | /* !! values used in different tables */ | 54 | /* !! values used in different tables */ |
@@ -7180,7 +7183,7 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
7180 | sd->gamma = gamma[(int) sd->sensor]; | 7183 | sd->gamma = gamma[(int) sd->sensor]; |
7181 | sd->autogain = sd_ctrls[SD_AUTOGAIN].qctrl.default_value; | 7184 | sd->autogain = sd_ctrls[SD_AUTOGAIN].qctrl.default_value; |
7182 | sd->lightfreq = sd_ctrls[SD_FREQ].qctrl.default_value; | 7185 | sd->lightfreq = sd_ctrls[SD_FREQ].qctrl.default_value; |
7183 | sd->quality = 50; | 7186 | sd->quality = QUALITY_DEF; |
7184 | 7187 | ||
7185 | switch (sd->sensor) { | 7188 | switch (sd->sensor) { |
7186 | case SENSOR_GC0305: | 7189 | case SENSOR_GC0305: |
@@ -7536,6 +7539,34 @@ static int sd_querymenu(struct gspca_dev *gspca_dev, | |||
7536 | return -EINVAL; | 7539 | return -EINVAL; |
7537 | } | 7540 | } |
7538 | 7541 | ||
7542 | static int sd_set_jcomp(struct gspca_dev *gspca_dev, | ||
7543 | struct v4l2_jpegcompression *jcomp) | ||
7544 | { | ||
7545 | struct sd *sd = (struct sd *) gspca_dev; | ||
7546 | |||
7547 | if (jcomp->quality < QUALITY_MIN) | ||
7548 | sd->quality = QUALITY_MIN; | ||
7549 | else if (jcomp->quality > QUALITY_MAX) | ||
7550 | sd->quality = QUALITY_MAX; | ||
7551 | else | ||
7552 | sd->quality = jcomp->quality; | ||
7553 | if (gspca_dev->streaming) | ||
7554 | jpeg_set_qual(sd->jpeg_hdr, sd->quality); | ||
7555 | return 0; | ||
7556 | } | ||
7557 | |||
7558 | static int sd_get_jcomp(struct gspca_dev *gspca_dev, | ||
7559 | struct v4l2_jpegcompression *jcomp) | ||
7560 | { | ||
7561 | struct sd *sd = (struct sd *) gspca_dev; | ||
7562 | |||
7563 | memset(jcomp, 0, sizeof *jcomp); | ||
7564 | jcomp->quality = sd->quality; | ||
7565 | jcomp->jpeg_markers = V4L2_JPEG_MARKER_DHT | ||
7566 | | V4L2_JPEG_MARKER_DQT; | ||
7567 | return 0; | ||
7568 | } | ||
7569 | |||
7539 | static const struct sd_desc sd_desc = { | 7570 | static const struct sd_desc sd_desc = { |
7540 | .name = MODULE_NAME, | 7571 | .name = MODULE_NAME, |
7541 | .ctrls = sd_ctrls, | 7572 | .ctrls = sd_ctrls, |
@@ -7546,6 +7577,8 @@ static const struct sd_desc sd_desc = { | |||
7546 | .stop0 = sd_stop0, | 7577 | .stop0 = sd_stop0, |
7547 | .pkt_scan = sd_pkt_scan, | 7578 | .pkt_scan = sd_pkt_scan, |
7548 | .querymenu = sd_querymenu, | 7579 | .querymenu = sd_querymenu, |
7580 | .get_jcomp = sd_get_jcomp, | ||
7581 | .set_jcomp = sd_set_jcomp, | ||
7549 | }; | 7582 | }; |
7550 | 7583 | ||
7551 | static const __devinitdata struct usb_device_id device_table[] = { | 7584 | static const __devinitdata struct usb_device_id device_table[] = { |