/*
   this file is for attribution only of zizhan
   And public attribution of xiaomi platforms(like K2 and so and)
*/
#include "zizhan-8475-pinctrl.dtsi"
#include "xiaomi-sm8475-common.dtsi"
&pmk8350_vadc {
	pinctrl-names = "default";
	pinctrl-0 = <&pm8350b_rear_tof_therm_default>;

	pm8350_msm_therm {
		reg = <PM8350_ADC7_AMUX_THM1_100K_PU>;
		label = "pm8350_msm_therm";
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
		qcom,pre-scaling = <1 1>;
	};

	pm8350_cam_flash_therm {
		reg = <PM8350_ADC7_AMUX_THM2_100K_PU>;
		label = "pm8350_cam_flash_therm";
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
		qcom,pre-scaling = <1 1>;
	};

	pm8350_hot_pocket_therm {
		reg = <PM8350_ADC7_AMUX_THM3_100K_PU>;
		label = "pm8350_hot_pocket_therm";
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
		qcom,pre-scaling = <1 1>;
	};

	pm8350_wide_rfc_therm {
		reg = <PM8350_ADC7_AMUX_THM4_100K_PU>;
		label = "pm8350_wide_rfc_therm";
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
		qcom,pre-scaling = <1 1>;
	};

	pm8350b_rear_tof_therm {
		reg = <PM8350B_ADC7_AMUX_THM4_100K_PU>;
		label = "pm8350b_rear_tof_therm";
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
		qcom,pre-scaling = <1 1>;
	};

	pm8350b_usb_conn_therm {
		reg = <PMR735A_ADC7_GPIO1_100K_PU>;
		label = "pm8350b_usb_conn_therm";
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
		qcom,pre-scaling = <1 1>;
	};

	pm8350b_wl_chg_therm {
		reg = <PMR735A_ADC7_GPIO2_100K_PU>;
		label = "pm8350b_wl_chg_therm";
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
		qcom,pre-scaling = <1 1>;
	};

	pmk8350_xo_therm {
		reg = <PMR735A_ADC7_GPIO3_100K_PU>;
		label = "pmk8350_xo_therm";
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
		qcom,pre-scaling = <1 1>;
	};
};

&pmk8350_adc_tm {
	io-channels = <&pmk8350_vadc PM8350_ADC7_AMUX_THM1_100K_PU>,
			<&pmk8350_vadc PM8350_ADC7_AMUX_THM2_100K_PU>,
			<&pmk8350_vadc PM8350_ADC7_AMUX_THM3_100K_PU>,
			<&pmk8350_vadc PM8350_ADC7_AMUX_THM4_100K_PU>,
			<&pmk8350_vadc PM8350B_ADC7_AMUX_THM4_100K_PU>,
			<&pmk8350_vadc PMR735A_ADC7_GPIO1_100K_PU>,
			<&pmk8350_vadc PMR735A_ADC7_GPIO2_100K_PU>,
			<&pmk8350_vadc PMR735A_ADC7_GPIO3_100K_PU>;

	pm8350_msm_therm {
		reg = <PM8350_ADC7_AMUX_THM1_100K_PU>;
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
	};

	pm8350_cam_flash_therm {
		reg = <PM8350_ADC7_AMUX_THM2_100K_PU>;
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
	};

	pm8350_hot_pocket_therm {
		reg = <PM8350_ADC7_AMUX_THM3_100K_PU>;
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
	};

	pm8350_wide_rfc_therm {
		reg = <PM8350_ADC7_AMUX_THM4_100K_PU>;
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
	};

	pm8350b_rear_tof_therm {
		reg = <PM8350B_ADC7_AMUX_THM4_100K_PU>;
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
	};

	pm8350b_usb_conn_therm {
		reg = <PMR735A_ADC7_GPIO1_100K_PU>;
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
	};

	pm8350b_wl_chg_therm {
		reg = <PMR735A_ADC7_GPIO2_100K_PU>;
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
	};

	pmk8350_xo_therm {
		reg = <PMR735A_ADC7_GPIO3_100K_PU>;
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
	};
};

&pm8350b_haptics {
	qcom,vmax-mv = <3250>;
	qcom,lra-period-us = <5102>;
	qcom,lra-f0-min = <185>;
	qcom,lra-f0-max = <200>;
	qcom,lra-f0-default = <196>;
	qcom,lra-f0-cal-count = <592>;
};

&thermal_zones {
	cpu_therm {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pmk8350_adc_tm PM8350_ADC7_AMUX_THM1_100K_PU>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};

	flash_therm {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pmk8350_adc_tm PM8350_ADC7_AMUX_THM2_100K_PU>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};

	quiet_therm {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pmk8350_adc_tm PM8350_ADC7_AMUX_THM3_100K_PU>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};

	charger_therm0 {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pmk8350_adc_tm PM8350_ADC7_AMUX_THM4_100K_PU>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};

	conn_therm {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pmk8350_adc_tm PM8350B_ADC7_AMUX_THM4_100K_PU>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};

	pa_therm0 {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pmk8350_adc_tm PMR735A_ADC7_GPIO1_100K_PU>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};

	pa_therm1 {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pmk8350_adc_tm PMR735A_ADC7_GPIO2_100K_PU>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};

	wifi_therm {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pmk8350_adc_tm PMR735A_ADC7_GPIO3_100K_PU>;
		wake-capable-sensor;
		trips {
			active-config0 {
				temperature = <125000>;
				hysteresis = <1000>;
				type = "passive";
			};
		};
	};
};

&soc {
	fingerprint_fpc {
		status = "ok";
		compatible = "fpc,fpc1020";
		interrupt-parent = <&tlmm>;
		interrupts = <40 0x0>;
		fpc,gpio_rst    = <&tlmm 41 0x0>;
		fpc,gpio_irq    = <&tlmm 40 0x0>;
		fp_vdd_vreg-supply = <&L11C>;
		pinctrl-names = "fpc1020_reset_reset",
                                "fpc1020_reset_active",
                                "fpc1020_irq_active";

		pinctrl-0 = <&msm_gpio_reset>;
		pinctrl-1 = <&msm_gpio_reset_output_high>;
		pinctrl-2 = <&msm_gpio_irq>;
	};

	xiaomi_fingerprint {
		compatible = "xiaomi-fingerprint";
		status = "ok";
		fingerprint,name = "xiaomi-fingerprint";
	};

        fingerprint_goodix {
		compatible = "goodix,fingerprint";
		l11c_vdd-supply = <&L11C>;
		goodix,gpio-reset = <&tlmm 41 0x0>;
		goodix,gpio-irq = <&tlmm 40 0x0>;
		status = "ok";
	};

	gpio_keys {
		hall_key {
			label = "hall_key";
			gpios = <&tlmm 62 GPIO_ACTIVE_LOW>;
			linux,input-type = <5>;
			linux,code = <0>;
			gpio-key,wakeup;
			debounce-interval = <15>;
		};
	};
};

&L11C {
	regulator-boot-on;
	regulator-always-on;
	regulator-min-microvolt = <3300000>;
	regulator-max-microvolt = <3300000>;
	qcom,init-voltage = <3300000>;
};

&tlmm {
	/* FP_RESET_N */
	msm_gpio_reset: msm_gpio_reset {
		mux {
			pins = "gpio41";
			function = "gpio";
		};
		config {
			pins = "gpio41";
			drive-strength = <2>;
			bias-disable;
			output-low;
		};
	};

        /* FP_RESET_N, state device active*/
	msm_gpio_reset_output_high: msm_gpio_reset_output_high {
		mux {
			pins = "gpio41";
			function = "gpio";
		};
		config {
			pins = "gpio41";
			drive-strength = <2>;
			bias-disable;
			output-high;
		};
	};

        /* FP_INT_N */
	msm_gpio_irq: msm_gpio_irq {
		mux {
			pins = "gpio40";
			function = "gpio";
		};
		config {
			pins = "gpio40";
			drive-strength = <2>;
			bias-pull-down;
		};
	};
};

&soc {
	thermal-message {
		board-sensor = "VIRTUAL-SENSOR";
	};

	bcl-ibat {
		enable-ibatset-16ms;
	};

	xiaomi_touch {
		compatible = "xiaomi-touch";
		status = "ok";
		touch,name = "xiaomi-touch";
	};
};

&S1C {
	regulator-boot-on;
	regulator-always-on;
};

&qupv3_se1_i2c {
	status = "ok";
	wl2866d_pm:willsemi,ldo@28 {
		compatible = "willsemi,wl2866d";
		reg = <0x28>;/*slave address*/
		index = <0>;

		wl2866d_dvdd1:on,wl2866d@0{
			offset = /bits/ 16 <0x0000>;
			regulator-name ="wl2866d-dvdd1";
			regulator-min-microvolt = <600000>;
			regulator-max-microvolt = <1800000>;
			min-dropout-voltage = <80000>;
			iout_ua = <500000>;
			init-voltage = <1800000>;
		};

		wl2866d_dvdd2:on,wl2866d@1{
			offset = /bits/ 16 <0x0001>;
			regulator-name ="wl2866d-dvdd2";
			regulator-min-microvolt = <600000>;
			regulator-max-microvolt = <1800000>;
			min-dropout-voltage = <80000>;
			iout_ua = <500000>;
			init-voltage = <1800000>;
		};

		wl2866d_avdd1:on,wl2866d@2{
			offset = /bits/ 16 <0x0002>;
			regulator-name ="wl2866d-avdd1";
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <4300000>;
			min-dropout-voltage = <90000>;
			iout_ua = <300000>;
			init-voltage = <3000000>;
		};

		wl2866d_avdd2:on,wl2866d@3{
			offset = /bits/ 16 <0x0003>;
			regulator-name ="wl2866d-avdd2";
			regulator-min-microvolt = <1200000>;
			regulator-max-microvolt = <4300000>;
			min-dropout-voltage = <90000>;
			iout_ua = <300000>;
			init-voltage = <3300000>;
		};
	};
};

&qupv3_se4_spi {
	status = "ok";
	qcom,rt;
	pinctrl-0 = <&mi_ts_spi_active_pri &mi_ts_cs_active_pri>;
	pinctrl-1 = <&mi_ts_spi_suspend_pri &mi_ts_cs_suspend_pri>;
	fts-pri@0 {
		status = "ok";
		compatible = "st,spi-pri";
		reg = <0x0>;
		interrupt-parent = <&tlmm>;
		interrupts = <21 0x2008>;
		pinctrl-names = "pmx_ts_pri_active", "pmx_ts_pri_suspend";
		pinctrl-0 = <&mi_ts_pri_active>;
		pinctrl-1 = <&ts_int_suspend &ts_reset_suspend>;
		avdd-supply = <&L7C>;
		dvdd-supply = <&L2C>;
		fts,regulator_avdd = "avdd";
		fts,regulator_dvdd = "dvdd";
		fts,x-max = <19140>;
		fts,y-max = <21600>;
		fts,irq-gpio = <&tlmm 21 0x2008>;
		fts,reset-gpio = <&tlmm 20 0x00>;
		fts,support-super-resolution = <1>;
		fts,touch-follow-performance-def = <3>;
		fts,touch-tap-sensitivity-def = <4>;
		fts,touch-aim-sensitivity-def = <3>;
		fts,touch-tap-stability-def = <3>;
		fts,cornerfilter-area-step1 = <100>;
		fts,cornerfilter-area-step2 = <170>;
		fts,cornerfilter-area-step3 = <250>;
		fts,touch-deadzone-filter-ver = <2 0 0 0 0 0 0 0
										2 1 0 0 0 0 0 0
										2 2 0 0 0 0 0 0
										2 3 0 0 0 0 0 0>;
		fts,touch-deadzone-filter-hor = <2 0 0 0 0 0 0 0
										2 1 0 0 0 0 0 0
										2 2 0 0 0 0 0 0
										2 3 0 0 0 0 0 0>;
		fts,touch-edgezone-filter-ver = <1 0 0 0 0 0 0 0
										1 1 0 0 0 0 0 0
										1 2 0 0 30 2159 0 0
										1 3 1883 0 1913 2159 0 0>;
		fts,touch-edgezone-filter-hor = <1 0 0 0 1913 30 0 0
										1 1 0 2129 1913 2159 0 0
										1 2 0 0 30 2159 0 0
										1 3 1883 0 1913 2159 0 0>;
		fts,touch-cornerzone-filter-ver = <0 0 0 0 0 0 0 0
										0 1 0 0 0 0 0 0
										0 2 0 1859 150 2159 0 0
										0 3 1763 1859 1913 2159 0 0>;
		fts,touch-cornerzone-filter-hor1 = <0 0 0 0 170 170 0 0
										0 1 0 0 0 0 0 0
										0 2 0 1989 170 2159 0 0
										0 3 0 0 0 0 0 0>;
		fts,touch-cornerzone-filter-hor2 = <0 0 0 0 0 0 0 0
										0 1 1743 0 1913 170 0 0
										0 2 0 0 0 0 0 0
										0 3 1743 1989 1913 2159 0 0>;
		fts,touch-follow-performance = <10 15 1
										8 15 1
										6 15 1
										4 15 1
										2 15 1>;
		fts,touch-tap-sensitivity = <160 150 140 120 100>;
		fts,touch-aim-sensitivity = <10 8 6 4 2>;
		fts,touch-tap-stability = <8 12 15 18 25>;
		fts,touch-expert-array = <6 15 1 120 6 15
								  2 15 1 120 4 15
								  4 15 1 120 2 15>;
	};
};

&qupv3_se19_spi {
	status = "ok";
	qcom,rt;
	pinctrl-0 = <&mi_ts_spi_active_sec &mi_ts_cs_active_sec>;
	pinctrl-1 = <&mi_ts_spi_suspend_sec &mi_ts_cs_suspend_sec>;
	fts-sec@0 {
		status = "ok";
		compatible = "st,spi";
		reg = <0x0>;
		interrupt-parent = <&tlmm>;
		interrupts = <119 0x2008>;
		pinctrl-names = "pmx_ts_sec_active", "pmx_ts_sec_suspend";
		pinctrl-0 = <&mi_ts_sec_active>;
		pinctrl-1 = <&ts_int_sec_suspend &ts_reset_sec_suspend>;
		avdd-supply = <&wl2866d_avdd2>;
		vdd-supply = <&wl2866d_dvdd2>;
		/*panel = <&dsi_k8_42_02_0a_dsc_cmd>;*/
		fts,pwr-reg-name = "avdd";
		fts,bus-reg-name = "vdd";
		fts,irq-gpio = <&tlmm 119 0x2008>;
		fts,irq-gpio-name = "fts_irq";
		fts,reset-gpio-enable;
		fts,reset-gpio = <&tlmm 52 0x00>;
		fts,reset-gpio-name = "fts_rst";
		fts,irq-flags = <0x2008>;
		fts,x-max = <10800>;
		fts,y-max = <25200>;
		fts,fod-lx = <5860>;
		fts,fod-ly = <23460>;
		fts,fod-x-size = <2680>;
		fts,fod-y-size = <2660>;
		fts,support-fod;
		spi-max-frequency = <12000000>;
		fts,support-super-resolution = <1>;
		fts,default-fw-name = "st_fts_l18_sec.ftb";
		fts,config-array-size = <1>;
		fts,touch-follow-performance-def = <3>;
		fts,touch-tap-sensitivity-def = <4>;
		fts,touch-aim-sensitivity-def = <3>;
		fts,touch-tap-stability-def = <3>;
		fts,cornerfilter-area-step1 = <100>;
		fts,cornerfilter-area-step2 = <170>;
		fts,cornerfilter-area-step3 = <250>;
		fts,touch-deadzone-filter-ver = <2 0 0 0 0 0 0 0
										2 1 0 0 0 0 0 0
										2 2 0 0 0 0 0 0
										2 3 0 0 0 0 0 0>;
		fts,touch-deadzone-filter-hor = <2 0 0 0 0 0 0 0
										2 1 0 0 0 0 0 0
										2 2 0 0 0 0 0 0
										2 3 0 0 0 0 0 0>;
		fts,touch-edgezone-filter-ver = <1 0 0 0 0 0 0 0
										1 1 0 0 0 0 0 0
										1 2 0 0 40 2519 0 0
										1 3 1039 0 1079 2519 0 0>;
		fts,touch-edgezone-filter-hor = <1 0 0 0 1079 40 0 0
										1 1 0 2479 1079 2519 0 0
										1 2 0 0 40 2519 0 0
										1 3 1039 0 1079 2519 0 0>;
		fts,touch-cornerzone-filter-ver = <0 0 0 0 0 0 0 0
										0 1 0 0 0 0 0 0
										0 2 0 2219 150 2519 0 0
										0 3 929 2219 1079 2519 0 0>;
		fts,touch-cornerzone-filter-hor1 = <0 0 0 0 170 170 0 0
										0 1 0 0 0 0 0 0
										0 2 0 2349 170 2519 0 0
										0 3 0 0 0 0 0 0>;
		fts,touch-cornerzone-filter-hor2 = <0 0 0 0 0 0 0 0
										0 1 909 0 1079 170 0 0
										0 2 0 0 0 0 0 0
										0 3 909 2349 1079 2519 0 0>;
		fts,touch-follow-performance = <10 15 1
										8 15 1
										6 15 1
										4 15 1
										2 15 1>;
		fts,touch-tap-sensitivity = <160 150 140 120 100>;
		fts,touch-aim-sensitivity = <10 8 6 4 2>;
		fts,touch-tap-stability = <8 12 15 18 25>;
		fts,touch-expert-array = <6 15 1 120 6 15
								  2 15 1 120 4 15
								  4 15 1 120 2 15>;
		fts,cfg_0 {
			fts,tp-vendor = <0x38>;
			fts,fw-name = "st_fts_l18_sec.ftb";
			fts,limit-name = "stm_fts_production_limits_sec.csv";
		};
	};
};

&qupv3_se15_i2c {
	status = "ok";
cs35l41_0: cs35l41@40 {
			status = "ok";
			compatible = "cirrus,cs35l41";
			reset-gpios = <&tlmm 1 0>;
			reg = <0x40>;
			interrupt-parent = <&tlmm>;
			interrupts = <88 0x2008>;
			pinctrl-names = "default";
			pinctrl-0 = <&cirrus_reset_default_0 &cirrus_irq_default_0>;
			cirrus,temp-warn_threshold = <3>;
			cirrus,boost-peak-milliamp = <4000>;
			cirrus,boost-ind-nanohenry = <1000>;
			cirrus,boost-cap-microfarad = <15>;
			cirrus,asp-sdout-hiz = <3>;
			cirrus,right-channel-amp;
			sound-name-prefix = "T";
			cirrus,fast-switch = "T-music.txt", "T-handset.txt", "T-handfree.txt";
			cirrus,gpio-config2 {
				cirrus,gpio-src-select = <0x4>;
				cirrus,gpio-output-enable;
			};
		};
cs35l41_1: cs35l41@42 {
			status = "ok";
			compatible = "cirrus,cs35l41";
			reset-gpios = <&tlmm 1 0>;
			reg = <0x42>;
			interrupt-parent = <&tlmm>;
			interrupts = <118 0x2008>;
			pinctrl-names = "default";
			pinctrl-0 = <&cirrus_irq_default_1>;
			cirrus,temp-warn_threshold = <3>;
			cirrus,boost-peak-milliamp = <4000>;
			cirrus,boost-ind-nanohenry = <1000>;
			cirrus,boost-cap-microfarad = <15>;
			cirrus,asp-sdout-hiz = <3>;
			sound-name-prefix = "B";
			cirrus,fast-switch = "B-music.txt", "B-handfree.txt";
			cirrus,gpio-config2 {
				cirrus,gpio-src-select = <0x4>;
				cirrus,gpio-output-enable;
			};
		};
};

&nxp_eusb2_repeater {
	qcom,param-override-seq =
		<0x10 0x07
		0x62 0x08>;
	qcom,param-override-seq-host =
		<0x21 0x07
		0x63 0x08>;
};

&sdhc_2 {
	status = "disabled";
};

&qseecom_ta_mem {
	size = <0x0 0x2000000>;
};

&qseecom_mem {
	size = <0x0 0x2400000>;
};


&battery_charger {
        mi,support-dual-panel;
        mi,support-soc-update;
        qcom,shutdown-voltage = <3350>;
};
