aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/sunplus.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/gspca/sunplus.c')
-rw-r--r--drivers/media/video/gspca/sunplus.c35
1 files changed, 34 insertions, 1 deletions
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
1325static 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
1341static 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 */
1323static const struct sd_desc sd_desc = { 1354static 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 -- */