From ed9cd1de8ddfb02d42d70a530edf571873dcde96 Mon Sep 17 00:00:00 2001
From: b19715 <b19715@freescale.com>
Date: Tue, 28 Sep 2021 11:32:17 +0800
Subject: [PATCH] iMX8QM MEK, add ISL7998x support.

---
 arch/arm64/boot/dts/freescale/Makefile        |   1 +
 .../dts/freescale/imx8qm-mek-isl7998x.dts     | 172 ++++++++++++++++++
 2 files changed, 173 insertions(+)
 create mode 100644 arch/arm64/boot/dts/freescale/imx8qm-mek-isl7998x.dts

diff --git a/arch/arm64/boot/dts/freescale/Makefile b/arch/arm64/boot/dts/freescale/Makefile
index 3c2d8faef821..5d9b8499e1b4 100644
--- a/arch/arm64/boot/dts/freescale/Makefile
+++ b/arch/arm64/boot/dts/freescale/Makefile
@@ -97,6 +97,7 @@ dtb-$(CONFIG_ARCH_MXC) += imx8qm-mek.dtb imx8qm-mek-ov5640.dtb \
 			  imx8qm-mek-jdi-wuxga-lvds1-panel.dtb \
 			  imx8qm-mek-jdi-wuxga-lvds1-panel-rpmsg.dtb \
 			  imx8qm-mek-usdhc3-m2.dtb imx8qm-mek-usd-wifi.dtb \
+			  imx8qm-mek-isl7998x.dtb \
 			  imx8qm-lpddr4-val.dtb imx8qm-lpddr4-val-mqs.dtb \
 			  imx8qm-lpddr4-val-spdif.dtb imx8qm-mek-ca53.dtb \
 			  imx8qm-mek-ca72.dtb imx8qm-lpddr4-val-ca53.dtb \
diff --git a/arch/arm64/boot/dts/freescale/imx8qm-mek-isl7998x.dts b/arch/arm64/boot/dts/freescale/imx8qm-mek-isl7998x.dts
new file mode 100644
index 000000000000..3e5e170addcb
--- /dev/null
+++ b/arch/arm64/boot/dts/freescale/imx8qm-mek-isl7998x.dts
@@ -0,0 +1,172 @@
+/*
+ * Copyright 2021 NXP
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include "imx8qm-mek.dts"
+
+&iomuxc {
+	pinctrl_isl7998x0: isl7998x0grp{
+		fsl,pins = <
+			IMX8QM_MIPI_CSI0_GPIO0_00_LSIO_GPIO1_IO27		0xC0000041
+			IMX8QM_MIPI_CSI0_GPIO0_01_LSIO_GPIO1_IO28		0xC0000041
+		>;
+	};
+
+	pinctrl_isl7998x1: isl7998x1grp{
+		fsl,pins = <
+			IMX8QM_MIPI_CSI1_GPIO0_00_LSIO_GPIO1_IO30		0xC0000041
+			IMX8QM_MIPI_CSI1_GPIO0_01_LSIO_GPIO1_IO31		0xC0000041
+		>;
+	};
+};
+
+&isi_0 {
+	interface = <2 0 2>;
+	deinterlace_mode = <0>;  /* 0 ~ 1: No de-interlacing,
+				    2: Odd even weave, 3: Even odd weave
+				    4: Odd even blending, 5: Even odd blending
+				    6 ~ 7: Line doubling */
+	ntsc_top = <0>;		/* 0 for ISL79987. */
+	status = "okay";
+};
+
+&isi_1 {
+	interface = <2 1 2>;
+	deinterlace_mode = <0>;  /* 0 ~ 1: No de-interlacing,
+				    2: Odd even weave, 3: Even odd weave
+				    4: Odd even blending, 5: Even odd blending
+				    6 ~ 7: Line doubling */
+	ntsc_top = <0>;		/* 0 for ISL79987. */
+	status = "okay";
+};
+
+&isi_2 {
+	interface = <2 2 2>;
+	deinterlace_mode = <0>;  /* 0 ~ 1: No de-interlacing,
+				    2: Odd even weave, 3: Even odd weave
+				    4: Odd even blending, 5: Even odd blending
+				    6 ~ 7: Line doubling */
+	ntsc_top = <0>;		/* 0 for ISL79987. */
+	status = "okay";
+};
+
+&isi_3 {
+	interface = <2 3 2>;
+	deinterlace_mode = <0>;  /* 0 ~ 1: No de-interlacing,
+				    2: Odd even weave, 3: Even odd weave
+				    4: Odd even blending, 5: Even odd blending
+				    6 ~ 7: Line doubling */
+	ntsc_top = <0>;		/* 0 for ISL79987. */
+	status = "okay";
+};
+
+&isi_4 {
+	status = "disabled";
+};
+
+&isi_5 {
+	status = "disabled";
+};
+
+&isi_6 {
+	status = "disabled";
+};
+
+&isi_7 {
+	status = "disabled";
+};
+
+&mipi_csi_0 {
+	virtual-channel;
+	status = "okay";
+
+	/delete-node/port@0;
+
+	port@0 {
+		reg = <0>;
+		mipi_csi0_ep: endpoint {
+			remote-endpoint = <&isl7998x_mipi_ep>;
+			data-lanes = <1 2>;
+		};
+	};
+};
+
+&mipi_csi_1 {
+	virtual-channel;
+	status = "okay";
+
+	/delete-node/port@1;
+
+	port@1 {
+		reg = <1>;
+		mipi_csi1_ep: endpoint {
+			remote-endpoint = <&isl7998x_mipi_ep_1>;
+			data-lanes = <1 2>;
+		};
+	};
+};
+
+&i2c_mipi_csi0 {
+	clock-frequency = <100000>;
+	status = "okay";
+
+	isl7998x: isl7998x@44 {
+		compatible = "intersil,isl7998x";
+		reg = <0x44>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_isl7998x0>;
+		clocks = <&clk_dummy>;
+		clock-names = "capture_mclk";
+		mclk = <27000000>;
+		mclk_source = <0>;
+		pwn-gpios = <&lsio_gpio3 7 GPIO_ACTIVE_LOW>;
+		rst-gpios = <&lsio_gpio3 8 GPIO_ACTIVE_HIGH>;
+		virtual-channel;
+		status = "okay";
+		port {
+			isl7998x_mipi_ep: endpoint {
+				remote-endpoint = <&mipi_csi0_ep>;
+			};
+		};
+	};
+
+	/delete-node/max9286_mipi@6a;
+};
+
+&i2c_mipi_csi1 {
+	clock-frequency = <100000>;
+	status = "okay";
+
+	isl7998x_1: isl7998x_1@44 {
+		compatible = "intersil,isl7998x";
+		reg = <0x44>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_isl7998x1>;
+		clocks = <&clk_dummy>;
+		clock-names = "capture_mclk";
+		mclk = <27000000>;
+		mclk_source = <0>;
+		pwn-gpios = <&lsio_gpio3 7 GPIO_ACTIVE_LOW>;
+		rst-gpios = <&lsio_gpio3 8 GPIO_ACTIVE_HIGH>;
+		virtual-channel;
+		status = "okay";
+		port {
+			isl7998x_mipi_ep_1: endpoint {
+				remote-endpoint = <&mipi_csi1_ep>;
+			};
+		};
+	};
+
+	/delete-node/max9286_mipi@6a;
+};
+
-- 
2.17.1

