diff --git a/patch/apalis_iMX8/0001-Bugfix-in-mipi_csi2_s_stream.-The-system-hung-on-str.patch b/patch/apalis_iMX8/0001-Bugfix-in-mipi_csi2_s_stream.-The-system-hung-on-str.patch new file mode 100644 index 0000000..ab06986 --- /dev/null +++ b/patch/apalis_iMX8/0001-Bugfix-in-mipi_csi2_s_stream.-The-system-hung-on-str.patch @@ -0,0 +1,56 @@ +From 5aaac6ea0229ec1583b4607a41b6c08895c158fe Mon Sep 17 00:00:00 2001 +From: Peter Martienssen +Date: Fri, 22 Apr 2022 18:21:35 +0200 +Subject: [PATCH 1/5] Bugfix in mipi_csi2_s_stream. The system hung on stream + start when stream was stopped twice before. This was especially the case when + using v4l2-ctl --stream-mmap --stream-count=1. + +--- + drivers/staging/media/imx/imx8-mipi-csi2.c | 29 +++++++++++++--------- + 1 file changed, 17 insertions(+), 12 deletions(-) + +diff --git a/drivers/staging/media/imx/imx8-mipi-csi2.c b/drivers/staging/media/imx/imx8-mipi-csi2.c +index 0227a4f25538..47c18d7d33c2 100644 +--- a/drivers/staging/media/imx/imx8-mipi-csi2.c ++++ b/drivers/staging/media/imx/imx8-mipi-csi2.c +@@ -948,20 +948,25 @@ static int mipi_csi2_s_stream(struct v4l2_subdev *sd, int enable) + __func__, enable, csi2dev->flags); + + if (enable) { +- pm_runtime_get_sync(dev); +- if (!csi2dev->running++) { +- mxc_csi2_get_sensor_fmt(csi2dev); +- mxc_mipi_csi2_hc_config(csi2dev); +- mxc_mipi_csi2_reset(csi2dev); +- mxc_mipi_csi2_csr_config(csi2dev); +- mxc_mipi_csi2_enable(csi2dev); +- mxc_mipi_csi2_reg_dump(csi2dev); +- } +- } else { +- if (!--csi2dev->running) ++ if (csi2dev->running) + mxc_mipi_csi2_disable(csi2dev); ++ else ++ pm_runtime_get_sync(dev); ++ ++ csi2dev->running = 1; ++ mxc_csi2_get_sensor_fmt(csi2dev); ++ mxc_mipi_csi2_hc_config(csi2dev); ++ mxc_mipi_csi2_reset(csi2dev); ++ mxc_mipi_csi2_csr_config(csi2dev); ++ mxc_mipi_csi2_enable(csi2dev); ++ mxc_mipi_csi2_reg_dump(csi2dev); + +- pm_runtime_put(dev); ++ } else { ++ if (csi2dev->running) { ++ csi2dev->running = 0; ++ mxc_mipi_csi2_disable(csi2dev); ++ pm_runtime_put(dev); ++ } + } + + return ret; +-- +2.25.1 + diff --git a/yocto/meta-vc-mipi/recipes-kernel/linux/linux-toradex_5.4-2.3.x.bbappend b/yocto/meta-vc-mipi/recipes-kernel/linux/linux-toradex_5.4-2.3.x.bbappend index fd2a266..6b62bc8 100644 --- a/yocto/meta-vc-mipi/recipes-kernel/linux/linux-toradex_5.4-2.3.x.bbappend +++ b/yocto/meta-vc-mipi/recipes-kernel/linux/linux-toradex_5.4-2.3.x.bbappend @@ -7,8 +7,9 @@ SRC_URI += "file://vc_mipi_core.h" SRC_URI += "file://vc_mipi_modules.c" SRC_URI += "file://vc_mipi_modules.h" SRC_URI += "file://0001-Added-CIDs-for-trigger_mode-flash_mode-frame_rate-an.patch" -SRC_URI += "file://0001-media-v4l-Add-Y14-format-support.patch" SRC_URI += "file://0001-Added-VC-MIPI-driver-files-to-.gitignore.patch" +SRC_URI += "file://0001-Bugfix-in-mipi_csi2_s_stream.-The-system-hung-on-str.patch" +SRC_URI += "file://0001-media-v4l-Add-Y14-format-support.patch" SRC_URI += "file://0002-Added-VC-MIPI-driver-to-Kconfig-toradex_defconfig-an.patch" SRC_URI += "file://0003-Added-pixelformat-GREY-Y10-Y12-Y14-RGGB-RG10-RG12-GB.patch" SRC_URI += "file://0004-It-is-necessary-to-provide-the-driver-with-the-set-m.patch"