summaryrefslogtreecommitdiff
path: root/drivers/staging/media/atomisp/pci/atomisp_fops.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/media/atomisp/pci/atomisp_fops.c')
-rw-r--r--drivers/staging/media/atomisp/pci/atomisp_fops.c49
1 files changed, 1 insertions, 48 deletions
diff --git a/drivers/staging/media/atomisp/pci/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp_fops.c
index 4dba6120af39..50c4123ba006 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_fops.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_fops.c
@@ -445,12 +445,8 @@ const struct vb2_ops atomisp_vb2_ops = {
static void atomisp_dev_init_struct(struct atomisp_device *isp)
{
- unsigned int i;
-
isp->isp_fatal_error = false;
- for (i = 0; i < isp->input_cnt; i++)
- isp->inputs[i].asd = NULL;
/*
* For Merrifield, frequency is scalable.
* After boot-up, the default frequency is 200MHz.
@@ -524,21 +520,12 @@ static int atomisp_open(struct file *file)
}
atomisp_dev_init_struct(isp);
-
- ret = v4l2_subdev_call(isp->flash, core, s_power, 1);
- if (ret < 0 && ret != -ENODEV && ret != -ENOIOCTLCMD) {
- dev_err(isp->dev, "Failed to power-on flash\n");
- goto css_error;
- }
-
atomisp_subdev_init_struct(asd);
pipe->users++;
mutex_unlock(&isp->mutex);
return 0;
-css_error:
- pm_runtime_put(vdev->v4l2_dev->dev);
error:
mutex_unlock(&isp->mutex);
v4l2_fh_release(file);
@@ -552,8 +539,6 @@ static int atomisp_release(struct file *file)
struct atomisp_video_pipe *pipe = atomisp_to_video_pipe(vdev);
struct atomisp_sub_device *asd = pipe->asd;
struct v4l2_subdev_fh fh;
- struct v4l2_rect clear_compose = {0};
- int ret;
v4l2_fh_init(&fh.vfh, vdev);
@@ -566,48 +551,16 @@ static int atomisp_release(struct file *file)
pipe->users--;
- /*
- * A little trick here:
- * file injection input resolution is recorded in the sink pad,
- * therefore can not be cleared when releaseing one device node.
- * The sink pad setting can only be cleared when all device nodes
- * get released.
- */
- {
- struct v4l2_mbus_framefmt isp_sink_fmt = { 0 };
-
- atomisp_subdev_set_ffmt(&asd->subdev, fh.state,
- V4L2_SUBDEV_FORMAT_ACTIVE,
- ATOMISP_SUBDEV_PAD_SINK, &isp_sink_fmt);
- }
-
atomisp_css_free_stat_buffers(asd);
atomisp_free_internal_buffers(asd);
- if (isp->inputs[asd->input_curr].asd == asd) {
- ret = v4l2_subdev_call(isp->inputs[asd->input_curr].camera,
- core, s_power, 0);
- if (ret && ret != -ENOIOCTLCMD)
- dev_warn(isp->dev, "Failed to power-off sensor\n");
-
- /* clear the asd field to show this camera is not used */
- isp->inputs[asd->input_curr].asd = NULL;
- }
+ atomisp_s_sensor_power(isp, asd->input_curr, 0);
atomisp_destroy_pipes_stream(asd);
- ret = v4l2_subdev_call(isp->flash, core, s_power, 0);
- if (ret < 0 && ret != -ENODEV && ret != -ENOIOCTLCMD)
- dev_warn(isp->dev, "Failed to power-off flash\n");
-
if (pm_runtime_put_sync(vdev->v4l2_dev->dev) < 0)
dev_err(isp->dev, "Failed to power off device\n");
- atomisp_subdev_set_selection(&asd->subdev, fh.state,
- V4L2_SUBDEV_FORMAT_ACTIVE,
- ATOMISP_SUBDEV_PAD_SOURCE,
- V4L2_SEL_TGT_COMPOSE, 0,
- &clear_compose);
mutex_unlock(&isp->mutex);
return 0;
}