diff options
| author | Muralidharan Karicheri <m-karicheri2@ti.com> | 2009-11-19 10:00:31 -0500 |
|---|---|---|
| committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-15 21:18:03 -0500 |
| commit | b6456c0cfe9d94e6d2bf684e6e6c031fc0b10031 (patch) | |
| tree | e5742dc96ec8b2a74708787e6cb4ceefcc3e2bac /include/linux | |
| parent | 20d15a200d34cfb7141fb4558895d7d5233db84b (diff) | |
V4L/DVB (13571): v4l: Adding Digital Video Timings APIs
This adds the above APIs to the v4l2 core. This is based on version v1.2
of the RFC titled "V4L - Support for video timings at the input/output interface"
Following new ioctls are added:-
- VIDIOC_ENUM_DV_PRESETS
- VIDIOC_S_DV_PRESET
- VIDIOC_G_DV_PRESET
- VIDIOC_QUERY_DV_PRESET
- VIDIOC_S_DV_TIMINGS
- VIDIOC_G_DV_TIMINGS
Please refer to the RFC for the details. This code was tested using vpfe
capture driver on TI's DM365. Following is the test configuration used :-
Blu-Ray HD DVD source -> TVP7002 -> DM365 (VPFE) ->DDR
A draft version of the TVP7002 driver (currently being reviewed in the mailing
list) was used that supports V4L2_DV_1080I60 & V4L2_DV_720P60 presets.
A loopback video capture application was used for testing these APIs. This calls
following IOCTLS :-
- verify the new v4l2_input capabilities flag added
- Enumerate available presets using VIDIOC_ENUM_DV_PRESETS
- Set one of the supported preset using VIDIOC_S_DV_PRESET
- Get current preset using VIDIOC_G_DV_PRESET
- Detect current preset using VIDIOC_QUERY_DV_PRESET
- Using stub functions in tvp7002, verify VIDIOC_S_DV_TIMINGS
and VIDIOC_G_DV_TIMINGS ioctls are received at the sub device.
- Tested on 64bit platform by Hans Verkuil
Signed-off-by: Muralidharan Karicheri <m-karicheri2@ti.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Reviewed-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/videodev2.h | 116 |
1 files changed, 114 insertions, 2 deletions
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 32b92298fd79..59047ebf452e 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
| @@ -732,6 +732,99 @@ struct v4l2_standard { | |||
| 732 | }; | 732 | }; |
| 733 | 733 | ||
| 734 | /* | 734 | /* |
| 735 | * V I D E O T I M I N G S D V P R E S E T | ||
| 736 | */ | ||
| 737 | struct v4l2_dv_preset { | ||
| 738 | __u32 preset; | ||
| 739 | __u32 reserved[4]; | ||
| 740 | }; | ||
| 741 | |||
| 742 | /* | ||
| 743 | * D V P R E S E T S E N U M E R A T I O N | ||
| 744 | */ | ||
| 745 | struct v4l2_dv_enum_preset { | ||
| 746 | __u32 index; | ||
| 747 | __u32 preset; | ||
| 748 | __u8 name[32]; /* Name of the preset timing */ | ||
| 749 | __u32 width; | ||
| 750 | __u32 height; | ||
| 751 | __u32 reserved[4]; | ||
| 752 | }; | ||
| 753 | |||
| 754 | /* | ||
| 755 | * D V P R E S E T V A L U E S | ||
| 756 | */ | ||
| 757 | #define V4L2_DV_INVALID 0 | ||
| 758 | #define V4L2_DV_480P59_94 1 /* BT.1362 */ | ||
| 759 | #define V4L2_DV_576P50 2 /* BT.1362 */ | ||
| 760 | #define V4L2_DV_720P24 3 /* SMPTE 296M */ | ||
| 761 | #define V4L2_DV_720P25 4 /* SMPTE 296M */ | ||
| 762 | #define V4L2_DV_720P30 5 /* SMPTE 296M */ | ||
| 763 | #define V4L2_DV_720P50 6 /* SMPTE 296M */ | ||
| 764 | #define V4L2_DV_720P59_94 7 /* SMPTE 274M */ | ||
| 765 | #define V4L2_DV_720P60 8 /* SMPTE 274M/296M */ | ||
| 766 | #define V4L2_DV_1080I29_97 9 /* BT.1120/ SMPTE 274M */ | ||
| 767 | #define V4L2_DV_1080I30 10 /* BT.1120/ SMPTE 274M */ | ||
| 768 | #define V4L2_DV_1080I25 11 /* BT.1120 */ | ||
| 769 | #define V4L2_DV_1080I50 12 /* SMPTE 296M */ | ||
| 770 | #define V4L2_DV_1080I60 13 /* SMPTE 296M */ | ||
| 771 | #define V4L2_DV_1080P24 14 /* SMPTE 296M */ | ||
| 772 | #define V4L2_DV_1080P25 15 /* SMPTE 296M */ | ||
| 773 | #define V4L2_DV_1080P30 16 /* SMPTE 296M */ | ||
| 774 | #define V4L2_DV_1080P50 17 /* BT.1120 */ | ||
| 775 | #define V4L2_DV_1080P60 18 /* BT.1120 */ | ||
| 776 | |||
| 777 | /* | ||
| 778 | * D V B T T I M I N G S | ||
| 779 | */ | ||
| 780 | |||
| 781 | /* BT.656/BT.1120 timing data */ | ||
| 782 | struct v4l2_bt_timings { | ||
| 783 | __u32 width; /* width in pixels */ | ||
| 784 | __u32 height; /* height in lines */ | ||
| 785 | __u32 interlaced; /* Interlaced or progressive */ | ||
| 786 | __u32 polarities; /* Positive or negative polarity */ | ||
| 787 | __u64 pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */ | ||
| 788 | __u32 hfrontporch; /* Horizpontal front porch in pixels */ | ||
| 789 | __u32 hsync; /* Horizontal Sync length in pixels */ | ||
| 790 | __u32 hbackporch; /* Horizontal back porch in pixels */ | ||
| 791 | __u32 vfrontporch; /* Vertical front porch in pixels */ | ||
| 792 | __u32 vsync; /* Vertical Sync length in lines */ | ||
| 793 | __u32 vbackporch; /* Vertical back porch in lines */ | ||
| 794 | __u32 il_vfrontporch; /* Vertical front porch for bottom field of | ||
| 795 | * interlaced field formats | ||
| 796 | */ | ||
| 797 | __u32 il_vsync; /* Vertical sync length for bottom field of | ||
| 798 | * interlaced field formats | ||
| 799 | */ | ||
| 800 | __u32 il_vbackporch; /* Vertical back porch for bottom field of | ||
| 801 | * interlaced field formats | ||
| 802 | */ | ||
| 803 | __u32 reserved[16]; | ||
| 804 | } __attribute__ ((packed)); | ||
| 805 | |||
| 806 | /* Interlaced or progressive format */ | ||
| 807 | #define V4L2_DV_PROGRESSIVE 0 | ||
| 808 | #define V4L2_DV_INTERLACED 1 | ||
| 809 | |||
| 810 | /* Polarities. If bit is not set, it is assumed to be negative polarity */ | ||
| 811 | #define V4L2_DV_VSYNC_POS_POL 0x00000001 | ||
| 812 | #define V4L2_DV_HSYNC_POS_POL 0x00000002 | ||
| 813 | |||
| 814 | |||
| 815 | /* DV timings */ | ||
| 816 | struct v4l2_dv_timings { | ||
| 817 | __u32 type; | ||
| 818 | union { | ||
| 819 | struct v4l2_bt_timings bt; | ||
| 820 | __u32 reserved[32]; | ||
| 821 | }; | ||
| 822 | } __attribute__ ((packed)); | ||
| 823 | |||
| 824 | /* Values for the type field */ | ||
| 825 | #define V4L2_DV_BT_656_1120 0 /* BT.656/1120 timing type */ | ||
| 826 | |||
| 827 | /* | ||
| 735 | * V I D E O I N P U T S | 828 | * V I D E O I N P U T S |
| 736 | */ | 829 | */ |
| 737 | struct v4l2_input { | 830 | struct v4l2_input { |
| @@ -742,7 +835,8 @@ struct v4l2_input { | |||
| 742 | __u32 tuner; /* Associated tuner */ | 835 | __u32 tuner; /* Associated tuner */ |
| 743 | v4l2_std_id std; | 836 | v4l2_std_id std; |
| 744 | __u32 status; | 837 | __u32 status; |
| 745 | __u32 reserved[4]; | 838 | __u32 capabilities; |
| 839 | __u32 reserved[3]; | ||
| 746 | }; | 840 | }; |
| 747 | 841 | ||
| 748 | /* Values for the 'type' field */ | 842 | /* Values for the 'type' field */ |
| @@ -773,6 +867,11 @@ struct v4l2_input { | |||
| 773 | #define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */ | 867 | #define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */ |
| 774 | #define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */ | 868 | #define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */ |
| 775 | 869 | ||
| 870 | /* capabilities flags */ | ||
| 871 | #define V4L2_IN_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */ | ||
| 872 | #define V4L2_IN_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */ | ||
| 873 | #define V4L2_IN_CAP_STD 0x00000004 /* Supports S_STD */ | ||
| 874 | |||
| 776 | /* | 875 | /* |
| 777 | * V I D E O O U T P U T S | 876 | * V I D E O O U T P U T S |
| 778 | */ | 877 | */ |
| @@ -783,13 +882,19 @@ struct v4l2_output { | |||
| 783 | __u32 audioset; /* Associated audios (bitfield) */ | 882 | __u32 audioset; /* Associated audios (bitfield) */ |
| 784 | __u32 modulator; /* Associated modulator */ | 883 | __u32 modulator; /* Associated modulator */ |
| 785 | v4l2_std_id std; | 884 | v4l2_std_id std; |
| 786 | __u32 reserved[4]; | 885 | __u32 capabilities; |
| 886 | __u32 reserved[3]; | ||
| 787 | }; | 887 | }; |
| 788 | /* Values for the 'type' field */ | 888 | /* Values for the 'type' field */ |
| 789 | #define V4L2_OUTPUT_TYPE_MODULATOR 1 | 889 | #define V4L2_OUTPUT_TYPE_MODULATOR 1 |
| 790 | #define V4L2_OUTPUT_TYPE_ANALOG 2 | 890 | #define V4L2_OUTPUT_TYPE_ANALOG 2 |
| 791 | #define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3 | 891 | #define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3 |
| 792 | 892 | ||
| 893 | /* capabilities flags */ | ||
| 894 | #define V4L2_OUT_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */ | ||
| 895 | #define V4L2_OUT_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */ | ||
| 896 | #define V4L2_OUT_CAP_STD 0x00000004 /* Supports S_STD */ | ||
| 897 | |||
| 793 | /* | 898 | /* |
| 794 | * C O N T R O L S | 899 | * C O N T R O L S |
| 795 | */ | 900 | */ |
| @@ -1624,6 +1729,13 @@ struct v4l2_dbg_chip_ident { | |||
| 1624 | #endif | 1729 | #endif |
| 1625 | 1730 | ||
| 1626 | #define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) | 1731 | #define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) |
| 1732 | #define VIDIOC_ENUM_DV_PRESETS _IOWR('V', 83, struct v4l2_dv_enum_preset) | ||
| 1733 | #define VIDIOC_S_DV_PRESET _IOWR('V', 84, struct v4l2_dv_preset) | ||
| 1734 | #define VIDIOC_G_DV_PRESET _IOWR('V', 85, struct v4l2_dv_preset) | ||
| 1735 | #define VIDIOC_QUERY_DV_PRESET _IOR('V', 86, struct v4l2_dv_preset) | ||
| 1736 | #define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings) | ||
| 1737 | #define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings) | ||
| 1738 | |||
| 1627 | /* Reminder: when adding new ioctls please add support for them to | 1739 | /* Reminder: when adding new ioctls please add support for them to |
| 1628 | drivers/media/video/v4l2-compat-ioctl32.c as well! */ | 1740 | drivers/media/video/v4l2-compat-ioctl32.c as well! */ |
| 1629 | 1741 | ||
