diff options
author | Laurent Pinchart <laurent.pinchart@skynet.be> | 2009-07-01 19:24:47 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-09-12 11:18:33 -0400 |
commit | 8e113595edf0741b45ba10ba88cb5d077787c155 (patch) | |
tree | 3b2d7b940445989586ad198d2c5c974432d97618 /drivers/media/video/uvc/uvcvideo.h | |
parent | 35f02a681b72ece756cf005e17f305a72329c140 (diff) |
V4L/DVB (12379): uvcvideo: Multiple streaming interfaces support
Restructure the UVC descriptors parsing code to handle multiple streaming
interfaces. The driver now creates a uvc_video_chain instance for each chain
detected in the UVC control interface descriptors, and tries to register one
video device per streaming endpoint.
Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/uvc/uvcvideo.h')
-rw-r--r-- | drivers/media/video/uvc/uvcvideo.h | 59 |
1 files changed, 31 insertions, 28 deletions
diff --git a/drivers/media/video/uvc/uvcvideo.h b/drivers/media/video/uvc/uvcvideo.h index 3cd9041e22a1..e7958aa454ce 100644 --- a/drivers/media/video/uvc/uvcvideo.h +++ b/drivers/media/video/uvc/uvcvideo.h | |||
@@ -80,9 +80,11 @@ struct uvc_xu_control { | |||
80 | #define UVC_ENTITY_IS_UNIT(entity) (((entity)->type & 0xff00) == 0) | 80 | #define UVC_ENTITY_IS_UNIT(entity) (((entity)->type & 0xff00) == 0) |
81 | #define UVC_ENTITY_IS_TERM(entity) (((entity)->type & 0xff00) != 0) | 81 | #define UVC_ENTITY_IS_TERM(entity) (((entity)->type & 0xff00) != 0) |
82 | #define UVC_ENTITY_IS_ITERM(entity) \ | 82 | #define UVC_ENTITY_IS_ITERM(entity) \ |
83 | (((entity)->type & 0x8000) == UVC_TERM_INPUT) | 83 | (UVC_ENTITY_IS_TERM(entity) && \ |
84 | ((entity)->type & 0x8000) == UVC_TERM_INPUT) | ||
84 | #define UVC_ENTITY_IS_OTERM(entity) \ | 85 | #define UVC_ENTITY_IS_OTERM(entity) \ |
85 | (((entity)->type & 0x8000) == UVC_TERM_OUTPUT) | 86 | (UVC_ENTITY_IS_TERM(entity) && \ |
87 | ((entity)->type & 0x8000) == UVC_TERM_OUTPUT) | ||
86 | 88 | ||
87 | 89 | ||
88 | /* ------------------------------------------------------------------------ | 90 | /* ------------------------------------------------------------------------ |
@@ -402,10 +404,24 @@ struct uvc_video_queue { | |||
402 | struct list_head irqqueue; | 404 | struct list_head irqqueue; |
403 | }; | 405 | }; |
404 | 406 | ||
407 | struct uvc_video_chain { | ||
408 | struct uvc_device *dev; | ||
409 | struct list_head list; | ||
410 | |||
411 | struct list_head iterms; /* Input terminals */ | ||
412 | struct list_head oterms; /* Output terminals */ | ||
413 | struct uvc_entity *processing; /* Processing unit */ | ||
414 | struct uvc_entity *selector; /* Selector unit */ | ||
415 | struct list_head extensions; /* Extension units */ | ||
416 | |||
417 | struct mutex ctrl_mutex; | ||
418 | }; | ||
419 | |||
405 | struct uvc_streaming { | 420 | struct uvc_streaming { |
406 | struct list_head list; | 421 | struct list_head list; |
407 | struct uvc_device *dev; | 422 | struct uvc_device *dev; |
408 | struct video_device *vdev; | 423 | struct video_device *vdev; |
424 | struct uvc_video_chain *chain; | ||
409 | atomic_t active; | 425 | atomic_t active; |
410 | 426 | ||
411 | struct usb_interface *intf; | 427 | struct usb_interface *intf; |
@@ -446,18 +462,6 @@ struct uvc_streaming { | |||
446 | __u8 last_fid; | 462 | __u8 last_fid; |
447 | }; | 463 | }; |
448 | 464 | ||
449 | struct uvc_video_device { | ||
450 | struct uvc_device *dev; | ||
451 | |||
452 | struct list_head iterms; /* Input terminals */ | ||
453 | struct uvc_entity *oterm; /* Output terminal */ | ||
454 | struct uvc_entity *sterm; /* USB streaming terminal */ | ||
455 | struct uvc_entity *processing; | ||
456 | struct uvc_entity *selector; | ||
457 | struct list_head extensions; | ||
458 | struct mutex ctrl_mutex; | ||
459 | }; | ||
460 | |||
461 | enum uvc_device_state { | 465 | enum uvc_device_state { |
462 | UVC_DEV_DISCONNECTED = 1, | 466 | UVC_DEV_DISCONNECTED = 1, |
463 | }; | 467 | }; |
@@ -480,8 +484,7 @@ struct uvc_device { | |||
480 | __u32 clock_frequency; | 484 | __u32 clock_frequency; |
481 | 485 | ||
482 | struct list_head entities; | 486 | struct list_head entities; |
483 | 487 | struct list_head chains; | |
484 | struct uvc_video_device video; | ||
485 | 488 | ||
486 | /* Video Streaming interfaces */ | 489 | /* Video Streaming interfaces */ |
487 | struct list_head streams; | 490 | struct list_head streams; |
@@ -500,7 +503,7 @@ enum uvc_handle_state { | |||
500 | }; | 503 | }; |
501 | 504 | ||
502 | struct uvc_fh { | 505 | struct uvc_fh { |
503 | struct uvc_video_device *video; | 506 | struct uvc_video_chain *chain; |
504 | struct uvc_streaming *stream; | 507 | struct uvc_streaming *stream; |
505 | enum uvc_handle_state state; | 508 | enum uvc_handle_state state; |
506 | }; | 509 | }; |
@@ -618,9 +621,9 @@ extern int uvc_status_suspend(struct uvc_device *dev); | |||
618 | extern int uvc_status_resume(struct uvc_device *dev); | 621 | extern int uvc_status_resume(struct uvc_device *dev); |
619 | 622 | ||
620 | /* Controls */ | 623 | /* Controls */ |
621 | extern struct uvc_control *uvc_find_control(struct uvc_video_device *video, | 624 | extern struct uvc_control *uvc_find_control(struct uvc_video_chain *chain, |
622 | __u32 v4l2_id, struct uvc_control_mapping **mapping); | 625 | __u32 v4l2_id, struct uvc_control_mapping **mapping); |
623 | extern int uvc_query_v4l2_ctrl(struct uvc_video_device *video, | 626 | extern int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain, |
624 | struct v4l2_queryctrl *v4l2_ctrl); | 627 | struct v4l2_queryctrl *v4l2_ctrl); |
625 | 628 | ||
626 | extern int uvc_ctrl_add_info(struct uvc_control_info *info); | 629 | extern int uvc_ctrl_add_info(struct uvc_control_info *info); |
@@ -630,23 +633,23 @@ extern void uvc_ctrl_cleanup_device(struct uvc_device *dev); | |||
630 | extern int uvc_ctrl_resume_device(struct uvc_device *dev); | 633 | extern int uvc_ctrl_resume_device(struct uvc_device *dev); |
631 | extern void uvc_ctrl_init(void); | 634 | extern void uvc_ctrl_init(void); |
632 | 635 | ||
633 | extern int uvc_ctrl_begin(struct uvc_video_device *video); | 636 | extern int uvc_ctrl_begin(struct uvc_video_chain *chain); |
634 | extern int __uvc_ctrl_commit(struct uvc_video_device *video, int rollback); | 637 | extern int __uvc_ctrl_commit(struct uvc_video_chain *chain, int rollback); |
635 | static inline int uvc_ctrl_commit(struct uvc_video_device *video) | 638 | static inline int uvc_ctrl_commit(struct uvc_video_chain *chain) |
636 | { | 639 | { |
637 | return __uvc_ctrl_commit(video, 0); | 640 | return __uvc_ctrl_commit(chain, 0); |
638 | } | 641 | } |
639 | static inline int uvc_ctrl_rollback(struct uvc_video_device *video) | 642 | static inline int uvc_ctrl_rollback(struct uvc_video_chain *chain) |
640 | { | 643 | { |
641 | return __uvc_ctrl_commit(video, 1); | 644 | return __uvc_ctrl_commit(chain, 1); |
642 | } | 645 | } |
643 | 646 | ||
644 | extern int uvc_ctrl_get(struct uvc_video_device *video, | 647 | extern int uvc_ctrl_get(struct uvc_video_chain *chain, |
645 | struct v4l2_ext_control *xctrl); | 648 | struct v4l2_ext_control *xctrl); |
646 | extern int uvc_ctrl_set(struct uvc_video_device *video, | 649 | extern int uvc_ctrl_set(struct uvc_video_chain *chain, |
647 | struct v4l2_ext_control *xctrl); | 650 | struct v4l2_ext_control *xctrl); |
648 | 651 | ||
649 | extern int uvc_xu_ctrl_query(struct uvc_video_device *video, | 652 | extern int uvc_xu_ctrl_query(struct uvc_video_chain *chain, |
650 | struct uvc_xu_control *ctrl, int set); | 653 | struct uvc_xu_control *ctrl, int set); |
651 | 654 | ||
652 | /* Utility functions */ | 655 | /* Utility functions */ |