#include "xiaomi-sm7450-common.dtsi"

&icnss2 {
	wlan-en-gpio = <25>;
};

//disable PMK7450 GPIO_1_2_3 to fix the temp value inaccurate
&pmk8350_gpios {
    pmk8350_sc8551_therm {
        pmk8350_sc8551_therm_default: pmk8350_sc8551_therm_default {
            pins = "gpio1";
            bias-high-impedance;
        };
    };

    pmk8350_conn_therm {
        pmk8350_conn_therm_default: pmk8350_conn_therm_default {
            pins = "gpio2";
            bias-high-impedance;
        };
    };

    pmk8350_led_l_therm {
        pmk8350_led_l_therm_default: pmk8350_led_l_therm_default {
            pins = "gpio3";
            bias-high-impedance;
        };
    };
};

&pmk8350_vadc {
    pinctrl-names = "default";

    //disable PMK7450 GPIO_1_2_3 to fix the temp value inaccurate
    pinctrl-0 = <
        &pmk8350_sc8551_therm_default
        &pmk8350_conn_therm_default
        &pmk8350_led_l_therm_default>;

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

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

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

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

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

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

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

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

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

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

&pmk8350_adc_tm {
    io-channels = <&pmk8350_vadc PM7325_ADC7_AMUX_THM1_100K_PU>,
                  <&pmk8350_vadc PM7325_ADC7_AMUX_THM2_100K_PU>,
                  <&pmk8350_vadc PM7325_ADC7_AMUX_THM3_100K_PU>,
                  <&pmk8350_vadc PM7325_ADC7_AMUX_THM4_100K_PU>,
                  <&pmk8350_vadc PM7325_ADC7_AMUX_THM5_100K_PU>,
                  <&pmk8350_vadc PM7325_ADC7_GPIO3_100K_PU>,
                  <&pmk8350_vadc PMK8350_ADC7_AMUX_THM1_100K_PU>,
                  <&pmk8350_vadc PMK8350_ADC7_AMUX_THM2_100K_PU>;

    pm7325_quiet_therm {
        reg = <PM7325_ADC7_AMUX_THM1_100K_PU>;
        qcom,ratiometric;
        qcom,hw-settle-time = <200>;
    };

    pm7325_cam_flash_therm {
        reg = <PM7325_ADC7_AMUX_THM2_100K_PU>;
        qcom,ratiometric;
        qcom,hw-settle-time = <200>;
    };

    pm7325_skin_msm_therm {
        reg = <PM7325_ADC7_AMUX_THM3_100K_PU>;
        qcom,ratiometric;
        qcom,hw-settle-time = <200>;
    };

    pm7325_wide_rfc_therm {
        reg = <PM7325_ADC7_AMUX_THM4_100K_PU>;
        qcom,ratiometric;
        qcom,hw-settle-time = <200>;
    };

    pm7325_4g_pa_therm {
        reg = <PM7325_ADC7_AMUX_THM5_100K_PU>;
        qcom,ratiometric;
        qcom,hw-settle-time = <200>;
    };

    pm7325_5g_pa_therm {
        reg = <PM7325_ADC7_GPIO3_100K_PU>;
        qcom,ratiometric;
        qcom,hw-settle-time = <200>;
    };

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

    pmk8350_sc8551_therm {
        reg = <PMK8350_ADC7_AMUX_THM2_100K_PU>;
        qcom,ratiometric;
        qcom,hw-settle-time = <200>;
    };
};

&pmk8350 {
    pmk8350_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 PMK8350_ADC7_AMUX_THM3_100K_PU>,
                      <&pmk8350_vadc PMK8350_ADC7_AMUX_THM4_100K_PU>;

	pmk8350_conn_therm {
            reg = <PMK8350_ADC7_AMUX_THM3_100K_PU>;
            qcom,ratiometric;
            qcom,hw-settle-time = <200>;
        };

        pmk8350_led_l_therm {
            reg = <PMK8350_ADC7_AMUX_THM4_100K_PU>;
            qcom,ratiometric;
            qcom,hw-settle-time = <200>;
        };
    };
};

&thermal_zones {
    quiet_therm {
        polling-delay-passive = <0>;
        polling-delay = <0>;
        thermal-governor = "user_space";
        thermal-sensors = <&pmk8350_adc_tm PM7325_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 PM7325_ADC7_AMUX_THM2_100K_PU>;
        wake-capable-sensor;
        trips {
            active-config0 {
                temperature = <125000>;
                hysteresis = <1000>;
                type = "passive";
            };
        };
    };

    cpu_therm {
        polling-delay-passive = <0>;
        polling-delay = <0>;
        thermal-governor = "user_space";
        thermal-sensors = <&pmk8350_adc_tm PM7325_ADC7_AMUX_THM3_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 PM7325_ADC7_AMUX_THM4_100K_PU>;
        wake-capable-sensor;
        trips {
            active-config0 {
                temperature = <125000>;
                hysteresis = <1000>;
                type = "passive";
            };
        };
    };

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

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

    xo_therm {
        polling-delay-passive = <0>;
        polling-delay = <0>;
        thermal-governor = "user_space";
        thermal-sensors = <&pmk8350_adc_tm PMK8350_ADC7_AMUX_THM1_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 PMK8350_ADC7_AMUX_THM2_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_iio PMK8350_ADC7_AMUX_THM3_100K_PU>;
        wake-capable-sensor;
        trips {
            active-config0 {
                temperature = <125000>;
                hysteresis = <1000>;
                type = "passive";
            };
        };
    };

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

&qupv3_se0_spi {
    status = "ok";
    qcom,rt;
    pinctrl-1 = <&qupv3_se0_spi_sleep &qupv3_se0_spi_sleep_cs>;
    synaptics_tcm@0 {
        compatible = "synaptics,tcm-spi";
        reg = <0>;
        spi-max-frequency = <5000000>;
        interrupt-parent = <&tlmm>;
        interrupts = <51 0x2808>;
        synaptics,avdd-name = "avdd";
        avdd-supply = <&L11C>;
        synaptics,iovdd-name = "iovdd";
        iovdd-supply = <&L2C>;
        synaptics,irq-gpio = <&tlmm 51 0x2808>;
        synaptics,reset-gpio = <&tlmm 126 0x00>;
        synaptics,irq-on-state = <0>;
        synaptics,spi-mode = <0>;
        synaptics,byte-delay-us = <0>;
        synaptics,block-delay-us = <0>;
        synaptics,power-delay-ms = <200>;
        synaptics,reset-delay-ms = <200>;
        synaptics,ubl-max-freq = <5000000>;
        synaptics,ubl-byte-delay-us = <20>;
        pinctrl-names = "default";
        pinctrl-0 = <&syna_reset_gpio_default>;
        synaptics,game-mode-array =
                <1 0 0 0 0>;  /* MAX MIN DEF SET GET    */
        synaptics,active-mode-array =
                <1 0 0 0 0>;  /* MAX MIN DEF SET GET    */
        synaptics,up-threshold-array =
                <4 0 2 0 0>;  /* MAX MIN DEF SET GET    */
        synaptics,tolerance-array =
                <4 0 2 0 0>;  /* MAX MIN DEF SET GET    */
        synaptics,edge-filter-array =
                <3 0 2 2 2>;  /* MAX MIN DEF SET GET    */
        synaptics,panel-orien-array =
                <3 0 0 0 0>;  /* MAX MIN DEF SET GET    */
        synaptics,report-rate-array =
                <4 0 2 0 0>;  /* MAX MIN DEF SET GET    */
        synaptics,cornerfilter-area-step-array = <0 100 170 250>; /* step 0 to step 3 */
        synaptics,cornerzone-filter-hor1-array =
            /* B0:Type, B1:pos, B2:x0, B3:y0, B4:x1, B5:y1, B6:reserved, B7: reserved */
                <0 0 0 0 170 170 0 0>,
                <0 1 0 0 0 0 0 0>,
                <0 2 0 2229 170 2399 0 0>,
                <0 3 0 0 0 0 0 0>;
        synaptics,cornerzone-filter-hor2-array =
            /* B0:Type, B1:pos, B2:x0, B3:y0, B4:x1, B5:y1, B6:reserved, B7: reserved */
                <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 2229 1079 2399 0 0>;
        synaptics,cornerzone-filter-ver-array =
            /* B0:Type, B1:pos, B2:x0, B3:y0, B4:x1, B5:y1, B6:reserved, B7: reserved */
                <0 0 0 0 0 0 0 0>,
                <0 1 0 0 0 0 0 0>,
                <0 2 0 2099 150 2399 0 0>,
                <0 3 929 2099 1079 2399 0 0>;
        synaptics,deadzone-filter-hor-array =
            /* B0:Type, B1:pos, B2:x0, B3:y0, B4:x1, B5:y1, B6:reserved, B7: reserved */
                <2 0 0 0 1079 0 0 0>,
                <2 1 0 2399 1079 2399 0 0>,
                <2 2 0 0 0 0 0 0>,
                <2 3 0 0 0 0 0 0>;
        synaptics,deadzone-filter-ver-array =
            /* B0:Type, B1:pos, B2:x0, B3:y0, B4:x1, B5:y1, B6:reserved, B7: reserved */
                <2 0 0 0 0 0 0 0>,
                <2 1 0 0 0 0 0 0>,
                <2 2 0 0 0 2399 0 0>,
                <2 3 1079 0 1079 2399 0 0>;
        synaptics,edgezone-filter-hor-array =
            /* B0:Type, B1:pos, B2:x0, B3:y0, B4:x1, B5:y1, B6:reserved, B7: reserved */
                <1 0 0 0 1079 40 0 0>,
                <1 1 0 2359 1079 2399 0 0>,
                <1 2 0 0 40 2399 0 0>,
                <1 3 1039 0 1079 2399 0 0>;
        synaptics,edgezone-filter-ver-array =
            /* B0:Type, B1:pos, B2:x0, B3:y0, B4:x1, B5:y1, B6:reserved, B7: reserved */
                <1 0 0 0 0 0 0 0>,
                <1 1 0 0 0 0 0 0>,
                <1 2 0 0 40 2399 0 0>,
                <1 3 1039 0 1079 2399 0 0>;
        synaptics,panel-display-resolution = <1079 2399>;  /* X  Y*/
    };
};

&tlmm {
    qupv3_se0_spi_sleep: qupv3_se0_spi_sleep {
        mux {
            pins = "gpio0", "gpio1",
                    "gpio2";
            function = "gpio";
        };

        config {
            pins = "gpio0", "gpio1",
                    "gpio2";
            drive-strength = <6>;
            bias-disable;
        };
    };

    qupv3_se0_spi_sleep_cs: qupv3_se0_spi_sleep_cs {
        mux {
            pins = "gpio3";
            function = "gpio";
        };

        config {
            pins = "gpio3";
            drive-strength = <6>;
            bias-disable;
            output-high;
        };
    };

    syna_reset_gpio_default: syna_reset_gpio_default {
        mux {
            pins = "gpio126";
            function = "gpio";
        };

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

&qupv3_se11_spi {
	status = "ok";
	ir-spi@0 {
		compatible = "ir-spi-led";
		reg = <0>;
		spi-max-frequency = <19200000>;
		status = "ok";
		};
};

&qupv3_se3_i2c {
    status = "ok";
	aw2033@45 {
		compatible = "awinic,aw2033_led";
		reg = <0x45>;
		status = "okay";
		aw2033,red {
			aw2033,name = "red";
			aw2033,id = <0>;
			aw2033,imax = <2>;
			aw2033,led-current = <3>;
			aw2033,max-brightness = <255>;
			aw2033,rise-time-ms = <6>;
			aw2033,hold-time-ms = <0>;
			aw2033,fall-time-ms = <6>;
			aw2033,off-time-ms = <4>;
		};

		aw2033,green {
			aw2033,name = "green";
			aw2033,id = <1>;
			aw2033,imax = <2>;
			aw2033,led-current = <3>;
			aw2033,max-brightness = <255>;
			aw2033,rise-time-ms = <6>;
			aw2033,hold-time-ms = <0>;
			aw2033,fall-time-ms = <6>;
			aw2033,off-time-ms = <4>;
		};
		aw2033,blue {
			aw2033,name = "blue";
			aw2033,id = <2>;
			aw2033,imax = <2>;
			aw2033,led-current = <3>;
			aw2033,max-brightness = <255>;
			aw2033,rise-time-ms = <6>;
			aw2033,hold-time-ms = <0>;
			aw2033,fall-time-ms = <6>;
			aw2033,off-time-ms = <4>;
		};
	};
};

&soc {
	fingerprint_goodix {
               status = "ok";
               compatible = "goodix,fingerprint";
               vdda-supply = <&L3C>;
               goodix,gpio-reset = <&tlmm 141 0x0>;
               goodix,gpio-irq = <&tlmm 43 0x0>;
       };

};

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

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

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

