// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright 2026 Marek Vasut
 */

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>

&{/} {
	hdmi-out {
		compatible = "hdmi-connector";
		type = "a";

		port {
			hdmi_con: endpoint {
				remote-endpoint = <&lt9611_out>;
			};
		};
	};
};

&i2c_display {	/* Display connector I2C */
	#address-cells = <1>;
	#size-cells = <0>;

	lt9611_codec: hdmi-bridge@3b {
		compatible = "lontium,lt9611";
		reg = <0x3b>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_panel_expansion>;
		vcc-supply = <&buck4_reg>;	/* X400 pin 55, +3V3_S0 */
		vdd-supply = <&buck5_reg>;	/* X400 pin 51, +1V8_S0 */

		/* Audio I2S not described */
		#sound-dai-cells = <1>;

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

			port@0 {
				reg = <0>;

				lt9611_a: endpoint {
					remote-endpoint = <&mipi_dsi_bridge1_out>;
				};
			};

			port@2 {
				reg = <2>;

				lt9611_out: endpoint {
					remote-endpoint = <&hdmi_con>;
				};
			};
		};
	};

	eeprom@50 {
		compatible = "atmel,24c02";
		reg = <0x50>;
		pagesize = <16>;
	};
};

&iomuxc {
	/* Free &pinctrl_panel_expansion from hog for lt9611_codec above */
	pinctrl-0 = <&pinctrl_hog_misc>, <&pinctrl_hog_feature>,
		    <&pinctrl_hog_panel>, <&pinctrl_hog_sbc>;
};

&mipi_dsi {
	/* HDMI 148.5 MHz x2 (DDR) x3 (24bpp / 8) */
	samsung,burst-clock-frequency = <891000000>;
	samsung,esc-clock-frequency = <10000000>;
	status = "okay";

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

		port@1 {
			reg = <1>;

			mipi_dsi_bridge1_out: endpoint {
				clock-lanes = <0>;
				data-lanes = <1 2 3 4>;
				/* Clock and data lanes have DN/DP swapped */
				lane-polarities = <1 1 1 1 1>;
				remote-endpoint = <&lt9611_a>;
			};
		};
	};
};