Ejemplo n.º 1
0
int s3c_camif_release(struct inode *inode, struct file *file)
{
	camif_cfg_t *cfg = s3c_camif_get_fimc_object(MINOR(inode->i_rdev));

	if (cfg->dma_type & CAMIF_PREVIEW) {
		cfg->cis->status &= ~PWANT2START;
		cfg->cis->status |= P_NOT_WORKING;
		s3c_camif_stop_preview(cfg);
		up((struct semaphore *) &cfg->cis->lock);
	} else {
		cfg->cis->status &= ~CWANT2START;
		s3c_camif_stop_capture(cfg);
	}

	video_exclusive_release(inode, file);

	if (cfg->cis->sensor == NULL)
		DPRINTK("A CIS sensor for MSDMA has been used\n");
	else
		cfg->cis->sensor->driver->command(cfg->cis->sensor, USER_EXIT, NULL);

	cfg->cis->user--;
	cfg->status = CAMIF_STOPPED;

	return 0;
}
Ejemplo n.º 2
0
/* release the camera */
static int zr364xx_release(struct inode *inode, struct file *file)
{
	struct video_device *vdev = video_devdata(file);
	struct zr364xx_camera *cam;
	struct usb_device *udev;
	int i, err;

	DBG("zr364xx_release");

	if (vdev == NULL)
		return -ENODEV;
	cam = video_get_drvdata(vdev);

	udev = cam->udev;

	mutex_lock(&cam->lock);
	for (i = 0; i < 2; i++) {
		err =
		    send_control_msg(udev, 1, init[cam->method][i].value,
				     0, init[i][cam->method].bytes,
				     init[cam->method][i].size);
		if (err < 0) {
			info("error during release sequence");
			mutex_unlock(&cam->lock);
			return err;
		}
	}

	file->private_data = NULL;
	video_exclusive_release(inode, file);

	/* Added some delay here, since opening/closing the camera quickly,
	 * like Ekiga does during its startup, can crash the webcam
	 */
	mdelay(100);

	mutex_unlock(&cam->lock);
	return 0;
}