diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2006-06-26 22:42:39 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-06-30 14:59:27 -0400 |
commit | 38a2713ada91d5e7e4c0a1a0b12e45e2ec7079c3 (patch) | |
tree | e3d0a2fd5b3b95f75b3e09de9dc54d2edb5e1533 /drivers/media/video/cx88/cx88-blackbird.c | |
parent | 598736c55622f7ea65b98f93c825ff95c433877c (diff) |
V4L/DVB (4264): Cx88-blackbird: implement VIDIOC_QUERYCTRL and VIDIOC_QUERYMENU
This patch implements the newer v4l2 control features to make the
standard user controls and mpeg encoder controls of cx88-blackbird
video encoder boards available to userspace.
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/cx88/cx88-blackbird.c')
-rw-r--r-- | drivers/media/video/cx88/cx88-blackbird.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index 4ff81582ec56..349632b48e93 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c | |||
@@ -686,6 +686,39 @@ static struct videobuf_queue_ops blackbird_qops = { | |||
686 | 686 | ||
687 | /* ------------------------------------------------------------------ */ | 687 | /* ------------------------------------------------------------------ */ |
688 | 688 | ||
689 | static const u32 *ctrl_classes[] = { | ||
690 | cx88_user_ctrls, | ||
691 | cx2341x_mpeg_ctrls, | ||
692 | NULL | ||
693 | }; | ||
694 | |||
695 | static int blackbird_queryctrl(struct cx8802_dev *dev, struct v4l2_queryctrl *qctrl) | ||
696 | { | ||
697 | qctrl->id = v4l2_ctrl_next(ctrl_classes, qctrl->id); | ||
698 | if (qctrl->id == 0) | ||
699 | return -EINVAL; | ||
700 | |||
701 | /* Standard V4L2 controls */ | ||
702 | if (cx8800_ctrl_query(qctrl) == 0) | ||
703 | return 0; | ||
704 | |||
705 | /* MPEG V4L2 controls */ | ||
706 | if (cx2341x_ctrl_query(&dev->params, qctrl)) | ||
707 | qctrl->flags |= V4L2_CTRL_FLAG_DISABLED; | ||
708 | return 0; | ||
709 | } | ||
710 | |||
711 | static int blackbird_querymenu(struct cx8802_dev *dev, struct v4l2_querymenu *qmenu) | ||
712 | { | ||
713 | struct v4l2_queryctrl qctrl; | ||
714 | |||
715 | qctrl.id = qmenu->id; | ||
716 | blackbird_queryctrl(dev, &qctrl); | ||
717 | return v4l2_ctrl_query_menu(qmenu, &qctrl, cx2341x_ctrl_get_menu(qmenu->id)); | ||
718 | } | ||
719 | |||
720 | /* ------------------------------------------------------------------ */ | ||
721 | |||
689 | static int mpeg_do_ioctl(struct inode *inode, struct file *file, | 722 | static int mpeg_do_ioctl(struct inode *inode, struct file *file, |
690 | unsigned int cmd, void *arg) | 723 | unsigned int cmd, void *arg) |
691 | { | 724 | { |
@@ -866,6 +899,16 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file, | |||
866 | core->name); | 899 | core->name); |
867 | return 0; | 900 | return 0; |
868 | } | 901 | } |
902 | case VIDIOC_QUERYMENU: | ||
903 | return blackbird_querymenu(dev, arg); | ||
904 | case VIDIOC_QUERYCTRL: | ||
905 | { | ||
906 | struct v4l2_queryctrl *c = arg; | ||
907 | |||
908 | if (blackbird_queryctrl(dev, c) == 0) | ||
909 | return 0; | ||
910 | return cx88_do_ioctl(inode, file, 0, dev->core, cmd, arg, mpeg_do_ioctl); | ||
911 | } | ||
869 | 912 | ||
870 | default: | 913 | default: |
871 | return cx88_do_ioctl(inode, file, 0, dev->core, cmd, arg, mpeg_do_ioctl); | 914 | return cx88_do_ioctl(inode, file, 0, dev->core, cmd, arg, mpeg_do_ioctl); |