aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-v4l2.c')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-v4l2.c94
1 files changed, 91 insertions, 3 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
index 00306faeac01..f048d80b77e5 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
@@ -533,7 +533,7 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
533 533
534 lmin = pvr2_ctrl_get_min(hcp); 534 lmin = pvr2_ctrl_get_min(hcp);
535 lmax = pvr2_ctrl_get_max(hcp); 535 lmax = pvr2_ctrl_get_max(hcp);
536 ldef = pvr2_ctrl_get_def(hcp); 536 pvr2_ctrl_get_def(hcp, &ldef);
537 if (w == -1) { 537 if (w == -1) {
538 w = ldef; 538 w = ldef;
539 } else if (w < lmin) { 539 } else if (w < lmin) {
@@ -543,7 +543,7 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
543 } 543 }
544 lmin = pvr2_ctrl_get_min(vcp); 544 lmin = pvr2_ctrl_get_min(vcp);
545 lmax = pvr2_ctrl_get_max(vcp); 545 lmax = pvr2_ctrl_get_max(vcp);
546 ldef = pvr2_ctrl_get_def(vcp); 546 pvr2_ctrl_get_def(vcp, &ldef);
547 if (h == -1) { 547 if (h == -1) {
548 h = ldef; 548 h = ldef;
549 } else if (h < lmin) { 549 } else if (h < lmin) {
@@ -604,6 +604,7 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
604 case VIDIOC_QUERYCTRL: 604 case VIDIOC_QUERYCTRL:
605 { 605 {
606 struct pvr2_ctrl *cptr; 606 struct pvr2_ctrl *cptr;
607 int val;
607 struct v4l2_queryctrl *vc = (struct v4l2_queryctrl *)arg; 608 struct v4l2_queryctrl *vc = (struct v4l2_queryctrl *)arg;
608 ret = 0; 609 ret = 0;
609 if (vc->id & V4L2_CTRL_FLAG_NEXT_CTRL) { 610 if (vc->id & V4L2_CTRL_FLAG_NEXT_CTRL) {
@@ -627,7 +628,8 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
627 pvr2_ctrl_get_desc(cptr)); 628 pvr2_ctrl_get_desc(cptr));
628 strlcpy(vc->name,pvr2_ctrl_get_desc(cptr),sizeof(vc->name)); 629 strlcpy(vc->name,pvr2_ctrl_get_desc(cptr),sizeof(vc->name));
629 vc->flags = pvr2_ctrl_get_v4lflags(cptr); 630 vc->flags = pvr2_ctrl_get_v4lflags(cptr);
630 vc->default_value = pvr2_ctrl_get_def(cptr); 631 pvr2_ctrl_get_def(cptr, &val);
632 vc->default_value = val;
631 switch (pvr2_ctrl_get_type(cptr)) { 633 switch (pvr2_ctrl_get_type(cptr)) {
632 case pvr2_ctl_enum: 634 case pvr2_ctl_enum:
633 vc->type = V4L2_CTRL_TYPE_MENU; 635 vc->type = V4L2_CTRL_TYPE_MENU;
@@ -753,6 +755,92 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
753 break; 755 break;
754 } 756 }
755 757
758 case VIDIOC_CROPCAP:
759 {
760 struct v4l2_cropcap *cap = (struct v4l2_cropcap *)arg;
761 if (cap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
762 ret = -EINVAL;
763 break;
764 }
765 ret = pvr2_hdw_get_cropcap(hdw, cap);
766 cap->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; /* paranoia */
767 break;
768 }
769 case VIDIOC_G_CROP:
770 {
771 struct v4l2_crop *crop = (struct v4l2_crop *)arg;
772 int val = 0;
773 if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
774 ret = -EINVAL;
775 break;
776 }
777 ret = pvr2_ctrl_get_value(
778 pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_CROPL), &val);
779 if (ret != 0) {
780 ret = -EINVAL;
781 break;
782 }
783 crop->c.left = val;
784 ret = pvr2_ctrl_get_value(
785 pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_CROPT), &val);
786 if (ret != 0) {
787 ret = -EINVAL;
788 break;
789 }
790 crop->c.top = val;
791 ret = pvr2_ctrl_get_value(
792 pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_CROPW), &val);
793 if (ret != 0) {
794 ret = -EINVAL;
795 break;
796 }
797 crop->c.width = val;
798 ret = pvr2_ctrl_get_value(
799 pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_CROPH), &val);
800 if (ret != 0) {
801 ret = -EINVAL;
802 break;
803 }
804 crop->c.height = val;
805 }
806 case VIDIOC_S_CROP:
807 {
808 struct v4l2_crop *crop = (struct v4l2_crop *)arg;
809 struct v4l2_cropcap cap;
810 if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
811 ret = -EINVAL;
812 break;
813 }
814 cap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
815 ret = pvr2_ctrl_set_value(
816 pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_CROPL),
817 crop->c.left);
818 if (ret != 0) {
819 ret = -EINVAL;
820 break;
821 }
822 ret = pvr2_ctrl_set_value(
823 pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_CROPT),
824 crop->c.top);
825 if (ret != 0) {
826 ret = -EINVAL;
827 break;
828 }
829 ret = pvr2_ctrl_set_value(
830 pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_CROPW),
831 crop->c.width);
832 if (ret != 0) {
833 ret = -EINVAL;
834 break;
835 }
836 ret = pvr2_ctrl_set_value(
837 pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_CROPH),
838 crop->c.height);
839 if (ret != 0) {
840 ret = -EINVAL;
841 break;
842 }
843 }
756 case VIDIOC_LOG_STATUS: 844 case VIDIOC_LOG_STATUS:
757 { 845 {
758 pvr2_hdw_trigger_module_log(hdw); 846 pvr2_hdw_trigger_module_log(hdw);