#include <dt-bindings/display/media-bus-format.h>
#include "rp-lcd-hdmi.dtsi"

#define RP_TRIPLE_LCD


&lvds_panel {
    status = "okay";
    compatible = "simple-panel";
    
    enable-delay-ms = <20>;
    prepare-delay-ms = <20>;
    unprepare-delay-ms = <20>;
    disable-delay-ms = <20>;
    bus-format = <MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA>;
    width-mm = <217>;
    height-mm = <136>;
    
        /**
         * power-supply = <>;
         * reset-gpios = <>;
         *
         * lcd reset pin and power supply
         * please refer to ***-lcd-gpio.dtsi
         * that included in main dts.
         */
         
    display-timings {
        native-mode = <&timing2>;

        timing2: timing2 {
            clock-frequency = <45000000>;
            hactive = <1024>;
            vactive = <600>;
            hback-porch = <160>;
            hfront-porch = <160>;
            vback-porch = <23>;
            vfront-porch = <12>;
            hsync-len = <20>;
            vsync-len = <3>;
            hsync-active = <0>;
            vsync-active = <0>;
            de-active = <0>;
            pixelclk-active = <0>;
        };
    };

    ports {
        #address-cells = <1>;
        #size-cells = <0>;

        port@0 {
            reg = <0>;
            dual-lvds-even-pixels;
            panel_in_lvds: endpoint {
                remote-endpoint = <&lvds_out_panel>;
            };
        };
    };
};


&lvds {
    status = "okay";

    ports {
        port@1 {
            reg = <1>;

            lvds_out_panel: endpoint {
                remote-endpoint = <&panel_in_lvds>;
            };
        };
    };
};






&edp_panel {
    status = "okay";
        compatible = "simple-panel";
        
        prepare-delay-ms = <20>;
        enable-delay-ms = <20>;
        disable-delay-ms = <20>;
        unprepare-delay-ms = <20>;
        
        /**
         * power-supply = <>;
         * reset-gpios = <>;
         *
         * lcd reset pin and power supply
         * please refer to ***-lcd-gpio.dtsi
         * that included in main dts.
         */
        
        display-timings {
                native-mode = <&timing1>;

                timing0: timing0 {//EDP 13.3
                        clock-frequency = <150000000>;
                        hactive = <1920>;
                        vactive = <1080>;
                        hfront-porch = <12>;
                        hsync-len = <16>;
                        hback-porch = <48>;
                        vfront-porch = <8>;
                        vsync-len = <4>;
                        vback-porch = <8>;
                        hsync-active = <0>;
                        vsync-active = <0>;
                        de-active = <0>;
                        pixelclk-active = <0>;
                };

                timing1: timing1 {// EDP 15.6   LP156WF6
                        clock-frequency = <138000000>;
                        hactive = <1920>;
                        vactive = <1080>;
                        hfront-porch = <48>;
                        hsync-len = <32>;
                        hback-porch = <80>;
                        vfront-porch = <3>;
                        vsync-len = <5>;
                        vback-porch = <23>;
                        hsync-active = <0>;
                        vsync-active = <0>;
                        de-active = <0>;
                        pixelclk-active = <0>;
                };
        };

        ports {
                    panel_in_edp: endpoint {
                            remote-endpoint = <&edp_out_panel>;
            };
    };
};


&edp {
    //hpd-gpios = <&gpio0 RK_PC2 GPIO_ACTIVE_HIGH>;
    status = "okay";
    force-hpd;
        ports {
                port@1 {
                        reg = <1>;

                        edp_out_panel: endpoint {
                                remote-endpoint = <&panel_in_edp>;
                        };
                };
        };
};


&dsi0_in_vp0 {
    status = "disabled";
};

&dsi0_in_vp1 {
    status = "disabled";
};



&dsi1_in_vp0 {
    status = "disabled";
};

&dsi1_in_vp1 {
    status = "disabled";
};



&lvds_in_vp1 {
    status = "disabled";
};

&lvds_in_vp2 {
    status = "okay";
};



&edp_in_vp0 {
    status = "disabled";
};

&edp_in_vp1 {
    status = "okay";
};



&video_phy0 {
    status = "okay";
};


&edp_phy {
    status = "okay";
};


&route_hdmi {
    status = "okay";
    connect = <&vp0_out_hdmi>;
};

&route_lvds {
    /******
    *   cannot enable cause of resolution is different from other two device,
    *   otherwish, the lvds will abnormal after into bootanimotaion.
    *******/
    status = "disabled";
    connect = <&vp2_out_lvds>;
};

&route_edp {
    status = "okay";
    connect = <&vp1_out_edp>;
};



&gt9xx {
        status = "okay";

        compatible = "goodix,gt9xx";
        reg = <0x5d>;
        gtp_resolution_x = <1024>;
        gtp_resolution_y = <600>;
        gtp_int_tarigger = <1>;
        gtp_change_x2y = <0>;
        gtp_overturn_x = <0>;
        gtp_overturn_y = <0>;
        gtp_send_cfg = <1>;
        gtp_touch_wakeup = <1>;

        /**
         * goodix_rst_gpio = <>;
         * goodix_irq_gpio = <>;
         *
         * touch panel interrupt and reset pin
         * please refer to ***-lcd-gpio.dtsi
         * that included in main dts.
         */

        goodix,cfg-group0 = [
            46 00 04 58 02 0A 3D 00 01 08
            28 05 50 32 03 05 00 00 00 00
            00 00 00 18 1A 1E 14 8D 2D 88
            17 15 31 0D 00 00 01 9B 03 1D
            00 00 00 00 00 00 00 00 00 00
            00 1E 5A 94 C5 02 08 00 00 00
            61 21 00 57 29 00 4E 34 00 48
            41 00 43 51 00 43 00 00 00 00
            00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 00 00
            00 00 00 01 04 05 06 07 08 09
            0C 0D 0E 0F 10 11 14 15 FF FF
            FF FF 00 00 00 00 00 00 00 00
            00 00 00 02 04 06 07 08 0A 0C
            0F 10 11 12 13 19 1B 1C 1E 1F
            20 21 22 23 24 25 26 27 FF FF
            FF FF FF FF 00 00 00 00 00 00
            00 00 00 00 FD 01];
        goodix,cfg-group3 = [
            46 00 04 58 02 0A 3D 00 01 08
            28 05 50 32 03 05 00 00 00 00
            00 00 00 18 1A 1E 14 8D 2D 88
            17 15 31 0D 00 00 01 9B 03 1D
            00 00 00 00 00 00 00 00 00 00
            00 1E 5A 94 C5 02 08 00 00 00
            61 21 00 57 29 00 4E 34 00 48
            41 00 43 51 00 43 00 00 00 00
            00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 00 00
            00 00 00 00 00 00 00 00 00 00
            00 00 00 01 04 05 06 07 08 09
            0C 0D 0E 0F 10 11 14 15 FF FF
            FF FF 00 00 00 00 00 00 00 00
            00 00 00 02 04 06 07 08 0A 0C
            0F 10 11 12 13 19 1B 1C 1E 1F
            20 21 22 23 24 25 26 27 FF FF
            FF FF FF FF 00 00 00 00 00 00
            00 00 00 00 FD 01];

};



