/* board base */
//#include "../rk3588s-evb4-lp4x-v10-linux.dts"
#include "rp-rk3588s-board.dtsi"

#include "rp-tp-i2c4-gt911.dtsi"
#include "rp-rk3588s-lcd-gpio.dtsi"

#include "rpdzkj_config.dtsi"

/* usb */
#include "rp-usb-typec-rk3588s.dtsi"
#include "rp-usb-host.dtsi"

/* ethernet */
#include "rp-eth-pcie2gmac-rk3588s.dtsi"

/* pcie */
#include "rp-pcie-power-rk3588s.dtsi"

/* audio */
#include "rp-audio-rt5640.dtsi"

/* wifi/bt */
#include "rp-wifi-bt-ap6275p-rk3588s.dtsi"

/* camera */
#include "rp-camera-mipi-xs9922b.dtsi"


#include "rp-lcd-typec-dp0.dtsi"    //usb edp0,must be enable rp-usb-typec.dtsi, batch ignore
#include "rp-lcd-hdmi0.dtsi"        

/* signel lcd */
#include "rp-lcd-mipi0-5-720-1280-v2-boxTP.dtsi"
//#include "rp-lcd-mipi0-7-720-1280.dtsi"
//#include "rp-lcd-mipi0-8-800-1280-v3.dtsi"
//#include "rp-lcd-mipi0-8-1200-1920.dtsi"
//#include "rp-lcd-mipi0-10-800-1280-v3.dtsi"
//#include "rp-lcd-mipi0-10-1200-1920.dtsi"
//#include "rp-lcd-mipi0-10-1920-1200-jc.dtsi"
//#include "rp-lcd-rk3588s-edp0-13.3-15.6-1920-1080.dtsi"
//#include "rp-lcd-mipi1-gm8775-lvds-21-1920-1080.dtsi"
//#include "rp-lcd-mipi1-gm8775-lvds-10.1-1024-600.dtsi"

/* quadplex lcd */
//#include "rp-lcd-quadplex-mipi0-5-720-1280-v2-boxTP-mipi1-gm8775-lvds-10.1-1024-600-edp0-hdmi1.dtsi"


/ {
    model = "rp-rk3588s";

    vcc_1v1_nldo_s3: vcc-1v1-nldo-s3 {
        compatible = "regulator-fixed";
        regulator-name = "vcc_1v1_nldo_s3";
        regulator-always-on;
        regulator-boot-on;
        regulator-min-microvolt = <1100000>;
        regulator-max-microvolt = <1100000>;
        vin-supply = <&vcc5v0_sys>;
    };

	fan_gpio_control {
            compatible = "fan_gpio_control";
            gpio-pin = <&gpio3 RK_PB4 GPIO_ACTIVE_HIGH>;
            thermal-zone = "soc-thermal";
            threshold-temp = <60000>; //60C
            running-time = <10000>; //10s
            status = "okay";
        };

        rp_power{
                status = "okay";
                compatible = "rp_power";
                rp_not_deep_sleep = <1>;

//#define GPIO_FUNCTION_OUTPUT 0
//#define GPIO_FUNCTION_INPUT 1
//#define GPIO_FUNCTION_IRQ 2
//#define GPIO_FUNCTION_FLASH 3
//#define GPIO_FUNCTION_OUTPUT_CTRL 4

                vdd-3v {   
                        gpio_num = <&gpio3 RK_PB0 GPIO_ACTIVE_HIGH>;
                        gpio_function = <4>;
                };

                //fan {   
                //        gpio_num = <&gpio3 RK_PB4 GPIO_ACTIVE_HIGH>;
                //        gpio_function = <4>;
                //};

                led {  
                        gpio_num = <&gpio3 RK_PB1 GPIO_ACTIVE_HIGH>;
                        gpio_function = <3>;
                };

                usb-host-power1 {  
                        gpio_num = <&gpio3 RK_PA6 GPIO_ACTIVE_HIGH>;
                        gpio_function = <4>;
                };

                usb-host-power2 {  
                        gpio_num = <&gpio3 RK_PC1 GPIO_ACTIVE_HIGH>;
                        gpio_function = <4>;
                };

                usb-host-power3 {  
                        gpio_num = <&gpio3 RK_PC2 GPIO_ACTIVE_HIGH>;
                        gpio_function = <4>;
                };

                usb-host-power4 {  
                        gpio_num = <&gpio3 RK_PC3 GPIO_ACTIVE_HIGH>;
                        gpio_function = <4>;
                };

                usb-hub-reset {  
                        gpio_num = <&gpio1 RK_PD5 GPIO_ACTIVE_LOW>;
                        gpio_function = <4>;
                };

                sd-pwren {  
                        gpio_num = <&gpio4 RK_PB4 GPIO_ACTIVE_HIGH>;
                        gpio_function = <4>;
                };
                
                pwren-4g {  
                        gpio_num = <&gpio3 RK_PA5 GPIO_ACTIVE_HIGH>;
                        gpio_function = <4>;
                };
    };

        rp_gpio{
                status = "okay";
                compatible = "rp_gpio";

                gpio0d3 {
                        gpio_num = <&gpio0 RK_PD3 GPIO_ACTIVE_HIGH>;
                        gpio_function = <0>;
                };
                gpio0b0 {
                        gpio_num = <&gpio0 RK_PB0 GPIO_ACTIVE_HIGH>;
                        gpio_function = <0>;
                };
                gpio1c1 {
                        gpio_num = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>;
                        gpio_function = <0>;
                };
                gpio1c4 {
                        gpio_num = <&gpio1 RK_PC4 GPIO_ACTIVE_HIGH>;
                        gpio_function = <0>;
                };
                gpio1c6 {
                        gpio_num = <&gpio1 RK_PC6 GPIO_ACTIVE_HIGH>;
                        gpio_function = <0>;
                };
                gpio1d2 {
                        gpio_num = <&gpio1 RK_PD2 GPIO_ACTIVE_HIGH>;
                        gpio_function = <0>;
                };
                gpio1d3 {
                        gpio_num = <&gpio1 RK_PD3 GPIO_ACTIVE_HIGH>;
                        gpio_function = <0>;
                };
        };
};


&uart0 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&uart0m2_xfer>;
};

&uart1 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&uart1m1_xfer>;
};

&uart3 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&uart3m2_xfer>;
};

&uart4 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&uart4m2_xfer>;
};


&uart5 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&uart5m1_xfer>;
};

&uart6 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&uart6m1_xfer>;
};

&uart7 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&uart7m2_xfer>;
};

&uart8 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&uart8m1_xfer>;
};

&fiq_debugger {
    rockchip,baudrate = <115200>;
};


&can0 {
    assigned-clocks = <&cru CLK_CAN0>;
    assigned-clock-rates = <200000000>;
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&can0m0_pins>;
};

&can1 {
    assigned-clocks = <&cru CLK_CAN1>;
    assigned-clock-rates = <200000000>;
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&can1m1_pins>;
};

&can2 {
    assigned-clocks = <&cru CLK_CAN2>;
    assigned-clock-rates = <200000000>;
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&can2m1_pins>;
};

&sdmmc {
    status = "okay";
  /delete-property/ vmmc-supply;
};
/*
&rk_headset {
  headset_gpio = <&gpio1 RK_PC0 GPIO_ACTIVE_HIGH>;
};
*/

&i2c8 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&i2c8m2_xfer>;

    hym8563: hym8563@51 {
        compatible = "haoyu,hym8563";
        reg = <0x51>;
        #clock-cells = <0>;
        clock-frequency = <32768>;
        clock-output-names = "hym8563";
    };

};

&display_subsystem {
clocks = <&hdptxphy_hdmi_clk0>, <&hdptxphy_hdmi_clk1>;
clock-names = "hdmi0_phy_pll", "hdmi1_phy_pll";
};

&hdptxphy_hdmi_clk0 {
            status = "okay";
};

&hdptxphy_hdmi_clk1 {
            status = "okay";
};
