From be4c57019ebf27a4cfe8bdd9bd8a2cc9f4fddd12 Mon Sep 17 00:00:00 2001
From: Felix Gerking <felix.gerking@garz-fricke.com>
Date: Thu, 3 Nov 2022 09:31:46 +0100
Subject: [PATCH] dts:mc3: Add backplane HDMI support (via ADV7535)

For the ADV7535 i2c connection, the PMIC's i2c level shifter must be
enabled.
Use 12MHz as dsi reference clock rate. This allows the ADV7535 to derive
suitable DDR clock rates. For futher details see:
https://source.codeaurora.org/external/imx/linux-imx/commit/arch/arm64/boot/dts/freescale/imx8mp.dtsi?h=lf-5.15.y&id=5b91a97520cf7479d313c855225caf83e5f3a228

BCS 746-000939
---
 arch/arm64/boot/dts/seconorth/Makefile        |  1 +
 .../dts/seconorth/hdmi-backplane-mc3.dtsi     | 70 +++++++++++++++++++
 .../seconorth-mc3-hdmi-backplane.dts          | 13 ++++
 3 files changed, 84 insertions(+)
 create mode 100644 arch/arm64/boot/dts/seconorth/hdmi-backplane-mc3.dtsi
 create mode 100644 arch/arm64/boot/dts/seconorth/seconorth-mc3-hdmi-backplane.dts

diff --git a/arch/arm64/boot/dts/seconorth/Makefile b/arch/arm64/boot/dts/seconorth/Makefile
index 63356d36ea8b8..b373833114aee 100644
--- a/arch/arm64/boot/dts/seconorth/Makefile
+++ b/arch/arm64/boot/dts/seconorth/Makefile
@@ -3,6 +3,7 @@
 dtb-y += 	\
 		pcf8563-overlay.dtbo \
 		rx8803-overlay.dtbo \
+		seconorth-mc3-hdmi-backplane.dtb \
 		seconorth-mc3-headless.dtb \
 		seconorth-mc3-lq057q3dc12.dtb \
 		seconorth-tanaro-atm0700l61ct.dtb \
diff --git a/arch/arm64/boot/dts/seconorth/hdmi-backplane-mc3.dtsi b/arch/arm64/boot/dts/seconorth/hdmi-backplane-mc3.dtsi
new file mode 100644
index 0000000000000..b43c978701eea
--- /dev/null
+++ b/arch/arm64/boot/dts/seconorth/hdmi-backplane-mc3.dtsi
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2022 SECO Northern Europe GmbH
+ */
+
+/ {
+	reg_hdmi_bp: regulator-hdmi-bp {
+		compatible = "regulator-fixed";
+		regulator-name = "HDMI_BP_5V";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_hdmi_bp>;
+		gpio = <&gpio3 20 0>;
+		enable-active-high;
+		regulator-always-on;
+		vin-supply = <&reg_vin_fused>;
+	};
+};
+
+&iomuxc {
+	pinctrl_adv7535_i2c: adv7535grp {
+		fsl,pins = <
+			MX8MP_IOMUXC_SD1_CMD__GPIO2_IO01			PAD_GPIO	/* ADV_INT */
+		>;
+	};
+
+	pinctrl_hdmi_bp: hdmi-bp {
+		fsl,pins = <
+			MX8MP_IOMUXC_SAI5_RXC__GPIO3_IO20			PAD_GPIO	/* HDMI_BP_5V_EN */
+		>;
+	};
+};
+
+&i2c4 {
+	adv_bridge: adv7535@39 {
+		compatible = "adi,adv7535";
+		reg = <0x39>;
+		adi,dsi-lanes = <4>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_adv7535_i2c>;
+		interrupt-parent = <&gpio2>;
+		interrupts = <1 IRQ_TYPE_LEVEL_LOW>;
+
+		status = "okay";
+
+		port {
+			adv7535_from_dsim: endpoint {
+				remote-endpoint = <&dsim_to_adv7535>;
+			};
+		};
+	};
+};
+
+&lcdif1 {
+	status = "okay";
+};
+
+&mipi_dsi {
+	status = "okay";
+	assigned-clock-parents = <&clk IMX8MP_CLK_24M>;
+	assigned-clock-rates = <12000000>;
+	/delete-property/ pref-rate;
+
+	port@1 {
+		dsim_to_adv7535: endpoint {
+			remote-endpoint = <&adv7535_from_dsim>;
+			attach-bridge;
+		};
+	};
+};
diff --git a/arch/arm64/boot/dts/seconorth/seconorth-mc3-hdmi-backplane.dts b/arch/arm64/boot/dts/seconorth/seconorth-mc3-hdmi-backplane.dts
new file mode 100644
index 0000000000000..5b7815cfccdd2
--- /dev/null
+++ b/arch/arm64/boot/dts/seconorth/seconorth-mc3-hdmi-backplane.dts
@@ -0,0 +1,13 @@
+/*
+ * Copyright 2022 SECO Nothern Europe GmbH
+ */
+
+/dts-v1/;
+
+#include "mc3.dtsi"
+#include "hdmi-backplane-mc3.dtsi"
+
+/ {
+	model      = "SECO Nothern Europe GmbH - Main Controller 3 HDMI BP, i.MX8MP";
+	compatible = "kk,trizeps8", "kk,trizeps8plus", "fsl,imx8mp-evk", "fsl,imx8mp";
+};
-- 
GitLab