#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/spmi/spmi.h>
#include <dt-bindings/iio/qcom,spmi-adc5-gen3-pmk8550.h>
#include <dt-bindings/iio/qcom,spmi-adc5-gen3-pm8550.h>
#include <dt-bindings/iio/qcom,spmi-adc5-gen3-pm8550b.h>
#include <dt-bindings/iio/qcom,spmi-adc5-gen3-pm8550vx.h>

&spmi_bus {
	#address-cells = <2>;
	#size-cells = <0>;
	interrupt-controller;
	#interrupt-cells = <4>;

	qcom,pmk8550@0 {
		compatible = "qcom,spmi-pmic";
		reg = <0 SPMI_USID>;
		#address-cells = <1>;
		#size-cells = <0>;

		pon_hlos@1300 {
			compatible = "qcom,pm8998-pon";
			reg = <0x1300>, <0x800>;
			reg-names = "pon_hlos", "pon_pbs";

			pmk8550_pwrkey: pwrkey {
				compatible = "qcom,pmk8350-pwrkey";
				interrupts = <0x0 0x13 0x7 IRQ_TYPE_EDGE_BOTH>;
				linux,code = <KEY_POWER>;
			};

			resin {
				compatible = "qcom,pmk8350-resin";
				interrupts = <0x0 0x13 0x6 IRQ_TYPE_EDGE_BOTH>;
				linux,code = <KEY_VOLUMEDOWN>;
			};
		};

		pmk8550_sdam_1: sdam@7000 {
			compatible = "qcom,spmi-sdam";
			reg = <0x7000>;
			#address-cells = <1>;
			#size-cells = <1>;

			ocp_log: ocp-log@76 {
				reg = <0x76 0x6>;
			};
		};

		pmk8550_sdam_2: sdam@7100 {
			compatible = "qcom,spmi-sdam";
			reg = <0x7100>;
			#address-cells = <1>;
			#size-cells = <1>;

			restart_reason: restart@48 {
				reg = <0x48 0x1>;
				bits = <1 7>;
			};
		};

		pmk8550_sdam_5: sdam@7400 {
			compatible = "qcom,spmi-sdam";
			reg = <0x7400>;
		};

		pmk8550_sdam_6: sdam@7500 {
			compatible = "qcom,spmi-sdam";
			reg = <0x7500>;
		};

		pmk8550_sdam_21: sdam@8400 {
			compatible = "qcom,spmi-sdam";
			reg = <0x8400>;
		};

		pmk8550_sdam_22: sdam@8500 {
			compatible = "qcom,spmi-sdam";
			reg = <0x8500>;
		};

		pmk8550_sdam_46: sdam@9d00 {
			compatible = "qcom,spmi-sdam";
			reg = <0x9d00>;
		};

		pmk8550_sdam_49: sdam@a000 {
			compatible = "qcom,spmi-sdam";
			reg = <0xa000>;
		};

		pmk8550_sdam_53: sdam@a400 {
			compatible = "qcom,spmi-sdam";
			reg = <0xa400>;
		};

		pmk8550_gpios: pinctrl@b800 {
			compatible = "qcom,pmk8550-gpio";
			reg = <0xb800>;
			gpio-controller;
			#gpio-cells = <2>;
			interrupt-controller;
			#interrupt-cells = <2>;
		};

		pmk8550_rtc: rtc@6100 {
			compatible = "qcom,pmk8350-rtc";
			reg = <0x6100>, <0x6200>;
			reg-names = "rtc", "alarm";
			interrupts = <0x0 0x62 0x1 IRQ_TYPE_EDGE_RISING>;
		};

		pmk8550_vadc: vadc@9000 {
			compatible = "qcom,spmi-adc5-gen3";
			reg = <0x9000>, <0x9100>;
			#address-cells = <1>;
			#size-cells = <0>;
			interrupt-names = "adc-sdam0" , "adc-sdam1";
			interrupts = <0x0 0x90 0x1 IRQ_TYPE_EDGE_RISING>,
				     <0x0 0x91 0x1 IRQ_TYPE_EDGE_RISING>;
			#thermal-sensor-cells = <1>;
			#io-channel-cells = <1>;
			io-channel-ranges;

			/* PMK8550 Channel nodes */
			pmk8550_offset_ref {
				reg = <PMK8550_ADC5_GEN3_OFFSET_REF>;
				label = "pmk8550_offset_ref";
				qcom,pre-scaling = <1 1>;
			};

			pmk8550_vref_1p25 {
				reg = <PMK8550_ADC5_GEN3_1P25VREF>;
				label = "pmk8550_vref_1p25";
				qcom,pre-scaling = <1 1>;
			};

			pmk8550_die_temp {
				reg = <PMK8550_ADC5_GEN3_DIE_TEMP>;
				label = "pmk8550_die_temp";
				qcom,pre-scaling = <1 1>;
			};

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

			/* PM8550 Channel nodes */
			pm8550_offset_ref {
				reg = <PM8550_ADC5_GEN3_OFFSET_REF>;
				label = "pm8550_offset_ref";
				qcom,pre-scaling = <1 1>;
			};

			pm8550_vref_1p25 {
				reg = <PM8550_ADC5_GEN3_1P25VREF>;
				label = "pm8550_vref_1p25";
				qcom,pre-scaling = <1 1>;
			};

			pm8550_die_temp {
				reg = <PM8550_ADC5_GEN3_DIE_TEMP>;
				label = "pm8550_die_temp";
				qcom,pre-scaling = <1 1>;
			};

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

			/* PM8550B Channel nodes */
			pm8550b_offset_ref {
				reg = <PM8550B_ADC5_GEN3_OFFSET_REF>;
				label = "pm8550b_offset_ref";
				qcom,pre-scaling = <1 1>;
			};

			pm8550b_vref_1p25 {
				reg = <PM8550B_ADC5_GEN3_1P25VREF>;
				label = "pm8550b_vref_1p25";
				qcom,pre-scaling = <1 1>;
			};

			pm8550b_die_temp {
				reg = <PM8550B_ADC5_GEN3_DIE_TEMP>;
				label = "pm8550b_die_temp";
				qcom,pre-scaling = <1 1>;
			};

			pm8550b_lite_die_temp {
				reg = <PM8550B_ADC5_GEN3_TEMP_ALARM_LITE>;
				label = "pm8550b_lite_die_temp";
				qcom,pre-scaling = <1 1>;
			};

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

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

			/* PM8550VS_C Channel nodes */
			pm8550vs_c_die_temp {
				reg = <PM8550VS_C_ADC5_GEN3_DIE_TEMP>;
				label = "pm8550vs_c_die_temp";
				qcom,pre-scaling = <1 1>;
			};

			/* PM8550VS_D Channel nodes */
			pm8550vs_d_die_temp {
				reg = <PM8550VS_D_ADC5_GEN3_DIE_TEMP>;
				label = "pm8550vs_d_die_temp";
				qcom,pre-scaling = <1 1>;
			};

			/* PM8550VS_E Channel nodes */
			pm8550vs_e_die_temp {
				reg = <PM8550VS_E_ADC5_GEN3_DIE_TEMP>;
				label = "pm8550vs_e_die_temp";
				qcom,pre-scaling = <1 1>;
			};

			/* PM8550VS_G Channel nodes */
			pm8550vs_g_die_temp {
				reg = <PM8550VS_G_ADC5_GEN3_DIE_TEMP>;
				label = "pm8550vs_g_die_temp";
				qcom,pre-scaling = <1 1>;
			};

			/* PM8550VE Channel nodes */
			pm8550ve_die_temp {
				reg = <PM8550VE_ADC5_GEN3_DIE_TEMP>;
				label = "pm8550ve_die_temp";
				qcom,pre-scaling = <1 1>;
			};
		};

		qti_epm: qcom,epm-device {
			compatible = "qcom,epm-devices";
			nvmem = <&pmk8550_sdam_49>,
				<&pmk8550_sdam_53>;
			nvmem-names = "epm-config-sdam",
				"epm-10s-avg-sdam";

			qcom,reg-ppid-ids = /bits/ 16 <0x1e4 0x19b 0x19e 0x1a1
					0x1a4 0x2a1 0x2a4 0x2aa 0x3a4 0x3a7
					0x3aa 0x59e 0x5a4 0x5a7>;

			qcom,reg-ppid-names = "sub_reg", "hv_sub_reg",
					"mv_sub_reg_ldo", "lv_sub_reg_ldo",
					"multimedia", "mxa", "apc0", "apc1",
					"ebi", "vddq", "cx", "mxc",
					"wlan_cx", "gfx";
		};
	};
};
