[PATCH] media: imx214: Fix stop streaming

From: Daniel Gomez
Date: Thu Oct 03 2019 - 10:46:43 EST


Stop video streaming when requested.

When s_stream is called to stop the video streaming, if/else condition calls
start_streaming function instead of the one for stopping it.

Fixes: 436190596241 ("media: imx214: Add imx214 camera sensor driver")
Signed-off-by: Daniel Gomez <daniel@xxxxxxxx>
---

You can find some logs before/after running in the hardware. Notice 0x100
register is for starting/stopping the video streaming from the imx214 sensor.

* Before patch:

# media-ctl -d /dev/media0 -l '"msm_csiphy0":1->"msm_csid0":0[1],"msm_csid0":1->"msm_ispif0":0[1],"msm_ispif0":1->"msm_vfe0_rdi0":0[1]'
# media-ctl -d /dev/media0 -V '"imx214 3-001a":0[fmt:SRGGB10/1920x1080],"msm_csiphy0":0[fmt:SRGGB10/1920x1080],"msm_csid0":0[fmt:SRGGB10/1920x1080],"msm_ispif0":0[fmt:SRGGB10/1920x1080],"msm_vfe0_rdi0":0[fmt:SRGGB10/1920x1080]'
# yavta -f SRGGB10P -s 1920x1080 -n 1 --capture=5 /dev/v4l/by-path/platform-a34000.camss-video-index0
Device /dev/v4l/by-path/platform-a34000.camss-video-index0 opened.
Device `Qualcomm Camera Subsystem' on `platform:a34000.camss' (driver 'qcom-camss') supports video, capture, with mplanes.
Video format set: SRGGB10P (41415270) 1920x1080 field none, 1 planes:
* Stride 2400, buffer size 2592000
Video format: SRGGB10P (41415270) 1920x1080 field none, 1 planes:
* Stride 2400, buffer size 2592000
1 buffers requested.
length: 1 offset: 4093609832 timestamp type/source: mono/EoF
Buffer 0/0 mapped at address 0xffff84b6b000.
0 (0) [-] none 0 2592000 B 30.682759 30.705111 4.697 fps ts mono/EoF
1 (0) [-] none 1 2592000 B 30.749391 30.771609 15.008 fps ts mono/EoF
2 (0) [-] none 2 2592000 B 30.816042 30.838225 15.004 fps ts mono/EoF
3 (0) [-] none 3 2592000 B 30.882690 30.904992 15.004 fps ts mono/EoF
4 (0) [-] none 4 2592000 B 30.949333 30.971543 15.005 fps ts mono/EoF
Captured 5 frames in 0.501681 seconds (9.966480 fps, 0.000000 B/s).
1 buffers released.
# v4l2-dbg -d /dev/v4l-subdev19 -g 0x100
ioctl: VIDIOC_DBG_G_REGISTER
Register 0x00000100 = 1h (1d 00000001b)

* After patch:

# media-ctl -d /dev/media0 -l '"msm_csiphy0":1->"msm_csid0":0[1],"msm_csid0":1->"msm_ispif0":0[1],"msm_ispif0":1->"msm_vfe0_rdi0":0[1]'
# media-ctl -d /dev/media0 -V '"imx214 3-001a":0[fmt:SRGGB10/1920x1080],"msm_csiphy0":0[fmt:SRGGB10/1920x1080],"msm_csid0":0[fmt:SRGGB10/1920x1080],"msm_ispif0":0[fmt:SRGGB10/1920x1080],"msm_vfe0_rdi0":0[fmt:SRGGB10/1920x1080]'
# yavta -f SRGGB10P -s 1920x1080 -n 1 --capture=5 /dev/v4l/by-path/platform-a34000.camss-video-index0
Device /dev/v4l/by-path/platform-a34000.camss-video-index0 opened.
Device `Qualcomm Camera Subsystem' on `platform:a34000.camss' (driver 'qcom-camss') supports video, capture, with mplanes.
Video format set: SRGGB10P (41415270) 1920x1080 field none, 1 planes:
* Stride 2400, buffer size 2592000
Video format: SRGGB10P (41415270) 1920x1080 field none, 1 planes:
* Stride 2400, buffer size 2592000
1 buffers requested.
length: 1 offset: 3764913896 timestamp type/source: mono/EoF
Buffer 0/0 mapped at address 0xffffb62f7000.
0 (0) [-] none 0 2592000 B 31.283473 31.306390 4.697 fps ts mono/EoF
1 (0) [-] none 1 2592000 B 31.350115 31.372475 15.006 fps ts mono/EoF
2 (0) [-] none 2 2592000 B 31.416765 31.439728 15.004 fps ts mono/EoF
3 (0) [-] none 3 2592000 B 31.483410 31.505791 15.005 fps ts mono/EoF
4 (0) [-] none 4 2592000 B 31.550058 31.573025 15.004 fps ts mono/EoF
Captured 5 frames in 0.502440 seconds (9.951430 fps, 0.000000 B/s).
1 buffers released.
# v4l2-dbg -d /dev/v4l-subdev19 -g 0x100
ioctl: VIDIOC_DBG_G_REGISTER
Register 0x00000100 = 0h (0d 00000000b)

drivers/media/i2c/imx214.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c
index 159a3a604f0e..24659cb0d083 100644
--- a/drivers/media/i2c/imx214.c
+++ b/drivers/media/i2c/imx214.c
@@ -785,7 +785,7 @@ static int imx214_s_stream(struct v4l2_subdev *subdev, int enable)
if (ret < 0)
goto err_rpm_put;
} else {
- ret = imx214_start_streaming(imx214);
+ ret = imx214_stop_streaming(imx214);
if (ret < 0)
goto err_rpm_put;
pm_runtime_put(imx214->dev);
--
2.20.1