Commit b56ab4ca authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab

[media] gspca: Remove bogus JPEG quality controls from various sub-drivers

Various gspca-subdrivers have a JPEG quality control which only changes
the quantization tables in the JPEG headers send to user-space without
making any changes to the settings of the bridge. Remove these bogus / wrong
controls.
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 82b343b2
...@@ -31,9 +31,7 @@ MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); ...@@ -31,9 +31,7 @@ MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA USB Conexant Camera Driver"); MODULE_DESCRIPTION("GSPCA USB Conexant Camera Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#define QUALITY_MIN 30 #define QUALITY 50
#define QUALITY_MAX 60
#define QUALITY_DEF 40
/* specific webcam descriptor */ /* specific webcam descriptor */
struct sd { struct sd {
...@@ -41,7 +39,6 @@ struct sd { ...@@ -41,7 +39,6 @@ struct sd {
struct v4l2_ctrl *brightness; struct v4l2_ctrl *brightness;
struct v4l2_ctrl *contrast; struct v4l2_ctrl *contrast;
struct v4l2_ctrl *sat; struct v4l2_ctrl *sat;
struct v4l2_ctrl *jpegqual;
u8 jpeg_hdr[JPEG_HDR_SZ]; u8 jpeg_hdr[JPEG_HDR_SZ];
}; };
...@@ -790,6 +787,7 @@ static int sd_start(struct gspca_dev *gspca_dev) ...@@ -790,6 +787,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
/* create the JPEG header */ /* create the JPEG header */
jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width, jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width,
0x22); /* JPEG 411 */ 0x22); /* JPEG 411 */
jpeg_set_qual(sd->jpeg_hdr, QUALITY);
cx11646_initsize(gspca_dev); cx11646_initsize(gspca_dev);
cx11646_fw(gspca_dev); cx11646_fw(gspca_dev);
...@@ -899,9 +897,6 @@ static int sd_s_ctrl(struct v4l2_ctrl *ctrl) ...@@ -899,9 +897,6 @@ static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
setbrightness(gspca_dev, sd->brightness->cur.val, ctrl->val); setbrightness(gspca_dev, sd->brightness->cur.val, ctrl->val);
setcontrast(gspca_dev, sd->contrast->cur.val, ctrl->val); setcontrast(gspca_dev, sd->contrast->cur.val, ctrl->val);
break; break;
case V4L2_CID_JPEG_COMPRESSION_QUALITY:
jpeg_set_qual(sd->jpeg_hdr, ctrl->val);
break;
} }
return gspca_dev->usb_err; return gspca_dev->usb_err;
} }
...@@ -916,16 +911,13 @@ static int sd_init_controls(struct gspca_dev *gspca_dev) ...@@ -916,16 +911,13 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler;
gspca_dev->vdev.ctrl_handler = hdl; gspca_dev->vdev.ctrl_handler = hdl;
v4l2_ctrl_handler_init(hdl, 4); v4l2_ctrl_handler_init(hdl, 3);
sd->brightness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd->brightness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
V4L2_CID_BRIGHTNESS, 0, 255, 1, 0xd4); V4L2_CID_BRIGHTNESS, 0, 255, 1, 0xd4);
sd->contrast = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd->contrast = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
V4L2_CID_CONTRAST, 0x0a, 0x1f, 1, 0x0c); V4L2_CID_CONTRAST, 0x0a, 0x1f, 1, 0x0c);
sd->sat = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, sd->sat = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
V4L2_CID_SATURATION, 0, 7, 1, 3); V4L2_CID_SATURATION, 0, 7, 1, 3);
sd->jpegqual = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
V4L2_CID_JPEG_COMPRESSION_QUALITY,
QUALITY_MIN, QUALITY_MAX, 1, QUALITY_DEF);
if (hdl->error) { if (hdl->error) {
pr_err("Could not initialize controls\n"); pr_err("Could not initialize controls\n");
return hdl->error; return hdl->error;
...@@ -933,27 +925,6 @@ static int sd_init_controls(struct gspca_dev *gspca_dev) ...@@ -933,27 +925,6 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
return 0; return 0;
} }
static int sd_set_jcomp(struct gspca_dev *gspca_dev,
struct v4l2_jpegcompression *jcomp)
{
struct sd *sd = (struct sd *) gspca_dev;
v4l2_ctrl_s_ctrl(sd->jpegqual, jcomp->quality);
return 0;
}
static int sd_get_jcomp(struct gspca_dev *gspca_dev,
struct v4l2_jpegcompression *jcomp)
{
struct sd *sd = (struct sd *) gspca_dev;
memset(jcomp, 0, sizeof *jcomp);
jcomp->quality = v4l2_ctrl_g_ctrl(sd->jpegqual);
jcomp->jpeg_markers = V4L2_JPEG_MARKER_DHT
| V4L2_JPEG_MARKER_DQT;
return 0;
}
/* sub-driver description */ /* sub-driver description */
static const struct sd_desc sd_desc = { static const struct sd_desc sd_desc = {
.name = MODULE_NAME, .name = MODULE_NAME,
...@@ -963,8 +934,6 @@ static const struct sd_desc sd_desc = { ...@@ -963,8 +934,6 @@ static const struct sd_desc sd_desc = {
.start = sd_start, .start = sd_start,
.stop0 = sd_stop0, .stop0 = sd_stop0,
.pkt_scan = sd_pkt_scan, .pkt_scan = sd_pkt_scan,
.get_jcomp = sd_get_jcomp,
.set_jcomp = sd_set_jcomp,
}; };
/* -- module initialisation -- */ /* -- module initialisation -- */
......
...@@ -30,6 +30,8 @@ MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); ...@@ -30,6 +30,8 @@ MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/Mars USB Camera Driver"); MODULE_DESCRIPTION("GSPCA/Mars USB Camera Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#define QUALITY 50
/* specific webcam descriptor */ /* specific webcam descriptor */
struct sd { struct sd {
struct gspca_dev gspca_dev; /* !! must be the first item */ struct gspca_dev gspca_dev; /* !! must be the first item */
...@@ -42,13 +44,6 @@ struct sd { ...@@ -42,13 +44,6 @@ struct sd {
struct v4l2_ctrl *illum_top; struct v4l2_ctrl *illum_top;
struct v4l2_ctrl *illum_bottom; struct v4l2_ctrl *illum_bottom;
}; };
struct v4l2_ctrl *jpegqual;
u8 quality;
#define QUALITY_MIN 40
#define QUALITY_MAX 70
#define QUALITY_DEF 50
u8 jpeg_hdr[JPEG_HDR_SZ]; u8 jpeg_hdr[JPEG_HDR_SZ];
}; };
...@@ -194,9 +189,6 @@ static int mars_s_ctrl(struct v4l2_ctrl *ctrl) ...@@ -194,9 +189,6 @@ static int mars_s_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_SHARPNESS: case V4L2_CID_SHARPNESS:
setsharpness(gspca_dev, ctrl->val); setsharpness(gspca_dev, ctrl->val);
break; break;
case V4L2_CID_JPEG_COMPRESSION_QUALITY:
jpeg_set_qual(sd->jpeg_hdr, ctrl->val);
break;
default: default:
return -EINVAL; return -EINVAL;
} }
...@@ -214,7 +206,7 @@ static int sd_init_controls(struct gspca_dev *gspca_dev) ...@@ -214,7 +206,7 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler;
gspca_dev->vdev.ctrl_handler = hdl; gspca_dev->vdev.ctrl_handler = hdl;
v4l2_ctrl_handler_init(hdl, 7); v4l2_ctrl_handler_init(hdl, 6);
sd->brightness = v4l2_ctrl_new_std(hdl, &mars_ctrl_ops, sd->brightness = v4l2_ctrl_new_std(hdl, &mars_ctrl_ops,
V4L2_CID_BRIGHTNESS, 0, 30, 1, 15); V4L2_CID_BRIGHTNESS, 0, 30, 1, 15);
sd->saturation = v4l2_ctrl_new_std(hdl, &mars_ctrl_ops, sd->saturation = v4l2_ctrl_new_std(hdl, &mars_ctrl_ops,
...@@ -229,9 +221,6 @@ static int sd_init_controls(struct gspca_dev *gspca_dev) ...@@ -229,9 +221,6 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
sd->illum_bottom = v4l2_ctrl_new_std(hdl, &mars_ctrl_ops, sd->illum_bottom = v4l2_ctrl_new_std(hdl, &mars_ctrl_ops,
V4L2_CID_ILLUMINATORS_2, 0, 1, 1, 0); V4L2_CID_ILLUMINATORS_2, 0, 1, 1, 0);
sd->illum_bottom->flags |= V4L2_CTRL_FLAG_UPDATE; sd->illum_bottom->flags |= V4L2_CTRL_FLAG_UPDATE;
sd->jpegqual = v4l2_ctrl_new_std(hdl, &mars_ctrl_ops,
V4L2_CID_JPEG_COMPRESSION_QUALITY,
QUALITY_MIN, QUALITY_MAX, 1, QUALITY_DEF);
if (hdl->error) { if (hdl->error) {
pr_err("Could not initialize controls\n"); pr_err("Could not initialize controls\n");
return hdl->error; return hdl->error;
...@@ -244,13 +233,11 @@ static int sd_init_controls(struct gspca_dev *gspca_dev) ...@@ -244,13 +233,11 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
static int sd_config(struct gspca_dev *gspca_dev, static int sd_config(struct gspca_dev *gspca_dev,
const struct usb_device_id *id) const struct usb_device_id *id)
{ {
struct sd *sd = (struct sd *) gspca_dev;
struct cam *cam; struct cam *cam;
cam = &gspca_dev->cam; cam = &gspca_dev->cam;
cam->cam_mode = vga_mode; cam->cam_mode = vga_mode;
cam->nmodes = ARRAY_SIZE(vga_mode); cam->nmodes = ARRAY_SIZE(vga_mode);
sd->quality = QUALITY_DEF;
return 0; return 0;
} }
...@@ -269,7 +256,7 @@ static int sd_start(struct gspca_dev *gspca_dev) ...@@ -269,7 +256,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
/* create the JPEG header */ /* create the JPEG header */
jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width, jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width,
0x21); /* JPEG 422 */ 0x21); /* JPEG 422 */
jpeg_set_qual(sd->jpeg_hdr, v4l2_ctrl_g_ctrl(sd->jpegqual)); jpeg_set_qual(sd->jpeg_hdr, QUALITY);
data = gspca_dev->usb_buf; data = gspca_dev->usb_buf;
...@@ -411,31 +398,6 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, ...@@ -411,31 +398,6 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
gspca_frame_add(gspca_dev, INTER_PACKET, data, len); gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
} }
static int sd_set_jcomp(struct gspca_dev *gspca_dev,
struct v4l2_jpegcompression *jcomp)
{
struct sd *sd = (struct sd *) gspca_dev;
int ret;
ret = v4l2_ctrl_s_ctrl(sd->jpegqual, jcomp->quality);
if (ret)
return ret;
jcomp->quality = v4l2_ctrl_g_ctrl(sd->jpegqual);
return 0;
}
static int sd_get_jcomp(struct gspca_dev *gspca_dev,
struct v4l2_jpegcompression *jcomp)
{
struct sd *sd = (struct sd *) gspca_dev;
memset(jcomp, 0, sizeof *jcomp);
jcomp->quality = v4l2_ctrl_g_ctrl(sd->jpegqual);
jcomp->jpeg_markers = V4L2_JPEG_MARKER_DHT
| V4L2_JPEG_MARKER_DQT;
return 0;
}
/* sub-driver description */ /* sub-driver description */
static const struct sd_desc sd_desc = { static const struct sd_desc sd_desc = {
.name = MODULE_NAME, .name = MODULE_NAME,
...@@ -445,8 +407,6 @@ static const struct sd_desc sd_desc = { ...@@ -445,8 +407,6 @@ static const struct sd_desc sd_desc = {
.start = sd_start, .start = sd_start,
.stopN = sd_stopN, .stopN = sd_stopN,
.pkt_scan = sd_pkt_scan, .pkt_scan = sd_pkt_scan,
.get_jcomp = sd_get_jcomp,
.set_jcomp = sd_set_jcomp,
}; };
/* -- module initialisation -- */ /* -- module initialisation -- */
......
...@@ -30,15 +30,12 @@ MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); ...@@ -30,15 +30,12 @@ MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SPCA500 USB Camera Driver"); MODULE_DESCRIPTION("GSPCA/SPCA500 USB Camera Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#define QUALITY 85
/* specific webcam descriptor */ /* specific webcam descriptor */
struct sd { struct sd {
struct gspca_dev gspca_dev; /* !! must be the first item */ struct gspca_dev gspca_dev; /* !! must be the first item */
struct v4l2_ctrl *jpegqual;
#define QUALITY_MIN 70
#define QUALITY_MAX 95
#define QUALITY_DEF 85
char subtype; char subtype;
#define AgfaCl20 0 #define AgfaCl20 0
#define AiptekPocketDV 1 #define AiptekPocketDV 1
...@@ -613,7 +610,7 @@ static int sd_start(struct gspca_dev *gspca_dev) ...@@ -613,7 +610,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
/* create the JPEG header */ /* create the JPEG header */
jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width, jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width,
0x22); /* JPEG 411 */ 0x22); /* JPEG 411 */
jpeg_set_qual(sd->jpeg_hdr, v4l2_ctrl_g_ctrl(sd->jpegqual)); jpeg_set_qual(sd->jpeg_hdr, QUALITY);
if (sd->subtype == LogitechClickSmart310) { if (sd->subtype == LogitechClickSmart310) {
xmult = 0x16; xmult = 0x16;
...@@ -890,32 +887,10 @@ static void setcolors(struct gspca_dev *gspca_dev, s32 val) ...@@ -890,32 +887,10 @@ static void setcolors(struct gspca_dev *gspca_dev, s32 val)
reg_w(gspca_dev, 0x00, 0x8169, val); reg_w(gspca_dev, 0x00, 0x8169, val);
} }
static int sd_set_jcomp(struct gspca_dev *gspca_dev,
struct v4l2_jpegcompression *jcomp)
{
struct sd *sd = (struct sd *) gspca_dev;
v4l2_ctrl_s_ctrl(sd->jpegqual, jcomp->quality);
return 0;
}
static int sd_get_jcomp(struct gspca_dev *gspca_dev,
struct v4l2_jpegcompression *jcomp)
{
struct sd *sd = (struct sd *) gspca_dev;
memset(jcomp, 0, sizeof *jcomp);
jcomp->quality = v4l2_ctrl_g_ctrl(sd->jpegqual);
jcomp->jpeg_markers = V4L2_JPEG_MARKER_DHT
| V4L2_JPEG_MARKER_DQT;
return 0;
}
static int sd_s_ctrl(struct v4l2_ctrl *ctrl) static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
{ {
struct gspca_dev *gspca_dev = struct gspca_dev *gspca_dev =
container_of(ctrl->handler, struct gspca_dev, ctrl_handler); container_of(ctrl->handler, struct gspca_dev, ctrl_handler);
struct sd *sd = (struct sd *)gspca_dev;
gspca_dev->usb_err = 0; gspca_dev->usb_err = 0;
...@@ -932,9 +907,6 @@ static int sd_s_ctrl(struct v4l2_ctrl *ctrl) ...@@ -932,9 +907,6 @@ static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_SATURATION: case V4L2_CID_SATURATION:
setcolors(gspca_dev, ctrl->val); setcolors(gspca_dev, ctrl->val);
break; break;
case V4L2_CID_JPEG_COMPRESSION_QUALITY:
jpeg_set_qual(sd->jpeg_hdr, ctrl->val);
break;
} }
return gspca_dev->usb_err; return gspca_dev->usb_err;
} }
...@@ -945,20 +917,16 @@ static const struct v4l2_ctrl_ops sd_ctrl_ops = { ...@@ -945,20 +917,16 @@ static const struct v4l2_ctrl_ops sd_ctrl_ops = {
static int sd_init_controls(struct gspca_dev *gspca_dev) static int sd_init_controls(struct gspca_dev *gspca_dev)
{ {
struct sd *sd = (struct sd *)gspca_dev;
struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler;
gspca_dev->vdev.ctrl_handler = hdl; gspca_dev->vdev.ctrl_handler = hdl;
v4l2_ctrl_handler_init(hdl, 4); v4l2_ctrl_handler_init(hdl, 3);
v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
V4L2_CID_BRIGHTNESS, 0, 255, 1, 127); V4L2_CID_BRIGHTNESS, 0, 255, 1, 127);
v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
V4L2_CID_CONTRAST, 0, 63, 1, 31); V4L2_CID_CONTRAST, 0, 63, 1, 31);
v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
V4L2_CID_SATURATION, 0, 63, 1, 31); V4L2_CID_SATURATION, 0, 63, 1, 31);
sd->jpegqual = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
V4L2_CID_JPEG_COMPRESSION_QUALITY,
QUALITY_MIN, QUALITY_MAX, 1, QUALITY_DEF);
if (hdl->error) { if (hdl->error) {
pr_err("Could not initialize controls\n"); pr_err("Could not initialize controls\n");
...@@ -976,8 +944,6 @@ static const struct sd_desc sd_desc = { ...@@ -976,8 +944,6 @@ static const struct sd_desc sd_desc = {
.start = sd_start, .start = sd_start,
.stopN = sd_stopN, .stopN = sd_stopN,
.pkt_scan = sd_pkt_scan, .pkt_scan = sd_pkt_scan,
.get_jcomp = sd_get_jcomp,
.set_jcomp = sd_set_jcomp,
}; };
/* -- module initialisation -- */ /* -- module initialisation -- */
......
...@@ -29,15 +29,11 @@ MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); ...@@ -29,15 +29,11 @@ MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
MODULE_DESCRIPTION("Syntek DV4000 (STK014) USB Camera Driver"); MODULE_DESCRIPTION("Syntek DV4000 (STK014) USB Camera Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#define QUALITY 50
/* specific webcam descriptor */ /* specific webcam descriptor */
struct sd { struct sd {
struct gspca_dev gspca_dev; /* !! must be the first item */ struct gspca_dev gspca_dev; /* !! must be the first item */
struct v4l2_ctrl *jpegqual;
#define QUALITY_MIN 70
#define QUALITY_MAX 95
#define QUALITY_DEF 88
u8 jpeg_hdr[JPEG_HDR_SZ]; u8 jpeg_hdr[JPEG_HDR_SZ];
}; };
...@@ -256,6 +252,7 @@ static int sd_start(struct gspca_dev *gspca_dev) ...@@ -256,6 +252,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
/* create the JPEG header */ /* create the JPEG header */
jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width, jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width,
0x22); /* JPEG 411 */ 0x22); /* JPEG 411 */
jpeg_set_qual(sd->jpeg_hdr, QUALITY);
/* work on alternate 1 */ /* work on alternate 1 */
usb_set_interface(gspca_dev->dev, gspca_dev->iface, 1); usb_set_interface(gspca_dev->dev, gspca_dev->iface, 1);
...@@ -353,32 +350,10 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, ...@@ -353,32 +350,10 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
gspca_frame_add(gspca_dev, INTER_PACKET, data, len); gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
} }
static int sd_set_jcomp(struct gspca_dev *gspca_dev,
struct v4l2_jpegcompression *jcomp)
{
struct sd *sd = (struct sd *) gspca_dev;
v4l2_ctrl_s_ctrl(sd->jpegqual, jcomp->quality);
return gspca_dev->usb_err;
}
static int sd_get_jcomp(struct gspca_dev *gspca_dev,
struct v4l2_jpegcompression *jcomp)
{
struct sd *sd = (struct sd *) gspca_dev;
memset(jcomp, 0, sizeof *jcomp);
jcomp->quality = v4l2_ctrl_g_ctrl(sd->jpegqual);
jcomp->jpeg_markers = V4L2_JPEG_MARKER_DHT
| V4L2_JPEG_MARKER_DQT;
return 0;
}
static int sd_s_ctrl(struct v4l2_ctrl *ctrl) static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
{ {
struct gspca_dev *gspca_dev = struct gspca_dev *gspca_dev =
container_of(ctrl->handler, struct gspca_dev, ctrl_handler); container_of(ctrl->handler, struct gspca_dev, ctrl_handler);
struct sd *sd = (struct sd *)gspca_dev;
gspca_dev->usb_err = 0; gspca_dev->usb_err = 0;
...@@ -398,9 +373,6 @@ static int sd_s_ctrl(struct v4l2_ctrl *ctrl) ...@@ -398,9 +373,6 @@ static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_POWER_LINE_FREQUENCY: case V4L2_CID_POWER_LINE_FREQUENCY:
setlightfreq(gspca_dev, ctrl->val); setlightfreq(gspca_dev, ctrl->val);
break; break;
case V4L2_CID_JPEG_COMPRESSION_QUALITY:
jpeg_set_qual(sd->jpeg_hdr, ctrl->val);
break;
} }
return gspca_dev->usb_err; return gspca_dev->usb_err;
} }
...@@ -411,11 +383,10 @@ static const struct v4l2_ctrl_ops sd_ctrl_ops = { ...@@ -411,11 +383,10 @@ static const struct v4l2_ctrl_ops sd_ctrl_ops = {
static int sd_init_controls(struct gspca_dev *gspca_dev) static int sd_init_controls(struct gspca_dev *gspca_dev)
{ {
struct sd *sd = (struct sd *)gspca_dev;
struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler;
gspca_dev->vdev.ctrl_handler = hdl; gspca_dev->vdev.ctrl_handler = hdl;
v4l2_ctrl_handler_init(hdl, 5); v4l2_ctrl_handler_init(hdl, 4);
v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
V4L2_CID_BRIGHTNESS, 0, 255, 1, 127); V4L2_CID_BRIGHTNESS, 0, 255, 1, 127);
v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
...@@ -426,9 +397,6 @@ static int sd_init_controls(struct gspca_dev *gspca_dev) ...@@ -426,9 +397,6 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
V4L2_CID_POWER_LINE_FREQUENCY, V4L2_CID_POWER_LINE_FREQUENCY,
V4L2_CID_POWER_LINE_FREQUENCY_60HZ, 1, V4L2_CID_POWER_LINE_FREQUENCY_60HZ, 1,
V4L2_CID_POWER_LINE_FREQUENCY_50HZ); V4L2_CID_POWER_LINE_FREQUENCY_50HZ);
sd->jpegqual = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
V4L2_CID_JPEG_COMPRESSION_QUALITY,
QUALITY_MIN, QUALITY_MAX, 1, QUALITY_DEF);
if (hdl->error) { if (hdl->error) {
pr_err("Could not initialize controls\n"); pr_err("Could not initialize controls\n");
...@@ -446,8 +414,6 @@ static const struct sd_desc sd_desc = { ...@@ -446,8 +414,6 @@ static const struct sd_desc sd_desc = {
.start = sd_start, .start = sd_start,
.stopN = sd_stopN, .stopN = sd_stopN,
.pkt_scan = sd_pkt_scan, .pkt_scan = sd_pkt_scan,
.get_jcomp = sd_get_jcomp,
.set_jcomp = sd_set_jcomp,
}; };
/* -- module initialisation -- */ /* -- module initialisation -- */
......
...@@ -30,15 +30,12 @@ MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); ...@@ -30,15 +30,12 @@ MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
MODULE_DESCRIPTION("GSPCA/SPCA5xx USB Camera Driver"); MODULE_DESCRIPTION("GSPCA/SPCA5xx USB Camera Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#define QUALITY 85
/* specific webcam descriptor */ /* specific webcam descriptor */
struct sd { struct sd {
struct gspca_dev gspca_dev; /* !! must be the first item */ struct gspca_dev gspca_dev; /* !! must be the first item */
struct v4l2_ctrl *jpegqual;
#define QUALITY_MIN 70
#define QUALITY_MAX 95
#define QUALITY_DEF 85
bool autogain; bool autogain;
u8 bridge; u8 bridge;
...@@ -727,7 +724,7 @@ static int sd_start(struct gspca_dev *gspca_dev) ...@@ -727,7 +724,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
/* create the JPEG header */ /* create the JPEG header */
jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width, jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width,
0x22); /* JPEG 411 */ 0x22); /* JPEG 411 */
jpeg_set_qual(sd->jpeg_hdr, v4l2_ctrl_g_ctrl(sd->jpegqual)); jpeg_set_qual(sd->jpeg_hdr, QUALITY);
if (sd->bridge == BRIDGE_SPCA504B) if (sd->bridge == BRIDGE_SPCA504B)
spca504B_setQtable(gspca_dev); spca504B_setQtable(gspca_dev);
...@@ -932,27 +929,6 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, ...@@ -932,27 +929,6 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
gspca_frame_add(gspca_dev, INTER_PACKET, data, len); gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
} }
static int sd_set_jcomp(struct gspca_dev *gspca_dev,
struct v4l2_jpegcompression *jcomp)
{
struct sd *sd = (struct sd *) gspca_dev;
v4l2_ctrl_s_ctrl(sd->jpegqual, jcomp->quality);
return 0;
}
static int sd_get_jcomp(struct gspca_dev *gspca_dev,
struct v4l2_jpegcompression *jcomp)
{
struct sd *sd = (struct sd *) gspca_dev;
memset(jcomp, 0, sizeof *jcomp);
jcomp->quality = v4l2_ctrl_g_ctrl(sd->jpegqual);
jcomp->jpeg_markers = V4L2_JPEG_MARKER_DHT
| V4L2_JPEG_MARKER_DQT;
return 0;
}
static int sd_s_ctrl(struct v4l2_ctrl *ctrl) static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
{ {
struct gspca_dev *gspca_dev = struct gspca_dev *gspca_dev =
...@@ -977,9 +953,6 @@ static int sd_s_ctrl(struct v4l2_ctrl *ctrl) ...@@ -977,9 +953,6 @@ static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_AUTOGAIN: case V4L2_CID_AUTOGAIN:
sd->autogain = ctrl->val; sd->autogain = ctrl->val;
break; break;
case V4L2_CID_JPEG_COMPRESSION_QUALITY:
jpeg_set_qual(sd->jpeg_hdr, ctrl->val);
break;
} }
return gspca_dev->usb_err; return gspca_dev->usb_err;
} }
...@@ -990,11 +963,10 @@ static const struct v4l2_ctrl_ops sd_ctrl_ops = { ...@@ -990,11 +963,10 @@ static const struct v4l2_ctrl_ops sd_ctrl_ops = {
static int sd_init_controls(struct gspca_dev *gspca_dev) static int sd_init_controls(struct gspca_dev *gspca_dev)
{ {
struct sd *sd = (struct sd *)gspca_dev;
struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler;
gspca_dev->vdev.ctrl_handler = hdl; gspca_dev->vdev.ctrl_handler = hdl;
v4l2_ctrl_handler_init(hdl, 5); v4l2_ctrl_handler_init(hdl, 4);
v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
V4L2_CID_BRIGHTNESS, -128, 127, 1, 0); V4L2_CID_BRIGHTNESS, -128, 127, 1, 0);
v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
...@@ -1003,9 +975,6 @@ static int sd_init_controls(struct gspca_dev *gspca_dev) ...@@ -1003,9 +975,6 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
V4L2_CID_SATURATION, 0, 255, 1, 0x1a); V4L2_CID_SATURATION, 0, 255, 1, 0x1a);
v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
V4L2_CID_AUTOGAIN, 0, 1, 1, 1); V4L2_CID_AUTOGAIN, 0, 1, 1, 1);
sd->jpegqual = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
V4L2_CID_JPEG_COMPRESSION_QUALITY,
QUALITY_MIN, QUALITY_MAX, 1, QUALITY_DEF);
if (hdl->error) { if (hdl->error) {
pr_err("Could not initialize controls\n"); pr_err("Could not initialize controls\n");
...@@ -1023,8 +992,6 @@ static const struct sd_desc sd_desc = { ...@@ -1023,8 +992,6 @@ static const struct sd_desc sd_desc = {
.start = sd_start, .start = sd_start,
.stopN = sd_stopN, .stopN = sd_stopN,
.pkt_scan = sd_pkt_scan, .pkt_scan = sd_pkt_scan,
.get_jcomp = sd_get_jcomp,
.set_jcomp = sd_set_jcomp,
}; };
/* -- module initialisation -- */ /* -- module initialisation -- */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment