// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd.
 * Copyright (c) 2025 Peter Robinson <pbrobinson@gmail.com>
 */

/dts-v1/;
/plugin/;

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

&{/} {
	avdd: regulator-avdd {
		compatible = "regulator-fixed";
		regulator-name = "avdd";
		regulator-min-microvolt = <11000000>;
		regulator-max-microvolt = <11000000>;
		vin-supply = <&vcc3v3_s0>;
	};

	backlight: backlight {
		compatible = "pwm-backlight";
		brightness-levels = <0 4 8 16 32 64 128 255>;
		default-brightness-level = <5>;
		pwms = <&pwm0 0 1000000 0>;
		status = "okay";
	};
};

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

	touch: touchscreen@5d {
		compatible = "goodix,gt911";
		reg = <0x5d>;
		interrupt-parent = <&gpio4>;
		interrupts = <RK_PD5 IRQ_TYPE_EDGE_FALLING>;
		AVDD28-supply = <&vcc3v0_touch>;
		VDDIO-supply = <&vcc3v0_touch>;
		irq-gpios = <&gpio4 RK_PD5 GPIO_ACTIVE_HIGH>;
		reset-gpios = <&gpio4 RK_PD6 GPIO_ACTIVE_HIGH>;
		status = "okay";
	};
};

&mipi_dsi {
	clock-master;
	#address-cells = <1>;
	#size-cells = <0>;
	status = "okay";

	mipi_panel: panel@0 {
		compatible = "feiyang,fy07024di26a30d";
		reg = <0>;
		avdd-supply = <&avdd>;
		backlight = <&backlight>;
		dvdd-supply = <&vcc3v3_s0>;

		port {
			mipi_in_panel: endpoint {
				remote-endpoint = <&mipi_out_panel>;
			};
		};
	};
};

&mipi_out {
	mipi_out_panel: endpoint {
		remote-endpoint = <&mipi_in_panel>;
	};
};

&pwm0 {
	status = "okay";
};