/*
   this file is for attribution only of unicorn
   And public attribution of xiaomi platforms(like K2 and so and)
*/

#include "mondrian-pinctrl.dtsi"
#include "xiaomi-sm8475-common.dtsi"
&soc {
	xiaomi_touch {
		compatible = "xiaomi-touch";
		status = "ok";
		touch,name = "xiaomi-touch";
	};

        thermal_message: thermal-message {
                board-sensor = "VIRTUAL-SENSOR";
        };

};

&qupv3_se4_spi {
	status = "ok";
	qcom,rt;
	pinctrl-0 = <&mi_ts_spi_active &mi_ts_cs_active>;
	pinctrl-1 = <&mi_ts_spi_sleep &mi_ts_cs_suspend>;
	xiaomi_touch@0 {
		status = "ok";
		compatible = "xiaomi,m11a-spi";
		reg = <0>;
		spi-max-frequency = <15000000>;
		interrupt-parent = <&tlmm>;
		interrupts = <21 0x2008>;
		//goodix,avdd-name = "avdd";
		//avdd-supply = <&L7C>;
		pinctrl-names = "pmx_ts_active", "pmx_ts_suspend";
		pinctrl-0 = <&mi_ts_active>;
		pinctrl-1 = <&ts_int_suspend &ts_reset_suspend>;

		goodix,avdd-gpio = <&tlmm 71 0x0>;
		goodix,iovdd-name = "vdd";
		vdd-supply = <&L2C>;
		goodix,irq-gpio = <&tlmm 21 0x2008>;
		goodix,reset-gpio = <&tlmm 20 0x00>;
		goodix,irq-flags = <2>;
		goodix,panel-max-x = <14400>;
		goodix,panel-max-y = <32000>;
		goodix,panel-max-w = <255>;
		goodix,panel-max-p = <4096>;
		goodix,firmware-name = "goodix_firmware_m11a";
		goodix,config-name = "goodix_cfg_group_m11a";
		goodix,touch-expert-array = <2 3 2 2
					     4 3 3 2
					     3 3 4 2>;
	};
};

&tlmm {
        mi_ts_active: mi_ts_active {
                mux {
                                pins = "gpio21", "gpio20";
                                function = "gpio";
                };
		config {
                                pins = "gpio21", "gpio20";
                                drive-strength = <8>;
                                bias-pull-up;
                };
        };
	/* RCV HANDSET CTL */
	rcv_gpio_high: rcv_gpio_high {
		mux {
			pins = "gpio52";
			function = "gpio";
		};

		config {
			pins = "gpio52";
			drive-strength = <2>;
			bias-pull-up;
			output-high;
		};
	};
	rcv_gpio_low: rcv_gpio_low {
		mux {
			pins = "gpio52";
			function = "gpio";
		};

		config {
			pins = "gpio52";
			drive-strength = <2>;
			bias-disable;
			output-low;
		};
	};

	tert_tdm_din_active: tert_tdm_din_active {
		mux {
			pins = "gpio122";
			function = "mi2s2_data0";
		};

		config {
			pins = "gpio122";
			drive-strength = <0x02>;
			bias-disable;
		};
	};

	tert_tdm_dout_active: tert_tdm_dout_active {
		mux {
			pins = "gpio124";
			function = "mi2s2_data1";
		};

		config {
			pins = "gpio124";
			drive-strength = <0x02>;
			bias-disable;
		};
	};

	tert_tdm_clk_active: tert_tdm_clk_active {
		mux {
			pins = "gpio121";
			function = "mi2s2_sck";
		};

		config {
			pins = "gpio121";
			drive-strength = <0x02>;
			bias-disable;
			output-low;
		};
	};

	tert_tdm_ws_active: tert_tdm_ws_active {
		mux {
			pins = "gpio123";
			function = "mi2s2_ws";
		};

		config {
			pins = "gpio123";
			drive-strength = <0x02>;
			bias-disable;
			output-low;
		};
	};
};

&qupv3_se15_i2c {
	status = "ok";

	/* TOP Smart PA */
	aw882xx_smartpa@34 {
		compatible = "awinic,aw882xx_smartpa";
		reg = <0x34>;
		irq-gpio = <&tlmm 88 0x2008>;
		reset-gpio = <&tlmm 1 0>;
		dc-flag = <0>;
		sync-flag = <1>;
		sound-channel = <0>;
		aw-cali-mode = "aw_none ";
		spksw-gpio = <&tlmm 52 0>;
		status = "ok";
	};

	/* BOT Smart PA */
	aw882xx_smartpa@35 {
		compatible = "awinic,aw882xx_smartpa";
		reg = <0x35>;
		irq-gpio = <&tlmm 63 0x2008>;
		reset-gpio = <&tlmm 3 0>;
		dc-flag = <0>;
		sync-flag = <1>;
		sound-channel = <1>;
		aw-cali-mode = "aw_none ";
		status = "ok";
	};
};

&battery_charger {
	qcom,shutdown-voltage = <3350>;
};

&nxp_eusb2_repeater {
	qcom,param-override-seq = /* override value offset */
		<0x50 0x06
		 0x00 0x07
		 0x63 0x08
		 0x03 0x0A>;
	qcom,param-override-seq-host =
		<0x40 0x06
		 0x21 0x07
		 0x64 0x08
		 0x03 0x0A>;
};

&soc {
	fingerprint_goodix {
		compatible = "goodix,fingerprint";
		l9c_vdd-supply = <&L9C>;
		goodix,gpio-reset = <&tlmm 41 0x0>;
		goodix,gpio-irq = <&tlmm 40 0x0>;
		status = "ok";
	};
};
&L9C {
	regulator-boot-on;
	regulator-always-on;
	regulator-min-microvolt = <3200000>;
	regulator-max-microvolt = <3200000>;
	qcom,init-voltage = <3200000>;
};

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

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

&pmk8350_vadc {
	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_flash_therm {
		reg = <PM8350_ADC7_AMUX_THM2_100K_PU>;
		label = "pm8350_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>;
	};

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


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

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

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

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

	pm8350b_usb_conn_therm {
		reg = <PM8350B_ADC7_AMUX_THM4_100K_PU>;
		label = "pm8350b_usb_conn_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_GPIO2_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_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>;
	};
	
	wireless_therm {
		reg = <PM8350B_ADC7_GPIO2_100K_PU>;
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
	};
	
	pm8350_charger0_therm {
		reg = <PM8350_ADC7_AMUX_THM4_100K_PU>;
		qcom,ratiometric;
		qcom,hw-settle-time = <200>;
	};

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

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

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

&pmk8350 {
	pm8350_adc_tm_iio: adc_tm_e {
		compatible = "qcom,adc-tm7-iio";
		reg = <0x3400>;
		#thermal-sensor-cells = <1>;
		#address-cells = <1>;
		#size-cells = <0>;

		io-channels = <&pmk8350_vadc PM8350B_ADC7_AMUX_THM4_100K_PU>;

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

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

	wireless_therm {
		polling-delay-passive = <0>;
		polling-delay = <0>;
		thermal-governor = "user_space";
		thermal-sensors = <&pmk8350_adc_tm PM8350B_ADC7_GPIO2_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";
			};
		};
	};

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

&bcl_soc {
        status = "disabled";
};


