linux/arch/arm64/boot/dts/qcom/sm6115-fxtec-pro1x.dts

// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
 * Copyright (c) 2023 - 2024, Dang Huynh <[email protected]>
 */

/dts-v1/;

#include "sm6115.dtsi"
#include "pm6125.dtsi"
#include "pmi632.dtsi"
#include <dt-bindings/arm/qcom,ids.h>
#include <dt-bindings/leds/common.h>
#include <dt-bindings/usb/pd.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>;
		};
	};

	disp_elvdd_supply: disp-elvdd-supply {
		compatible = "regulator-fixed";
		regulator-name = "disp_elvdd_supply";
	};

	disp_elvss_supply: disp-elvss-supply {
		compatible = "regulator-fixed";
		regulator-name = "disp_elvss_supply";
	};

	disp_vcc_supply: disp-vcc-supply {
		compatible = "regulator-fixed";
		regulator-name = "disp_vcc_supply";
	};

	disp_vci_supply: disp-vci-supply {
		compatible = "regulator-fixed";
		regulator-name = "disp_vci_supply";
	};

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

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

		hall-switch {
			label = "Hall Switch";
			linux,input-type = <EV_SW>;
			linux,code = <SW_KEYPAD_SLIDE>;
			gpios = <&tlmm 96 GPIO_ACTIVE_HIGH>;
			debounce-interval = <90>;
			wakeup-source;
		};

		key-camera {
			label = "Camera Button";
			linux,code = <KEY_CAMERA>;
			gpios = <&tlmm 18 GPIO_ACTIVE_LOW>;
			debounce-interval = <15>;
		};

		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;
		};
	};

	gpio-leds {
		compatible = "gpio-leds";

		capslock-led {
			label = "green:capslock";
			function = LED_FUNCTION_CAPSLOCK;
			color = <LED_COLOR_ID_GREEN>;
			gpios = <&pca9534 1 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "kbd-capslock";
			default-state = "off";
		};
	};

	ts_vdd_supply: ts-vdd-supply {
		compatible = "regulator-fixed";
		regulator-name = "ts_vdd_supply";
		gpio = <&pca9534 3 GPIO_ACTIVE_HIGH>;
		enable-active-high;
	};

	ts_vddio_supply: ts-vddio-supply {
		compatible = "regulator-fixed";
		regulator-name = "ts_vddio_supply";
		gpio = <&pca9534 2 GPIO_ACTIVE_HIGH>;
		enable-active-high;
	};
};

&gpi_dma0 {
	status = "okay";
};

&gpu {
	status = "okay";

	zap-shader {
		firmware-name = "qcom/sm6115/Fxtec/QX1050/a610_zap.mbn";
	};
};

&i2c1 {
	clock-frequency = <100000>;

	status = "okay";

	pca9534: gpio@21 {
		compatible = "nxp,pca9534";
		reg = <0x21>;
		gpio-controller;
		#gpio-cells = <2>;
	};
};

&i2c2 {
	status = "okay";
	/* Clock frequency was not specified downstream, let's park it to 100 KHz */
	clock-frequency = <100000>;

	touchscreen@14 {
		compatible = "goodix,gt9286";
		reg = <0x14>;

		interrupts-extended = <&tlmm 80 IRQ_TYPE_LEVEL_LOW>;

		irq-gpios = <&tlmm 80 IRQ_TYPE_LEVEL_LOW>;
		reset-gpios = <&tlmm 71 GPIO_ACTIVE_HIGH>;
		AVDD28-supply = <&ts_vdd_supply>;
		VDDIO-supply = <&ts_vddio_supply>;

		pinctrl-0 = <&ts_int_n>, <&ts_rst_n>;
		pinctrl-names = "default";
	};
};

&mdss {
	status = "okay";
};

&mdss_dsi0 {
	vdda-supply = <&pm6125_l18a>;
	status = "okay";

	panel: panel@0 {
		compatible = "boe,bf060y8m-aj0";
		reg = <0>;

		reset-gpios = <&tlmm 82 GPIO_ACTIVE_LOW>;

		elvdd-supply = <&disp_elvdd_supply>;
		elvss-supply = <&disp_elvss_supply>;
		vcc-supply = <&disp_vcc_supply>;
		vci-supply = <&disp_vci_supply>;
		vddio-supply = <&pm6125_l9a>;

		pinctrl-0 = <&mdss_dsi_n &panel_en_n>;
		pinctrl-names = "default";

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

&mdss_dsi0_out {
	data-lanes = <0 1 2 3>;
	remote-endpoint = <&panel_in>;
};

&mdss_dsi0_phy {
	status = "okay";
};

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

&pmi632_lpg {
	status = "okay";

	multi-led {
		color = <LED_COLOR_ID_RGB>;
		function = LED_FUNCTION_STATUS;

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

		led@1 {
			reg = <1>;
			color = <LED_COLOR_ID_RED>;
		};

		led@2 {
			reg = <2>;
			color = <LED_COLOR_ID_GREEN>;
		};

		led@3 {
			reg = <3>;
			color = <LED_COLOR_ID_BLUE>;
		};
	};
};

&pmi632_typec {
	status = "okay";

	connector {
		compatible = "usb-c-connector";

		power-role = "dual";
		data-role = "dual";
		self-powered;

		typec-power-opmode = "default";
		pd-disable;

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

			port@0 {
				reg = <0>;
				pmi632_hs_in: endpoint {
					remote-endpoint = <&usb_dwc3_hs>;
				};
			};

			port@1 {
				reg = <1>;
				pmi632_ss_in: endpoint {
					remote-endpoint = <&usb_qmpphy_out>;
				};
			};
		};
	};
};

&pmi632_vbus {
	regulator-min-microamp = <500000>;
	regulator-max-microamp = <1000000>;
	status = "okay";
};

&pon_pwrkey {
	status = "okay";
};

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

&qupv3_id_0 {
	status = "okay";
};

&remoteproc_adsp {
	firmware-name = "qcom/sm6115/Fxtec/QX1050/adsp.mbn";
	status = "okay";
};

&remoteproc_cdsp {
	firmware-name = "qcom/sm6115/Fxtec/QX1050/cdsp.mbn";
	status = "okay";
};

&remoteproc_mpss {
	firmware-name = "qcom/sm6115/Fxtec/QX1050/modem.mbn";
	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>;
			regulator-allow-set-load;
		};

		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;
		};
	};
};

&sdc2_state_off {
	cd-pins {
		pins = "gpio88";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
	};
};

&sdc2_state_on {
	cd-pins {
		pins = "gpio88";
		function = "gpio";
		drive-strength = <2>;
		bias-pull-up;
	};
};

&sdhc_2 {
	pinctrl-0 = <&sdc2_state_on>;
	pinctrl-1 = <&sdc2_state_off>;
	pinctrl-names = "default", "sleep";

	cd-gpios = <&tlmm 88 GPIO_ACTIVE_LOW>;

	vmmc-supply = <&pm6125_l22a>;
	vqmmc-supply = <&pm6125_l5a>;

	status = "okay";
};

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

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

	key_camera_n: key-camera-n-state {
		pins = "gpio18";
		function = "gpio";
		drive-strength = <2>;
		bias-pull-up;
	};

	panel_en_n: panel-en-n-state {
		pins = "gpio65";
		function = "gpio";
		bias-disable;
	};

	ts_rst_n: ts-rst-n-state {
		pins = "gpio71";
		function = "gpio";
		drive-strength = <8>;
		bias-pull-up;
	};

	ts_int_n: ts-int-n-state {
		pins = "gpio80";
		function = "gpio";
		drive-strength = <8>;
		bias-pull-up;
	};

	mdss_dsi_n: mdss-dsi-n-state {
		pins = "gpio82";
		function = "gpio";
		drive-strength = <8>;
		bias-disable;
	};

	hall_sensor_n: hall-sensor-n-state {
		pins = "gpio96";
		function = "gpio";
		drive-strength = <2>;
		bias-pull-up;
	};
};

&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_hs {
	remote-endpoint = <&pmi632_hs_in>;
};

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

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

&usb_qmpphy_out {
	remote-endpoint = <&pmi632_ss_in>;
};

&wifi {
	vdd-0.8-cx-mx-supply = <&pm6125_l8a>;
	vdd-1.8-xo-supply = <&pm6125_l16a>;
	vdd-1.3-rfa-supply = <&pm6125_l17a>;
	vdd-3.3-ch0-supply = <&pm6125_l23a>;

	qcom,ath10k-calibration-variant = "Fxtec_QX1050";

	status = "okay";
};

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