您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ video_device_node_name函数代码示例

51自学网 2021-06-03 09:39:49
  C++
这篇教程C++ video_device_node_name函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中video_device_node_name函数的典型用法代码示例。如果您正苦于以下问题:C++ video_device_node_name函数的具体用法?C++ video_device_node_name怎么用?C++ video_device_node_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了video_device_node_name函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: fimc_md_register_video_nodes

static int fimc_md_register_video_nodes(struct fimc_md *fmd){	struct video_device *vdev;	int i, ret = 0;	for (i = 0; i < FIMC_MAX_DEVS && !ret; i++) {		if (!fmd->fimc[i])			continue;		vdev = fmd->fimc[i]->m2m.vfd;		if (vdev) {			ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1);			if (ret)				break;			v4l2_info(&fmd->v4l2_dev, "Registered %s as /dev/%s/n",				  vdev->name, video_device_node_name(vdev));		}		vdev = fmd->fimc[i]->vid_cap.vfd;		if (vdev == NULL)			continue;		ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1);		v4l2_info(&fmd->v4l2_dev, "Registered %s as /dev/%s/n",			  vdev->name, video_device_node_name(vdev));	}	return ret;}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:28,


示例2: ts_open

static int ts_open(struct file *file){	struct video_device *vdev = video_devdata(file);	struct saa7134_dev *dev = video_drvdata(file);	int err;	dprintk("open dev=%s/n", video_device_node_name(vdev));	err = -EBUSY;	if (!mutex_trylock(&dev->empress_tsq.vb_lock))		return err;	if (atomic_read(&dev->empress_users))		goto done;	/* Unmute audio */	saa_writeb(SAA7134_AUDIO_MUTE_CTRL,		saa_readb(SAA7134_AUDIO_MUTE_CTRL) & ~(1 << 6));	atomic_inc(&dev->empress_users);	file->private_data = dev;	err = 0;done:	mutex_unlock(&dev->empress_tsq.vb_lock);	return err;}
开发者ID:KaZoom,项目名称:buildroot-linux-kernel-m3,代码行数:25,


示例3: omap24xxcam_device_register

static int omap24xxcam_device_register(struct v4l2_int_device *s){	struct omap24xxcam_device *cam = s->u.slave->master->priv;	struct video_device *vfd;	int rval;	/* We already have a slave. */	if (cam->sdev)		return -EBUSY;	cam->sdev = s;	if (device_create_file(cam->dev, &dev_attr_streaming) != 0) {		dev_err(cam->dev, "could not register sysfs entry/n");		rval = -EBUSY;		goto err;	}	/* initialize the video_device struct */	vfd = cam->vfd = video_device_alloc();	if (!vfd) {		dev_err(cam->dev, "could not allocate video device struct/n");		rval = -ENOMEM;		goto err;	}	vfd->release = video_device_release;	vfd->v4l2_dev = &cam->v4l2_dev;	strlcpy(vfd->name, CAM_NAME, sizeof(vfd->name));	vfd->fops		 = &omap24xxcam_fops;	vfd->ioctl_ops		 = &omap24xxcam_ioctl_fops;	omap24xxcam_hwinit(cam);	rval = omap24xxcam_sensor_init(cam);	if (rval)		goto err;	if (video_register_device(vfd, VFL_TYPE_GRABBER, video_nr) < 0) {		dev_err(cam->dev, "could not register V4L device/n");		rval = -EBUSY;		goto err;	}	omap24xxcam_poweron_reset(cam);	dev_info(cam->dev, "registered device %s/n",		 video_device_node_name(vfd));	return 0;err:	omap24xxcam_device_unregister(s);	return rval;}
开发者ID:03199618,项目名称:linux,代码行数:57,


示例4: fimc_register_m2m_device

int fimc_register_m2m_device(struct fimc_dev *fimc,			     struct v4l2_device *v4l2_dev){	struct video_device *vfd;	struct platform_device *pdev;	int ret = 0;	if (!fimc)		return -ENODEV;	pdev = fimc->pdev;	fimc->v4l2_dev = v4l2_dev;	vfd = video_device_alloc();	if (!vfd) {		v4l2_err(v4l2_dev, "Failed to allocate video device/n");		return -ENOMEM;	}	vfd->fops = &fimc_m2m_fops;	vfd->ioctl_ops = &fimc_m2m_ioctl_ops;	vfd->v4l2_dev = v4l2_dev;	vfd->minor = -1;	vfd->release = video_device_release;	vfd->lock = &fimc->lock;	snprintf(vfd->name, sizeof(vfd->name), "fimc.%d.m2m", fimc->id);	video_set_drvdata(vfd, fimc);	fimc->m2m.vfd = vfd;	fimc->m2m.m2m_dev = v4l2_m2m_init(&m2m_ops);	if (IS_ERR(fimc->m2m.m2m_dev)) {		v4l2_err(v4l2_dev, "failed to initialize v4l2-m2m device/n");		ret = PTR_ERR(fimc->m2m.m2m_dev);		goto err_init;	}	ret = media_entity_init(&vfd->entity, 0, NULL, 0);	if (ret)		goto err_me;	ret = video_register_device(vfd, VFL_TYPE_GRABBER, -1);	if (ret)		goto err_vd;	v4l2_info(v4l2_dev, "Registered %s as /dev/%s/n",		  vfd->name, video_device_node_name(vfd));	return 0;err_vd:	media_entity_cleanup(&vfd->entity);err_me:	v4l2_m2m_release(fimc->m2m.m2m_dev);err_init:	video_device_release(fimc->m2m.vfd);	return ret;}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:57,


示例5: rvin_v4l2_unregister

void rvin_v4l2_unregister(struct rvin_dev *vin){	if (!video_is_registered(&vin->vdev))		return;	v4l2_info(&vin->v4l2_dev, "Removing %s/n",		  video_device_node_name(&vin->vdev));	/* Checks internaly if vdev have been init or not */	video_unregister_device(&vin->vdev);}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:11,


示例6: rvin_v4l2_remove

void rvin_v4l2_remove(struct rvin_dev *vin){	v4l2_info(&vin->v4l2_dev, "Removing %s/n",		  video_device_node_name(&vin->vdev));	/* Checks internaly if handlers have been init or not */	v4l2_ctrl_handler_free(&vin->ctrl_handler);	/* Checks internaly if vdev have been init or not */	video_unregister_device(&vin->vdev);}
开发者ID:AshishNamdev,项目名称:linux,代码行数:11,


示例7: vivid_remove

static int vivid_remove(struct platform_device *pdev){	struct vivid_dev *dev;	unsigned i;	for (i = 0; vivid_devs[i]; i++) {		dev = vivid_devs[i];		if (dev->has_vid_cap) {			v4l2_info(&dev->v4l2_dev, "unregistering %s/n",				video_device_node_name(&dev->vid_cap_dev));			video_unregister_device(&dev->vid_cap_dev);		}		if (dev->has_vid_out) {			v4l2_info(&dev->v4l2_dev, "unregistering %s/n",				video_device_node_name(&dev->vid_out_dev));			video_unregister_device(&dev->vid_out_dev);		}		if (dev->has_vbi_cap) {			v4l2_info(&dev->v4l2_dev, "unregistering %s/n",				video_device_node_name(&dev->vbi_cap_dev));			video_unregister_device(&dev->vbi_cap_dev);		}		if (dev->has_vbi_out) {			v4l2_info(&dev->v4l2_dev, "unregistering %s/n",				video_device_node_name(&dev->vbi_out_dev));			video_unregister_device(&dev->vbi_out_dev);		}		if (dev->has_sdr_cap) {			v4l2_info(&dev->v4l2_dev, "unregistering %s/n",				video_device_node_name(&dev->sdr_cap_dev));			video_unregister_device(&dev->sdr_cap_dev);		}		if (dev->has_radio_rx) {			v4l2_info(&dev->v4l2_dev, "unregistering %s/n",				video_device_node_name(&dev->radio_rx_dev));			video_unregister_device(&dev->radio_rx_dev);		}		if (dev->has_radio_tx) {			v4l2_info(&dev->v4l2_dev, "unregistering %s/n",				video_device_node_name(&dev->radio_tx_dev));			video_unregister_device(&dev->radio_tx_dev);		}		if (dev->has_fb) {			v4l2_info(&dev->v4l2_dev, "unregistering fb%d/n",				dev->fb_info.node);			unregister_framebuffer(&dev->fb_info);			vivid_fb_release_buffers(dev);		}		v4l2_device_put(&dev->v4l2_dev);		vivid_devs[i] = NULL;	}	return 0;}
开发者ID:keeper,项目名称:backports,代码行数:54,


示例8: ivtv_reg_dev

static int ivtv_reg_dev(struct ivtv *itv, int type){	struct ivtv_stream *s = &itv->streams[type];	int vfl_type = ivtv_stream_info[type].vfl_type;	const char *name;	int num;	if (s->vdev == NULL)		return 0;	num = s->vdev->num;	/* card number + user defined offset + device offset */	if (type != IVTV_ENC_STREAM_TYPE_MPG) {		struct ivtv_stream *s_mpg = &itv->streams[IVTV_ENC_STREAM_TYPE_MPG];		if (s_mpg->vdev)			num = s_mpg->vdev->num + ivtv_stream_info[type].num_offset;	}	video_set_drvdata(s->vdev, s);	/* Register device. First try the desired minor, then any free one. */	if (video_register_device_no_warn(s->vdev, vfl_type, num)) {		IVTV_ERR("Couldn't register v4l2 device for %s (device node number %d)/n",				s->name, num);		video_device_release(s->vdev);		s->vdev = NULL;		return -ENOMEM;	}	name = video_device_node_name(s->vdev);	switch (vfl_type) {	case VFL_TYPE_GRABBER:		IVTV_INFO("Registered device %s for %s (%d kB)/n",			name, s->name, itv->options.kilobytes[type]);		break;	case VFL_TYPE_RADIO:		IVTV_INFO("Registered device %s for %s/n",			name, s->name);		break;	case VFL_TYPE_VBI:		if (itv->options.kilobytes[type])			IVTV_INFO("Registered device %s for %s (%d kB)/n",				name, s->name, itv->options.kilobytes[type]);		else			IVTV_INFO("Registered device %s for %s/n",				name, s->name);		break;	}	return 0;}
开发者ID:AllenWeb,项目名称:linux,代码行数:50,


示例9: video_open

static int video_open(struct file *file){	struct video_device *vdev = video_devdata(file);	struct cx25821_dev *dev = video_drvdata(file);	struct cx25821_fh *fh;	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;	u32 pix_format;	printk("open dev=%s type=%s/n", video_device_node_name(vdev),		v4l2_type_names[type]);	/* allocate + initialize per filehandle data */	fh = kzalloc(sizeof(*fh), GFP_KERNEL);	if (NULL == fh)		return -ENOMEM;	lock_kernel();	file->private_data = fh;	fh->dev = dev;	fh->type = type;	fh->width = 720;	if (dev->tvnorm & V4L2_STD_PAL_BG || dev->tvnorm & V4L2_STD_PAL_DK)		fh->height = 576;	else		fh->height = 480;	dev->channel_opened = SRAM_CH01;	pix_format =	    (dev->pixel_formats[dev->channel_opened] ==	     PIXEL_FRMT_411) ? V4L2_PIX_FMT_Y41P : V4L2_PIX_FMT_YUYV;	fh->fmt = format_by_fourcc(pix_format);	v4l2_prio_open(&dev->prio, &fh->prio);	videobuf_queue_sg_init(&fh->vidq, &cx25821_video_qops,			       &dev->pci->dev, &dev->slock,			       V4L2_BUF_TYPE_VIDEO_CAPTURE,			       V4L2_FIELD_INTERLACED,			       sizeof(struct cx25821_buffer), fh);	dprintk(1, "post videobuf_queue_init()/n");	unlock_kernel();	return 0;}
开发者ID:A2109devs,项目名称:lenovo_a2109a_kernel,代码行数:47,


示例10: rvin_v4l2_register

int rvin_v4l2_register(struct rvin_dev *vin){	struct video_device *vdev = &vin->vdev;	int ret;	vin->v4l2_dev.notify = rvin_notify;	/* video node */	vdev->v4l2_dev = &vin->v4l2_dev;	vdev->queue = &vin->queue;	snprintf(vdev->name, sizeof(vdev->name), "VIN%u output", vin->id);	vdev->release = video_device_release_empty;	vdev->lock = &vin->lock;	vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING |		V4L2_CAP_READWRITE;	/* Set a default format */	vin->format.pixelformat	= RVIN_DEFAULT_FORMAT;	vin->format.width = RVIN_DEFAULT_WIDTH;	vin->format.height = RVIN_DEFAULT_HEIGHT;	vin->format.field = RVIN_DEFAULT_FIELD;	vin->format.colorspace = RVIN_DEFAULT_COLORSPACE;	if (vin->info->use_mc) {		vdev->fops = &rvin_mc_fops;		vdev->ioctl_ops = &rvin_mc_ioctl_ops;	} else {		vdev->fops = &rvin_fops;		vdev->ioctl_ops = &rvin_ioctl_ops;		rvin_reset_format(vin);	}	rvin_format_align(vin, &vin->format);	ret = video_register_device(&vin->vdev, VFL_TYPE_GRABBER, -1);	if (ret) {		vin_err(vin, "Failed to register video device/n");		return ret;	}	video_set_drvdata(&vin->vdev, vin);	v4l2_info(&vin->v4l2_dev, "Device registered as %s/n",		  video_device_node_name(&vin->vdev));	return ret;}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:47,


示例11: fimc_register_m2m_device

int fimc_register_m2m_device(struct fimc_dev *fimc,                             struct v4l2_device *v4l2_dev){    struct video_device *vfd = &fimc->m2m.vfd;    int ret;    fimc->v4l2_dev = v4l2_dev;    memset(vfd, 0, sizeof(*vfd));    vfd->fops = &fimc_m2m_fops;    vfd->ioctl_ops = &fimc_m2m_ioctl_ops;    vfd->v4l2_dev = v4l2_dev;    vfd->minor = -1;    vfd->release = video_device_release_empty;    vfd->lock = &fimc->lock;    vfd->vfl_dir = VFL_DIR_M2M;    snprintf(vfd->name, sizeof(vfd->name), "fimc.%d.m2m", fimc->id);    video_set_drvdata(vfd, fimc);    fimc->m2m.m2m_dev = v4l2_m2m_init(&m2m_ops);    if (IS_ERR(fimc->m2m.m2m_dev)) {        v4l2_err(v4l2_dev, "failed to initialize v4l2-m2m device/n");        return PTR_ERR(fimc->m2m.m2m_dev);    }    ret = media_entity_init(&vfd->entity, 0, NULL, 0);    if (ret)        goto err_me;    ret = video_register_device(vfd, VFL_TYPE_GRABBER, -1);    if (ret)        goto err_vd;    v4l2_info(v4l2_dev, "Registered %s as /dev/%s/n",              vfd->name, video_device_node_name(vfd));    return 0;err_vd:    media_entity_cleanup(&vfd->entity);err_me:    v4l2_m2m_release(fimc->m2m.m2m_dev);    return ret;}
开发者ID:Niisp,项目名称:MT6795.kernel,代码行数:44,


示例12: stk1160_video_register

int stk1160_video_register(struct stk1160 *dev){	int rc;	/* Initialize video_device with a template structure */	dev->vdev = v4l_template;	dev->vdev.debug = vidioc_debug;	dev->vdev.queue = &dev->vb_vidq;	/*	 * Provide mutexes for v4l2 core and for videobuf2 queue.	 * It will be used to protect *only* v4l2 ioctls.	 */	dev->vdev.lock = &dev->v4l_lock;	dev->vdev.queue->lock = &dev->vb_queue_lock;	/* This will be used to set video_device parent */	dev->vdev.v4l2_dev = &dev->v4l2_dev;	set_bit(V4L2_FL_USE_FH_PRIO, &dev->vdev.flags);	/* NTSC is default */	dev->norm = V4L2_STD_NTSC_M;	dev->width = 720;	dev->height = 480;	/* set default format */	dev->fmt = &format[0];	stk1160_set_std(dev);	v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_std,			dev->norm);	video_set_drvdata(&dev->vdev, dev);	rc = video_register_device(&dev->vdev, VFL_TYPE_GRABBER, -1);	if (rc < 0) {		stk1160_err("video_register_device failed (%d)/n", rc);		return rc;	}	v4l2_info(&dev->v4l2_dev, "V4L2 device registered as %s/n",		  video_device_node_name(&dev->vdev));	return 0;}
开发者ID:cyberphox,项目名称:monoev3kernel,代码行数:44,


示例13: sd_probe

static int sd_probe(struct usb_interface *intf,				const struct usb_device_id *id){	struct gspca_dev *gspca_dev;	s32 ret;	ret = gspca_dev_probe(intf, id,			&sd_desc_mi1320, sizeof(struct sd), THIS_MODULE);	if (ret >= 0) {		gspca_dev = usb_get_intfdata(intf);		PDEBUG(D_PROBE,			"Camera is now controlling video device %s",			video_device_node_name(&gspca_dev->vdev));	}	return ret;}
开发者ID:Medvedroid,项目名称:OT_903D-kernel-2.6.35.7,代码行数:19,


示例14: empress_init

static int empress_init(struct saa7134_dev *dev){	int err;	dprintk("%s: %s/n",dev->name,__func__);	dev->empress_dev = video_device_alloc();	if (NULL == dev->empress_dev)		return -ENOMEM;	*(dev->empress_dev) = saa7134_empress_template;	dev->empress_dev->parent  = &dev->pci->dev;	dev->empress_dev->release = video_device_release;	snprintf(dev->empress_dev->name, sizeof(dev->empress_dev->name),		 "%s empress (%s)", dev->name,		 saa7134_boards[dev->board].name);	INIT_WORK(&dev->empress_workqueue, empress_signal_update);	video_set_drvdata(dev->empress_dev, dev);	err = video_register_device(dev->empress_dev,VFL_TYPE_GRABBER,				    empress_nr[dev->nr]);	if (err < 0) {		printk(KERN_INFO "%s: can't register video device/n",		       dev->name);		video_device_release(dev->empress_dev);		dev->empress_dev = NULL;		return err;	}	printk(KERN_INFO "%s: registered device %s [mpeg]/n",	       dev->name, video_device_node_name(dev->empress_dev));	videobuf_queue_sg_init(&dev->empress_tsq, &saa7134_ts_qops,			    &dev->pci->dev, &dev->slock,			    V4L2_BUF_TYPE_VIDEO_CAPTURE,			    V4L2_FIELD_ALTERNATE,			    sizeof(struct saa7134_buf),			    dev);	empress_signal_update(&dev->empress_workqueue);	return 0;}
开发者ID:KaZoom,项目名称:buildroot-linux-kernel-m3,代码行数:40,


示例15: tw68_initdev

//.........这里部分代码省略.........	pr_info("%s: found at %s, rev: %d, irq: %d, latency: %d, mmio: 0x%llx/n",		dev->name, pci_name(pci_dev), dev->pci_rev, pci_dev->irq,		dev->pci_lat, (u64)pci_resource_start(pci_dev, 0));	pci_set_master(pci_dev);	if (!pci_dma_supported(pci_dev, DMA_BIT_MASK(32))) {		pr_info("%s: Oops: no 32bit PCI DMA ???/n", dev->name);		err = -EIO;		goto fail1;	}	switch (pci_id->device) {	case PCI_DEVICE_ID_6800:	/* TW6800 */		dev->vdecoder = TW6800;		dev->board_virqmask = TW68_VID_INTS;		break;	case PCI_DEVICE_ID_6801:	/* Video decoder for TW6802 */		dev->vdecoder = TW6801;		dev->board_virqmask = TW68_VID_INTS | TW68_VID_INTSX;		break;	case PCI_DEVICE_ID_6804:	/* Video decoder for TW6804 */		dev->vdecoder = TW6804;		dev->board_virqmask = TW68_VID_INTS | TW68_VID_INTSX;		break;	default:		dev->vdecoder = TWXXXX;	/* To be announced */		dev->board_virqmask = TW68_VID_INTS | TW68_VID_INTSX;		break;	}	/* get mmio */	if (!request_mem_region(pci_resource_start(pci_dev, 0),				pci_resource_len(pci_dev, 0),				dev->name)) {		err = -EBUSY;		pr_err("%s: can't get MMIO memory @ 0x%llx/n",			dev->name,			(unsigned long long)pci_resource_start(pci_dev, 0));		goto fail1;	}	dev->lmmio = ioremap(pci_resource_start(pci_dev, 0),			     pci_resource_len(pci_dev, 0));	dev->bmmio = (__u8 __iomem *)dev->lmmio;	if (NULL == dev->lmmio) {		err = -EIO;		pr_err("%s: can't ioremap() MMIO memory/n",		       dev->name);		goto fail2;	}	/* initialize hardware #1 */	/* Then do any initialisation wanted before interrupts are on */	tw68_hw_init1(dev);	dev->alloc_ctx = vb2_dma_sg_init_ctx(&pci_dev->dev);	if (IS_ERR(dev->alloc_ctx)) {		err = PTR_ERR(dev->alloc_ctx);		goto fail3;	}	/* get irq */	err = devm_request_irq(&pci_dev->dev, pci_dev->irq, tw68_irq,			  IRQF_SHARED, dev->name, dev);	if (err < 0) {		pr_err("%s: can't get IRQ %d/n",		       dev->name, pci_dev->irq);		goto fail4;	}	/*	 *  Now do remainder of initialisation, first for	 *  things unique for this card, then for general board	 */	if (dev->instance < TW68_MAXBOARDS)		vidnr = video_nr[dev->instance];	/* initialise video function first */	err = tw68_video_init2(dev, vidnr);	if (err < 0) {		pr_err("%s: can't register video device/n",		       dev->name);		goto fail5;	}	tw_setl(TW68_INTMASK, dev->pci_irqmask);	pr_info("%s: registered device %s/n",	       dev->name, video_device_node_name(&dev->vdev));	return 0;fail5:	video_unregister_device(&dev->vdev);fail4:	vb2_dma_sg_cleanup_ctx(dev->alloc_ctx);fail3:	iounmap(dev->lmmio);fail2:	release_mem_region(pci_resource_start(pci_dev, 0),			   pci_resource_len(pci_dev, 0));fail1:	v4l2_device_unregister(&dev->v4l2_dev);	return err;}
开发者ID:ParrotSec,项目名称:linux-psec,代码行数:101,


示例16: hwcam_dev_create

inthwcam_dev_create(        struct device* dev,        int* dev_num){	int rc = 0;    struct v4l2_device* v4l2 = NULL;    struct video_device* vdev = NULL;    struct media_device* mdev = NULL;    hwcam_dev_t* cam = NULL;    cam = kzalloc(sizeof(hwcam_dev_t), GFP_KERNEL);	if (WARN_ON(!cam)) {		rc = -ENOMEM;		goto init_end;	}    v4l2 = &cam->v4l2;    vdev = video_device_alloc();    if (!vdev) {		rc = -ENOMEM;		goto video_alloc_fail;    }    mdev = kzalloc(sizeof(struct media_device), GFP_KERNEL);	if (!mdev) {		rc = -ENOMEM;		goto media_alloc_fail;	}	strlcpy(mdev->model, HWCAM_MODEL_USER, sizeof(mdev->model));	mdev->dev = dev;	rc = media_device_register(mdev);	if (rc < 0) {		goto media_register_fail;    }	rc = media_entity_init(&vdev->entity, 0, NULL, 0);	if (rc < 0) {		goto entity_init_fail;    }    v4l2->mdev = mdev;	v4l2->notify = NULL;	rc = v4l2_device_register(dev, v4l2);	if (rc < 0) {		goto v4l2_register_fail;    }	strlcpy(vdev->name, "hwcam-userdev", sizeof(vdev->name));	vdev->entity.type = MEDIA_ENT_T_DEVNODE_V4L;	vdev->entity.group_id = HWCAM_DEVICE_GROUP_ID;	vdev->v4l2_dev = v4l2;	vdev->release = video_device_release;	vdev->fops = &s_fops_hwcam_dev;	vdev->ioctl_ops = &s_iops_hwcam_dev;	vdev->minor = -1;	vdev->vfl_type = VFL_TYPE_GRABBER;	rc = video_register_device(vdev, VFL_TYPE_GRABBER, -1);	if (rc < 0) {		goto video_register_fail;    }	cam_debug("video dev name %s %s",vdev->dev.kobj.name,vdev->name);    mutex_init(&cam->lock);    vdev->lock = &cam->lock;	vdev->entity.name = video_device_node_name(vdev);	video_set_drvdata(vdev, cam);    cam->vdev = vdev;    cam->mdev = mdev;    cam->intf.vtbl = &s_vtbl_hwcam_dev;    *dev_num = vdev->num;	goto init_end;video_register_fail:	v4l2_device_unregister(v4l2);v4l2_register_fail:	media_entity_cleanup(&vdev->entity);entity_init_fail:	media_device_unregister(mdev);media_register_fail:    kzfree(mdev);media_alloc_fail:	video_device_release(vdev);video_alloc_fail:	kzfree(cam);init_end:	return rc;}
开发者ID:herryfan,项目名称:kernel-huawei-h60,代码行数:95,


示例17: cx18_reg_dev

static int cx18_reg_dev(struct cx18 *cx, int type){	struct cx18_stream *s = &cx->streams[type];	int vfl_type = cx18_stream_info[type].vfl_type;	const char *name;	int num, ret;	if (type == CX18_ENC_STREAM_TYPE_TS && s->dvb != NULL) {		ret = cx18_dvb_register(s);		if (ret < 0) {			CX18_ERR("DVB failed to register/n");			return ret;		}	}	if (s->video_dev == NULL)		return 0;	num = s->video_dev->num;	/* card number + user defined offset + device offset */	if (type != CX18_ENC_STREAM_TYPE_MPG) {		struct cx18_stream *s_mpg = &cx->streams[CX18_ENC_STREAM_TYPE_MPG];		if (s_mpg->video_dev)			num = s_mpg->video_dev->num			    + cx18_stream_info[type].num_offset;	}	video_set_drvdata(s->video_dev, s);	/* Register device. First try the desired minor, then any free one. */	ret = video_register_device_no_warn(s->video_dev, vfl_type, num);	if (ret < 0) {		CX18_ERR("Couldn't register v4l2 device for %s (device node number %d)/n",			s->name, num);		video_device_release(s->video_dev);		s->video_dev = NULL;		return ret;	}	name = video_device_node_name(s->video_dev);	switch (vfl_type) {	case VFL_TYPE_GRABBER:		CX18_INFO("Registered device %s for %s (%d x %d.%02d kB)/n",			  name, s->name, cx->stream_buffers[type],			  cx->stream_buf_size[type] / 1024,			  (cx->stream_buf_size[type] * 100 / 1024) % 100);		break;	case VFL_TYPE_RADIO:		CX18_INFO("Registered device %s for %s/n", name, s->name);		break;	case VFL_TYPE_VBI:		if (cx->stream_buffers[type])			CX18_INFO("Registered device %s for %s "				  "(%d x %d bytes)/n",				  name, s->name, cx->stream_buffers[type],				  cx->stream_buf_size[type]);		else			CX18_INFO("Registered device %s for %s/n",				name, s->name);		break;	}	return 0;}
开发者ID:AllenDou,项目名称:linux,代码行数:67,


示例18: camera_init_v4l2

int camera_init_v4l2(struct device *dev, unsigned int *session){	struct msm_video_device *pvdev;	struct v4l2_device *v4l2_dev;	int rc = 0;	pvdev = kzalloc(sizeof(struct msm_video_device),		GFP_KERNEL);	if (WARN_ON(!pvdev)) {		rc = -ENOMEM;		goto init_end;	}	pvdev->vdev = video_device_alloc();	if (WARN_ON(!pvdev->vdev)) {		rc = -ENOMEM;		goto video_fail;	}	v4l2_dev = kzalloc(sizeof(struct v4l2_device), GFP_KERNEL);	if (WARN_ON(!v4l2_dev)) {		rc = -ENOMEM;		goto v4l2_fail;	}#if defined(CONFIG_MEDIA_CONTROLLER)	v4l2_dev->mdev = kzalloc(sizeof(struct media_device),							 GFP_KERNEL);	if (!v4l2_dev->mdev) {		rc = -ENOMEM;		goto mdev_fail;	}	strlcpy(v4l2_dev->mdev->model, MSM_CAMERA_NAME,			sizeof(v4l2_dev->mdev->model));	v4l2_dev->mdev->dev = dev;	rc = media_device_register(v4l2_dev->mdev);	if (WARN_ON(rc < 0))		goto media_fail;	rc = media_entity_init(&pvdev->vdev->entity, 0, NULL, 0);	if (WARN_ON(rc < 0))		goto entity_fail;	pvdev->vdev->entity.type = MEDIA_ENT_T_DEVNODE_V4L;	pvdev->vdev->entity.group_id = QCAMERA_VNODE_GROUP_ID;#endif	v4l2_dev->notify = NULL;	pvdev->vdev->v4l2_dev = v4l2_dev;	rc = v4l2_device_register(dev, pvdev->vdev->v4l2_dev);	if (WARN_ON(rc < 0))		goto register_fail;	strlcpy(pvdev->vdev->name, "msm-sensor", sizeof(pvdev->vdev->name));	pvdev->vdev->release  = video_device_release;	pvdev->vdev->fops     = &camera_v4l2_fops;	pvdev->vdev->ioctl_ops = &camera_v4l2_ioctl_ops;	pvdev->vdev->minor     = -1;	pvdev->vdev->vfl_type  = VFL_TYPE_GRABBER;	rc = video_register_device(pvdev->vdev,		VFL_TYPE_GRABBER, -1);	if (WARN_ON(rc < 0))		goto video_register_fail;#if defined(CONFIG_MEDIA_CONTROLLER)	/* FIXME: How to get rid of this messy? */	pvdev->vdev->entity.name = video_device_node_name(pvdev->vdev);#endif	*session = pvdev->vdev->num;	atomic_set(&pvdev->opened, 0);	atomic_set(&pvdev->stream_cnt, 0);	video_set_drvdata(pvdev->vdev, pvdev);	device_init_wakeup(&pvdev->vdev->dev, 1);    if(!cam_wakelock_init)    {        cam_wakelock_init = 1;        wake_lock_init(&cam_wakelock, WAKE_LOCK_SUSPEND, "cam_wakelock");    }	goto init_end;video_register_fail:	v4l2_device_unregister(pvdev->vdev->v4l2_dev);register_fail:#if defined(CONFIG_MEDIA_CONTROLLER)	media_entity_cleanup(&pvdev->vdev->entity);entity_fail:	media_device_unregister(v4l2_dev->mdev);media_fail:	kzfree(v4l2_dev->mdev);mdev_fail:#endif	kzfree(v4l2_dev);v4l2_fail:	video_device_release(pvdev->vdev);video_fail:	kzfree(pvdev);init_end:	return rc;//.........这里部分代码省略.........
开发者ID:TheNameIsNigel,项目名称:android_kernel_carbon_msm8928,代码行数:101,


示例19: ivtv_open

static int ivtv_open(struct file *filp){	struct video_device *vdev = video_devdata(filp);	struct ivtv_stream *s = video_get_drvdata(vdev);	struct ivtv *itv = s->itv;	struct ivtv_open_id *item;	int res = 0;	IVTV_DEBUG_FILE("open %s/n", s->name);	if (ivtv_init_on_first_open(itv)) {		IVTV_ERR("Failed to initialize on device %s/n",			 video_device_node_name(vdev));		return -ENXIO;	}#ifdef CONFIG_VIDEO_ADV_DEBUG	/* Unless ivtv_fw_debug is set, error out if firmware dead. */	if (ivtv_fw_debug) {		IVTV_WARN("Opening %s with dead firmware lockout disabled/n",			  video_device_node_name(vdev));		IVTV_WARN("Selected firmware errors will be ignored/n");	} else {#else	if (1) {#endif		res = ivtv_firmware_check(itv, "ivtv_serialized_open");		if (res == -EAGAIN)			res = ivtv_firmware_check(itv, "ivtv_serialized_open");		if (res < 0)			return -EIO;	}	if (s->type == IVTV_DEC_STREAM_TYPE_MPG &&		test_bit(IVTV_F_S_CLAIMED, &itv->streams[IVTV_DEC_STREAM_TYPE_YUV].s_flags))		return -EBUSY;	if (s->type == IVTV_DEC_STREAM_TYPE_YUV &&		test_bit(IVTV_F_S_CLAIMED, &itv->streams[IVTV_DEC_STREAM_TYPE_MPG].s_flags))		return -EBUSY;	if (s->type == IVTV_DEC_STREAM_TYPE_YUV) {		if (read_reg(0x82c) == 0) {			IVTV_ERR("Tried to open YUV output device but need to send data to mpeg decoder before it can be used/n");			/* return -ENODEV; */		}		ivtv_udma_alloc(itv);	}	/* Allocate memory */	item = kzalloc(sizeof(struct ivtv_open_id), GFP_KERNEL);	if (NULL == item) {		IVTV_DEBUG_WARN("nomem on v4l2 open/n");		return -ENOMEM;	}	v4l2_fh_init(&item->fh, &s->vdev);	item->itv = itv;	item->type = s->type;	filp->private_data = &item->fh;	v4l2_fh_add(&item->fh);	if (item->type == IVTV_ENC_STREAM_TYPE_RAD &&			v4l2_fh_is_singular_file(filp)) {		if (!test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags)) {			if (atomic_read(&itv->capturing) > 0) {				/* switching to radio while capture is				   in progress is not polite */				v4l2_fh_del(&item->fh);				v4l2_fh_exit(&item->fh);				kfree(item);				return -EBUSY;			}		}		/* Mark that the radio is being used. */		set_bit(IVTV_F_I_RADIO_USER, &itv->i_flags);		/* We have the radio */		ivtv_mute(itv);		/* Switch tuner to radio */		ivtv_call_all(itv, tuner, s_radio);		/* Select the correct audio input (i.e. radio tuner) */		ivtv_audio_set_io(itv);		if (itv->hw_flags & IVTV_HW_SAA711X) {			ivtv_call_hw(itv, IVTV_HW_SAA711X, video, s_crystal_freq,				SAA7115_FREQ_32_11_MHZ, SAA7115_FREQ_FL_APLL);		}		/* Done! Unmute and continue. */		ivtv_unmute(itv);	}	/* YUV or MPG Decoding Mode? */	if (s->type == IVTV_DEC_STREAM_TYPE_MPG) {		clear_bit(IVTV_F_I_DEC_YUV, &itv->i_flags);	} else if (s->type == IVTV_DEC_STREAM_TYPE_YUV) {		set_bit(IVTV_F_I_DEC_YUV, &itv->i_flags);		/* For yuv, we need to know the dma size before we start */		itv->dma_data_req_size =				1080 * ((itv->yuv_info.v4l2_src_h + 31) & ~31);		itv->yuv_info.stream_size = 0;	}//.........这里部分代码省略.........
开发者ID:AlexShiLucky,项目名称:linux,代码行数:101,


示例20: cam_dummy_platform_probe

static int32_t cam_dummy_platform_probe(struct platform_device *pdev){	int32_t rc = 0;	const struct of_device_id *match;	struct msm_video_device *pvdev;	/* init_waitqueue_head(&cam_dummy_queue.state_wait);*/	pr_err("%s:%d/n", __func__, __LINE__);	match = of_match_device(cam_dummy_dt_match, &pdev->dev);	msm_v4l2_dev = kzalloc(sizeof(*msm_v4l2_dev),		GFP_KERNEL);	if (WARN_ON(!msm_v4l2_dev)) {		rc = -ENOMEM;		goto probe_end;	}	pvdev = kzalloc(sizeof(struct msm_video_device),		GFP_KERNEL);	if (WARN_ON(!pvdev)) {		rc = -ENOMEM;		goto pvdev_fail;	}	pvdev->vdev = video_device_alloc();	if (WARN_ON(!pvdev->vdev)) {		rc = -ENOMEM;		goto video_fail;	}#if defined(CONFIG_MEDIA_CONTROLLER)	msm_v4l2_dev->mdev = kzalloc(sizeof(struct media_device),		GFP_KERNEL);	if (!msm_v4l2_dev->mdev) {		rc = -ENOMEM;		goto mdev_fail;	}	strlcpy(msm_v4l2_dev->mdev->model, MSM_CAMERA_DUMMY_NAME,			sizeof(msm_v4l2_dev->mdev->model));	msm_v4l2_dev->mdev->dev = &(pdev->dev);	rc = media_device_register(msm_v4l2_dev->mdev);	if (WARN_ON(rc < 0))		goto media_fail;	if (WARN_ON((rc == media_entity_init(&pvdev->vdev->entity,			0, NULL, 0)) < 0))		goto entity_fail;	pvdev->vdev->entity.type = MEDIA_ENT_T_DEVNODE_V4L;	pvdev->vdev->entity.group_id = QCAMERA_VNODE_GROUP_ID;#endif	pvdev->vdev->v4l2_dev = msm_v4l2_dev;	rc = v4l2_device_register(&(pdev->dev), pvdev->vdev->v4l2_dev);	if (WARN_ON(rc < 0))		goto register_fail;	strlcpy(pvdev->vdev->name, "msm-camdummy", sizeof(pvdev->vdev->name));	pvdev->vdev->release  = video_device_release;	pvdev->vdev->fops     = &msm_fops_config;	pvdev->vdev->minor     = -1;	pvdev->vdev->vfl_type  = VFL_TYPE_GRABBER;	rc = video_register_device(pvdev->vdev,		VFL_TYPE_GRABBER, -1);	if (WARN_ON(rc < 0))		goto v4l2_fail;#if defined(CONFIG_MEDIA_CONTROLLER)	/* FIXME: How to get rid of this messy? */	pvdev->vdev->entity.name = video_device_node_name(pvdev->vdev);#endif	atomic_set(&pvdev->opened, 0);	video_set_drvdata(pvdev->vdev, pvdev);	goto probe_end;v4l2_fail:	v4l2_device_unregister(pvdev->vdev->v4l2_dev);register_fail:#if defined(CONFIG_MEDIA_CONTROLLER)	media_entity_cleanup(&pvdev->vdev->entity);entity_fail:	media_device_unregister(msm_v4l2_dev->mdev);media_fail:	kzfree(msm_v4l2_dev->mdev);mdev_fail:#endif	video_device_release(pvdev->vdev);video_fail:	kzfree(pvdev);pvdev_fail:	kzfree(msm_v4l2_dev);probe_end:	return rc;}
开发者ID:DAGr8,项目名称:kernel_samsung_hltecan,代码行数:98,


示例21: vivid_create_instance

//.........这里部分代码省略.........	}	if (dev->has_fb) {		/* Create framebuffer for testing capture/output overlay */		ret = vivid_fb_init(dev);		if (ret)			goto unreg_dev;		v4l2_info(&dev->v4l2_dev, "Framebuffer device registered as fb%d/n",				dev->fb_info.node);	}	/* finally start creating the device nodes */	if (dev->has_vid_cap) {		vfd = &dev->vid_cap_dev;		strlcpy(vfd->name, "vivid-vid-cap", sizeof(vfd->name));		vfd->fops = &vivid_fops;		vfd->ioctl_ops = &vivid_ioctl_ops;		vfd->release = video_device_release_empty;		vfd->v4l2_dev = &dev->v4l2_dev;		vfd->queue = &dev->vb_vid_cap_q;		vfd->tvnorms = tvnorms_cap;		/*		 * Provide a mutex to v4l2 core. It will be used to protect		 * all fops and v4l2 ioctls.		 */		vfd->lock = &dev->mutex;		video_set_drvdata(vfd, dev);		ret = video_register_device(vfd, VFL_TYPE_GRABBER, vid_cap_nr[inst]);		if (ret < 0)			goto unreg_dev;		v4l2_info(&dev->v4l2_dev, "V4L2 capture device registered as %s/n",					  video_device_node_name(vfd));	}	if (dev->has_vid_out) {		vfd = &dev->vid_out_dev;		strlcpy(vfd->name, "vivid-vid-out", sizeof(vfd->name));		vfd->vfl_dir = VFL_DIR_TX;		vfd->fops = &vivid_fops;		vfd->ioctl_ops = &vivid_ioctl_ops;		vfd->release = video_device_release_empty;		vfd->v4l2_dev = &dev->v4l2_dev;		vfd->queue = &dev->vb_vid_out_q;		vfd->tvnorms = tvnorms_out;		/*		 * Provide a mutex to v4l2 core. It will be used to protect		 * all fops and v4l2 ioctls.		 */		vfd->lock = &dev->mutex;		video_set_drvdata(vfd, dev);		ret = video_register_device(vfd, VFL_TYPE_GRABBER, vid_out_nr[inst]);		if (ret < 0)			goto unreg_dev;		v4l2_info(&dev->v4l2_dev, "V4L2 output device registered as %s/n",					  video_device_node_name(vfd));	}	if (dev->has_vbi_cap) {		vfd = &dev->vbi_cap_dev;		strlcpy(vfd->name, "vivid-vbi-cap", sizeof(vfd->name));		vfd->fops = &vivid_fops;		vfd->ioctl_ops = &vivid_ioctl_ops;
开发者ID:keeper,项目名称:backports,代码行数:67,


示例22: empress_init

static int empress_init(struct saa7134_dev *dev){    struct v4l2_ctrl_handler *hdl = &dev->empress_ctrl_handler;    struct vb2_queue *q;    int err;    pr_debug("%s: %s/n", dev->name, __func__);    dev->empress_dev = video_device_alloc();    if (NULL == dev->empress_dev)        return -ENOMEM;    *(dev->empress_dev) = saa7134_empress_template;    dev->empress_dev->v4l2_dev  = &dev->v4l2_dev;    dev->empress_dev->release = video_device_release;    dev->empress_dev->lock = &dev->lock;    snprintf(dev->empress_dev->name, sizeof(dev->empress_dev->name),             "%s empress (%s)", dev->name,             saa7134_boards[dev->board].name);    v4l2_ctrl_handler_init(hdl, 21);    v4l2_ctrl_add_handler(hdl, &dev->ctrl_handler, empress_ctrl_filter);    if (dev->empress_sd)        v4l2_ctrl_add_handler(hdl, dev->empress_sd->ctrl_handler, NULL);    if (hdl->error) {        video_device_release(dev->empress_dev);        return hdl->error;    }    dev->empress_dev->ctrl_handler = hdl;    INIT_WORK(&dev->empress_workqueue, empress_signal_update);    q = &dev->empress_vbq;    q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;    /*     * Do not add VB2_USERPTR: the saa7134 DMA engine cannot handle     * transfers that do not start at the beginning of a page. A USERPTR     * can start anywhere in a page, so USERPTR support is a no-go.     */    q->io_modes = VB2_MMAP | VB2_DMABUF | VB2_READ;    q->drv_priv = &dev->ts_q;    q->ops = &saa7134_empress_qops;    q->gfp_flags = GFP_DMA32;    q->mem_ops = &vb2_dma_sg_memops;    q->buf_struct_size = sizeof(struct saa7134_buf);    q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;    q->lock = &dev->lock;    q->dev = &dev->pci->dev;    err = vb2_queue_init(q);    if (err)        return err;    dev->empress_dev->queue = q;    video_set_drvdata(dev->empress_dev, dev);    err = video_register_device(dev->empress_dev,VFL_TYPE_GRABBER,                                empress_nr[dev->nr]);    if (err < 0) {        pr_info("%s: can't register video device/n",                dev->name);        video_device_release(dev->empress_dev);        dev->empress_dev = NULL;        return err;    }    pr_info("%s: registered device %s [mpeg]/n",            dev->name, video_device_node_name(dev->empress_dev));    empress_signal_update(&dev->empress_workqueue);    return 0;}
开发者ID:robeat101,项目名称:linux,代码行数:66,


示例23: usb_pwc_probe

//.........这里部分代码省略.........	pdev->release = le16_to_cpu(udev->descriptor.bcdDevice);	PWC_DEBUG_PROBE("Release: %04x/n", pdev->release);	/* Allocate USB command buffers */	pdev->ctrl_buf = kmalloc(sizeof(pdev->cmd_buf), GFP_KERNEL);	if (!pdev->ctrl_buf) {		PWC_ERROR("Oops, could not allocate memory for pwc_device./n");		rc = -ENOMEM;		goto err_free_mem;	}#ifdef CONFIG_USB_PWC_DEBUG	/* Query sensor type */	if (pwc_get_cmos_sensor(pdev, &rc) >= 0) {		PWC_DEBUG_OPEN("This %s camera is equipped with a %s (%d)./n",				pdev->vdev.name,				pwc_sensor_type_to_string(rc), rc);	}#endif	/* Set the leds off */	pwc_set_leds(pdev, 0, 0);	/* Setup initial videomode */	rc = pwc_set_video_mode(pdev, MAX_WIDTH, MAX_HEIGHT,				V4L2_PIX_FMT_YUV420, 30, &compression, 1);	if (rc)		goto err_free_mem;	/* Register controls (and read default values from camera */	rc = pwc_init_controls(pdev);	if (rc) {		PWC_ERROR("Failed to register v4l2 controls (%d)./n", rc);		goto err_free_mem;	}	/* And powerdown the camera until streaming starts */	pwc_camera_power(pdev, 0);	/* Register the v4l2_device structure */	pdev->v4l2_dev.release = pwc_video_release;	rc = v4l2_device_register(&intf->dev, &pdev->v4l2_dev);	if (rc) {		PWC_ERROR("Failed to register v4l2-device (%d)./n", rc);		goto err_free_controls;	}	pdev->v4l2_dev.ctrl_handler = &pdev->ctrl_handler;	pdev->vdev.v4l2_dev = &pdev->v4l2_dev;	pdev->vdev.lock = &pdev->v4l2_lock;	rc = video_register_device(&pdev->vdev, VFL_TYPE_GRABBER, -1);	if (rc < 0) {		PWC_ERROR("Failed to register as video device (%d)./n", rc);		goto err_unregister_v4l2_dev;	}	PWC_INFO("Registered as %s./n", video_device_node_name(&pdev->vdev));#ifdef CONFIG_USB_PWC_INPUT_EVDEV	/* register webcam snapshot button input device */	pdev->button_dev = input_allocate_device();	if (!pdev->button_dev) {		rc = -ENOMEM;		goto err_video_unreg;	}	usb_make_path(udev, pdev->button_phys, sizeof(pdev->button_phys));	strlcat(pdev->button_phys, "/input0", sizeof(pdev->button_phys));	pdev->button_dev->name = "PWC snapshot button";	pdev->button_dev->phys = pdev->button_phys;	usb_to_input_id(pdev->udev, &pdev->button_dev->id);	pdev->button_dev->dev.parent = &pdev->udev->dev;	pdev->button_dev->evbit[0] = BIT_MASK(EV_KEY);	pdev->button_dev->keybit[BIT_WORD(KEY_CAMERA)] = BIT_MASK(KEY_CAMERA);	rc = input_register_device(pdev->button_dev);	if (rc) {		input_free_device(pdev->button_dev);		pdev->button_dev = NULL;		goto err_video_unreg;	}#endif	return 0;#ifdef CONFIG_USB_PWC_INPUT_EVDEVerr_video_unreg:	video_unregister_device(&pdev->vdev);#endiferr_unregister_v4l2_dev:	v4l2_device_unregister(&pdev->v4l2_dev);err_free_controls:	v4l2_ctrl_handler_free(&pdev->ctrl_handler);err_free_mem:	kfree(pdev->ctrl_buf);	kfree(pdev);	return rc;}
开发者ID:AK101111,项目名称:linux,代码行数:101,


示例24: fimc_isp_video_device_register

int fimc_isp_video_device_register(struct fimc_isp *isp,				   struct v4l2_device *v4l2_dev,				   enum v4l2_buf_type type){	struct vb2_queue *q = &isp->video_capture.vb_queue;	struct fimc_is_video *iv;	struct video_device *vdev;	int ret;	if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)		iv = &isp->video_capture;	else		return -ENOSYS;	mutex_init(&isp->video_lock);	INIT_LIST_HEAD(&iv->pending_buf_q);	INIT_LIST_HEAD(&iv->active_buf_q);	iv->format = fimc_isp_find_format(NULL, NULL, 0);	iv->pixfmt.width = IS_DEFAULT_WIDTH;	iv->pixfmt.height = IS_DEFAULT_HEIGHT;	iv->pixfmt.pixelformat = iv->format->fourcc;	iv->pixfmt.colorspace = V4L2_COLORSPACE_SRGB;	iv->reqbufs_count = 0;	memset(q, 0, sizeof(*q));	q->type = type;	q->io_modes = VB2_MMAP | VB2_USERPTR;	q->ops = &isp_video_capture_qops;	q->mem_ops = &vb2_dma_contig_memops;	q->buf_struct_size = sizeof(struct isp_video_buf);	q->drv_priv = isp;	q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;	q->lock = &isp->video_lock;	ret = vb2_queue_init(q);	if (ret < 0)		return ret;	vdev = &iv->ve.vdev;	memset(vdev, 0, sizeof(*vdev));	snprintf(vdev->name, sizeof(vdev->name), "fimc-is-isp.%s",			type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ?			"capture" : "output");	vdev->queue = q;	vdev->fops = &isp_video_fops;	vdev->ioctl_ops = &isp_video_ioctl_ops;	vdev->v4l2_dev = v4l2_dev;	vdev->minor = -1;	vdev->release = video_device_release_empty;	vdev->lock = &isp->video_lock;	iv->pad.flags = MEDIA_PAD_FL_SINK;	ret = media_entity_pads_init(&vdev->entity, 1, &iv->pad);	if (ret < 0)		return ret;	video_set_drvdata(vdev, isp);	ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1);	if (ret < 0) {		media_entity_cleanup(&vdev->entity);		return ret;	}	v4l2_info(v4l2_dev, "Registered %s as /dev/%s/n",		  vdev->name, video_device_node_name(vdev));	return 0;}
开发者ID:a2hojsjsjs,项目名称:linux,代码行数:69,


示例25: rvin_v4l2_probe

int rvin_v4l2_probe(struct rvin_dev *vin){	struct video_device *vdev = &vin->vdev;	struct v4l2_subdev *sd = vin_to_source(vin);	int pad_idx, ret;	v4l2_set_subdev_hostdata(sd, vin);	vin->v4l2_dev.notify = rvin_notify;	ret = v4l2_subdev_call(sd, video, g_tvnorms, &vin->vdev.tvnorms);	if (ret < 0 && ret != -ENOIOCTLCMD && ret != -ENODEV)		return ret;	if (vin->vdev.tvnorms == 0) {		/* Disable the STD API if there are no tvnorms defined */		v4l2_disable_ioctl(&vin->vdev, VIDIOC_G_STD);		v4l2_disable_ioctl(&vin->vdev, VIDIOC_S_STD);		v4l2_disable_ioctl(&vin->vdev, VIDIOC_QUERYSTD);		v4l2_disable_ioctl(&vin->vdev, VIDIOC_ENUMSTD);	}	/* Add the controls */	/*	 * Currently the subdev with the largest number of controls (13) is	 * ov6550. So let's pick 16 as a hint for the control handler. Note	 * that this is a hint only: too large and you waste some memory, too	 * small and there is a (very) small performance hit when looking up	 * controls in the internal hash.	 */	ret = v4l2_ctrl_handler_init(&vin->ctrl_handler, 16);	if (ret < 0)		return ret;	ret = v4l2_ctrl_add_handler(&vin->ctrl_handler, sd->ctrl_handler, NULL);	if (ret < 0)		return ret;	/* video node */	vdev->fops = &rvin_fops;	vdev->v4l2_dev = &vin->v4l2_dev;	vdev->queue = &vin->queue;	strlcpy(vdev->name, KBUILD_MODNAME, sizeof(vdev->name));	vdev->release = video_device_release_empty;	vdev->ioctl_ops = &rvin_ioctl_ops;	vdev->lock = &vin->lock;	vdev->ctrl_handler = &vin->ctrl_handler;	vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING |		V4L2_CAP_READWRITE;	vin->src_pad_idx = 0;	for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++)		if (sd->entity.pads[pad_idx].flags == MEDIA_PAD_FL_SOURCE)			break;	if (pad_idx >= sd->entity.num_pads)		return -EINVAL;	vin->src_pad_idx = pad_idx;	vin->sink_pad_idx = 0;	for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++)		if (sd->entity.pads[pad_idx].flags == MEDIA_PAD_FL_SINK) {			vin->sink_pad_idx = pad_idx;			break;		}	vin->format.pixelformat	= RVIN_DEFAULT_FORMAT;	rvin_reset_format(vin);	ret = video_register_device(&vin->vdev, VFL_TYPE_GRABBER, -1);	if (ret) {		vin_err(vin, "Failed to register video device/n");		return ret;	}	video_set_drvdata(&vin->vdev, vin);	v4l2_info(&vin->v4l2_dev, "Device registered as %s/n",		  video_device_node_name(&vin->vdev));	return ret;}
开发者ID:AshishNamdev,项目名称:linux,代码行数:82,



注:本文中的video_device_node_name函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ video_device_release函数代码示例
C++ video_device_alloc函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。