// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
 * Copyright (c) 2023, Dang Huynh <danct12@riseup.net>
 */

/dts-v1/;

#include "sm6115.dtsi"
#include "pm6125.dtsi"
#include <dt-bindings/arm/qcom,ids.h>

/ {
	model = "F(x)tec Pro1X (QX1050)";
	compatible = "fxtec,pro1x", "qcom,sm6115";
	chassis-type = "handset";

	qcom,msm-id = <QCOM_ID_SM6115 0x10000>;

	chosen {
		#address-cells = <2>;
		#size-cells = <2>;
		ranges;

		framebuffer0: framebuffer@5c000000 {
			compatible = "simple-framebuffer";
			reg = <0x0 0x5c000000 0x0 (1080 * 2160 * 4)>;
			width = <1080>;
			height = <2160>;
			stride = <(1080 * 4)>;
			format = "a8r8g8b8";
			clocks = <&gcc GCC_DISP_HF_AXI_CLK>;
		};
	};

	gpio-keys {
		compatible = "gpio-keys";

		pinctrl-0 = <&vol_up_n>;
		pinctrl-names = "default";

		key-volume-up {
			label = "Volume Up";
			linux,code = <KEY_VOLUMEUP>;
			gpios = <&pm6125_gpios 5 GPIO_ACTIVE_LOW>;
			debounce-interval = <15>;
			linux,can-disable;
			wakeup-source;
		};
	};
};

&dispcc {
	/* HACK: disable until a panel driver is ready to retain simplefb */
	status = "disabled";
};

&pm6125_gpios {
	vol_up_n: vol-up-n-state {
		pins = "gpio5";
		function = "normal";
		power-source = <0>;
		bias-pull-up;
		input-enable;
	};
};

&pon_pwrkey {
	status = "okay";
};

&pon_resin {
	linux,code = <KEY_VOLUMEDOWN>;
	status = "okay";
};

&rpm_requests {
	regulators-0 {
		compatible = "qcom,rpm-pm6125-regulators";

		pm6125_s6a: s6 {
			regulator-min-microvolt = <304000>;
			regulator-max-microvolt = <1456000>;
		};

		pm6125_s7a: s7 {
			regulator-min-microvolt = <1280000>;
			regulator-max-microvolt = <2040000>;
		};

		pm6125_s8a: s8 {
			regulator-min-microvolt = <1064000>;
			regulator-max-microvolt = <1304000>;
		};

		pm6125_l1a: l1 {
			regulator-min-microvolt = <952000>;
			regulator-max-microvolt = <1152000>;
		};

		pm6125_l4a: l4 {
			regulator-min-microvolt = <488000>;
			regulator-max-microvolt = <1000000>;
		};

		pm6125_l5a: l5 {
			regulator-min-microvolt = <1648000>;
			regulator-max-microvolt = <3056000>;
		};

		pm6125_l6a: l6 {
			regulator-min-microvolt = <576000>;
			regulator-max-microvolt = <656000>;
		};

		pm6125_l7a: l7 {
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <1304000>;
		};

		pm6125_l8a: l8 {
			regulator-min-microvolt = <400000>;
			regulator-max-microvolt = <728000>;
		};

		pm6125_l9a: l9 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <2000000>;
		};

		pm6125_l10a: l10 {
			regulator-min-microvolt = <1704000>;
			regulator-max-microvolt = <1904000>;
		};

		pm6125_l11a: l11 {
			regulator-min-microvolt = <1704000>;
			regulator-max-microvolt = <1952000>;
			regulator-allow-set-load;
		};

		pm6125_l12a: l12 {
			regulator-min-microvolt = <1624000>;
			regulator-max-microvolt = <1984000>;
		};

		pm6125_l13a: l13 {
			regulator-min-microvolt = <1504000>;
			regulator-max-microvolt = <1952000>;
		};

		pm6125_l14a: l14 {
			regulator-min-microvolt = <1704000>;
			regulator-max-microvolt = <1904000>;
		};

		pm6125_l15a: l15 {
			regulator-min-microvolt = <2920000>;
			regulator-max-microvolt = <3232000>;
		};

		pm6125_l16a: l16 {
			regulator-min-microvolt = <1704000>;
			regulator-max-microvolt = <1904000>;
		};

		pm6125_l17a: l17 {
			regulator-min-microvolt = <1152000>;
			regulator-max-microvolt = <1384000>;
		};

		pm6125_l18a: l18 {
			regulator-min-microvolt = <1104000>;
			regulator-max-microvolt = <1312000>;
		};

		pm6125_l19a: l19 {
			regulator-min-microvolt = <1624000>;
			regulator-max-microvolt = <3304000>;
		};

		pm6125_l20a: l20 {
			regulator-min-microvolt = <1624000>;
			regulator-max-microvolt = <3304000>;
		};

		pm6125_l21a: l21 {
			regulator-min-microvolt = <2400000>;
			regulator-max-microvolt = <3600000>;
		};

		pm6125_l22a: l22 {
			regulator-min-microvolt = <2952000>;
			regulator-max-microvolt = <3304000>;
		};

		pm6125_l23a: l23 {
			regulator-min-microvolt = <3200000>;
			regulator-max-microvolt = <3400000>;
		};

		pm6125_l24a: l24 {
			regulator-min-microvolt = <2704000>;
			regulator-max-microvolt = <3600000>;
			regulator-allow-set-load;
		};
	};
};

&sleep_clk {
	clock-frequency = <32764>;
};

&tlmm {
	gpio-reserved-ranges = <0 4>, <14 4>;
};

&ufs_mem_hc {
	vcc-supply = <&pm6125_l24a>;
	vcc-max-microamp = <600000>;
	vccq2-supply = <&pm6125_l11a>;
	vccq2-max-microamp = <600000>;
	vdd-hba-supply = <&pm6125_l18a>;
	status = "okay";
};

&ufs_mem_phy {
	vdda-phy-supply = <&pm6125_l4a>;
	vdda-pll-supply = <&pm6125_l12a>;
	status = "okay";
};

&usb {
	status = "okay";
};

&usb_dwc3 {
	maximum-speed = "high-speed";
	dr_mode = "peripheral";
};

&usb_hsphy {
	vdd-supply = <&pm6125_l4a>;
	vdda-pll-supply = <&pm6125_l12a>;
	vdda-phy-dpdm-supply = <&pm6125_l15a>;
	status = "okay";
};

&xo_board {
	clock-frequency = <19200000>;
};
