查看设备结构体:
struct xvip_composite_device {
struct v4l2_device v4l2_dev;
struct media_device media_dev;
struct device *dev;
struct v4l2_async_notifier notifier;
struct list_head entities;
unsigned int num_subdevs;
struct list_head dmas;
u32 v4l2_caps;
};
由上面可知xvipp为一个v4l2设备,同时将其加入media框架中,notifier为v4l2同步子设备的通知器,即子设备被注册后,通知消息将会添加到该结构体中。同时定一个entites链表,用来保存整个pipeline通路上的实体。同时定义一个DMA通道的链表。
下面看一下probe函数:
static int xvip_composite_probe(struct platform_device *pdev)
{
struct xvip_composite_device *xdev;
int ret;
xdev = devm_kzalloc(&pdev->dev, sizeof(*xdev), GFP_KERNEL);
if (!xdev)
return -ENOMEM;
xdev->dev = &pdev->dev;
INIT_LIST_HEAD(&xdev->entities);
INIT_LIST_HEAD(&xdev->dmas);
ret = xvip_composite_v4l2_init(xdev);
if (ret < 0)
return ret;
ret = xvip_graph_init(xdev);
if (ret < 0)
goto error;
platfor