Пример #1
0
static int ov9640_remove(struct i2c_client *client)
{
	struct v4l2_subdev *sd = i2c_get_clientdata(client);
	struct ov9640_priv *priv = to_ov9640_sensor(sd);

	v4l2_device_unregister_subdev(&priv->subdev);
	v4l2_ctrl_handler_free(&priv->hdl);
	return 0;
}
Пример #2
0
void cpia2_camera_release(struct v4l2_device *v4l2_dev)
{
	struct camera_data *cam =
		container_of(v4l2_dev, struct camera_data, v4l2_dev);

	v4l2_ctrl_handler_free(&cam->hdl);
	v4l2_device_unregister(&cam->v4l2_dev);
	kfree(cam);
}
Пример #3
0
void solo_v4l2_exit(struct solo_dev *solo_dev)
{
	if (solo_dev->vfd == NULL)
		return;

	video_unregister_device(solo_dev->vfd);
	v4l2_ctrl_handler_free(&solo_dev->disp_hdl);
	solo_dev->vfd = NULL;
}
/*
 * m5mols_init_controls - initialization using v4l2_ctrl.
 */
static int m5mols_init_controls(struct m5mols_info *info)
{
	struct v4l2_subdev *sd = &info->sd;
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	u16 max_ex_mon;
	int ret;

	/* check minimum & maximum of M5MOLS controls */
	ret = i2c_r16_ae(sd, CAT3_MAX_GAIN_MON, (u32 *)&max_ex_mon);
	if (ret)
		return ret;

	/* set the controls using v4l2 control frameworks */
	v4l2_ctrl_handler_init(&info->handle, 9);

	info->colorfx = v4l2_ctrl_new_std_menu(&info->handle,
			&m5mols_ctrl_ops, V4L2_CID_COLORFX,
			9, 1, V4L2_COLORFX_NONE);
	info->autoexposure = v4l2_ctrl_new_std_menu(&info->handle,
			&m5mols_ctrl_ops, V4L2_CID_EXPOSURE_AUTO,
			1, 0, V4L2_EXPOSURE_AUTO);
	info->exposure = v4l2_ctrl_new_std(&info->handle,
			&m5mols_ctrl_ops, V4L2_CID_EXPOSURE,
			0, max_ex_mon, 1, (int)max_ex_mon/2);
	info->autofocus = v4l2_ctrl_new_std(&info->handle,
			&m5mols_ctrl_ops, V4L2_CID_FOCUS_AUTO,
			0, 1, 1, 0);
	info->autowb = v4l2_ctrl_new_std(&info->handle,
			&m5mols_ctrl_ops, V4L2_CID_AUTO_WHITE_BALANCE,
			0, 1, 1, 1);
	info->saturation = v4l2_ctrl_new_std(&info->handle,
			&m5mols_ctrl_ops, V4L2_CID_SATURATION,
			0, 6, 1, 3);
	info->zoom = v4l2_ctrl_new_std(&info->handle,
			&m5mols_ctrl_ops, V4L2_CID_ZOOM_ABSOLUTE,
			0, 70, 1, 0);
	info->jpeg_size = v4l2_ctrl_new_custom(&info->handle,
			&ctrl_private[0],
			NULL);
	info->encoded_size = v4l2_ctrl_new_custom(&info->handle,
			&ctrl_private[1],
			NULL);

	sd->ctrl_handler = &info->handle;

	if (info->handle.error) {
		dev_err(&client->dev, "Failed to init controls, %d\n", ret);
		v4l2_ctrl_handler_free(&info->handle);
		return info->handle.error;
	}

	v4l2_ctrl_cluster(2, &info->autoexposure);
	/* If above ctrl value is not good image, so it is better that not set */
	v4l2_ctrl_handler_setup(&info->handle);

	return 0;
}
Пример #5
0
static int tw2804_remove(struct i2c_client *client)
{
	struct v4l2_subdev *sd = i2c_get_clientdata(client);
	struct tw2804 *state = to_state(sd);

	v4l2_device_unregister_subdev(sd);
	v4l2_ctrl_handler_free(&state->hdl);
	return 0;
}
Пример #6
0
static void fimc_lite_unregister_capture_subdev(struct fimc_lite *fimc)
{
	struct v4l2_subdev *sd = &fimc->subdev;

	v4l2_device_unregister_subdev(sd);
	media_entity_cleanup(&sd->entity);
	v4l2_ctrl_handler_free(&fimc->ctrl_handler);
	v4l2_set_subdevdata(sd, NULL);
}
Пример #7
0
void fimc_isp_subdev_destroy(struct fimc_isp *isp)
{
	struct v4l2_subdev *sd = &isp->subdev;

	v4l2_device_unregister_subdev(sd);
	media_entity_cleanup(&sd->entity);
	v4l2_ctrl_handler_free(&isp->ctrls.handler);
	v4l2_set_subdevdata(sd, NULL);
}
static void au0828_usb_v4l2_release(struct v4l2_device *v4l2_dev)
{
	struct au0828_dev *dev =
		container_of(v4l2_dev, struct au0828_dev, v4l2_dev);

	v4l2_ctrl_handler_free(&dev->v4l2_ctrl_hdl);
	v4l2_device_unregister(&dev->v4l2_dev);
	au0828_usb_release(dev);
}
Пример #9
0
static void pwc_video_release(struct v4l2_device *v)
{
	struct pwc_device *pdev = container_of(v, struct pwc_device, v4l2_dev);

	v4l2_ctrl_handler_free(&pdev->ctrl_handler);
	v4l2_device_unregister(&pdev->v4l2_dev);
	kfree(pdev->ctrl_buf);
	kfree(pdev);
}
Пример #10
0
void solo_v4l2_exit(struct solo_dev *solo_dev)
{
	if (solo_dev->vfd == NULL)
		return;

	video_unregister_device(solo_dev->vfd);
	vb2_dma_contig_cleanup_ctx(solo_dev->alloc_ctx);
	v4l2_ctrl_handler_free(&solo_dev->disp_hdl);
	solo_dev->vfd = NULL;
}
Пример #11
0
static int lm3646_remove(struct i2c_client *client)
{
	struct lm3646_flash *flash = i2c_get_clientdata(client);

	v4l2_device_unregister_subdev(&flash->subdev_led);
	v4l2_ctrl_handler_free(&flash->ctrls_led);
	media_entity_cleanup(&flash->subdev_led.entity);

	return 0;
}
Пример #12
0
void vsp1_entity_destroy(struct vsp1_entity *entity)
{
	if (entity->video)
		vsp1_video_cleanup(entity->video);
	if (entity->subdev.ctrl_handler)
		v4l2_ctrl_handler_free(entity->subdev.ctrl_handler);
	media_entity_cleanup(&entity->subdev.entity);

	mutex_destroy(&entity->lock);
}
Пример #13
0
static void __exit fmi_exit(void)
{
	struct fmi *fmi = &fmi_card;

	v4l2_ctrl_handler_free(&fmi->hdl);
	video_unregister_device(&fmi->vdev);
	v4l2_device_unregister(&fmi->v4l2_dev);
	release_region(fmi->io, 2);
	if (dev && pnp_attached)
		pnp_device_detach(dev);
}
static int __exit adp1653_remove(struct i2c_client *client)
{
	struct v4l2_subdev *subdev = i2c_get_clientdata(client);
	struct adp1653_flash *flash = to_adp1653_flash(subdev);

	v4l2_device_unregister_subdev(&flash->subdev);
	v4l2_ctrl_handler_free(&flash->ctrls);
	media_entity_cleanup(&flash->subdev.entity);
	kfree(flash);
	return 0;
}
static int ad5823_remove(struct i2c_client *client)
{
    struct v4l2_subdev *subdev = i2c_get_clientdata(client);
    struct ad5823 *vcm = to_ad5823(subdev);

    v4l2_device_unregister_subdev(subdev);
    v4l2_ctrl_handler_free(&vcm->ctrls);
    media_entity_cleanup(&vcm->subdev.entity);
    kfree(vcm);
    return 0;
}
Пример #16
0
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);
}
static int sensor_subdev_close(struct v4l2_subdev *sd,
				  struct v4l2_subdev_fh *fh)
{
	struct sensor_info *info = to_sensor(sd);

	v4l2_dbg(1, sensor_debug, sd, "%s", __func__);

	v4l2_ctrl_handler_free(&info->handle);

	return 0;
}
Пример #18
0
static int as3645a_remove(struct i2c_client *client)
{
	struct v4l2_subdev *subdev = i2c_get_clientdata(client);
	struct as3645a *flash = to_as3645a(subdev);

	v4l2_device_unregister_subdev(subdev);
	v4l2_ctrl_handler_free(&flash->ctrls);
	media_entity_cleanup(&flash->subdev.entity);
	mutex_destroy(&flash->power_lock);

	return 0;
}
Пример #19
0
static int s5p_jpeg_release(struct file *file)
{
	struct s5p_jpeg_ctx *ctx = fh_to_ctx(file->private_data);

	v4l2_m2m_ctx_release(ctx->m2m_ctx);
	v4l2_ctrl_handler_free(&ctx->ctrl_handler);
	v4l2_fh_del(&ctx->fh);
	v4l2_fh_exit(&ctx->fh);
	kfree(ctx);

	return 0;
}
Пример #20
0
static struct v4l2_flash *__v4l2_flash_init(
	struct device *dev, struct fwnode_handle *fwn,
	struct led_classdev_flash *fled_cdev, struct led_classdev *iled_cdev,
	const struct v4l2_flash_ops *ops, struct v4l2_flash_config *config)
{
	struct v4l2_flash *v4l2_flash;
	struct v4l2_subdev *sd;
	int ret;

	if (!config)
		return ERR_PTR(-EINVAL);

	v4l2_flash = devm_kzalloc(dev, sizeof(*v4l2_flash), GFP_KERNEL);
	if (!v4l2_flash)
		return ERR_PTR(-ENOMEM);

	sd = &v4l2_flash->sd;
	v4l2_flash->fled_cdev = fled_cdev;
	v4l2_flash->iled_cdev = iled_cdev;
	v4l2_flash->ops = ops;
	sd->dev = dev;
	sd->fwnode = fwn ? fwn : dev_fwnode(dev);
	v4l2_subdev_init(sd, &v4l2_flash_subdev_ops);
	sd->internal_ops = &v4l2_flash_subdev_internal_ops;
	sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
	strlcpy(sd->name, config->dev_name, sizeof(sd->name));

	ret = media_entity_pads_init(&sd->entity, 0, NULL);
	if (ret < 0)
		return ERR_PTR(ret);

	sd->entity.function = MEDIA_ENT_F_FLASH;

	ret = v4l2_flash_init_controls(v4l2_flash, config);
	if (ret < 0)
		goto err_init_controls;

	fwnode_handle_get(sd->fwnode);

	ret = v4l2_async_register_subdev(sd);
	if (ret < 0)
		goto err_async_register_sd;

	return v4l2_flash;

err_async_register_sd:
	fwnode_handle_put(sd->fwnode);
	v4l2_ctrl_handler_free(sd->ctrl_handler);
err_init_controls:
	media_entity_cleanup(&sd->entity);

	return ERR_PTR(ret);
}
Пример #21
0
Файл: g2d.c Проект: 7799/linux
static int g2d_release(struct file *file)
{
	struct g2d_dev *dev = video_drvdata(file);
	struct g2d_ctx *ctx = fh2ctx(file->private_data);

	v4l2_ctrl_handler_free(&ctx->ctrl_handler);
	v4l2_fh_del(&ctx->fh);
	v4l2_fh_exit(&ctx->fh);
	kfree(ctx);
	v4l2_info(&dev->v4l2_dev, "instance closed\n");
	return 0;
}
Пример #22
0
static void cx18_remove(struct pci_dev *pci_dev)
{
	struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev);
	struct cx18 *cx = to_cx18(v4l2_dev);
	int i;

	CX18_DEBUG_INFO("Removing Card\n");

	flush_request_modules(cx);

	/* Stop all captures */
	CX18_DEBUG_INFO("Stopping all streams\n");
	if (atomic_read(&cx->tot_capturing) > 0)
		cx18_stop_all_captures(cx);

	/* Stop interrupts that cause incoming work to be queued */
	cx18_sw1_irq_disable(cx, IRQ_CPU_TO_EPU | IRQ_APU_TO_EPU);

	/* Incoming work can cause outgoing work, so clean up incoming first */
	cx18_cancel_in_work_orders(cx);
	cx18_cancel_out_work_orders(cx);

	/* Stop ack interrupts that may have been needed for work to finish */
	cx18_sw2_irq_disable(cx, IRQ_CPU_TO_EPU_ACK | IRQ_APU_TO_EPU_ACK);

	cx18_halt_firmware(cx);

	destroy_workqueue(cx->in_work_queue);

	cx18_streams_cleanup(cx, 1);

	exit_cx18_i2c(cx);

	free_irq(cx->pci_dev->irq, (void *)cx);

	cx18_iounmap(cx);

	release_mem_region(cx->base_addr, CX18_MEM_SIZE);

	pci_disable_device(cx->pci_dev);

	if (cx->vbi.sliced_mpeg_data[0] != NULL)
		for (i = 0; i < CX18_VBI_FRAMES; i++)
			kfree(cx->vbi.sliced_mpeg_data[i]);

	v4l2_ctrl_handler_free(&cx->av_state.hdl);

	CX18_INFO("Removed %s\n", cx->card_name);

	v4l2_device_unregister(v4l2_dev);
	kfree(cx);
}
/*
 * sensor_init_controls - initialization using v4l2_ctrl.
 */
static int sensor_init_controls(struct sensor_info *info)
{
	struct v4l2_subdev *sd = &info->sd;
	int num_of_ctl_hint = ARRAY_SIZE(ctrl_private);

	/* set the controls using v4l2 control frameworks */
	v4l2_ctrl_handler_init(&info->handle, num_of_ctl_hint);

	/* Vision mode only support simple AE */
	info->ae_target = v4l2_ctrl_new_custom(&info->handle,
			&ctrl_private[0], NULL);
	info->ae_weight[0] = v4l2_ctrl_new_custom(&info->handle,
			&ctrl_private[1], NULL);
	info->ae_weight[1] = v4l2_ctrl_new_custom(&info->handle,
			&ctrl_private[2], NULL);
	info->ae_weight[2] = v4l2_ctrl_new_custom(&info->handle,
			&ctrl_private[3], NULL);
	info->ae_weight[3] = v4l2_ctrl_new_custom(&info->handle,
			&ctrl_private[4], NULL);
	info->ae_weight[4] = v4l2_ctrl_new_custom(&info->handle,
			&ctrl_private[5], NULL);
	info->ae_weight[5] = v4l2_ctrl_new_custom(&info->handle,
			&ctrl_private[6], NULL);
	info->ae_weight[6] = v4l2_ctrl_new_custom(&info->handle,
			&ctrl_private[7], NULL);
	info->ae_weight[7] = v4l2_ctrl_new_custom(&info->handle,
			&ctrl_private[8], NULL);
	info->rg_weight = v4l2_ctrl_new_custom(&info->handle,
			&ctrl_private[9], NULL);
	info->ae_speed = v4l2_ctrl_new_custom(&info->handle,
			&ctrl_private[10], NULL);
	info->shutter = v4l2_ctrl_new_custom(&info->handle,
			&ctrl_private[11], NULL);
	info->gain = v4l2_ctrl_new_custom(&info->handle,
			&ctrl_private[12], NULL);
	info->bit_converting = v4l2_ctrl_new_custom(&info->handle,
			&ctrl_private[13], NULL);
	info->autoexposure = v4l2_ctrl_new_custom(&info->handle,
			&ctrl_private[14], NULL);
	info->framerate = v4l2_ctrl_new_custom(&info->handle,
			&ctrl_private[15], NULL);

	sd->ctrl_handler = &info->handle;

	if (info->handle.error) {
		sensor_err("Failed to init controls, %d\n", info->handle.error);
		v4l2_ctrl_handler_free(&info->handle);
		return info->handle.error;
	}

	return 0;
}
Пример #24
0
static void si470x_usb_release(struct v4l2_device *v4l2_dev)
{
	struct si470x_device *radio =
		container_of(v4l2_dev, struct si470x_device, v4l2_dev);

	usb_free_urb(radio->int_in_urb);
	v4l2_ctrl_handler_free(&radio->hdl);
	v4l2_device_unregister(&radio->v4l2_dev);
	kfree(radio->int_in_buffer);
	kfree(radio->buffer);
	kfree(radio->usb_buf);
	kfree(radio);
}
Пример #25
0
static int lm3560_remove(struct i2c_client *client)
{
	struct lm3560_flash *flash = i2c_get_clientdata(client);
	unsigned int i;

	for (i = LM3560_LED0; i < LM3560_LED_MAX; i++) {
		v4l2_device_unregister_subdev(&flash->subdev_led[i]);
		v4l2_ctrl_handler_free(&flash->ctrls_led[i]);
		media_entity_cleanup(&flash->subdev_led[i].entity);
	}

	return 0;
}
Пример #26
0
static int empress_fini(struct saa7134_dev *dev)
{
    pr_debug("%s: %s\n", dev->name, __func__);

    if (NULL == dev->empress_dev)
        return 0;
    flush_work(&dev->empress_workqueue);
    video_unregister_device(dev->empress_dev);
    vb2_queue_release(&dev->empress_vbq);
    v4l2_ctrl_handler_free(&dev->empress_ctrl_handler);
    dev->empress_dev = NULL;
    return 0;
}
Пример #27
0
static int aksensor_remove(struct i2c_client *client)
{
	struct aksensor_priv *priv = to_aksensor(client);

	if (NULL != cur_sensor_info->handler) {
		cur_sensor_info->handler->cam_close_func();
		cur_sensor_info->handler = NULL; 
	}
	
	v4l2_device_unregister_subdev(&priv->subdev);
	v4l2_ctrl_handler_free(&priv->hdl);
	kfree(priv);
	return 0;
}
Пример #28
0
static int radio_isa_common_remove(struct radio_isa_card *isa,
				   unsigned region_size)
{
	const struct radio_isa_ops *ops = isa->drv->ops;

	ops->s_mute_volume(isa, true, isa->volume ? isa->volume->cur.val : 0);
	video_unregister_device(&isa->vdev);
	v4l2_ctrl_handler_free(&isa->hdl);
	v4l2_device_unregister(&isa->v4l2_dev);
	release_region(isa->io, region_size);
	v4l2_info(&isa->v4l2_dev, "Removed radio card %s\n", isa->drv->card);
	kfree(isa);
	return 0;
}
Пример #29
0
static int mt9v011_remove(struct i2c_client *c)
{
	struct v4l2_subdev *sd = i2c_get_clientdata(c);
	struct mt9v011 *core = to_mt9v011(sd);

	v4l2_dbg(1, debug, sd,
		"mt9v011.c: removing mt9v011 adapter on address 0x%x\n",
		c->addr << 1);

	v4l2_device_unregister_subdev(sd);
	v4l2_ctrl_handler_free(&core->ctrls);
	kfree(to_mt9v011(sd));
	return 0;
}
static int sensor_remove(struct i2c_client *client)
{
	struct v4l2_subdev *sd = i2c_get_clientdata(client);
	struct sensor_info *info = to_sensor(sd);

	v4l2_device_unregister_subdev(sd);
	v4l2_ctrl_handler_free(&info->handle);
	free_irq(info->pdata->irq, sd);
	gpio_free(info->pdata->gpio_rst);
	media_entity_cleanup(&sd->entity);
	kfree(info);

	return 0;
}