// SPDX-License-Identifier: GPL-2.0-only

/dts-v1/;

#include <dt-bindings/regulator/qcom,rpmh-regulator.h>

#include "sm8450.dtsi"
#include "pm8350.dtsi"
#include "pm8350c.dtsi"

/ {
	model = "Samsung Galaxy S22 5G";
	compatible = "samsung,r0q", "qcom,sm8450";
	chassis-type = "handset";

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

		framebuffer: framebuffer@b8000000 {
			compatible = "simple-framebuffer";
			reg = <0x0 0xb8000000 0x0 0x2b00000>;
			width = <1080>;
			height = <2340>;
			stride = <(1080 * 4)>;
			format = "a8r8g8b8";
		};
	};

	vph_pwr: regulator-vph-pwr {
		compatible = "regulator-fixed";
		regulator-name = "vph_pwr";
		regulator-min-microvolt = <3700000>;
		regulator-max-microvolt = <3700000>;
		regulator-always-on;
		regulator-boot-on;
	};

	reserved-memory {
		/*
		 * The bootloader will only keep display hardware enabled
		 * if this memory region is named exactly 'splash_region'
		 */
		splash-region@b8000000 {
			reg = <0x0 0xb8000000 0x0 0x2b00000>;
			no-map;
		};
	};
};

&apps_rsc {
	regulators-0 {
		compatible = "qcom,pm8350-rpmh-regulators";
		qcom,pmic-id = "b";

		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-l7-supply = <&vreg_bob>;
		vdd-l3-l5-supply = <&vreg_bob>;

		vreg_l2b_3p07: ldo2 {
			regulator-min-microvolt = <3072000>;
			regulator-max-microvolt = <3072000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};

		vreg_l5b_0p88: ldo5 {
			regulator-min-microvolt = <880000>;
			regulator-max-microvolt = <888000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};
	};

	regulators-1 {
		compatible = "qcom,pm8350c-rpmh-regulators";
		qcom,pmic-id = "c";

		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-l1-l12-supply = <&vreg_bob>;
		vdd-l2-l8-supply = <&vreg_bob>;
		vdd-l3-l4-l5-l7-l13-supply = <&vreg_bob>;
		vdd-l6-l9-l11-supply = <&vreg_bob>;

		vdd-bob-supply = <&vph_pwr>;

		vreg_bob: bob {
			regulator-min-microvolt = <3008000>;
			regulator-max-microvolt = <3960000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_AUTO>;
		};

		vreg_l1c_1p8: ldo1 {
			regulator-min-microvolt = <1800000>;
			regulator-max-microvolt = <1800000>;
			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
		};
	};
};

&tlmm {
	gpio-reserved-ranges = <36 4>; /* SPI (not linked to anything) */
};

&usb_1 {
	/* Keep USB 2.0 only for now */
	qcom,select-utmi-as-pipe-clk;

	dr_mode = "peripheral";
	maximum-speed = "high-speed";
	/* Remove USB3 phy */
	phys = <&usb_1_hsphy>;
	phy-names = "usb2-phy";

	status = "okay";
};

&usb_1_hsphy {
	vdda-pll-supply = <&vreg_l5b_0p88>;
	vdda18-supply = <&vreg_l1c_1p8>;
	vdda33-supply = <&vreg_l2b_3p07>;

	status = "okay";
};