diff options
author | Guoniu.zhou <guoniu.zhou@nxp.com> | 2021-01-29 10:29:11 +0800 |
---|---|---|
committer | Philippe Schenker <philippe.schenker@toradex.com> | 2022-05-18 16:47:50 +0200 |
commit | 7b01408469cae7ef288bbe29ab6324727fb5db0f (patch) | |
tree | a54c96437cc5d5b734239b33c6e192ae3a98234a /drivers/staging/media/imx/imx8-isi-cap.c | |
parent | 45719cacf645796012ddd248ad08af757ffa1c77 (diff) |
LF-3217: media: isi: cap: call streamoff if the process abnormal exit
For normal case, userspace should call streamon/streamoff balance, but
for some special case, the process will be killed or terminated and the
streamoff ioctl will be ignored. So driver need to handle the case.
Signed-off-by: Guoniu.zhou <guoniu.zhou@nxp.com>
Reviewed-by: Robby Cai <robby.cai@nxp.com>
(cherry picked from commit 057b44588095cb6be35175f42467c1481d0dd54b)
Diffstat (limited to 'drivers/staging/media/imx/imx8-isi-cap.c')
-rw-r--r-- | drivers/staging/media/imx/imx8-isi-cap.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/staging/media/imx/imx8-isi-cap.c b/drivers/staging/media/imx/imx8-isi-cap.c index 6ba5b3a86f49..0960a8fa8af8 100644 --- a/drivers/staging/media/imx/imx8-isi-cap.c +++ b/drivers/staging/media/imx/imx8-isi-cap.c @@ -31,6 +31,8 @@ #include "imx8-common.h" #define sd_to_cap_dev(ptr) container_of(ptr, struct mxc_isi_cap_dev, sd) +static int mxc_isi_cap_streamoff(struct file *file, void *priv, + enum v4l2_buf_type type); struct mxc_isi_fmt mxc_isi_out_formats[] = { { @@ -739,14 +741,19 @@ static int mxc_isi_capture_open(struct file *file) static int mxc_isi_capture_release(struct file *file) { struct mxc_isi_cap_dev *isi_cap = video_drvdata(file); + struct video_device *vdev = video_devdata(file); struct mxc_isi_dev *mxc_isi = mxc_isi_get_hostdata(isi_cap->pdev); struct device *dev = &isi_cap->pdev->dev; + struct vb2_queue *q = vdev->queue; struct v4l2_subdev *sd; int ret = -1; if (!isi_cap->is_link_setup) return 0; + if (isi_cap->is_streaming[isi_cap->id]) + mxc_isi_cap_streamoff(file, NULL, q->type); + sd = mxc_get_remote_subdev(&isi_cap->sd, __func__); if (!sd) goto label; @@ -1078,6 +1085,7 @@ static int mxc_isi_cap_streamon(struct file *file, void *priv, if (ret < 0 && ret != -ENOIOCTLCMD) return ret; + isi_cap->is_streaming[isi_cap->id] = 1; mxc_isi->is_streaming = 1; return 0; @@ -1096,6 +1104,7 @@ static int mxc_isi_cap_streamoff(struct file *file, void *priv, mxc_isi_channel_disable(mxc_isi); ret = vb2_ioctl_streamoff(file, priv, type); + isi_cap->is_streaming[isi_cap->id] = 0; mxc_isi->is_streaming = 0; return ret; |