aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-08-03 03:35:10 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-11-28 07:30:00 -0500
commit8be8ec6ea58bd77338f6ffa2f6d2acfc88b835f4 (patch)
tree8bf7dcb4b5bead6f0cd726013b5493867d53b376 /drivers/media
parent0550513c7a559b4933c5e1d47fbd15d15f6078d5 (diff)
[media] uvcvideo: Mark first output terminal as default video node
The MEDIA_ENT_FL_DEFAULT identifies entities that are considered as default for their group and type. For video nodes, it identifies the node that application should use by default. UVC devices don't report which output terminal should be considered as the default, use the first one. Most devices have a single output terminal anyway. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/usb/uvc/uvc_driver.c2
-rw-r--r--drivers/media/usb/uvc/uvc_entity.c2
-rw-r--r--drivers/media/usb/uvc/uvcvideo.h4
3 files changed, 8 insertions, 0 deletions
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 22f14d286fbb..5dbefa68b1d2 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -1564,6 +1564,8 @@ static int uvc_scan_device(struct uvc_device *dev)
1564 chain->dev = dev; 1564 chain->dev = dev;
1565 v4l2_prio_init(&chain->prio); 1565 v4l2_prio_init(&chain->prio);
1566 1566
1567 term->flags |= UVC_ENTITY_FLAG_DEFAULT;
1568
1567 if (uvc_scan_chain(chain, term) < 0) { 1569 if (uvc_scan_chain(chain, term) < 0) {
1568 kfree(chain); 1570 kfree(chain);
1569 continue; 1571 continue;
diff --git a/drivers/media/usb/uvc/uvc_entity.c b/drivers/media/usb/uvc/uvc_entity.c
index 29e239911d0e..dc56a59ecadc 100644
--- a/drivers/media/usb/uvc/uvc_entity.c
+++ b/drivers/media/usb/uvc/uvc_entity.c
@@ -93,6 +93,8 @@ static int uvc_mc_init_entity(struct uvc_entity *entity)
93 } else if (entity->vdev != NULL) { 93 } else if (entity->vdev != NULL) {
94 ret = media_entity_init(&entity->vdev->entity, 94 ret = media_entity_init(&entity->vdev->entity,
95 entity->num_pads, entity->pads, 0); 95 entity->num_pads, entity->pads, 0);
96 if (entity->flags & UVC_ENTITY_FLAG_DEFAULT)
97 entity->vdev->entity.flags |= MEDIA_ENT_FL_DEFAULT;
96 } else 98 } else
97 ret = 0; 99 ret = 0;
98 100
diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
index 006ae274d22e..af505fdd9b3f 100644
--- a/drivers/media/usb/uvc/uvcvideo.h
+++ b/drivers/media/usb/uvc/uvcvideo.h
@@ -225,10 +225,14 @@ struct uvc_format_desc {
225 * always be accessed with the UVC_ENTITY_* macros and never directly. 225 * always be accessed with the UVC_ENTITY_* macros and never directly.
226 */ 226 */
227 227
228#define UVC_ENTITY_FLAG_DEFAULT (1 << 0)
229
228struct uvc_entity { 230struct uvc_entity {
229 struct list_head list; /* Entity as part of a UVC device. */ 231 struct list_head list; /* Entity as part of a UVC device. */
230 struct list_head chain; /* Entity as part of a video device 232 struct list_head chain; /* Entity as part of a video device
231 * chain. */ 233 * chain. */
234 unsigned int flags;
235
232 __u8 id; 236 __u8 id;
233 __u16 type; 237 __u16 type;
234 char name[64]; 238 char name[64];