// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2023 Rockchip Electronics Co., Ltd.
 *
 */

#include <dt-bindings/display/media-bus-format.h>
#include "rk3562-evb1-lp4x-v10.dtsi"
#include "rk3562-android.dtsi"
#include "rk3562-rk817.dtsi"


/ {
	panel-rgb {
		compatible = "simple-panel";
		status = "okay";
		backlight = <&backlight>;
		enable-gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>;
		reset-delay-ms = <20>;
		enable-delay-ms = <20>;
		prepare-delay-ms = <20>;
		unprepare-delay-ms = <20>;
		disable-delay-ms = <20>;
		bus-format = <MEDIA_BUS_FMT_RGB666_1X18>;
		width-mm = <164>;
		height-mm = <100>;

		display-timings {
			native-mode = <&timing0>;

			timing0: timing0 {
				clock-frequency = <50000000>;
				hactive = <1024>;
				vactive = <600>;
				hback-porch = <140>;
				hfront-porch = <160>;
				vback-porch = <20>;
				vfront-porch = <12>;
				hsync-len = <20>;
				vsync-len = <3>;
				hsync-active = <0>;
				vsync-active = <0>;
				de-active = <0>;
				pixelclk-active = <0>;
			};
		};

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

			port@0 {
				reg = <0>;
				panel_in_rgb: endpoint {
					remote-endpoint = <&rgb_out_panel>;
				};
			};
		};
	};
};

&backlight {
	pwms = <&pwm9 0 25000 0>;
	status = "okay";
};

&dsi {
	status = "disabled";
};

/*
 * The pins of gmac0 and rgb are multiplexed
 */
&gmac0 {
	status = "disabled";
};

&rgb {
	status = "okay";
	pinctrl-0 = <&rgb666_pins>;

	ports {
		port@1 {
			reg = <1>;

			rgb_out_panel: endpoint {
				remote-endpoint = <&panel_in_rgb>;
			};
		};
	};
};

&rgb_in_vp0 {
	status = "okay";
};

&pwm9 {
	pinctrl-names = "active";
	pinctrl-0 = <&pwm9m0_pins>;
	status = "okay";
};

&route_rgb {
	status = "okay";
	connect = <&vp0_out_rgb>;
};

/*
 * The pins of sai0 and backlight are multiplexed
 */
&sai0 {
	status = "disabled";
};

&video_phy {
	status = "disabled";
};
