Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

Validate the pad field in the core code whenever specified.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>

authored by

Laurent Pinchart and committed by
Mauro Carvalho Chehab
9cfd65e8 c4fa146c

+78 -13
+22 -5
Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml
··· 1 1 <refentry id="vidioc-dv-timings-cap"> 2 2 <refmeta> 3 - <refentrytitle>ioctl VIDIOC_DV_TIMINGS_CAP</refentrytitle> 3 + <refentrytitle>ioctl VIDIOC_DV_TIMINGS_CAP, VIDIOC_SUBDEV_DV_TIMINGS_CAP</refentrytitle> 4 4 &manvol; 5 5 </refmeta> 6 6 7 7 <refnamediv> 8 8 <refname>VIDIOC_DV_TIMINGS_CAP</refname> 9 + <refname>VIDIOC_SUBDEV_DV_TIMINGS_CAP</refname> 9 10 <refpurpose>The capabilities of the Digital Video receiver/transmitter</refpurpose> 10 11 </refnamediv> 11 12 ··· 34 33 <varlistentry> 35 34 <term><parameter>request</parameter></term> 36 35 <listitem> 37 - <para>VIDIOC_DV_TIMINGS_CAP</para> 36 + <para>VIDIOC_DV_TIMINGS_CAP, VIDIOC_SUBDEV_DV_TIMINGS_CAP</para> 38 37 </listitem> 39 38 </varlistentry> 40 39 <varlistentry> ··· 55 54 interface and may change in the future.</para> 56 55 </note> 57 56 58 - <para>To query the capabilities of the DV receiver/transmitter applications can call 59 - this ioctl and the driver will fill in the structure. Note that drivers may return 57 + <para>To query the capabilities of the DV receiver/transmitter applications 58 + can call the <constant>VIDIOC_DV_TIMINGS_CAP</constant> ioctl on a video node 59 + and the driver will fill in the structure. Note that drivers may return 60 60 different values after switching the video input or output.</para> 61 + 62 + <para>When implemented by the driver DV capabilities of subdevices can be 63 + queried by calling the <constant>VIDIOC_SUBDEV_DV_TIMINGS_CAP</constant> ioctl 64 + directly on a subdevice node. The capabilities are specific to inputs (for DV 65 + receivers) or outputs (for DV transmitters), applications must specify the 66 + desired pad number in the &v4l2-dv-timings-cap; <structfield>pad</structfield> 67 + field. Attempts to query capabilities on a pad that doesn't support them will 68 + return an &EINVAL;.</para> 61 69 62 70 <table pgwide="1" frame="none" id="v4l2-bt-timings-cap"> 63 71 <title>struct <structname>v4l2_bt_timings_cap</structname></title> ··· 137 127 </row> 138 128 <row> 139 129 <entry>__u32</entry> 140 - <entry><structfield>reserved</structfield>[3]</entry> 130 + <entry><structfield>pad</structfield></entry> 131 + <entry>Pad number as reported by the media controller API. This field 132 + is only used when operating on a subdevice node. When operating on a 133 + video node applications must set this field to zero.</entry> 134 + </row> 135 + <row> 136 + <entry>__u32</entry> 137 + <entry><structfield>reserved</structfield>[2]</entry> 141 138 <entry>Reserved for future extensions. Drivers must set the array to zero.</entry> 142 139 </row> 143 140 <row>
+23 -7
Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml
··· 1 1 <refentry id="vidioc-enum-dv-timings"> 2 2 <refmeta> 3 - <refentrytitle>ioctl VIDIOC_ENUM_DV_TIMINGS</refentrytitle> 3 + <refentrytitle>ioctl VIDIOC_ENUM_DV_TIMINGS, VIDIOC_SUBDEV_ENUM_DV_TIMINGS</refentrytitle> 4 4 &manvol; 5 5 </refmeta> 6 6 7 7 <refnamediv> 8 8 <refname>VIDIOC_ENUM_DV_TIMINGS</refname> 9 + <refname>VIDIOC_SUBDEV_ENUM_DV_TIMINGS</refname> 9 10 <refpurpose>Enumerate supported Digital Video timings</refpurpose> 10 11 </refnamediv> 11 12 ··· 34 33 <varlistentry> 35 34 <term><parameter>request</parameter></term> 36 35 <listitem> 37 - <para>VIDIOC_ENUM_DV_TIMINGS</para> 36 + <para>VIDIOC_ENUM_DV_TIMINGS, VIDIOC_SUBDEV_ENUM_DV_TIMINGS</para> 38 37 </listitem> 39 38 </varlistentry> 40 39 <varlistentry> ··· 62 61 63 62 <para>To query the available timings, applications initialize the 64 63 <structfield>index</structfield> field and zero the reserved array of &v4l2-enum-dv-timings; 65 - and call the <constant>VIDIOC_ENUM_DV_TIMINGS</constant> ioctl with a pointer to this 66 - structure. Drivers fill the rest of the structure or return an 64 + and call the <constant>VIDIOC_ENUM_DV_TIMINGS</constant> ioctl on a video node with a 65 + pointer to this structure. Drivers fill the rest of the structure or return an 67 66 &EINVAL; when the index is out of bounds. To enumerate all supported DV timings, 68 67 applications shall begin at index zero, incrementing by one until the 69 68 driver returns <errorcode>EINVAL</errorcode>. Note that drivers may enumerate a 70 69 different set of DV timings after switching the video input or 71 70 output.</para> 71 + 72 + <para>When implemented by the driver DV timings of subdevices can be queried 73 + by calling the <constant>VIDIOC_SUBDEV_ENUM_DV_TIMINGS</constant> ioctl directly 74 + on a subdevice node. The DV timings are specific to inputs (for DV receivers) or 75 + outputs (for DV transmitters), applications must specify the desired pad number 76 + in the &v4l2-enum-dv-timings; <structfield>pad</structfield> field. Attempts to 77 + enumerate timings on a pad that doesn't support them will return an &EINVAL;.</para> 72 78 73 79 <table pgwide="1" frame="none" id="v4l2-enum-dv-timings"> 74 80 <title>struct <structname>v4l2_enum_dv_timings</structname></title> ··· 90 82 </row> 91 83 <row> 92 84 <entry>__u32</entry> 93 - <entry><structfield>reserved</structfield>[3]</entry> 94 - <entry>Reserved for future extensions. Drivers must set the array to zero.</entry> 85 + <entry><structfield>pad</structfield></entry> 86 + <entry>Pad number as reported by the media controller API. This field 87 + is only used when operating on a subdevice node. When operating on a 88 + video node applications must set this field to zero.</entry> 89 + </row> 90 + <row> 91 + <entry>__u32</entry> 92 + <entry><structfield>reserved</structfield>[2]</entry> 93 + <entry>Reserved for future extensions. Drivers and applications must 94 + set the array to zero.</entry> 95 95 </row> 96 96 <row> 97 97 <entry>&v4l2-dv-timings;</entry> ··· 119 103 <term><errorcode>EINVAL</errorcode></term> 120 104 <listitem> 121 105 <para>The &v4l2-enum-dv-timings; <structfield>index</structfield> 122 - is out of bounds.</para> 106 + is out of bounds or the <structfield>pad</structfield> number is invalid.</para> 123 107 </listitem> 124 108 </varlistentry> 125 109 <varlistentry>
+27
drivers/media/v4l2-core/v4l2-subdev.c
··· 366 366 367 367 case VIDIOC_S_EDID: 368 368 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); 369 396 #endif 370 397 default: 371 398 return v4l2_subdev_call(sd, core, ioctl, cmd, arg);
+6 -1
include/uapi/linux/v4l2-subdev.h
··· 162 162 #define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop) 163 163 #define VIDIOC_SUBDEV_G_SELECTION _IOWR('V', 61, struct v4l2_subdev_selection) 164 164 #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 */ 166 166 #define VIDIOC_SUBDEV_G_EDID _IOWR('V', 40, struct v4l2_edid) 167 167 #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) 168 173 169 174 #endif