// SPDX-License-Identifier: GPL-2.0-only
/*
 * msm8939-pm8916.dtsi describes common properties (e.g. regulator connections)
 * that apply to most devices that make use of the MSM8939 SoC and PM8916 PMIC.
 * Many regulators have a fixed purpose in the original reference design and
 * were rarely re-used for different purposes. Devices that deviate from the
 * typical reference design should not make use of this include and instead add
 * the necessary properties in the board-specific device tree.
 */

#include "msm8939.dtsi"
#include "pm8916.dtsi"

&mdss_dsi0 {
	vdda-supply = <&pm8916_l2>;
	vddio-supply = <&pm8916_l6>;
};

&mdss_dsi0_phy {
	vddio-supply = <&pm8916_l6>;
};

&mdss_dsi1 {
	vdda-supply = <&pm8916_l2>;
	vddio-supply = <&pm8916_l6>;
};

&mdss_dsi1_phy {
	vddio-supply = <&pm8916_l6>;
};

&mpss {
	pll-supply = <&pm8916_l7>;
};

&pm8916_codec {
	vdd-cdc-io-supply = <&pm8916_l5>;
	vdd-cdc-tx-rx-cx-supply = <&pm8916_l5>;
	vdd-micbias-supply = <&pm8916_l13>;
};

&rpm_requests {
	pm8916_rpm_regulators: regulators {
		compatible = "qcom,rpm-pm8916-regulators";
		vdd_l1_l2_l3-supply = <&pm8916_s3>;
		vdd_l4_l5_l6-supply = <&pm8916_s4>;
		vdd_l7-supply = <&pm8916_s4>;

		/* pm8916_s1 is managed by rpmpd (MSM8939_VDDMDCX) */
		/* pm8916_s2 is managed by rpmpd (MSM8939_VDDCX) */
		pm8916_s3: s3 {
			regulator-min-microvolt = <1250000>;
			regulator-max-microvolt = <1350000>;
			regulator-always-on; /* Needed for L2 */
		};
		pm8916_s4: s4 {
			regulator-min-microvolt = <1850000>;
			regulator-max-microvolt = <2150000>;
			regulator-always-on; /* Needed for L5/L7 */
		};

		/*
		 * Some of the regulators are unused or managed by another
		 * processor (e.g. the modem). We should still define nodes for
		 * them to ensure the vote from the application processor can be
		 * dropped in case the regulators are already on during boot.
		 *
		 * The labels for these nodes are omitted on purpose because
		 * boards should configure a proper voltage before using them.
		 */
		l1 {};

		pm8916_l2: l2 {
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <1200000>;
			regulator-always-on; /* Needed for LPDDR RAM */
		};

		/* pm8916_l3 is managed by rpmpd (MSM8939_VDDMX) */

		l4 {};

		pm8916_l5: l5 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
			regulator-always-on; /* Needed for most digital I/O */
		};

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

		pm8916_l7: l7 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
			regulator-always-on; /* Needed for CPU PLL */
		};

		pm8916_l8: l8 {
			regulator-min-microvolt = <2900000>;
			regulator-max-microvolt = <2900000>;
		};

		pm8916_l9: l9 {
			regulator-min-microvolt = <3300000>;
			regulator-max-microvolt = <3300000>;
		};

		l10 {};

		pm8916_l11: l11 {
			regulator-min-microvolt = <2950000>;
			regulator-max-microvolt = <2950000>;
			regulator-allow-set-load;
			regulator-system-load = <200000>;
		};

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

		pm8916_l13: l13 {
			regulator-min-microvolt = <3075000>;
			regulator-max-microvolt = <3075000>;
		};

		l14 {};
		l15 {};
		l16 {};
		l17 {};
		l18 {};
	};
};

&sdhc_1 {
	vmmc-supply = <&pm8916_l8>;
	vqmmc-supply = <&pm8916_l5>;
};

&sdhc_2 {
	vmmc-supply = <&pm8916_l11>;
	vqmmc-supply = <&pm8916_l12>;
};

&usb_hs_phy {
	v1p8-supply = <&pm8916_l7>;
	v3p3-supply = <&pm8916_l13>;
};

&wcnss {
	vddpx-supply = <&pm8916_l7>;
};

&wcnss_iris {
	vddxo-supply = <&pm8916_l7>;
	vddrfa-supply = <&pm8916_s3>;
	vddpa-supply = <&pm8916_l9>;
	vdddig-supply = <&pm8916_l5>;
};