#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
#include <dt-bindings/iio/qcom,spmi-adc7-smb139x.h>

#include "pmk8350.dtsi"
#include "pm8350.dtsi"
#include "pm8350c.dtsi"
#include "pm8350b.dtsi"
#include "pmr735a.dtsi"
#include "pmr735b.dtsi"
#include "pm8450.dtsi"

&pmk8350 {
	/delete-node/ pon_pbs@800;
	/delete-node/ pon_hlos@1300;

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

		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>;
		};

		pwrkey-bark {
			compatible = "qcom,pmk8350-pwrkey-bark";
			interrupts = <0x0 0x13 0x0 IRQ_TYPE_EDGE_BOTH>;
			linux,code = <KEY_POWER>;
		};
		pwrkey-resin-bark {
			compatible = "qcom,pmk8350-pwrkey-resin-bark";
			interrupts = <0x0 0x13 0x2 IRQ_TYPE_EDGE_BOTH>;
			linux,code = <KEY_POWER>;
		};
	};
};

&pm8350_gpios {
	pm8350_rear_tof_therm {
		pm8350_rear_tof_therm_default: pm8350_rear_tof_therm_default {
			pins = "gpio1";
			bias-high-impedance;
		};
	};

	key_vol_up {
		key_vol_up_default: key_vol_up_default {
			pins = "gpio6";
			function = "normal";
			input-enable;
			bias-pull-up;
			power-source = <1>;
		};
	};
};

&pm8350b_gpios {
	pm8350b_rear_tof_therm {
		pm8350b_rear_tof_therm_default: pm8350b_rear_tof_therm_default {
			pins = "gpio2";
			bias-high-impedance;
		};
	};
};

&pm8350c_gpios {
	lcd_backlight_ctrl {
		lcd_backlight_ctrl_default: lcd_backlight_ctrl_default {
			pins = "gpio8";
			function = "func1";
			input-disable;
			output-enable;
			bias-disable;
			power-source = <1>;       /* 1.8V */
			qcom,drive-strength = <2>;
		};
	};
};

&pmk8350_sdam_2 {
	hap_cl_brake: cl_brake@7c {
		reg = <0x7c 0x1>;
		bits = <0 8>;
	};
};

&pm8350b_haptics {
	nvmem-cell-names = "hap_cl_brake";
	nvmem-cells = <&hap_cl_brake>;
	nvmem-names = "hap_cfg_sdam";
	nvmem = <&pmk8350_sdam_46>;
	qcom,pbs-client = <&pm8350b_pbs2>;
};

&soc {
	reboot_reason {
		compatible = "qcom,reboot-reason";
		nvmem-cells = <&restart_reason>;
		nvmem-cell-names = "restart_reason";
	};

	pmic-pon-log {
		compatible = "qcom,pmic-pon-log";
		nvmem = <&pmk8350_sdam_5>;
		nvmem-names = "pon_log";
	};
};

&pmk8350_vadc {
	pinctrl-names = "default";
	pinctrl-0 = <&pm8350b_rear_tof_therm_default>;

	pm8350b_chg_temp {
		reg = <PM8350B_ADC7_CHG_TEMP>;
		label = "pm8350b_chg_temp";
		qcom,pre-scaling = <1 1>;
	};

	pm8350b_iin_fb {
		reg = <PM8350B_ADC7_IIN_FB>;
		label = "pm8350b_iin_fb";
		qcom,pre-scaling = <32 100>;
	};

	pm8350b_ichg_fb {
		reg = <PM8350B_ADC7_ICHG_FB>;
		label = "pm8350b_ichg_fb";
		qcom,pre-scaling = <1000 305185>;
	};

	pm8350b_usb_in_v_div_16 {
		reg = <PM8350B_ADC7_USB_IN_V_16>;
		label = "pm8350b_usb_in_v_div_16";
		qcom,pre-scaling = <1 16>;
	};

	smb139x_1_smb_temp {
		reg = <SMB1394_1_ADC7_SMB_TEMP>;
		label = "smb139x_1_smb_temp";
		qcom,hw-settle-time = <200>;
	};

	smb139x_1_ichg_smb {
		reg = <SMB1394_1_ADC7_ICHG_SMB>;
		label = "smb139x_1_ichg_smb";
		qcom,hw-settle-time = <200>;
	};

	smb139x_1_iin_smb {
		reg = <SMB1394_1_ADC7_IIN_SMB>;
		label = "smb139x_1_iin_smb";
		qcom,hw-settle-time = <200>;
	};

	smb139x_2_smb_temp {
		reg = <SMB1394_2_ADC7_SMB_TEMP>;
		label = "smb139x_2_smb_temp";
		qcom,hw-settle-time = <200>;
	};

	smb139x_2_ichg_smb {
		reg = <SMB1394_2_ADC7_ICHG_SMB>;
		label = "smb139x_2_ichg_smb";
		qcom,hw-settle-time = <200>;
	};

	smb139x_2_iin_smb {
		reg = <SMB1394_2_ADC7_IIN_SMB>;
		label = "smb139x_2_iin_smb";
		qcom,hw-settle-time = <200>;
	};
};

&pm8350_tz {
	io-channels = <&pmk8350_vadc PM8350_ADC7_DIE_TEMP>;
	io-channel-names = "thermal";
};

&pm8350b_tz {
	io-channels = <&pmk8350_vadc PM8350B_ADC7_DIE_TEMP>;
	io-channel-names = "thermal";
};
