aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Ribalda <ricardo.ribalda@gmail.com>2015-10-29 06:10:31 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-11-17 11:46:44 -0500
commit082afb7c4ee6ce0c1c0451816bf2c5a747fc51b1 (patch)
tree2f48e6824122fd8012d039db21bc6f79929772a2
parent91739838a5860a24863d76ab8cb10e15f10b3fc1 (diff)
[media] media/usb/pvrusb2: Support for V4L2_CTRL_WHICH_DEF_VAL
This driver does not use the control infrastructure. Add support for the new field which on structure v4l2_ext_controls Acked-by: Mike Isely <isely@pobox.com> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--drivers/media/usb/pvrusb2/pvrusb2-v4l2.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
index 1c5f85bf7ed4..81f788b7b242 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
@@ -628,6 +628,7 @@ static int pvr2_g_ext_ctrls(struct file *file, void *priv,
628 struct pvr2_v4l2_fh *fh = file->private_data; 628 struct pvr2_v4l2_fh *fh = file->private_data;
629 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; 629 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw;
630 struct v4l2_ext_control *ctrl; 630 struct v4l2_ext_control *ctrl;
631 struct pvr2_ctrl *cptr;
631 unsigned int idx; 632 unsigned int idx;
632 int val; 633 int val;
633 int ret; 634 int ret;
@@ -635,8 +636,15 @@ static int pvr2_g_ext_ctrls(struct file *file, void *priv,
635 ret = 0; 636 ret = 0;
636 for (idx = 0; idx < ctls->count; idx++) { 637 for (idx = 0; idx < ctls->count; idx++) {
637 ctrl = ctls->controls + idx; 638 ctrl = ctls->controls + idx;
638 ret = pvr2_ctrl_get_value( 639 cptr = pvr2_hdw_get_ctrl_v4l(hdw, ctrl->id);
639 pvr2_hdw_get_ctrl_v4l(hdw, ctrl->id), &val); 640 if (cptr) {
641 if (ctls->which == V4L2_CTRL_WHICH_DEF_VAL)
642 pvr2_ctrl_get_def(cptr, &val);
643 else
644 ret = pvr2_ctrl_get_value(cptr, &val);
645 } else
646 ret = -EINVAL;
647
640 if (ret) { 648 if (ret) {
641 ctls->error_idx = idx; 649 ctls->error_idx = idx;
642 return ret; 650 return ret;
@@ -658,6 +666,10 @@ static int pvr2_s_ext_ctrls(struct file *file, void *priv,
658 unsigned int idx; 666 unsigned int idx;
659 int ret; 667 int ret;
660 668
669 /* Default value cannot be changed */
670 if (ctls->which == V4L2_CTRL_WHICH_DEF_VAL)
671 return -EINVAL;
672
661 ret = 0; 673 ret = 0;
662 for (idx = 0; idx < ctls->count; idx++) { 674 for (idx = 0; idx < ctls->count; idx++) {
663 ctrl = ctls->controls + idx; 675 ctrl = ctls->controls + idx;