// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2026 Amarula Solutions, Dario Binacchi <dario.binacchi@amarulasolutions.com>
 * Copyright (C) 2026 Engicam srl
 *
 * Rocktech RK050HR345-CT106A 5" 480x854 RGB panel with EDT FT5306
 * I2C touchscreen controller.
 */

/dts-v1/;
/plugin/;

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

&i2c1 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&i2c1_pins_a>;
	pinctrl-1 = <&i2c1_sleep_pins_a>;
	i2c-scl-rising-time-ns = <185>;
	i2c-scl-falling-time-ns = <20>;
	#address-cells = <1>;
	#size-cells = <0>;
	status = "okay";

	touchscreen@38 {
		compatible = "edt,edt-ft5306";
		reg = <0x38>;
		interrupt-parent = <&gpiob>;
		interrupts = <0 IRQ_TYPE_EDGE_FALLING>;
		reset-gpios = <&gpiod 1 GPIO_ACTIVE_LOW>;
		touchscreen-size-x = <480>;
		touchscreen-size-y = <854>;
	};
};

&ltdc {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&ltdc_pins_a>;
	pinctrl-1 = <&ltdc_sleep_pins_a>;
	status = "okay";

	port {
		ltdc_out: endpoint {
			remote-endpoint = <&panel_in>;
		};
	};
};

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

	display@0 {
		compatible = "rocktech,rk050hr345-ct106a", "ilitek,ili9806e";
		reg = <0>;
		vdd-supply = <&reg_3v3>;
		spi-max-frequency = <10000000>;
		reset-gpios = <&gpiob 6 GPIO_ACTIVE_LOW>;
		backlight = <&backlight>;

		port {
			panel_in: endpoint {
				remote-endpoint = <&ltdc_out>;
			};
		};
	};
};