#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/iio/qti_power_supply_iio.h>

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

	pmx_sde: pmx_sde {
		sde_dsi_active: sde_dsi_active {
			pinconf {
				pins = "gpio1", "gpio2";
				function = "normal";
				qcom,drive-strength = <PMIC_GPIO_STRENGTH_HIGH>;
				bias-disable;
				output-high;
			};
		};

		sde_dsi_suspend: sde_dsi_suspend {
			pinconf {
				pins = "gpio1", "gpio2";
				function = "normal";
				qcom,drive-strength = <PMIC_GPIO_STRENGTH_LOW>;
				bias-pull-down;
				output-low;
			};
		};
	};
};

&soc {
	gpio_keys {
		compatible = "gpio-keys";
		label = "gpio-keys";

		pinctrl-names = "default";
		pinctrl-0 = <&key_vol_up_default>;

		vol_up {
			label = "volume_up";
			gpios = <&pm5100_gpios 9 GPIO_ACTIVE_LOW>;
			linux,input-type = <1>;
			linux,code = <KEY_VOLUMEUP>;
			gpio-key,wakeup;
			debounce-interval = <15>;
			linux,can-disable;
		};
	};

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

&pm5100_adc {
	#thermal-sensor-cells = <1>;
	status = "ok";

	pm5100_xo_therm {
		qcom,adc-tm-type = <1>;
	};

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

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

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

	pm5100_bat_id {
		qcom,hw-settle-time = <16000>;
	};
};

&thermal_zones {
	xo-therm-usr {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pm5100_adc PM5100_ADC5_GEN3_AMUX1_THM_100K_PU>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};

	pa-therm0-usr {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pm5100_adc PM5100_ADC5_GEN3_AMUX4_THM_100K_PU>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};

	quiet-therm-usr {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pm5100_adc PM5100_ADC5_GEN3_AMUX5_THM_100K_PU>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};

	sdm-skin-therm-usr {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pm5100_adc PM5100_ADC5_GEN3_AMUX6_THM_100K_PU>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};
};

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

	monaco_batterydata: qcom,battery-data {
		qcom,batt-id-range-pct = <15>;
	};
};

&pm5100_charger {
	status = "okay";
	qcom,battery-data = <&monaco_batterydata>;
	dpdm-supply = <&usb2_phy0>;
	nvmem-cell-names = "charger_debug_mask";
	nvmem-cells = <&charger_debug_mask>;
	qcom,auto-recharge-soc = <98>;
	qcom,suspend-input-on-debug-batt;
	qcom,chg-term-src = <1>;
	qcom,chg-term-current-ma = <(-20)>;
	qcom,fcc-stepping-enable;
	qcom,fcc-step-delay-ms = <1000>;
	qcom,fcc-step-size-ua = <100000>;
	qcom,fcc-step-start-ua = <200000>;
	qcom,concurrency-mode-supported;
};
