V4L/DVB (4926): Fix USBVision handling of VIDIOC_QUERYCTRL
There's a better (and recommended) way for handling VIDIOC_QUERYCTRL. This patch will fix the issue where the hardware control values were invalid and stops the SAA7115 module from complaining about invalid values. saa7115 4-0024: invalid brightness setting 32768 saa7115 4-0024: invalid contrast setting 49152 saa7115 4-0024: invalid hue setting 32768 saa7115 4-0024: invalid saturation setting 32768 Signed-off-by: Dwaine Garden <dwainegarden@rogers.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
This commit is contained in:
committed by
Mauro Carvalho Chehab
parent
cc9e595a58
commit
18d8a4540c
@@ -448,11 +448,6 @@ static struct usbvision_v4l2_format_st usbvision_v4l2_format[] = {
|
|||||||
#define DEFAULT_SCRATCH_BUF_SIZE (0x20000) // 128kB memory scratch buffer
|
#define DEFAULT_SCRATCH_BUF_SIZE (0x20000) // 128kB memory scratch buffer
|
||||||
static const int scratch_buf_size = DEFAULT_SCRATCH_BUF_SIZE;
|
static const int scratch_buf_size = DEFAULT_SCRATCH_BUF_SIZE;
|
||||||
|
|
||||||
static int init_brightness = 128; // Initalize the brightness of the video device
|
|
||||||
static int init_contrast = 192; // Initalize the contrast of the video device
|
|
||||||
static int init_saturation = 128; // Initalize the staturation mode of the video device
|
|
||||||
static int init_hue = 128; // Initalize the Hue settings of the video device
|
|
||||||
|
|
||||||
// Function prototypes
|
// Function prototypes
|
||||||
static int usbvision_restart_isoc(struct usb_usbvision *usbvision);
|
static int usbvision_restart_isoc(struct usb_usbvision *usbvision);
|
||||||
static int usbvision_begin_streaming(struct usb_usbvision *usbvision);
|
static int usbvision_begin_streaming(struct usb_usbvision *usbvision);
|
||||||
@@ -4120,53 +4115,33 @@ static int usbvision_v4l2_do_ioctl(struct inode *inode, struct file *file,
|
|||||||
}
|
}
|
||||||
case VIDIOC_QUERYCTRL:
|
case VIDIOC_QUERYCTRL:
|
||||||
{
|
{
|
||||||
struct v4l2_queryctrl *qc = arg;
|
struct v4l2_queryctrl *ctrl = arg;
|
||||||
switch(qc->id) {
|
int id=ctrl->id;
|
||||||
case V4L2_CID_BRIGHTNESS:
|
|
||||||
case V4L2_CID_HUE:
|
memset(ctrl,0,sizeof(*ctrl));
|
||||||
case V4L2_CID_SATURATION:
|
ctrl->id=id;
|
||||||
case V4L2_CID_CONTRAST:
|
|
||||||
case V4L2_CID_AUDIO_VOLUME:
|
i2c_clients_command(&usbvision->i2c_adap, cmd, arg);
|
||||||
case V4L2_CID_AUDIO_MUTE:
|
|
||||||
return v4l2_ctrl_query_fill_std(qc);
|
if (ctrl->type)
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
|
else
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
PDEBUG(DBG_IOCTL,"VIDIOC_QUERYCTRL id=%x value=%x",ctrl->id,ctrl->type);
|
||||||
}
|
}
|
||||||
case VIDIOC_G_CTRL:
|
case VIDIOC_G_CTRL:
|
||||||
{
|
{
|
||||||
struct v4l2_control *ctrl = arg;
|
struct v4l2_control *ctrl = arg;
|
||||||
|
|
||||||
switch (ctrl->id) {
|
|
||||||
case V4L2_CID_BRIGHTNESS:
|
|
||||||
ctrl->value = usbvision->brightness;
|
|
||||||
break;
|
|
||||||
case V4L2_CID_CONTRAST:
|
|
||||||
ctrl->value = usbvision->contrast;
|
|
||||||
break;
|
|
||||||
case V4L2_CID_SATURATION:
|
|
||||||
ctrl->value = usbvision->saturation;
|
|
||||||
break;
|
|
||||||
case V4L2_CID_HUE:
|
|
||||||
ctrl->value = usbvision->hue;
|
|
||||||
break;
|
|
||||||
case V4L2_CID_AUDIO_VOLUME:
|
|
||||||
/* ctrl->value = usbvision->volume; */
|
|
||||||
break;
|
|
||||||
case V4L2_CID_AUDIO_MUTE:
|
|
||||||
ctrl->value = usbvision->AudioMute;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
PDEBUG(DBG_IOCTL,"VIDIOC_G_CTRL id=%x value=%x",ctrl->id,ctrl->value);
|
PDEBUG(DBG_IOCTL,"VIDIOC_G_CTRL id=%x value=%x",ctrl->id,ctrl->value);
|
||||||
|
call_i2c_clients(usbvision, VIDIOC_G_CTRL, ctrl);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case VIDIOC_S_CTRL:
|
case VIDIOC_S_CTRL:
|
||||||
{
|
{
|
||||||
struct v4l2_control *ctrl = arg;
|
struct v4l2_control *ctrl = arg;
|
||||||
|
|
||||||
PDEBUG(DBG_IOCTL, "VIDIOC_S_CTRL id=%x value=%x",ctrl->id,ctrl->value);
|
PDEBUG(DBG_IOCTL, "VIDIOC_S_CTRL id=%x value=%x",ctrl->id,ctrl->value);
|
||||||
call_i2c_clients(usbvision, VIDIOC_S_CTRL, ctrl);
|
call_i2c_clients(usbvision, VIDIOC_S_CTRL, ctrl);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -5229,16 +5204,6 @@ static void usbvision_configure_video(struct usb_usbvision *usbvision)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
model = usbvision->DevModel;
|
model = usbvision->DevModel;
|
||||||
|
|
||||||
RESTRICT_TO_RANGE(init_brightness, 0, 255);
|
|
||||||
RESTRICT_TO_RANGE(init_contrast, 0, 255);
|
|
||||||
RESTRICT_TO_RANGE(init_saturation, 0, 255);
|
|
||||||
RESTRICT_TO_RANGE(init_hue, 0, 255);
|
|
||||||
|
|
||||||
usbvision->saturation = init_saturation << 8;
|
|
||||||
usbvision->hue = init_hue << 8;
|
|
||||||
usbvision->brightness = init_brightness << 8;
|
|
||||||
usbvision->contrast = init_contrast << 8;
|
|
||||||
usbvision->depth = 24;
|
usbvision->depth = 24;
|
||||||
usbvision->palette = usbvision_v4l2_format[2]; // V4L2_PIX_FMT_RGB24;
|
usbvision->palette = usbvision_v4l2_format[2]; // V4L2_PIX_FMT_RGB24;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user