// SPDX-License-Identifier: BSD-3-Clause
/*
 * Copyright (c) 2025, Teguh Sobirin.
 */

/dts-v1/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include "qcs8550-ayntec-common.dtsi"

&{/} {
	model = "AYN Odin 2 Portal";
	compatible = "ayntec,odin2portal", "qcom,qcs8550", "qcom,sm8550";

	vdd_bl_5v0: vdd-bl-5v0-regulator {
		compatible = "regulator-fixed";
		regulator-name = "vdd_bl_5v0";

		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;

		gpio = <&tlmm 52 GPIO_ACTIVE_HIGH>;
		enable-active-high;
	};

	vdd_disp_2v8: vdd-disp-2v8-regulator {
		compatible = "regulator-fixed";
		regulator-name = "vdd_disp_2v8";

		regulator-min-microvolt = <2800000>;
		regulator-max-microvolt = <2800000>;

		gpio = <&tlmm 142 GPIO_ACTIVE_HIGH>;
		enable-active-high;
	};
};

&display_panel {
	compatible = "ayntec,odin2portal-panel", "chipone,icna3512";

	pinctrl-0 = <&dsi_p_rst_active>, <&dsi_p_te_active>;
	pinctrl-1 = <&dsi_p_rst_suspend>, <&dsi_p_te_suspend>;
	pinctrl-names = "default", "sleep";

	vdd-supply = <&vreg_l11b_1p2>;
	vddio-supply = <&vreg_l12b_1p8>;
	vci-supply = <&vreg_l13b_3p0>;
	disp-supply = <&vdd_disp_2v8>;
	blvdd-supply = <&vdd_bl_5v0>;

	reset-gpios = <&tlmm 133 GPIO_ACTIVE_LOW>;

	rotation = <270>;
};

&i2c4 {
	clock-frequency = <400000>;

	status = "okay";

	touchscreen@38 {
		compatible = "focaltech,ft5426";
		reg = <0x38>;

		interrupt-parent = <&tlmm>;
		interrupts = <25 IRQ_TYPE_EDGE_FALLING>;

		reset-gpios = <&tlmm 24 GPIO_ACTIVE_LOW>;

		vcc-supply = <&vreg_l14b_3p2>;
		iovcc-supply = <&vreg_l12b_1p8>;

		pinctrl-0 = <&ts_p_rst_default &ts_p_int_default>;
		pinctrl-1 = <&ts_p_rst_sleep &ts_p_int_sleep>;
		pinctrl-names = "default", "sleep";

		touchscreen-size-x = <1080>;
		touchscreen-size-y = <1920>;
		touchscreen-swapped-x-y;
		touchscreen-inverted-y;
	};
};

&remoteproc_adsp {
	firmware-name = "qcom/sm8550/ayntec/odin2portal/adsp.mbn",
			"qcom/sm8550/ayntec/odin2portal/adsp_dtb.mbn";

	status = "okay";
};

&spk_amp_l {
	firmware-name = "qcom/sm8550/ayntec/odin2portal/aw883xx_acf.bin";
};

&spk_amp_r {
	firmware-name = "qcom/sm8550/ayntec/odin2portal/aw883xx_acf.bin";
};