commit 6d8f0595c9b1f3dd256eefa6e513114101fd138e
Author: Markus Bauer <mb@karo-electronics.de>
Date:   Wed Jan 26 10:20:28 2022 +0100

    Fit meta-basler-imx8 for karo layers

diff --git a/meta-basler-imx8/conf/layer.conf b/meta-basler-imx8/conf/layer.conf
index 4f801ed..e1ba955 100644
--- a/meta-basler-imx8/conf/layer.conf
+++ b/meta-basler-imx8/conf/layer.conf
@@ -35,4 +35,12 @@ KERNEL_DEVICETREE_append_imx8mpevk = " \
   freescale/imx8mp-evk-basler-isi0-isi1.dtb  \
   freescale/imx8mp-evk-basler-isi0.dtb "
 
-
+# qsxp
+KERNEL_DEVICETREE_append_qsxp-ml81 = " \
+  freescale/imx8mp-qsxp-ml81-qsbase3-basler.dtb \
+"
+
+# qsxm
+KERNEL_DEVICETREE_append_qsxm-mm60 = " \
+  freescale/imx8mm-qsxm-mm60-qsbase3-basler.dtb \
+"
diff --git a/meta-basler-imx8/recipes-kernel/linux/linux-imx/0022-Add-basler-camera-on-CSI1-via-ISI1.patch b/meta-basler-imx8/recipes-kernel/linux/linux-imx/0022-Add-basler-camera-on-CSI1-via-ISI1.patch
index ee20959..73a9d14 100644
--- a/meta-basler-imx8/recipes-kernel/linux/linux-imx/0022-Add-basler-camera-on-CSI1-via-ISI1.patch
+++ b/meta-basler-imx8/recipes-kernel/linux/linux-imx/0022-Add-basler-camera-on-CSI1-via-ISI1.patch
@@ -4,23 +4,10 @@ Date: Thu, 8 Oct 2020 18:36:21 +0200
 Subject: [PATCH 22/27] Add basler camera on CSI1 via ISI1.
 
 ---
- arch/arm64/boot/dts/freescale/Makefile        |   1 +
  .../imx8mp-evk-basler-mixed-isp-isi.dts       | 113 ++++++++++++++++++
  2 files changed, 114 insertions(+)
  create mode 100644 arch/arm64/boot/dts/freescale/imx8mp-evk-basler-mixed-isp-isi.dts
 
-diff --git a/arch/arm64/boot/dts/freescale/Makefile b/arch/arm64/boot/dts/freescale/Makefile
-index f109d1d95..4e4c0f50b 100644
---- a/arch/arm64/boot/dts/freescale/Makefile
-+++ b/arch/arm64/boot/dts/freescale/Makefile
-@@ -84,6 +84,7 @@ dtb-$(CONFIG_ARCH_MXC) += imx8mp-evk.dtb imx8mp-evk-rm67191.dtb imx8mp-evk-it626
- 			  imx8mp-evk-root.dtb imx8mp-evk-inmate.dtb imx8mp-evk-ov2775.dtb \
- 			  imx8mp-evk-ov2775-ov5640.dtb imx8mp-evk-basler-ov5640.dtb imx8mp-evk-basler.dtb \
- 			  imx8mp-evk-basler-ov2775.dtb imx8mp-evk-dual-basler.dtb \
-+			  imx8mp-evk-basler-mixed-isp-isi.dtb \
- 			  imx8mp-evk-dual-ov2775.dtb imx8mp-evk-spdif-lb.dtb imx8mp-evk-dsp.dtb \
- 			  imx8mp-evk-dsp-lpa.dtb imx8mp-evk-sof-wm8960.dtb \
- 			  imx8mp-evk-iqaudio-dacplus.dtb imx8mp-evk-iqaudio-dacpro.dtb imx8mp-evk-hifiberry-dacplus.dtb \
 diff --git a/arch/arm64/boot/dts/freescale/imx8mp-evk-basler-mixed-isp-isi.dts b/arch/arm64/boot/dts/freescale/imx8mp-evk-basler-mixed-isp-isi.dts
 new file mode 100644
 index 000000000..4628a57a4
diff --git a/meta-basler-imx8/recipes-kernel/linux/linux-imx/dts/freescale/imx8mm-qsxm-mm60-qsbase3-basler.dts b/meta-basler-imx8/recipes-kernel/linux/linux-imx/dts/freescale/imx8mm-qsxm-mm60-qsbase3-basler.dts
new file mode 100644
index 0000000..a5e6b53
--- /dev/null
+++ b/meta-basler-imx8/recipes-kernel/linux/linux-imx/dts/freescale/imx8mm-qsxm-mm60-qsbase3-basler.dts
@@ -0,0 +1,89 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2021 Markus Bauer <mb@karo-electronics.de>
+ *
+ */
+
+/dts-v1/;
+
+#include "imx8mm-qsxm-mm60-qsbase3-raspi-display.dts"
+
+&mipi_csi_1 {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	status = "okay";
+
+	port {
+		mipi1_sensor_ep: endpoint@1 {
+			remote-endpoint = <&basler_camera_mipi1_ep>;
+
+			/* If the following entries are changed, then
+			 * the entries in the basler_camera_mipi1_ep node
+			 * need to updated too. */
+			/* On the i.mx8mmini NXP uses data-lanes
+			 * other than expected by the kernel.
+			 * On the imx8mmini the entry data-lanes
+			 * must contain the number of data lanes. */
+			data-lanes = <4>;
+			clock-lanes = <0>;
+			link-frequencies = /bits/ 64 <496000000>;
+
+			csis-hs-settle = <13>;
+			csis-clk-settle = <2>;
+			csis-wclk;
+		};
+
+		csi1_mipi_ep: endpoint@2 {
+			remote-endpoint = <&csi1_ep>;
+		};
+	};
+};
+
+&csi1_bridge {
+	fsl,mipi-mode;
+	dma-coherent;
+	bsl,dma-invalidate;
+	status = "okay";
+
+	port {
+		csi1_ep: endpoint {
+			remote-endpoint = <&csi1_mipi_ep>;
+		};
+	};
+};
+
+&i2c3 {
+	basler_camera_mipi1: basler_camera_mipi@36 {
+		compatible = "basler,basler-camera";
+		reg = <0x36>;
+		status = "okay";
+
+		port {
+			basler_camera_mipi1_ep: endpoint@1 {
+				remote-endpoint = <&mipi1_sensor_ep>;
+
+				/* IMPORTANT: The following three entries needs to be held
+				 * in sync with the information stored in the mipi1_sensor_ep node. */
+				data-lanes = <1 2 3 4>;
+				clock-lanes = <0>;
+				link-frequencies = /bits/ 64 <496000000>;
+			};
+		};
+	};
+};
+
+&vpu_g1 {
+	status = "okay";
+};
+
+&vpu_g2 {
+	status = "okay";
+};
+
+&vpu_h1 {
+	status = "okay";
+};
+
+&vpu_v4l2 {
+	status = "okay";
+};
diff --git a/meta-basler-imx8/recipes-kernel/linux/linux-imx/dts/freescale/imx8mp-qsxp-ml81-qsbase3-basler.dts b/meta-basler-imx8/recipes-kernel/linux/linux-imx/dts/freescale/imx8mp-qsxp-ml81-qsbase3-basler.dts
new file mode 100644
index 0000000..a989c8d
--- /dev/null
+++ b/meta-basler-imx8/recipes-kernel/linux/linux-imx/dts/freescale/imx8mp-qsxp-ml81-qsbase3-basler.dts
@@ -0,0 +1,91 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2021 Markus Bauer <mb@karo-electronics.de>
+ *
+ */
+
+/dts-v1/;
+
+#include "imx8mp-qsxp-ml81-qsbase3-raspi-display.dts"
+
+/ {
+	model = "Ka-Ro electronics QSXP-ML81 (NXP i.MX8MP) module on QSBASE3 baseboard with Raspberry Pi Display and Basler camera";
+};
+
+&dsp {
+	status = "okay";
+};
+
+&i2c3 {
+	basler_camera_vvcam@36 {
+		compatible = "basler,basler-camera-vvcam", "basler-camera-vvcam";
+		reg = <0x36>;
+		csi_id = <0x00>;
+		status = "okay";
+
+		port {
+			basler_ep_0: endpoint {
+				data-lanes = <1 2 3 4>;
+				clock-lanes = <0>;
+				link-frequencies = /bits/ 64 <750000000>;
+				max-lane-frequency = /bits/ 64 <750000000>;
+				max-pixel-frequency = /bits/ 64 <500000000>;
+				max-data-rate = /bits/ 64 <0>;
+				remote-endpoint = <&mipi_csi0_ep>;
+			};
+		};
+	};
+};
+
+&mipi_csi_0 {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	status = "okay";
+
+	port@0 {
+		reg = <0>;
+		mipi_csi0_ep: endpoint {
+			remote-endpoint = <&basler_ep_0>;
+			data-lanes = <4>;
+			csis-hs-settle = <16>;
+			csis-clk-settle = <2>;
+			csis-wclk;
+		};
+	};
+};
+
+&cameradev {
+	status = "okay";
+};
+
+&isi_0 {
+	status = "disabled";
+
+	cap_device {
+		status = "okay";
+	};
+
+	m2m_device {
+		status = "okay";
+	};
+};
+
+&isi_1 {
+	status = "disabled";
+
+	cap_device {
+		status = "okay";
+	};
+};
+
+&isp_0 {
+	status = "okay";
+};
+
+&dewarp {
+	status = "okay";
+};
+
+&vpu_v4l2 {
+	status = "okay";
+};
diff --git a/meta-basler-imx8/recipes-kernel/linux/linux-imx_5.10.bbappend b/meta-basler-imx8/recipes-kernel/linux/linux-imx_5.10.bbappend
index d90b55e..c48a08b 100644
--- a/meta-basler-imx8/recipes-kernel/linux/linux-imx_5.10.bbappend
+++ b/meta-basler-imx8/recipes-kernel/linux/linux-imx_5.10.bbappend
@@ -2,3 +2,7 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/linux-imx:"
 
 require linux-imx_5.10.inc
 
+SRC_URI_append = " \
+        file://dts/freescale/imx8mp-qsxp-ml81-qsbase3-basler.dts;subdir=git/arch/arm64/boot \
+        file://dts/freescale/imx8mm-qsxm-mm60-qsbase3-basler.dts;subdir=git/arch/arm64/boot \
+"
diff --git a/meta-basler-imx8/recipes-kernel/linux/linux-imx_5.10.inc b/meta-basler-imx8/recipes-kernel/linux/linux-imx_5.10.inc
index 7c85cf1..5b4594b 100644
--- a/meta-basler-imx8/recipes-kernel/linux/linux-imx_5.10.inc
+++ b/meta-basler-imx8/recipes-kernel/linux/linux-imx_5.10.inc
@@ -25,8 +25,6 @@ SRC_URI_append = "\
     file://0022-Add-basler-camera-on-CSI1-via-ISI1.patch  \
     file://0023-Add-basler-camera-on-CSI0-via-ISI0-chained.patch  \
     file://0024-imx8mp-isi-add-dual-isi-dtb.-fix-max-link-frequencie.patch  \
-    file://0025-LF-2670-01-arm64-dts-add-sensor-clock-for-isp.patch  \
     file://0026-LF-2670-02-media-isi-core-disable-gate-clock-for-isi.patch  \
-    file://0027-LF-2670-03-media-csi-disable-gate-clock-for-csi-by-d.patch  \
 "
 
diff --git a/meta-basler-tools/meta-basler-common/recipes-bsp/isp-imx/isp-imx/init b/meta-basler-tools/meta-basler-common/recipes-bsp/isp-imx/isp-imx/init
new file mode 100644
index 0000000..12f0163
--- /dev/null
+++ b/meta-basler-tools/meta-basler-common/recipes-bsp/isp-imx/isp-imx/init
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+### BEGIN INIT INFO
+# Provides: isp-imx
+# Required-Start: $local_fs $remote_fs
+# Required-Stop: $local_fs $remote_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+### END INIT INFO
+
+export PATH=/sbin:/bin:/usr/bin:/usr/sbin
+
+killproc() {
+        pid=`/bin/pidof $1`
+        [ "$pid" != "" ] && kill $pid
+}
+
+case "$1" in
+  start)
+        /opt/imx8-isp/bin/start_isp.sh > /dev/null &
+  ;;
+
+  stop)
+        echo "Stopping imx8-isp"
+        killall isp-imx
+  ;;
+
+  restart)
+        $0 stop
+        sleep 1
+        $0 start
+  ;;
+
+  *)
+        echo "usage: $0 { start | stop | restart }"
+  ;;
+esac
+
+exit 0
diff --git a/meta-basler-tools/meta-basler-common/recipes-bsp/isp-imx/isp-imx_4.2.2.14+basler.bb b/meta-basler-tools/meta-basler-common/recipes-bsp/isp-imx/isp-imx_4.2.2.14+basler.bb
index 912c155..d85056c 100644
--- a/meta-basler-tools/meta-basler-common/recipes-bsp/isp-imx/isp-imx_4.2.2.14+basler.bb
+++ b/meta-basler-tools/meta-basler-common/recipes-bsp/isp-imx/isp-imx_4.2.2.14+basler.bb
@@ -4,13 +4,16 @@ DESCRIPTION = "i.MX8M Plus ISP stack"
 LICENSE = "Basler & MIT"
 LIC_FILES_CHKSUM = "file://COPYING;md5=8fa3130fd6cc076743b929f50b7be06a"
 
-SRC_URI = "file://isp-imx_${PV}.tar.gz;subdir=${S}\
+SRC_URI = "file://init\
+           file://isp-imx_${PV}.tar.gz;subdir=${S}\
 	         file://COPYING;subdir=${S}\
           "
 
-inherit systemd  
+inherit update-rc.d systemd
 
 do_install() {
+    install -Dm755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/isp-imx
+
     install -d ${D}/${libdir}
     install -d ${D}/opt/imx8-isp/bin
     cp -r ${S}/opt/imx8-isp/bin/* ${D}/opt/imx8-isp/bin
@@ -23,13 +26,13 @@ do_install() {
      fi
 }
 
-RDEPENDS_${PN} = "libdrm bash imx-gpu-g2d kernel-module-isp-vvcam"
+RDEPENDS_${PN} = "libdrm bash procps imx-gpu-g2d kernel-module-isp-vvcam"
 SYSTEMD_AUTO_ENABLE = "enable"
 SYSTEMD_SERVICE_${PN} = "imx8-isp.service"
 PACKAGES = "${PN}"
 
-FILES_${PN} = "${libdir} /opt ${systemd_system_unitdir}/imx8-isp.service /etc/default"
+FILES_${PN} = "${libdir} /opt ${systemd_system_unitdir}/imx8-isp.service /etc/default ${sysconfdir}/init.d/isp-imx"
 
 INSANE_SKIP_${PN} += "rpaths dev-deps dev-so already-stripped"
 
-
+INITSCRIPT_NAME = "isp-imx"
