#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/iio/qcom,spmi-adc5-gen3-pm7550ba.h>
#include <dt-bindings/iio/qcom,spmi-adc5-gen3-pmx75.h>

#include "pmk8550.dtsi"
#include "pmx75.dtsi"
#include "pm7550ba.dtsi"

/ {
	vreg_sdc1_sd_ls_vccb: sdc1-sd-ls-gpio-regulator {
		compatible = "regulator-gpio";
		regulator-name = "sdc1_sd_ls_vccb";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <2850000>;
		enable-gpio = <&tlmm 102 GPIO_ACTIVE_HIGH>;
		gpios = <&tlmm 84 GPIO_ACTIVE_HIGH>;
		states = <1800000 0>,
			 <2850000 1>;
		startup-delay-us = <5000>;
		enable-active-high;
	};

	vreg_sdc1_emmc_sd_vdd: sdc1-emmc-sd-fixed-regulator {
		compatible = "qcom,stub-regulator";
		regulator-name = "sdc1_emmc_sd_vdd";
		regulator-min-microvolt = <2950000>;
		regulator-max-microvolt = <2950000>;
		parent-supply = <&vreg_sdc1_sd_ls_vccb>;
	};

	vreg_sdc2_sd_ls_vccb: sdc2-sd-ls-gpio-regulator {
		compatible = "regulator-gpio";
		regulator-name = "sdc2_sd_ls_vccb";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <2850000>;
		enable-gpio = <&pmx75_gpios 12 GPIO_ACTIVE_HIGH>;
		gpios = <&tlmm 121 GPIO_ACTIVE_HIGH>;
		states = <1800000 0>,
			 <2850000 1>;
		startup-delay-us = <5000>;
		enable-active-high;
		status = "disabled";
	};

	vreg_sdc2_sd_vdd: sdc2-sd-fixed-regulator {
		compatible = "qcom,stub-regulator";
		regulator-name = "sdc2_sd_vdd";
		regulator-min-microvolt = <2950000>;
		regulator-max-microvolt = <2950000>;
		parent-supply = <&vreg_sdc2_sd_ls_vccb>;
		status = "disabled";
	};
};

&pmk8550_vadc {
	/delete-node/ pm8550_offset_ref;
	/delete-node/ pm8550_vref_1p25;
	/delete-node/ pm8550_die_temp;
	/delete-node/ pm8550_vph_pwr;

	/delete-node/ pm8550b_offset_ref;
	/delete-node/ pm8550b_vref_1p25;
	/delete-node/ pm8550b_die_temp;
	/delete-node/ pm8550b_lite_die_temp;
	/delete-node/ pm8550b_vph_pwr;
	/delete-node/ pm8550b_vbat_sns_qbg;

	/delete-node/ pm8550vs_c_die_temp;
	/delete-node/ pm8550vs_d_die_temp;
	/delete-node/ pm8550vs_e_die_temp;
	/delete-node/ pm8550vs_g_die_temp;

	/delete-node/ pm8550ve_die_temp;

	/* PM8550BA Channel nodes */
	pm7550ba_offset_ref {
		reg = <PM7550BA_ADC5_GEN3_OFFSET_REF>;
		label = "pm7550ba_offset_ref";
		qcom,pre-scaling = <1 1>;
	};

	pm7550ba_vref_1p25 {
		reg = <PM7550BA_ADC5_GEN3_1P25VREF>;
		label = "pm7550ba_vref_1p25";
		qcom,pre-scaling = <1 1>;
	};

	pm7550ba_die_temp {
		reg = <PM7550BA_ADC5_GEN3_DIE_TEMP>;
		label = "pm7550ba_die_temp";
		qcom,pre-scaling = <1 1>;
	};

	pm7550ba_vph_pwr {
		reg = <PM7550BA_ADC5_GEN3_VPH_PWR>;
		label = "pm7550ba_vph_pwr";
		qcom,pre-scaling = <1 3>;
	};

	/* PMX75 Channel nodes */
	pmx75_offset_ref {
		reg = <PMX75_ADC5_GEN3_OFFSET_REF>;
		label = "pmx75_offset_ref";
		qcom,pre-scaling = <1 1>;
	};

	pmx75_vref_1p25 {
		reg = <PMX75_ADC5_GEN3_1P25VREF>;
		label = "pmx75_vref_1p135";
		qcom,pre-scaling = <1 1>;
	};

	pmx75_die_temp {
		reg = <PMX75_ADC5_GEN3_DIE_TEMP>;
		label = "pmx75_die_temp";
		qcom,pre-scaling = <1 1>;
	};

	pmx75_vph_pwr {
		reg = <PMX75_ADC5_GEN3_VPH_PWR>;
		label = "pmx75_vph_pwr";
		qcom,pre-scaling = <1 3>;
	};

	pmx75_pa_therm1 {
		reg = <PMX75_ADC5_GEN3_AMUX_THM1_100K_PU>;
		label = "pmx75_pa_therm1";
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
		qcom,pre-scaling = <1 1>;
		qcom,adc-tm-type = <1>;
	};

	pmx75_pa_therm2 {
		reg = <PMX75_ADC5_GEN3_AMUX_THM2_100K_PU>;
		label = "pmx75_pa_therm2";
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
		qcom,pre-scaling = <1 1>;
		qcom,adc-tm-type = <1>;
	};

	pmx75_sdx_case_therm {
		reg = <PMX75_ADC5_GEN3_AMUX_THM3_100K_PU>;
		label = "pmx75_sdx_case_therm";
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
		qcom,pre-scaling = <1 1>;
		qcom,adc-tm-type = <1>;
	};

	pmx75_ambient_therm {
		reg = <PMX75_ADC5_GEN3_AMUX_THM4_100K_PU>;
		label = "pmx75_ambient_therm";
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
		qcom,pre-scaling = <1 1>;
		qcom,adc-tm-type = <1>;
	};

	pmx75_qtm_therm {
		reg = <PMX75_ADC5_GEN3_AMUX_THM5_100K_PU>;
		label = "pmx75_qtm_therm";
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
		qcom,pre-scaling = <1 1>;
		qcom,adc-tm-type = <1>;
	};

	pmx75_sdr_skin_therm {
		reg = <PMX75_ADC5_GEN3_AMUX_THM6_100K_PU>;
		label = "pmx75_sdr_skin_therm";
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
		qcom,pre-scaling = <1 1>;
		qcom,adc-tm-type = <1>;
	};
};

&thermal_zones {
	pa-therm1 {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-sensors = <&pmk8550_vadc PMX75_ADC5_GEN3_AMUX_THM1_100K_PU>;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

			active-config1 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};

	pa-therm2 {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-sensors = <&pmk8550_vadc PMX75_ADC5_GEN3_AMUX_THM2_100K_PU>;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

			active-config1 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};

	sdx-case-therm {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-sensors = <&pmk8550_vadc PMX75_ADC5_GEN3_AMUX_THM3_100K_PU>;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

			active-config1 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};

	ambient-therm {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-sensors = <&pmk8550_vadc PMX75_ADC5_GEN3_AMUX_THM4_100K_PU>;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

			active-config1 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};

	qtm-therm {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-sensors = <&pmk8550_vadc PMX75_ADC5_GEN3_AMUX_THM5_100K_PU>;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

			active-config1 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};

	sdr-skin-therm {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-sensors = <&pmk8550_vadc PMX75_ADC5_GEN3_AMUX_THM6_100K_PU>;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

			active-config1 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};

	xo-therm {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-sensors = <&pmk8550_vadc PMK8550_ADC5_GEN3_AMUX_THM1_XO_THERM_100K_PU>;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};

			active-config1 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};
};

&soc {
	pmic-pon-log {
		compatible = "qcom,pmic-pon-log";
		nvmem = <&pmk8550_sdam_5>, <&pmk8550_sdam_6>;
		nvmem-names = "pon_log0", "pon_log1";
	};
};
