-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 252196 b: refs/heads/master c: 4ffc2d8 h: refs/heads/master v: v3
- Loading branch information
Laurent Pinchart
authored and
Mauro Carvalho Chehab
committed
May 25, 2011
1 parent
cee452a
commit 28b0d54
Showing
5 changed files
with
137 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 5a254d751e52e0f817090c29950d16cf18490d5b | ||
refs/heads/master: 4ffc2d89f38a7fbb3b24adb7fb066a159c351c11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
uvcvideo-objs := uvc_driver.o uvc_queue.o uvc_v4l2.o uvc_video.o uvc_ctrl.o \ | ||
uvc_status.o uvc_isight.o | ||
ifeq ($(CONFIG_MEDIA_CONTROLLER),y) | ||
uvcvideo-objs += uvc_entity.o | ||
endif | ||
obj-$(CONFIG_USB_VIDEO_CLASS) += uvcvideo.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* | ||
* uvc_entity.c -- USB Video Class driver | ||
* | ||
* Copyright (C) 2005-2011 | ||
* Laurent Pinchart (laurent.pinchart@ideasonboard.com) | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
*/ | ||
|
||
#include <linux/kernel.h> | ||
#include <linux/list.h> | ||
#include <linux/videodev2.h> | ||
|
||
#include <media/v4l2-common.h> | ||
|
||
#include "uvcvideo.h" | ||
|
||
/* ------------------------------------------------------------------------ | ||
* Video subdevices registration and unregistration | ||
*/ | ||
|
||
static int uvc_mc_register_entity(struct uvc_video_chain *chain, | ||
struct uvc_entity *entity) | ||
{ | ||
const u32 flags = MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE; | ||
struct uvc_entity *remote; | ||
unsigned int i; | ||
u8 remote_pad; | ||
int ret; | ||
|
||
for (i = 0; i < entity->num_pads; ++i) { | ||
if (!(entity->pads[i].flags & MEDIA_PAD_FL_SINK)) | ||
continue; | ||
|
||
remote = uvc_entity_by_id(chain->dev, entity->baSourceID[i]); | ||
if (remote == NULL) | ||
return -EINVAL; | ||
|
||
remote_pad = remote->num_pads - 1; | ||
ret = media_entity_create_link(&remote->subdev.entity, | ||
remote_pad, &entity->subdev.entity, i, flags); | ||
if (ret < 0) | ||
return ret; | ||
} | ||
|
||
return v4l2_device_register_subdev(&chain->dev->vdev, &entity->subdev); | ||
} | ||
|
||
static struct v4l2_subdev_ops uvc_subdev_ops = { | ||
}; | ||
|
||
void uvc_mc_cleanup_entity(struct uvc_entity *entity) | ||
{ | ||
media_entity_cleanup(&entity->subdev.entity); | ||
} | ||
|
||
static int uvc_mc_init_entity(struct uvc_entity *entity) | ||
{ | ||
v4l2_subdev_init(&entity->subdev, &uvc_subdev_ops); | ||
strlcpy(entity->subdev.name, entity->name, sizeof(entity->subdev.name)); | ||
|
||
return media_entity_init(&entity->subdev.entity, entity->num_pads, | ||
entity->pads, 0); | ||
} | ||
|
||
int uvc_mc_register_entities(struct uvc_video_chain *chain) | ||
{ | ||
struct uvc_entity *entity; | ||
int ret; | ||
|
||
list_for_each_entry(entity, &chain->entities, chain) { | ||
ret = uvc_mc_init_entity(entity); | ||
if (ret < 0) { | ||
uvc_printk(KERN_INFO, "Failed to initialize entity for " | ||
"entity %u\n", entity->id); | ||
return ret; | ||
} | ||
} | ||
|
||
list_for_each_entry(entity, &chain->entities, chain) { | ||
ret = uvc_mc_register_entity(chain, entity); | ||
if (ret < 0) { | ||
uvc_printk(KERN_INFO, "Failed to register entity for " | ||
"entity %u\n", entity->id); | ||
return ret; | ||
} | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters