diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2012-06-09 09:09:07 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-07-06 16:19:46 -0400 |
commit | efc626b013900c5fc23b9900943356d0ece96d48 (patch) | |
tree | bb853ad8026e2bfe9c1628216b3126e212d38096 /drivers | |
parent | f16f77b0193c04e0c549c8e22546a8cd24e44d79 (diff) |
[media] v4l2-ioctl.c: use the new table for preset/timings ioctls
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/v4l2-ioctl.c | 207 |
1 files changed, 67 insertions, 140 deletions
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index ee11e08cb04c..fdceac803b6f 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c | |||
@@ -655,29 +655,35 @@ static void v4l_print_dbg_register(const void *arg, bool write_only) | |||
655 | p->reg, p->val); | 655 | p->reg, p->val); |
656 | } | 656 | } |
657 | 657 | ||
658 | static void v4l_print_u32(const void *arg, bool write_only) | 658 | static void v4l_print_dv_enum_presets(const void *arg, bool write_only) |
659 | { | 659 | { |
660 | pr_cont("value=%u\n", *(const u32 *)arg); | 660 | const struct v4l2_dv_enum_preset *p = arg; |
661 | |||
662 | pr_cont("index=%u, preset=%u, name=%s, width=%u, height=%u\n", | ||
663 | p->index, p->preset, p->name, p->width, p->height); | ||
661 | } | 664 | } |
662 | 665 | ||
663 | static void v4l_print_newline(const void *arg, bool write_only) | 666 | static void v4l_print_dv_preset(const void *arg, bool write_only) |
664 | { | 667 | { |
665 | pr_cont("\n"); | 668 | const struct v4l2_dv_preset *p = arg; |
669 | |||
670 | pr_cont("preset=%u\n", p->preset); | ||
666 | } | 671 | } |
667 | 672 | ||
668 | static void dbgtimings(struct video_device *vfd, | 673 | static void v4l_print_dv_timings(const void *arg, bool write_only) |
669 | const struct v4l2_dv_timings *p) | ||
670 | { | 674 | { |
675 | const struct v4l2_dv_timings *p = arg; | ||
676 | |||
671 | switch (p->type) { | 677 | switch (p->type) { |
672 | case V4L2_DV_BT_656_1120: | 678 | case V4L2_DV_BT_656_1120: |
673 | dbgarg2("bt-656/1120:interlaced=%d," | 679 | pr_cont("type=bt-656/1120, interlaced=%u, " |
674 | " pixelclock=%lld," | 680 | "pixelclock=%llu, " |
675 | " width=%d, height=%d, polarities=%x," | 681 | "width=%u, height=%u, polarities=0x%x, " |
676 | " hfrontporch=%d, hsync=%d," | 682 | "hfrontporch=%u, hsync=%u, " |
677 | " hbackporch=%d, vfrontporch=%d," | 683 | "hbackporch=%u, vfrontporch=%u, " |
678 | " vsync=%d, vbackporch=%d," | 684 | "vsync=%u, vbackporch=%u, " |
679 | " il_vfrontporch=%d, il_vsync=%d," | 685 | "il_vfrontporch=%u, il_vsync=%u, " |
680 | " il_vbackporch=%d, standards=%x, flags=%x\n", | 686 | "il_vbackporch=%u, standards=0x%x, flags=0x%x\n", |
681 | p->bt.interlaced, p->bt.pixelclock, | 687 | p->bt.interlaced, p->bt.pixelclock, |
682 | p->bt.width, p->bt.height, | 688 | p->bt.width, p->bt.height, |
683 | p->bt.polarities, p->bt.hfrontporch, | 689 | p->bt.polarities, p->bt.hfrontporch, |
@@ -688,11 +694,48 @@ static void dbgtimings(struct video_device *vfd, | |||
688 | p->bt.standards, p->bt.flags); | 694 | p->bt.standards, p->bt.flags); |
689 | break; | 695 | break; |
690 | default: | 696 | default: |
691 | dbgarg2("Unknown type %d!\n", p->type); | 697 | pr_cont("type=%d\n", p->type); |
692 | break; | 698 | break; |
693 | } | 699 | } |
694 | } | 700 | } |
695 | 701 | ||
702 | static void v4l_print_enum_dv_timings(const void *arg, bool write_only) | ||
703 | { | ||
704 | const struct v4l2_enum_dv_timings *p = arg; | ||
705 | |||
706 | pr_cont("index=%u, ", p->index); | ||
707 | v4l_print_dv_timings(&p->timings, write_only); | ||
708 | } | ||
709 | |||
710 | static void v4l_print_dv_timings_cap(const void *arg, bool write_only) | ||
711 | { | ||
712 | const struct v4l2_dv_timings_cap *p = arg; | ||
713 | |||
714 | switch (p->type) { | ||
715 | case V4L2_DV_BT_656_1120: | ||
716 | pr_cont("type=bt-656/1120, width=%u-%u, height=%u-%u, " | ||
717 | "pixelclock=%llu-%llu, standards=0x%x, capabilities=0x%x\n", | ||
718 | p->bt.min_width, p->bt.max_width, | ||
719 | p->bt.min_height, p->bt.max_height, | ||
720 | p->bt.min_pixelclock, p->bt.max_pixelclock, | ||
721 | p->bt.standards, p->bt.capabilities); | ||
722 | break; | ||
723 | default: | ||
724 | pr_cont("type=%u\n", p->type); | ||
725 | break; | ||
726 | } | ||
727 | } | ||
728 | |||
729 | static void v4l_print_u32(const void *arg, bool write_only) | ||
730 | { | ||
731 | pr_cont("value=%u\n", *(const u32 *)arg); | ||
732 | } | ||
733 | |||
734 | static void v4l_print_newline(const void *arg, bool write_only) | ||
735 | { | ||
736 | pr_cont("\n"); | ||
737 | } | ||
738 | |||
696 | static int check_ext_ctrls(struct v4l2_ext_controls *c, int allow_priv) | 739 | static int check_ext_ctrls(struct v4l2_ext_controls *c, int allow_priv) |
697 | { | 740 | { |
698 | __u32 i; | 741 | __u32 i; |
@@ -1740,20 +1783,20 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = { | |||
1740 | IOCTL_INFO_FNC(VIDIOC_DBG_G_REGISTER, v4l_dbg_g_register, v4l_print_dbg_register, 0), | 1783 | IOCTL_INFO_FNC(VIDIOC_DBG_G_REGISTER, v4l_dbg_g_register, v4l_print_dbg_register, 0), |
1741 | IOCTL_INFO_FNC(VIDIOC_DBG_G_CHIP_IDENT, v4l_dbg_g_chip_ident, v4l_print_dbg_chip_ident, 0), | 1784 | IOCTL_INFO_FNC(VIDIOC_DBG_G_CHIP_IDENT, v4l_dbg_g_chip_ident, v4l_print_dbg_chip_ident, 0), |
1742 | IOCTL_INFO_FNC(VIDIOC_S_HW_FREQ_SEEK, v4l_s_hw_freq_seek, v4l_print_hw_freq_seek, INFO_FL_PRIO), | 1785 | IOCTL_INFO_FNC(VIDIOC_S_HW_FREQ_SEEK, v4l_s_hw_freq_seek, v4l_print_hw_freq_seek, INFO_FL_PRIO), |
1743 | IOCTL_INFO(VIDIOC_ENUM_DV_PRESETS, 0), | 1786 | IOCTL_INFO_STD(VIDIOC_ENUM_DV_PRESETS, vidioc_enum_dv_presets, v4l_print_dv_enum_presets, 0), |
1744 | IOCTL_INFO(VIDIOC_S_DV_PRESET, INFO_FL_PRIO), | 1787 | IOCTL_INFO_STD(VIDIOC_S_DV_PRESET, vidioc_s_dv_preset, v4l_print_dv_preset, INFO_FL_PRIO), |
1745 | IOCTL_INFO(VIDIOC_G_DV_PRESET, 0), | 1788 | IOCTL_INFO_STD(VIDIOC_G_DV_PRESET, vidioc_g_dv_preset, v4l_print_dv_preset, 0), |
1746 | IOCTL_INFO(VIDIOC_QUERY_DV_PRESET, 0), | 1789 | IOCTL_INFO_STD(VIDIOC_QUERY_DV_PRESET, vidioc_query_dv_preset, v4l_print_dv_preset, 0), |
1747 | IOCTL_INFO(VIDIOC_S_DV_TIMINGS, INFO_FL_PRIO), | 1790 | IOCTL_INFO_STD(VIDIOC_S_DV_TIMINGS, vidioc_s_dv_timings, v4l_print_dv_timings, INFO_FL_PRIO), |
1748 | IOCTL_INFO(VIDIOC_G_DV_TIMINGS, 0), | 1791 | IOCTL_INFO_STD(VIDIOC_G_DV_TIMINGS, vidioc_g_dv_timings, v4l_print_dv_timings, 0), |
1749 | IOCTL_INFO(VIDIOC_DQEVENT, 0), | 1792 | IOCTL_INFO(VIDIOC_DQEVENT, 0), |
1750 | IOCTL_INFO(VIDIOC_SUBSCRIBE_EVENT, 0), | 1793 | IOCTL_INFO(VIDIOC_SUBSCRIBE_EVENT, 0), |
1751 | IOCTL_INFO(VIDIOC_UNSUBSCRIBE_EVENT, 0), | 1794 | IOCTL_INFO(VIDIOC_UNSUBSCRIBE_EVENT, 0), |
1752 | IOCTL_INFO_FNC(VIDIOC_CREATE_BUFS, v4l_create_bufs, v4l_print_create_buffers, INFO_FL_PRIO), | 1795 | IOCTL_INFO_FNC(VIDIOC_CREATE_BUFS, v4l_create_bufs, v4l_print_create_buffers, INFO_FL_PRIO), |
1753 | IOCTL_INFO_FNC(VIDIOC_PREPARE_BUF, v4l_prepare_buf, v4l_print_buffer, 0), | 1796 | IOCTL_INFO_FNC(VIDIOC_PREPARE_BUF, v4l_prepare_buf, v4l_print_buffer, 0), |
1754 | IOCTL_INFO(VIDIOC_ENUM_DV_TIMINGS, 0), | 1797 | IOCTL_INFO_STD(VIDIOC_ENUM_DV_TIMINGS, vidioc_enum_dv_timings, v4l_print_enum_dv_timings, 0), |
1755 | IOCTL_INFO(VIDIOC_QUERY_DV_TIMINGS, 0), | 1798 | IOCTL_INFO_STD(VIDIOC_QUERY_DV_TIMINGS, vidioc_query_dv_timings, v4l_print_dv_timings, 0), |
1756 | IOCTL_INFO(VIDIOC_DV_TIMINGS_CAP, 0), | 1799 | IOCTL_INFO_STD(VIDIOC_DV_TIMINGS_CAP, vidioc_dv_timings_cap, v4l_print_dv_timings_cap, 0), |
1757 | }; | 1800 | }; |
1758 | #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) | 1801 | #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) |
1759 | 1802 | ||
@@ -1938,122 +1981,6 @@ static long __video_do_ioctl(struct file *file, | |||
1938 | } | 1981 | } |
1939 | break; | 1982 | break; |
1940 | } | 1983 | } |
1941 | case VIDIOC_ENUM_DV_PRESETS: | ||
1942 | { | ||
1943 | struct v4l2_dv_enum_preset *p = arg; | ||
1944 | |||
1945 | ret = ops->vidioc_enum_dv_presets(file, fh, p); | ||
1946 | if (!ret) | ||
1947 | dbgarg(cmd, | ||
1948 | "index=%d, preset=%d, name=%s, width=%d," | ||
1949 | " height=%d ", | ||
1950 | p->index, p->preset, p->name, p->width, | ||
1951 | p->height); | ||
1952 | break; | ||
1953 | } | ||
1954 | case VIDIOC_S_DV_PRESET: | ||
1955 | { | ||
1956 | struct v4l2_dv_preset *p = arg; | ||
1957 | |||
1958 | dbgarg(cmd, "preset=%d\n", p->preset); | ||
1959 | ret = ops->vidioc_s_dv_preset(file, fh, p); | ||
1960 | break; | ||
1961 | } | ||
1962 | case VIDIOC_G_DV_PRESET: | ||
1963 | { | ||
1964 | struct v4l2_dv_preset *p = arg; | ||
1965 | |||
1966 | ret = ops->vidioc_g_dv_preset(file, fh, p); | ||
1967 | if (!ret) | ||
1968 | dbgarg(cmd, "preset=%d\n", p->preset); | ||
1969 | break; | ||
1970 | } | ||
1971 | case VIDIOC_QUERY_DV_PRESET: | ||
1972 | { | ||
1973 | struct v4l2_dv_preset *p = arg; | ||
1974 | |||
1975 | ret = ops->vidioc_query_dv_preset(file, fh, p); | ||
1976 | if (!ret) | ||
1977 | dbgarg(cmd, "preset=%d\n", p->preset); | ||
1978 | break; | ||
1979 | } | ||
1980 | case VIDIOC_S_DV_TIMINGS: | ||
1981 | { | ||
1982 | struct v4l2_dv_timings *p = arg; | ||
1983 | |||
1984 | dbgtimings(vfd, p); | ||
1985 | switch (p->type) { | ||
1986 | case V4L2_DV_BT_656_1120: | ||
1987 | ret = ops->vidioc_s_dv_timings(file, fh, p); | ||
1988 | break; | ||
1989 | default: | ||
1990 | ret = -EINVAL; | ||
1991 | break; | ||
1992 | } | ||
1993 | break; | ||
1994 | } | ||
1995 | case VIDIOC_G_DV_TIMINGS: | ||
1996 | { | ||
1997 | struct v4l2_dv_timings *p = arg; | ||
1998 | |||
1999 | ret = ops->vidioc_g_dv_timings(file, fh, p); | ||
2000 | if (!ret) | ||
2001 | dbgtimings(vfd, p); | ||
2002 | break; | ||
2003 | } | ||
2004 | case VIDIOC_ENUM_DV_TIMINGS: | ||
2005 | { | ||
2006 | struct v4l2_enum_dv_timings *p = arg; | ||
2007 | |||
2008 | if (!ops->vidioc_enum_dv_timings) | ||
2009 | break; | ||
2010 | |||
2011 | ret = ops->vidioc_enum_dv_timings(file, fh, p); | ||
2012 | if (!ret) { | ||
2013 | dbgarg(cmd, "index=%d: ", p->index); | ||
2014 | dbgtimings(vfd, &p->timings); | ||
2015 | } | ||
2016 | break; | ||
2017 | } | ||
2018 | case VIDIOC_QUERY_DV_TIMINGS: | ||
2019 | { | ||
2020 | struct v4l2_dv_timings *p = arg; | ||
2021 | |||
2022 | if (!ops->vidioc_query_dv_timings) | ||
2023 | break; | ||
2024 | |||
2025 | ret = ops->vidioc_query_dv_timings(file, fh, p); | ||
2026 | if (!ret) | ||
2027 | dbgtimings(vfd, p); | ||
2028 | break; | ||
2029 | } | ||
2030 | case VIDIOC_DV_TIMINGS_CAP: | ||
2031 | { | ||
2032 | struct v4l2_dv_timings_cap *p = arg; | ||
2033 | |||
2034 | if (!ops->vidioc_dv_timings_cap) | ||
2035 | break; | ||
2036 | |||
2037 | ret = ops->vidioc_dv_timings_cap(file, fh, p); | ||
2038 | if (ret) | ||
2039 | break; | ||
2040 | switch (p->type) { | ||
2041 | case V4L2_DV_BT_656_1120: | ||
2042 | dbgarg(cmd, | ||
2043 | "type=%d, width=%u-%u, height=%u-%u, " | ||
2044 | "pixelclock=%llu-%llu, standards=%x, capabilities=%x ", | ||
2045 | p->type, | ||
2046 | p->bt.min_width, p->bt.max_width, | ||
2047 | p->bt.min_height, p->bt.max_height, | ||
2048 | p->bt.min_pixelclock, p->bt.max_pixelclock, | ||
2049 | p->bt.standards, p->bt.capabilities); | ||
2050 | break; | ||
2051 | default: | ||
2052 | dbgarg(cmd, "unknown type "); | ||
2053 | break; | ||
2054 | } | ||
2055 | break; | ||
2056 | } | ||
2057 | case VIDIOC_DQEVENT: | 1984 | case VIDIOC_DQEVENT: |
2058 | { | 1985 | { |
2059 | struct v4l2_event *ev = arg; | 1986 | struct v4l2_event *ev = arg; |