From cac457dcd4e422adc96572e54f4637a15453c06a Mon Sep 17 00:00:00 2001
From: Felix Gerking <felix.gerking@garz-fricke.com>
Date: Thu, 3 Nov 2022 09:04:04 +0100
Subject: [PATCH] dts:mc3:hdmi: Add onboard HDMI support

At the moment there is a problem with the HDMI hot plug detection (HPD)
in combination with the eARC. The HPD only works correctly when
the EARC_N_HPD signal is disconnected. Simply enabling or disabling the
xcvr (eARC) controller does not result in a valid HPD.
HDMI works when the eARC is not connected.
The 5V fault detection is currently not supported.

BCS 746-000949
---
 arch/arm64/boot/dts/seconorth/mc3.dtsi | 60 ++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/arch/arm64/boot/dts/seconorth/mc3.dtsi b/arch/arm64/boot/dts/seconorth/mc3.dtsi
index 4d4a0c5dce02a..edb45120b9873 100644
--- a/arch/arm64/boot/dts/seconorth/mc3.dtsi
+++ b/arch/arm64/boot/dts/seconorth/mc3.dtsi
@@ -137,6 +137,21 @@ reg_usdhc2_vqmmc: regulator-usdhc2-vqmmc {
 		states = <1800000 1>, <3300000 0>;
 	};
 
+	sound_hdmi: sound-hdmi {
+		compatible = "fsl,imx-audio-hdmi";
+		model = "audio-hdmi";
+		audio-cpu = <&aud2htx>;
+		hdmi-out;
+		constraint-rate = <44100>,
+				<88200>,
+				<176400>,
+				<32000>,
+				<48000>,
+				<96000>,
+				<192000>;
+		status = "okay";
+	};
+
 	usbhub_reset: usbhub-gpio-reset {
 		compatible = "gpio-reset";
 		pinctrl-names = "USBHUB_RST";
@@ -305,6 +320,24 @@ &vpu_v4l2 {
 	status = "okay";
 };
 
+/* HDMI onboard */
+
+&irqsteer_hdmi {
+	status = "okay";
+};
+
+&hdmi_blk_ctrl {
+	status = "okay";
+};
+
+&hdmi_pavi {
+	status = "okay";
+};
+
+&hdmi {
+	status = "okay";
+};
+
 /*
  * For some reason, without the hdmiphy the device stalls
  * during the boot process. Further investigation into why
@@ -314,6 +347,23 @@ &hdmiphy {
 	status = "okay";
 };
 
+&lcdif3 {
+	status = "okay";
+
+	/*
+	 * thres-low and thres-high values were taken from
+	 * imx8mp-evk.dtb
+	 */
+	thres-low  = <1 2>;             /* (FIFO * 1 / 2) */
+	thres-high = <3 4>;             /* (FIFO * 3 / 4) */
+};
+
+/* HDMI Audio */
+
+&aud2htx {
+	status = "okay";
+};
+
 &i2c1 {
 	clock-frequency = <100000>;
 	pinctrl-names = "default";
@@ -489,6 +539,16 @@ &i2c4 {
 
 &iomuxc {
 	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_hog>;
+
+	pinctrl_hog: hoggrp {
+		fsl,pins = <
+			MX8MP_IOMUXC_HDMI_DDC_SCL__HDMIMIX_HDMI_SCL	0x400001c3
+			MX8MP_IOMUXC_HDMI_DDC_SDA__HDMIMIX_HDMI_SDA	0x400001c3
+			MX8MP_IOMUXC_HDMI_HPD__HDMIMIX_HDMI_HPD		0x40000019
+			MX8MP_IOMUXC_HDMI_CEC__HDMIMIX_HDMI_CEC		0x40000019
+		>;
+	};
 
 	pinctrl_buzzer_pwm4: pwm-buzzer {
 		fsl,pins = <MX8MP_IOMUXC_SAI3_MCLK__PWM4_OUT 0x80000000>;
-- 
GitLab