// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright 2025 Josua Mayer <josua@solid-run.com>
 */

/ {
	hdmi-connector {
		compatible = "hdmi-connector";
		label = "hdmi";
		type = "c";

		port {
			hdmi_connector_in: endpoint {
				remote-endpoint = <&adv7535_out>;
			};
		};
	};
};

&i2c3 {
	hdmi@3d {
		compatible = "adi,adv7535";
		reg = <0x3d>, <0x3f>, <0x3c>, <0x38>;
		reg-names = "main", "edid", "cec", "packet";
		adi,dsi-lanes = <4>;
		avdd-supply = <&v_1_8>;
		dvdd-supply = <&v_1_8>;
		pvdd-supply = <&v_1_8>;
		a2vdd-supply = <&v_1_8>;
		v3p3-supply = <&v_3_3>;
		pinctrl-names = "default";
		pinctrl-0 = <&mini_hdmi_pins>;
		interrupt-parent = <&gpio4>;
		interrupts = <27 IRQ_TYPE_EDGE_FALLING>;

		ports {
			#address-cells = <1>;
			#size-cells = <0>;

			port@0 {
				reg = <0>;

				adv7535_from_dsim: endpoint {
					remote-endpoint = <&mipi_dsi_out>;
				};
			};

			port@1 {
				reg = <1>;

				adv7535_out: endpoint {
					remote-endpoint = <&hdmi_connector_in>;
				};
			};
		};
	};
};

&iomuxc {
	mini_hdmi_pins: pinctrl-mini-hdmi-grp {
		fsl,pins = <
			MX8MP_IOMUXC_SAI2_MCLK__GPIO4_IO27		0x0
		>;
	};
};

&lcdif1 {
	status = "okay";
};

&mipi_dsi {
	samsung,esc-clock-frequency = <10000000>;
	status = "okay";
};

&mipi_dsi_out {
	remote-endpoint = <&adv7535_from_dsim>;
};