Commit 4540e0ad authored by Songjun Wu's avatar Songjun Wu Committed by Mauro Carvalho Chehab

[media] atmel-isc: set the format on the first open

Set the current format on the first open.
Signed-off-by: default avatarSongjun Wu <songjun.wu@microchip.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent a58d1191
...@@ -924,10 +924,16 @@ static int isc_open(struct file *file) ...@@ -924,10 +924,16 @@ static int isc_open(struct file *file)
goto unlock; goto unlock;
ret = v4l2_subdev_call(sd, core, s_power, 1); ret = v4l2_subdev_call(sd, core, s_power, 1);
if (ret < 0 && ret != -ENOIOCTLCMD) if (ret < 0 && ret != -ENOIOCTLCMD) {
v4l2_fh_release(file); v4l2_fh_release(file);
else goto unlock;
ret = 0; }
ret = isc_set_fmt(isc, &isc->fmt);
if (ret) {
v4l2_subdev_call(sd, core, s_power, 0);
v4l2_fh_release(file);
}
unlock: unlock:
mutex_unlock(&isc->lock); mutex_unlock(&isc->lock);
...@@ -1118,8 +1124,16 @@ static int isc_set_default_fmt(struct isc_device *isc) ...@@ -1118,8 +1124,16 @@ static int isc_set_default_fmt(struct isc_device *isc)
.pixelformat = isc->user_formats[0]->fourcc, .pixelformat = isc->user_formats[0]->fourcc,
}, },
}; };
int ret;
return isc_set_fmt(isc, &f); ret = isc_try_fmt(isc, &f, NULL);
if (ret)
return ret;
isc->current_fmt = isc->user_formats[0];
isc->fmt = f;
return 0;
} }
static int isc_async_complete(struct v4l2_async_notifier *notifier) static int isc_async_complete(struct v4l2_async_notifier *notifier)
...@@ -1172,20 +1186,12 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier) ...@@ -1172,20 +1186,12 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier)
return ret; return ret;
} }
ret = v4l2_subdev_call(sd_entity->sd, core, s_power, 1);
if (ret < 0 && ret != -ENOIOCTLCMD)
return ret;
ret = isc_set_default_fmt(isc); ret = isc_set_default_fmt(isc);
if (ret) { if (ret) {
v4l2_err(&isc->v4l2_dev, "Could not set default format\n"); v4l2_err(&isc->v4l2_dev, "Could not set default format\n");
return ret; return ret;
} }
ret = v4l2_subdev_call(sd_entity->sd, core, s_power, 0);
if (ret < 0 && ret != -ENOIOCTLCMD)
return ret;
/* Register video device */ /* Register video device */
strlcpy(vdev->name, ATMEL_ISC_NAME, sizeof(vdev->name)); strlcpy(vdev->name, ATMEL_ISC_NAME, sizeof(vdev->name));
vdev->release = video_device_release_empty; vdev->release = video_device_release_empty;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment