diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/videodev2.h | 29 | ||||
-rw-r--r-- | include/media/v4l2-ctrls.h | 23 | ||||
-rw-r--r-- | include/media/v4l2-event.h | 2 |
3 files changed, 47 insertions, 7 deletions
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 8a4c309d2344..baafe2f2e02a 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
@@ -1791,6 +1791,7 @@ struct v4l2_streamparm { | |||
1791 | #define V4L2_EVENT_ALL 0 | 1791 | #define V4L2_EVENT_ALL 0 |
1792 | #define V4L2_EVENT_VSYNC 1 | 1792 | #define V4L2_EVENT_VSYNC 1 |
1793 | #define V4L2_EVENT_EOS 2 | 1793 | #define V4L2_EVENT_EOS 2 |
1794 | #define V4L2_EVENT_CTRL 3 | ||
1794 | #define V4L2_EVENT_PRIVATE_START 0x08000000 | 1795 | #define V4L2_EVENT_PRIVATE_START 0x08000000 |
1795 | 1796 | ||
1796 | /* Payload for V4L2_EVENT_VSYNC */ | 1797 | /* Payload for V4L2_EVENT_VSYNC */ |
@@ -1799,21 +1800,45 @@ struct v4l2_event_vsync { | |||
1799 | __u8 field; | 1800 | __u8 field; |
1800 | } __attribute__ ((packed)); | 1801 | } __attribute__ ((packed)); |
1801 | 1802 | ||
1803 | /* Payload for V4L2_EVENT_CTRL */ | ||
1804 | #define V4L2_EVENT_CTRL_CH_VALUE (1 << 0) | ||
1805 | #define V4L2_EVENT_CTRL_CH_FLAGS (1 << 1) | ||
1806 | |||
1807 | struct v4l2_event_ctrl { | ||
1808 | __u32 changes; | ||
1809 | __u32 type; | ||
1810 | union { | ||
1811 | __s32 value; | ||
1812 | __s64 value64; | ||
1813 | }; | ||
1814 | __u32 flags; | ||
1815 | __s32 minimum; | ||
1816 | __s32 maximum; | ||
1817 | __s32 step; | ||
1818 | __s32 default_value; | ||
1819 | }; | ||
1820 | |||
1802 | struct v4l2_event { | 1821 | struct v4l2_event { |
1803 | __u32 type; | 1822 | __u32 type; |
1804 | union { | 1823 | union { |
1805 | struct v4l2_event_vsync vsync; | 1824 | struct v4l2_event_vsync vsync; |
1825 | struct v4l2_event_ctrl ctrl; | ||
1806 | __u8 data[64]; | 1826 | __u8 data[64]; |
1807 | } u; | 1827 | } u; |
1808 | __u32 pending; | 1828 | __u32 pending; |
1809 | __u32 sequence; | 1829 | __u32 sequence; |
1810 | struct timespec timestamp; | 1830 | struct timespec timestamp; |
1811 | __u32 reserved[9]; | 1831 | __u32 id; |
1832 | __u32 reserved[8]; | ||
1812 | }; | 1833 | }; |
1813 | 1834 | ||
1835 | #define V4L2_EVENT_SUB_FL_SEND_INITIAL (1 << 0) | ||
1836 | |||
1814 | struct v4l2_event_subscription { | 1837 | struct v4l2_event_subscription { |
1815 | __u32 type; | 1838 | __u32 type; |
1816 | __u32 reserved[7]; | 1839 | __u32 id; |
1840 | __u32 flags; | ||
1841 | __u32 reserved[5]; | ||
1817 | }; | 1842 | }; |
1818 | 1843 | ||
1819 | /* | 1844 | /* |
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index e720f11a56fd..c45bf40e080d 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h | |||
@@ -28,9 +28,10 @@ | |||
28 | /* forward references */ | 28 | /* forward references */ |
29 | struct v4l2_ctrl_handler; | 29 | struct v4l2_ctrl_handler; |
30 | struct v4l2_ctrl; | 30 | struct v4l2_ctrl; |
31 | struct v4l2_fh; | ||
32 | struct video_device; | 31 | struct video_device; |
33 | struct v4l2_subdev; | 32 | struct v4l2_subdev; |
33 | struct v4l2_event_subscription; | ||
34 | struct v4l2_fh; | ||
34 | 35 | ||
35 | /** struct v4l2_ctrl_ops - The control operations that the driver has to provide. | 36 | /** struct v4l2_ctrl_ops - The control operations that the driver has to provide. |
36 | * @g_volatile_ctrl: Get a new value for this control. Generally only relevant | 37 | * @g_volatile_ctrl: Get a new value for this control. Generally only relevant |
@@ -107,6 +108,7 @@ struct v4l2_ctrl_ops { | |||
107 | struct v4l2_ctrl { | 108 | struct v4l2_ctrl { |
108 | /* Administrative fields */ | 109 | /* Administrative fields */ |
109 | struct list_head node; | 110 | struct list_head node; |
111 | struct list_head fhs; | ||
110 | struct v4l2_ctrl_handler *handler; | 112 | struct v4l2_ctrl_handler *handler; |
111 | struct v4l2_ctrl **cluster; | 113 | struct v4l2_ctrl **cluster; |
112 | unsigned ncontrols; | 114 | unsigned ncontrols; |
@@ -180,6 +182,11 @@ struct v4l2_ctrl_handler { | |||
180 | int error; | 182 | int error; |
181 | }; | 183 | }; |
182 | 184 | ||
185 | struct v4l2_ctrl_fh { | ||
186 | struct list_head node; | ||
187 | struct v4l2_fh *fh; | ||
188 | }; | ||
189 | |||
183 | /** struct v4l2_ctrl_config - Control configuration structure. | 190 | /** struct v4l2_ctrl_config - Control configuration structure. |
184 | * @ops: The control ops. | 191 | * @ops: The control ops. |
185 | * @id: The control ID. | 192 | * @id: The control ID. |
@@ -425,9 +432,9 @@ struct v4l2_ctrl *v4l2_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id); | |||
425 | * This sets or clears the V4L2_CTRL_FLAG_INACTIVE flag atomically. | 432 | * This sets or clears the V4L2_CTRL_FLAG_INACTIVE flag atomically. |
426 | * Does nothing if @ctrl == NULL. | 433 | * Does nothing if @ctrl == NULL. |
427 | * This will usually be called from within the s_ctrl op. | 434 | * This will usually be called from within the s_ctrl op. |
435 | * The V4L2_EVENT_CTRL event will be generated afterwards. | ||
428 | * | 436 | * |
429 | * This function can be called regardless of whether the control handler | 437 | * This function assumes that the control handler is locked. |
430 | * is locked or not. | ||
431 | */ | 438 | */ |
432 | void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active); | 439 | void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active); |
433 | 440 | ||
@@ -437,11 +444,12 @@ void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active); | |||
437 | * | 444 | * |
438 | * This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically. | 445 | * This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically. |
439 | * Does nothing if @ctrl == NULL. | 446 | * Does nothing if @ctrl == NULL. |
447 | * The V4L2_EVENT_CTRL event will be generated afterwards. | ||
440 | * This will usually be called when starting or stopping streaming in the | 448 | * This will usually be called when starting or stopping streaming in the |
441 | * driver. | 449 | * driver. |
442 | * | 450 | * |
443 | * This function can be called regardless of whether the control handler | 451 | * This function assumes that the control handler is not locked and will |
444 | * is locked or not. | 452 | * take the lock itself. |
445 | */ | 453 | */ |
446 | void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed); | 454 | void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed); |
447 | 455 | ||
@@ -486,6 +494,11 @@ s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl); | |||
486 | */ | 494 | */ |
487 | int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val); | 495 | int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val); |
488 | 496 | ||
497 | void v4l2_ctrl_add_fh(struct v4l2_ctrl_handler *hdl, | ||
498 | struct v4l2_ctrl_fh *ctrl_fh, | ||
499 | struct v4l2_event_subscription *sub); | ||
500 | void v4l2_ctrl_del_fh(struct v4l2_ctrl *ctrl, struct v4l2_fh *fh); | ||
501 | |||
489 | /* Helpers for ioctl_ops. If hdl == NULL then they will all return -EINVAL. */ | 502 | /* Helpers for ioctl_ops. If hdl == NULL then they will all return -EINVAL. */ |
490 | int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc); | 503 | int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc); |
491 | int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm); | 504 | int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm); |
diff --git a/include/media/v4l2-event.h b/include/media/v4l2-event.h index 3b86177c8cd2..45e9c1e05513 100644 --- a/include/media/v4l2-event.h +++ b/include/media/v4l2-event.h | |||
@@ -40,6 +40,7 @@ struct v4l2_kevent { | |||
40 | struct v4l2_subscribed_event { | 40 | struct v4l2_subscribed_event { |
41 | struct list_head list; | 41 | struct list_head list; |
42 | u32 type; | 42 | u32 type; |
43 | u32 id; | ||
43 | }; | 44 | }; |
44 | 45 | ||
45 | struct v4l2_events { | 46 | struct v4l2_events { |
@@ -58,6 +59,7 @@ void v4l2_event_free(struct v4l2_fh *fh); | |||
58 | int v4l2_event_dequeue(struct v4l2_fh *fh, struct v4l2_event *event, | 59 | int v4l2_event_dequeue(struct v4l2_fh *fh, struct v4l2_event *event, |
59 | int nonblocking); | 60 | int nonblocking); |
60 | void v4l2_event_queue(struct video_device *vdev, const struct v4l2_event *ev); | 61 | void v4l2_event_queue(struct video_device *vdev, const struct v4l2_event *ev); |
62 | void v4l2_event_queue_fh(struct v4l2_fh *fh, const struct v4l2_event *ev); | ||
61 | int v4l2_event_pending(struct v4l2_fh *fh); | 63 | int v4l2_event_pending(struct v4l2_fh *fh); |
62 | int v4l2_event_subscribe(struct v4l2_fh *fh, | 64 | int v4l2_event_subscribe(struct v4l2_fh *fh, |
63 | struct v4l2_event_subscription *sub); | 65 | struct v4l2_event_subscription *sub); |