// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2015, LGE Inc. All rights reserved.
 * Copyright (c) 2016, The Linux Foundation. All rights reserved.
 * Copyright (c) 2021-2022, Petr Vorel <petr.vorel@gmail.com>
 * Copyright (c) 2022, Dominik Kobinski <dominikkobinski314@gmail.com>
 */

/dts-v1/;

#include "msm8992.dtsi"
#include "pm8994.dtsi"
#include "pmi8994.dtsi"

/* cont_splash_mem has different memory mapping */
/delete-node/ &cont_splash_mem;

/* disabled on downstream, conflicts with cont_splash_mem */
/delete-node/ &dfps_data_mem;

/ {
	model = "LG Nexus 5X";
	compatible = "lg,bullhead", "qcom,msm8992";
	chassis-type = "handset";

	qcom,msm-id = <251 0>, <252 0>;
	qcom,pmic-id = <0x10009 0x1000A 0x0 0x0>;

	/* Bullhead firmware doesn't support PSCI */
	/delete-node/ psci;

	aliases {
		serial0 = &blsp1_uart2;
	};

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

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

		ramoops@1ff00000 {
			compatible = "ramoops";
			reg = <0x0 0x1ff00000 0x0 0x40000>;
			console-size = <0x10000>;
			record-size = <0x10000>;
			ftrace-size = <0x10000>;
			pmsg-size = <0x20000>;
		};

		cont_splash_mem: memory@3400000 {
			reg = <0 0x03400000 0 0xc00000>;
			no-map;
		};

		reserved@5000000 {
			reg = <0x0 0x05000000 0x0 0x1a00000>;
			no-map;
		};
	};
};

&blsp1_uart2 {
	status = "okay";
};

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

		vdd_l1-supply = <&pm8994_s1>;
		vdd_l2_26_28-supply = <&pm8994_s3>;
		vdd_l3_11-supply = <&pm8994_s3>;
		vdd_l4_27_31-supply = <&pm8994_s3>;
		vdd_l5_7-supply = <&pm8994_s3>;
		vdd_l6_12_32-supply = <&pm8994_s5>;
		vdd_l8_16_30-supply = <&vph_pwr>;
		vdd_l9_10_18_22-supply = <&vph_pwr>;
		vdd_l13_19_23_24-supply = <&vph_pwr>;
		vdd_l14_15-supply = <&pm8994_s5>;
		vdd_l17_29-supply = <&vph_pwr>;
		vdd_l20_21-supply = <&vph_pwr>;
		vdd_l25-supply = <&pm8994_s5>;
		vdd_lvs1_2-supply = <&pm8994_s4>;

		/* S1, S2, S6 and S12 are managed by RPMPD */

		pm8994_s1: s1 {
			regulator-min-microvolt = <1025000>;
			regulator-max-microvolt = <1025000>;
		};

		pm8994_s2: s2 {
			/* TODO */
		};

		pm8994_s3: s3 {
			regulator-min-microvolt = <1300000>;
			regulator-max-microvolt = <1300000>;
		};

		pm8994_s4: s4 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
			regulator-allow-set-load;
			regulator-system-load = <325000>;
		};

		pm8994_s5: s5 {
			regulator-min-microvolt = <2150000>;
			regulator-max-microvolt = <2150000>;
		};

		pm8994_s7: s7 {
			regulator-min-microvolt = <1000000>;
			regulator-max-microvolt = <1000000>;
		};

		/* S8, S9, S10 and S11 - SPMI-managed VDD_APC */

		pm8994_l1: l1 {
			regulator-min-microvolt = <1000000>;
			regulator-max-microvolt = <1000000>;
		};

		pm8994_l2: l2 {
			regulator-min-microvolt = <1250000>;
			regulator-max-microvolt = <1250000>;
		};

		pm8994_l3: l3 {
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <1200000>;
		};

		pm8994_l4: l4 {
			regulator-min-microvolt = <1225000>;
			regulator-max-microvolt = <1225000>;
		};

		/* L5 is inaccessible from RPM */

		pm8994_l6: l6 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};

		/* L7 is inaccessible from RPM */

		pm8994_l8: l8 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};

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

		pm8994_l10: l10 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};

		pm8994_l11: l11 {
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <1200000>;
		};

		pm8994_l12: l12 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};

		pm8994_l13: l13 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <2950000>;
		};

		pm8994_l14: l14 {
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <1200000>;
		};

		pm8994_l15: l15 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};

		pm8994_l16: l16 {
			regulator-min-microvolt = <2700000>;
			regulator-max-microvolt = <2700000>;
		};

		pm8994_l17: l17 {
			regulator-min-microvolt = <2700000>;
			regulator-max-microvolt = <2700000>;
		};

		pm8994_l18: l18 {
			regulator-min-microvolt = <3000000>;
			regulator-max-microvolt = <3000000>;
		};

		pm8994_l19: l19 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};

		pm8994_l20: l20 {
			regulator-min-microvolt = <2950000>;
			regulator-max-microvolt = <2950000>;
			regulator-always-on;
			regulator-boot-on;
			regulator-allow-set-load;
			regulator-system-load = <570000>;
		};

		pm8994_l21: l21 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
			regulator-always-on;
		};

		pm8994_l22: l22 {
			regulator-min-microvolt = <3100000>;
			regulator-max-microvolt = <3100000>;
		};

		pm8994_l23: l23 {
			regulator-min-microvolt = <2800000>;
			regulator-max-microvolt = <2800000>;
		};

		pm8994_l24: l24 {
			regulator-min-microvolt = <3075000>;
			regulator-max-microvolt = <3150000>;
		};

		pm8994_l25: l25 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};

		pm8994_l26: l26 {
			regulator-min-microvolt = <987500>;
			regulator-max-microvolt = <987500>;
		};

		pm8994_l27: l27 {
			regulator-min-microvolt = <1050000>;
			regulator-max-microvolt = <1050000>;
		};

		pm8994_l28: l28 {
			regulator-min-microvolt = <1000000>;
			regulator-max-microvolt = <1000000>;
		};

		pm8994_l29: l29 {
			regulator-min-microvolt = <2800000>;
			regulator-max-microvolt = <2800000>;
		};

		pm8994_l30: l30 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};

		pm8994_l31: l31 {
			regulator-min-microvolt = <1262500>;
			regulator-max-microvolt = <1262500>;
		};

		pm8994_l32: l32 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
		};
	};

	pmi8994_regulators: regulators-1 {
		compatible = "qcom,rpm-pmi8994-regulators";

		vdd_s1-supply = <&vph_pwr>;
		vdd_bst_byp-supply = <&vph_pwr>;

		pmi8994_s1: s1 {};

		/* S2 & S3 - VDD_GFX */

		pmi8994_bby: boost-bypass {};
	};
};

&sdhc1 {
	status = "okay";

	mmc-hs400-1_8v;
};