History

[media] v4l: Add support for DV timings ioctls on subdev nodes

Validate the pad field in the core code whenever specified.

Laurent Pinchart committed 12 years ago

Commit 9cfd65e1 parent c4fa1464 files · +78 −13Browse files

Unified · Split

4 files
  1. Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml +22 −5
  2. Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml +23 −7
  3. drivers/media/v4l2-core/v4l2-subdev.c +27 −0
  4. include/uapi/linux/v4l2-subdev.h +6 −1
Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml+22−5
@@ -1,11 +1,12 @@
11 <refentry id="vidioc-dv-timings-cap">
22 <refmeta>
3− <refentrytitle>ioctl VIDIOC_DV_TIMINGS_CAP</refentrytitle>
3+ <refentrytitle>ioctl VIDIOC_DV_TIMINGS_CAP, VIDIOC_SUBDEV_DV_TIMINGS_CAP</refentrytitle>
44 &manvol;
55 </refmeta>
66
77 <refnamediv>
88 <refname>VIDIOC_DV_TIMINGS_CAP</refname>
9+ <refname>VIDIOC_SUBDEV_DV_TIMINGS_CAP</refname>
910 <refpurpose>The capabilities of the Digital Video receiver/transmitter</refpurpose>
1011 </refnamediv>
1112
@@ -33,7 +34,7 @@ · 21 unmodified lines
3334 <varlistentry>
3435 <term><parameter>request</parameter></term>
3536 <listitem>
36− <para>VIDIOC_DV_TIMINGS_CAP</para>
37+ <para>VIDIOC_DV_TIMINGS_CAP, VIDIOC_SUBDEV_DV_TIMINGS_CAP</para>
3738 </listitem>
3839 </varlistentry>
3940 <varlistentry>
@@ -54,10 +55,19 @@ · 14 unmodified lines
5455 interface and may change in the future.</para>
5556 </note>
5657
57− <para>To query the capabilities of the DV receiver/transmitter applications can call
58−this ioctl and the driver will fill in the structure. Note that drivers may return
58+ <para>To query the capabilities of the DV receiver/transmitter applications
59+can call the <constant>VIDIOC_DV_TIMINGS_CAP</constant> ioctl on a video node
60+and the driver will fill in the structure. Note that drivers may return
5961 different values after switching the video input or output.</para>
6062
63+ <para>When implemented by the driver DV capabilities of subdevices can be
64+queried by calling the <constant>VIDIOC_SUBDEV_DV_TIMINGS_CAP</constant> ioctl
65+directly on a subdevice node. The capabilities are specific to inputs (for DV
66+receivers) or outputs (for DV transmitters), applications must specify the
67+desired pad number in the &v4l2-dv-timings-cap; <structfield>pad</structfield>
68+field. Attempts to query capabilities on a pad that doesn't support them will
69+return an &EINVAL;.</para>
70+
6171 <table pgwide="1" frame="none" id="v4l2-bt-timings-cap">
6272 <title>struct <structname>v4l2_bt_timings_cap</structname></title>
6373 <tgroup cols="3">
@@ -127,7 +137,14 @@ different values after switching the video input or output.</para> · 63 unmodified lines
127137 </row>
128138 <row>
129139 <entry>__u32</entry>
130− <entry><structfield>reserved</structfield>[3]</entry>
140+ <entry><structfield>pad</structfield></entry>
141+ <entry>Pad number as reported by the media controller API. This field
142+ is only used when operating on a subdevice node. When operating on a
143+ video node applications must set this field to zero.</entry>
144+ </row>
145+ <row>
146+ <entry>__u32</entry>
147+ <entry><structfield>reserved</structfield>[2]</entry>
131148 <entry>Reserved for future extensions. Drivers must set the array to zero.</entry>
132149 </row>
133150 <row>
Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml+23−7
@@ -1,11 +1,12 @@
11 <refentry id="vidioc-enum-dv-timings">
22 <refmeta>
3− <refentrytitle>ioctl VIDIOC_ENUM_DV_TIMINGS</refentrytitle>
3+ <refentrytitle>ioctl VIDIOC_ENUM_DV_TIMINGS, VIDIOC_SUBDEV_ENUM_DV_TIMINGS</refentrytitle>
44 &manvol;
55 </refmeta>
66
77 <refnamediv>
88 <refname>VIDIOC_ENUM_DV_TIMINGS</refname>
9+ <refname>VIDIOC_SUBDEV_ENUM_DV_TIMINGS</refname>
910 <refpurpose>Enumerate supported Digital Video timings</refpurpose>
1011 </refnamediv>
1112
@@ -33,7 +34,7 @@ · 21 unmodified lines
3334 <varlistentry>
3435 <term><parameter>request</parameter></term>
3536 <listitem>
36− <para>VIDIOC_ENUM_DV_TIMINGS</para>
37+ <para>VIDIOC_ENUM_DV_TIMINGS, VIDIOC_SUBDEV_ENUM_DV_TIMINGS</para>
3738 </listitem>
3839 </varlistentry>
3940 <varlistentry>
@@ -61,14 +62,21 @@ standards or even custom timings that are not in this list.</para> · 21 unmodified lines
6162
6263 <para>To query the available timings, applications initialize the
6364 <structfield>index</structfield> field and zero the reserved array of &v4l2-enum-dv-timings;
64−and call the <constant>VIDIOC_ENUM_DV_TIMINGS</constant> ioctl with a pointer to this
65−structure. Drivers fill the rest of the structure or return an
65+and call the <constant>VIDIOC_ENUM_DV_TIMINGS</constant> ioctl on a video node with a
66+pointer to this structure. Drivers fill the rest of the structure or return an
6667 &EINVAL; when the index is out of bounds. To enumerate all supported DV timings,
6768 applications shall begin at index zero, incrementing by one until the
6869 driver returns <errorcode>EINVAL</errorcode>. Note that drivers may enumerate a
6970 different set of DV timings after switching the video input or
7071 output.</para>
7172
73+ <para>When implemented by the driver DV timings of subdevices can be queried
74+by calling the <constant>VIDIOC_SUBDEV_ENUM_DV_TIMINGS</constant> ioctl directly
75+on a subdevice node. The DV timings are specific to inputs (for DV receivers) or
76+outputs (for DV transmitters), applications must specify the desired pad number
77+in the &v4l2-enum-dv-timings; <structfield>pad</structfield> field. Attempts to
78+enumerate timings on a pad that doesn't support them will return an &EINVAL;.</para>
79+
7280 <table pgwide="1" frame="none" id="v4l2-enum-dv-timings">
7381 <title>struct <structname>v4l2_enum_dv_timings</structname></title>
7482 <tgroup cols="3">
@@ -82,8 +90,16 @@ application.</entry> · 7 unmodified lines
8290 </row>
8391 <row>
8492 <entry>__u32</entry>
85− <entry><structfield>reserved</structfield>[3]</entry>
86− <entry>Reserved for future extensions. Drivers must set the array to zero.</entry>
93+ <entry><structfield>pad</structfield></entry>
94+ <entry>Pad number as reported by the media controller API. This field
95+ is only used when operating on a subdevice node. When operating on a
96+ video node applications must set this field to zero.</entry>
97+ </row>
98+ <row>
99+ <entry>__u32</entry>
100+ <entry><structfield>reserved</structfield>[2]</entry>
101+ <entry>Reserved for future extensions. Drivers and applications must
102+ set the array to zero.</entry>
87103 </row>
88104 <row>
89105 <entry>&v4l2-dv-timings;</entry>
@@ -103,7 +119,7 @@ application.</entry> · 13 unmodified lines
103119 <term><errorcode>EINVAL</errorcode></term>
104120 <listitem>
105121 <para>The &v4l2-enum-dv-timings; <structfield>index</structfield>
106−is out of bounds.</para>
122+is out of bounds or the <structfield>pad</structfield> number is invalid.</para>
107123 </listitem>
108124 </varlistentry>
109125 <varlistentry>
drivers/media/v4l2-core/v4l2-subdev.c+27−0
@@ -366,6 +366,33 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) · 365 unmodified lines
366366
367367 case VIDIOC_S_EDID:
368368 return v4l2_subdev_call(sd, pad, set_edid, arg);
369+
370+ case VIDIOC_SUBDEV_DV_TIMINGS_CAP: {
371+ struct v4l2_dv_timings_cap *cap = arg;
372+
373+ if (cap->pad >= sd->entity.num_pads)
374+ return -EINVAL;
375+
376+ return v4l2_subdev_call(sd, pad, dv_timings_cap, cap);
377+ }
378+
379+ case VIDIOC_SUBDEV_ENUM_DV_TIMINGS: {
380+ struct v4l2_enum_dv_timings *dvt = arg;
381+
382+ if (dvt->pad >= sd->entity.num_pads)
383+ return -EINVAL;
384+
385+ return v4l2_subdev_call(sd, pad, enum_dv_timings, dvt);
386+ }
387+
388+ case VIDIOC_SUBDEV_QUERY_DV_TIMINGS:
389+ return v4l2_subdev_call(sd, video, query_dv_timings, arg);
390+
391+ case VIDIOC_SUBDEV_G_DV_TIMINGS:
392+ return v4l2_subdev_call(sd, video, g_dv_timings, arg);
393+
394+ case VIDIOC_SUBDEV_S_DV_TIMINGS:
395+ return v4l2_subdev_call(sd, video, s_dv_timings, arg);
369396 #endif
370397 default:
371398 return v4l2_subdev_call(sd, core, ioctl, cmd, arg);
include/uapi/linux/v4l2-subdev.h+6−1
@@ -162,8 +162,13 @@ struct v4l2_subdev_selection { · 161 unmodified lines
162162 #define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop)
163163 #define VIDIOC_SUBDEV_G_SELECTION _IOWR('V', 61, struct v4l2_subdev_selection)
164164 #define VIDIOC_SUBDEV_S_SELECTION _IOWR('V', 62, struct v4l2_subdev_selection)
165−/* These two G/S_EDID ioctls are identical to the ioctls in videodev2.h */
165+/* The following ioctls are identical to the ioctls in videodev2.h */
166166 #define VIDIOC_SUBDEV_G_EDID _IOWR('V', 40, struct v4l2_edid)
167167 #define VIDIOC_SUBDEV_S_EDID _IOWR('V', 41, struct v4l2_edid)
168+#define VIDIOC_SUBDEV_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings)
169+#define VIDIOC_SUBDEV_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings)
170+#define VIDIOC_SUBDEV_ENUM_DV_TIMINGS _IOWR('V', 98, struct v4l2_enum_dv_timings)
171+#define VIDIOC_SUBDEV_QUERY_DV_TIMINGS _IOR('V', 99, struct v4l2_dv_timings)
172+#define VIDIOC_SUBDEV_DV_TIMINGS_CAP _IOWR('V', 100, struct v4l2_dv_timings_cap)
168173
169174 #endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t