// SPDX-License-Identifier: BSD-3-Clause

/dts-v1/;

#include "msm8996.dtsi"
#include "pm8994.dtsi"
#include "pmi8994.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>

/ {
	model = "Inforce 6640 Single Board Computer";
	compatible = "inforce,ifc6640", "qcom,apq8096-sbc", "qcom,apq8096";

	qcom,msm-id = <291 0x00030001>;
	qcom,board-id = <0x00010018 0>;

	aliases {
		serial0 = &blsp2_uart2;
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};

	v1p05: v1p05-regulator {
		compatible = "regulator-fixed";
		regulator-name = "v1p05";
		regulator-always-on;
		regulator-boot-on;

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

		vin-supply = <&v5p0>;
	};

	v12_poe: v12-poe-regulator {
		compatible = "regulator-fixed";
		regulator-name = "v12_poe";
		regulator-always-on;
		regulator-boot-on;

		regulator-min-microvolt = <12000000>;
		regulator-max-microvolt = <12000000>;
	};

	v3p3: v3p3-regulator {
		compatible = "regulator-fixed";
		regulator-name = "v3p3";
		regulator-always-on;
		regulator-boot-on;

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

		vin-supply = <&v12_poe>;
	};

	v5p0: v5p0-regulator {
		compatible = "regulator-fixed";
		regulator-name = "v5p0";
		regulator-always-on;
		regulator-boot-on;

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

		vin-supply = <&v12_poe>;
	};

	vph_pwr: vph-pwr-regulator {
		compatible = "regulator-fixed";
		regulator-name = "vph_pwr";
		regulator-always-on;
		regulator-boot-on;

		regulator-min-microvolt = <3800000>;
		regulator-max-microvolt = <3800000>;
	};
};

&blsp2_uart2 {
	status = "okay";
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&blsp2_uart2_2pins_default>;
	pinctrl-1 = <&blsp2_uart2_2pins_sleep>;
};

&gpu {
	status = "okay";
};

&mdss {
	status = "okay";
};

&mdss_hdmi {
	status = "okay";
};

&mdss_hdmi_phy {
	status = "okay";
};

&sdc2_state_on {
	cd-pins {
		pins = "gpio38";
		function = "gpio";

		bias-pull-up;
		drive-strength = <16>;
	};
};

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

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

		vdd_s1-supply = <&vph_pwr>;
		vdd_s2-supply = <&vph_pwr>;
		vdd_s3-supply = <&vph_pwr>;
		vdd_s4-supply = <&vph_pwr>;
		vdd_s5-supply = <&vph_pwr>;
		vdd_s6-supply = <&vph_pwr>;
		vdd_s7-supply = <&vph_pwr>;
		vdd_s8-supply = <&vph_pwr>;
		vdd_s9-supply = <&vph_pwr>;
		vdd_s10-supply = <&vph_pwr>;
		vdd_s11-supply = <&vph_pwr>;
		vdd_s12-supply = <&vph_pwr>;
		vdd_l2_l26_l28-supply = <&vreg_s3a_1p3>;
		vdd_l3_l11-supply = <&vreg_s3a_1p3>;
		vdd_l4_l27_l31-supply = <&vreg_s3a_1p3>;
		vdd_l5_l7-supply = <&vreg_s5a_2p15>;
		vdd_l6_l12_l32-supply = <&vreg_s5a_2p15>;
		vdd_l8_l16_l30-supply = <&vph_pwr>;
		vdd_l25-supply = <&vreg_s3a_1p3>;
		vdd_lvs1_2-supply = <&vreg_s4a_1p8>;

		vreg_s3a_1p3: s3 {
			regulator-name = "vreg_s3a_1p3";
			regulator-min-microvolt = <1300000>;
			regulator-max-microvolt = <1300000>;
		};

		vreg_s4a_1p8: s4 {
			regulator-name = "vreg_s4a_1p8";
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
			regulator-always-on;
		};
		vreg_s5a_2p15: s5 {
			regulator-name = "vreg_s5a_2p15";
			regulator-min-microvolt = <2150000>;
			regulator-max-microvolt = <2150000>;
		};
		vreg_s7a_1p0: s7 {
			regulator-name = "vreg_s7a_1p0";
			regulator-min-microvolt = <800000>;
			regulator-max-microvolt = <800000>;
		};

		vreg_l1a_1p0: l1 {
			regulator-name = "vreg_l1a_1p0";
			regulator-min-microvolt = <1000000>;
			regulator-max-microvolt = <1000000>;
		};
		vreg_l2a_1p25: l2 {
			regulator-name = "vreg_l2a_1p25";
			regulator-min-microvolt = <1250000>;
			regulator-max-microvolt = <1250000>;
		};
		vreg_l3a_0p875: l3 {
			regulator-name = "vreg_l3a_0p875";
			regulator-min-microvolt = <850000>;
			regulator-max-microvolt = <850000>;
		};
		vreg_l4a_1p225: l4 {
			regulator-name = "vreg_l4a_1p225";
			regulator-min-microvolt = <1225000>;
			regulator-max-microvolt = <1225000>;
		};
		vreg_l6a_1p2: l6 {
			regulator-name = "vreg_l6a_1p2";
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <1200000>;
		};
		vreg_l8a_1p8: l8 {
			regulator-name = "vreg_l8a_1p8";
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};
		vreg_l9a_1p8: l9 {
			regulator-name = "vreg_l9a_1p8";
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};
		vreg_l10a_1p8: l10 {
			regulator-name = "vreg_l10a_1p8";
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};
		vreg_l11a_1p15: l11 {
			regulator-name = "vreg_l11a_1p15";
			regulator-min-microvolt = <1150000>;
			regulator-max-microvolt = <1150000>;
		};
		vreg_l12a_1p8: l12 {
			regulator-name = "vreg_l12a_1p8";
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};
		vreg_l13a_2p95: l13 {
			regulator-name = "vreg_l13a_2p95";
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <2950000>;
		};
		vreg_l14a_1p8: l14 {
			regulator-name = "vreg_l14a_1p8";
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};
		vreg_l15a_1p8: l15 {
			regulator-name = "vreg_l15a_1p8";
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};
		vreg_l16a_2p7: l16 {
			regulator-name = "vreg_l16a_2p7";
			regulator-min-microvolt = <2700000>;
			regulator-max-microvolt = <2700000>;
		};
		vreg_l17a_2p8: l17 {
			regulator-name = "vreg_l17a_2p8";
			regulator-min-microvolt = <2500000>;
			regulator-max-microvolt = <2500000>;
		};
		vreg_l18a_2p85: l18 {
			regulator-name = "vreg_l18a_2p85";
			regulator-min-microvolt = <2700000>;
			regulator-max-microvolt = <2900000>;
		};
		vreg_l19a_2p8: l19 {
			regulator-name = "vreg_l19a_2p8";
			regulator-min-microvolt = <3000000>;
			regulator-max-microvolt = <3000000>;
		};
		vreg_l20a_2p95: l20 {
			regulator-name = "vreg_l20a_2p95";
			regulator-min-microvolt = <2950000>;
			regulator-max-microvolt = <2950000>;
			regulator-allow-set-load;
		};
		vreg_l21a_2p95: l21 {
			regulator-name = "vreg_l21a_2p95";
			regulator-min-microvolt = <2950000>;
			regulator-max-microvolt = <2950000>;
		};
		vreg_l22a_3p0: l22 {
			regulator-name = "vreg_l22a_3p0";
			regulator-min-microvolt = <3300000>;
			regulator-max-microvolt = <3300000>;
		};
		vreg_l23a_2p8: l23 {
			regulator-name = "vreg_l23a_2p8";
			regulator-min-microvolt = <2800000>;
			regulator-max-microvolt = <2800000>;
		};
		vreg_l24a_3p075: l24 {
			regulator-name = "vreg_l24a_3p075";
			regulator-min-microvolt = <3075000>;
			regulator-max-microvolt = <3075000>;
		};
		vreg_l25a_1p2: l25 {
			regulator-name = "vreg_l25a_1p2";
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <1200000>;
			regulator-allow-set-load;
		};
		vreg_l26a_0p8: l27 {
			regulator-name = "vreg_l26a_0p8";
			regulator-min-microvolt = <1000000>;
			regulator-max-microvolt = <1000000>;
		};
		vreg_l28a_0p925: l28 {
			regulator-name = "vreg_l28a_0p925";
			regulator-min-microvolt = <925000>;
			regulator-max-microvolt = <925000>;
			regulator-allow-set-load;
		};
		vreg_l29a_2p8: l29 {
			regulator-name = "vreg_l29a_2p8";
			regulator-min-microvolt = <2800000>;
			regulator-max-microvolt = <2800000>;
		};
		vreg_l30a_1p8: l30 {
			regulator-name = "vreg_l30a_1p8";
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};
		vreg_l32a_1p8: l32 {
			regulator-name = "vreg_l32a_1p8";
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};

		vreg_lvs1a_1p8: lvs1 {
			regulator-name = "vreg_lvs1a_1p8";
		};

		vreg_lvs2a_1p8: lvs2 {
			regulator-name = "vreg_lvs2a_1p8";
		};
	};
};

&sdhc2 {
	status = "okay";

	bus-width = <4>;

	cd-gpios = <&tlmm 38 GPIO_ACTIVE_LOW>;

	vmmc-supply = <&vreg_l21a_2p95>;
	vqmmc-supply = <&vreg_l13a_2p95>;
};

&ufshc {
	status = "okay";

	vcc-supply = <&vreg_l20a_2p95>;
	vccq-supply = <&vreg_l25a_1p2>;
	vccq2-supply = <&vreg_s4a_1p8>;

	vcc-max-microamp = <600000>;
	vccq-max-microamp = <450000>;
	vccq2-max-microamp = <450000>;
};

&ufsphy {
	status = "okay";

	vdda-phy-supply = <&vreg_l28a_0p925>;
	vdda-pll-supply = <&vreg_l12a_1p8>;
};

&venus {
	status = "okay";
};